arcane-os 0.5.10 → 0.5.12

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 +41 -0
  2. package/README.md +117 -26
  3. package/browser-runtime/ai/browser-speech-providers.mjs +1 -1
  4. package/docs/architecture.md +303 -0
  5. package/docs/compatibility.md +38 -0
  6. package/docs/event-manager.md +263 -0
  7. package/docs/platform-targets.md +104 -0
  8. package/docs/publishing.md +126 -0
  9. package/docs/reference/README.md +206 -0
  10. package/docs/reference/ai/browser-speech.md +879 -0
  11. package/docs/reference/ai/browser-wasm.md +637 -0
  12. package/docs/reference/ai/twin-cloud.md +156 -0
  13. package/docs/reference/arcane-ollama.md +288 -0
  14. package/docs/reference/availability-and-normalization.md +224 -0
  15. package/docs/reference/behavioral-testing.md +129 -0
  16. package/docs/reference/cli.md +820 -0
  17. package/docs/reference/core/README.md +61 -0
  18. package/docs/reference/core/arcane-ai-contracts.md +906 -0
  19. package/docs/reference/core/arcane-api.md +601 -0
  20. package/docs/reference/core/arcane-entities.md +59 -0
  21. package/docs/reference/core/arcane-events.md +134 -0
  22. package/docs/reference/core/ollama-module.md +181 -0
  23. package/docs/reference/core/reference/arcane-api/ai-and-ollama.md +1909 -0
  24. package/docs/reference/core/reference/arcane-api/applications-terminal-capabilities.md +1057 -0
  25. package/docs/reference/core/reference/arcane-api/core-and-events.md +320 -0
  26. package/docs/reference/core/reference/arcane-api/filesystem-storage-preferences-appearance.md +610 -0
  27. package/docs/reference/core/reference/arcane-api/namespaces.md +1157 -0
  28. package/docs/reference/core/reference/arcane-api/platform-installation-users-system.md +1423 -0
  29. package/docs/reference/core/reference/arcane-api/session-provisioning-diagnostics-development.md +315 -0
  30. package/docs/reference/event-manager.md +1409 -0
  31. package/docs/reference/inventory/package-api.json +3194 -0
  32. package/docs/reference/inventory/runtime-components.json +1015 -0
  33. package/docs/reference/inventory/runtime-entities.json +25 -0
  34. package/docs/reference/inventory/runtime-modules.json +1367 -0
  35. package/docs/reference/mail.md +309 -0
  36. package/docs/reference/protocols.md +749 -0
  37. package/docs/reference/runtime-components.md +1532 -0
  38. package/docs/reference/runtime-entities.md +305 -0
  39. package/docs/reference/runtime-modules.md +3310 -0
  40. package/docs/reference/sdk-api.md +6733 -0
  41. package/docs/roadmap.md +79 -0
  42. package/docs/work-amplification.md +66 -0
  43. package/examples/wasm-ai-demo/README.md +80 -0
  44. package/examples/wasm-ai-demo/app.js +787 -0
  45. package/examples/wasm-ai-demo/index.html +343 -0
  46. package/examples/wasm-ai-demo/profile-tools.js +217 -0
  47. package/examples/wasm-ai-demo/profiles/BOSS.Modelfile +106 -0
  48. package/examples/wasm-ai-demo/profiles/PreCrisis.Modelfile +693 -0
  49. package/examples/wasm-ai-demo/rag/boss-library.json +3006 -0
  50. package/examples/wasm-ai-demo/rag.js +295 -0
  51. package/examples/wasm-ai-demo/server.mjs +71 -0
  52. package/package.json +10 -1
  53. package/runtime/arcane/modules/AI.js +60 -11
  54. package/runtime/arcane/modules/AIProviderRuntime.js +26 -5
@@ -0,0 +1,224 @@
1
+ # Availability and normalization
2
+
3
+ Use this page to choose an API by capability. The compact labels tell you where
4
+ it runs; the [protocol guide](protocols.md) contains the implementation detail.
5
+
6
+ ## Availability labels
7
+
8
+ | Label | Meaning |
9
+ | --- | --- |
10
+ | **Node** | Runs in the SDK's supported Node.js process. It is not a renderer API. |
11
+ | **Browser** | Uses standard browser APIs and can run without a native host when its own dependencies are available. |
12
+ | **Native** | Requires an admitted `globalThis.Arcane` host method or a native target provider. |
13
+ | **Cloud** | Calls a remote provider over HTTPS and needs provider configuration and network policy. |
14
+ | **Cross-host** | Keeps one application contract usable across supported hosts. Execution may stay in-process, use a registered provider, or cross a documented Arcane WebView2, WebKitGTK, Android WebView, or development HTTP transport. |
15
+ | **Provider-native** | Intentionally returns the underlying provider's complete envelope instead of an Arcane-normalized entity. |
16
+
17
+ “Available” never means “authorized.” App grants, method allowlists, host
18
+ policy, package-owned model policy, platform support, and dependency readiness
19
+ are independent checks.
20
+
21
+ The current native host/target matrix covers Microsoft NT, Linux, and Android
22
+ where listed. It exposes no macOS target or Core host contract in this SDK
23
+ version; WebKitGTK availability must not be generalized to macOS.
24
+
25
+ ## Capability-first matrix
26
+
27
+ | What the developer wants to do | Preferred surface | Availability | Normalization |
28
+ | --- | --- | --- | --- |
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. Tests and checks run only when explicitly selected; verification is separate and selected-output-specific. |
30
+ | Publish application events or review a complete event history | `arcane-os/event-manager` | **Node** and **Browser**; optional DOM capture needs a browser DOM or compatible host | Live listeners receive original arguments. Ordinary `secure:false` recording preserves complete URLs, public details, and captured stack text in deeply frozen `arcane-event-stack/1` snapshots while credential-named fields remain redacted. The stack format is local diagnostic data, not a host transport. |
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
+ | Select and observe independent LLM/STT/TTS roles | `/arcane/modules/AIProviderRuntime.js` and `AIRuntimeState.js` | **Cross-host** controller/state; registered providers retain their own host requirements | Required/projected provider members, route/configuration records, and status fields; per-role lifecycle, cancellation, stream cleanup, sticky state, and startup barriers are normalized. `localOnly` creates no fallback. |
33
+ | Run a caller-selected local LLM entirely in a browser renderer | `arcane-os/ai/browser-wasm` through `createArcaneAI()` | **Browser** only; secure context, WebAssembly, OPFS/DBOPFS, WebGPU, and requested full offload are required; no CPU fallback | The public AI API module normalizes multi-model lifecycle, status, complete all-choice streaming, cancellation, exact ordered structural tool-call visibility, and session persistence. Model sources are canonical ordered file descriptors; licenses and model choice remain application policy. |
34
+ | Run caller-selected Whisper or Kokoro in a browser renderer | `arcane-os/ai/browser-speech` registered with `AIProviderRuntime` | **Browser** only; DBOPFS, Web Locks, Workers, Fetch/object URLs, and a caller-supplied self-contained runtime/model closure are required | STT/TTS use independent provider/2 lifecycle and status. Kokoro adds bounded Worker/session concurrency and explicit `auto`, `webgpu`, or `wasm` execution. Complete model/runtime selection, offline behavior, cancellation, Worker teardown, and request/result shapes are normalized. No runtime/model content or cloud fallback is supplied. |
35
+ | Preserve complete chat history and memory | `/arcane/modules/PersistentAIChatSession.js` | **Browser / native WebView** with ChatEntity/DBOPFS and a configured chat function | Existing DBOPFS names and memory semantics are preserved. Live-context commit is atomic; durable persistence is explicit and coherent across user/assistant turns and atomic all-ID tool-result batches. |
36
+ | Search an app-owned document corpus for explicit chat context | `/arcane/modules/DBOPFSDocumentLibrary.js` | **Browser** or compatible injected DBOPFS adapter | Generation/manifest completion, complete lexical search, partial read failures, and untrusted context labels are normalized. Construction does not search; an explicitly wired context builder performs retrieval for each prepared chat send. |
37
+ | 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. |
38
+ | 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**. |
39
+ | Use TWiN Cloud from the renderer profile | `/arcane/modules/AI.js` | **Cloud** from an allowed browser/native renderer | High-level chat behavior is normalized by the module. The TWiN access key authenticates remote LLM chat; raw provider diagnostics remain provider-specific. No automatic cloud fallback is inferred from local failure. |
40
+ | Use speech through one application helper | `/arcane/modules/AI.js` and `Arcane.speech` | **Browser** or **Native** | The helper keeps audio on device: Whisper owns STT and Kokoro owns TTS. It normalizes application-facing audio/text behavior while browser and native request/response plumbing differs below that boundary. |
41
+ | Inspect or manage raw Ollama models | `Arcane.ollama` or `/arcane/modules/Ollama.js` | **Native** desktop Core for management; narrower Android inference only | Wrapper method names, errors, streaming correlation, and admission are Arcane-controlled. Direct Ollama success envelopes are intentionally provider-native. |
42
+ | Use native terminal, installation, user, provisioning, or machine controls | matching `Arcane.*` namespace | **Native** and app/capability restricted | Calls and errors use the common bridge contract. Platform results can be host-specific and are marked in the method guide. |
43
+
44
+ ## The normalized application path
45
+
46
+ For ordinary cross-platform application code:
47
+
48
+ ```javascript
49
+ const runtime = globalThis.Arcane?.runtime?.current?.();
50
+
51
+ if (!runtime?.connected) {
52
+ throw new Error('Open this application through an Arcane host.');
53
+ }
54
+
55
+ const access = await globalThis.Arcane.capabilities.list();
56
+
57
+ if (!access.methods.includes('localAI.status')) {
58
+ throw new Error('This application is not admitted for local AI.');
59
+ }
60
+
61
+ const status = await globalThis.Arcane.localAI.status();
62
+ console.log(status.ready, status.models);
63
+ ```
64
+
65
+ This code does not select WebView2, WebKitGTK, or an HTTP bridge. It calls one
66
+ Arcane API. The host chooses its transport, and Core applies the bound
67
+ application identity and method policy.
68
+
69
+ ## Normalization levels
70
+
71
+ ### Fully SDK-normalized
72
+
73
+ The Node toolchain uses `ArcaneError`, stable SDK error codes, structured
74
+ `arcane-cli-events/1` records, and normalized target descriptors. Platform
75
+ providers can add complete target detail but cannot
76
+ silently substitute a different target or artifact kind.
77
+
78
+ The central EventManager is also host-neutral JavaScript. Its synchronous live
79
+ bus preserves listener argument identity, while its optional history owns a
80
+ separate diagnostic normalization boundary: snapshots are complete, redact
81
+ credentials and explicitly protected private fields, and are importable as
82
+ `arcane-event-stack/1`. DOM
83
+ instrumentation adds browser diagnostics only; it does not replay browser
84
+ state. See [EventManager and time-travel review](event-manager.md).
85
+
86
+ ### Browser-local provider adapter
87
+
88
+ [`arcane-os/ai/browser-wasm`](ai/browser-wasm.md) exposes the same
89
+ provider-neutral lifecycle used by `createArcaneAI()`, while its packaged
90
+ Wllama engine and caller-supplied model run inside the browser. This
91
+ surface does not require an Arcane Core method grant because it does not call a
92
+ Core host. Browser Fetch, CORS, storage policy, secure-context behavior, and
93
+ resource limits still apply.
94
+
95
+ The current browser runtime requires WebGPU and has no CPU fallback. A successful
96
+ load requests full GPU offload (`gpuLayers: 99999`). `navigator.gpu` presence by
97
+ itself is not readiness. The provider emits the instrumented
98
+ `arcane.ai.browser-wasm.webgpu.adapter.selected` capability event after adapter
99
+ selection.
100
+
101
+ `localOnly:true` describes inference after load; it does not promise that load
102
+ is offline. A normal cache miss downloads from the exact caller-supplied HTTPS
103
+ URL. App, provider/model-binding, and load-operation options may use
104
+ `{security:{secure?:boolean}}`. The SDK default is `secure:false`, and omitted
105
+ security leaves ordinary model loading fully functional. Download byte counts,
106
+ remaining bytes, rate, and ETA are observational progress only. Optional member
107
+ `bytes` values may initialize progress and HTTP Range planning, but neither
108
+ declared nor observed byte measures validate, admit, identify, hash, or decide
109
+ cache reuse for model content. Completed split members and deterministic Range
110
+ parts within any member are retained across an interrupted install so retry
111
+ fetches only missing work. Exact part length is used only to recognize a
112
+ completed HTTP transport frame. Zero-length whole entries and incomplete Range
113
+ sets cannot become cache hits; failed or incorrectly framed active parts are
114
+ removed. After a
115
+ complete current representation exists, the store attempts to remove redundant
116
+ Range fragments; cleanup failure is warned without hiding the usable model. Optional
117
+ `secure:true` records intent only; historical checking remains disabled until a
118
+ separately authorized user review. Successful
119
+ Wllama model loading remains mandatory. `load({offline:true})` permits only a compatible
120
+ cache entry and otherwise rejects with `ARCANE_AI_MODEL_OFFLINE_MISS`. Tool
121
+ calls are result data for application review and dispatch; every declaration
122
+ and emitted call requires nonempty user-facing `arguments.message`, and the SDK
123
+ never executes them. An ordered assistant call array remains pending until the
124
+ application records exactly one matching executed, declined, cancelled, or
125
+ not-executed `role:'tool'` result with nonblank user-facing content for every
126
+ pending ID in one atomic batch. The direct browser provider and its
127
+ v1-to-provider/2 adapter validate the same request history, declarations, and
128
+ terminal structural-call contract. Structured completions contain exactly one
129
+ top-level `message` or `choices` envelope, every choice is validated, and the
130
+ ordinary stream iterator exposes complete content and reasoning projections
131
+ from every choice in provider order while its private pump continues even when
132
+ the terminal result is awaited first. Structural deltas remain private until
133
+ validation; terminal-only calls are valid, while observed calls must preserve
134
+ their choice, order, identity, exact arguments, and extension fields at
135
+ settlement. Complete provider chunks and terminal envelopes remain available
136
+ through explicit data, response, or inspection surfaces.
137
+
138
+ [`arcane-os/ai/browser-speech`](ai/browser-speech.md) implements the sibling
139
+ `stt` and `tts` provider/2 roles. Each caller-selected Whisper or Kokoro
140
+ provider has its own load, use, cancellation, unload, dispose, cache, Worker,
141
+ status, and error state. The SDK supplies neither speech adapter runtime nor
142
+ model/voice content; every selected file is application-owned and stored
143
+ through the SDK-created DBOPFS adapter.
144
+
145
+ Kokoro defaults to `{device:'auto',maxConcurrentRequests:4}`. Automatic
146
+ selection attempts the complete Worker/session pool on WebGPU when exposed and
147
+ recreates the complete pool on WASM if WebGPU loading rejects. Explicit
148
+ `webgpu` or `wasm` disables that fallback. Each accepted synthesis owns one
149
+ pool slot, and provider-neutral FIFO backpressure preserves later requests.
150
+ Whisper remains one WASM Worker.
151
+
152
+ For high-level speech, read
153
+ `ai.providerRuntime.status('tts', {execution:true}).execution` after load.
154
+ Kokoro reports `requestedDevice`, `selectedDevice`, `maxConcurrentRequests`,
155
+ and `activeRequestCount`; requested `auto` with selected `wasm` identifies
156
+ fallback. `selectedDevice` is `null` while unloaded. The default `status()`
157
+ remains the sticky lifecycle snapshot; execution is an explicit provider read,
158
+ and inspection errors propagate. Neither state proves physical GPU kernel
159
+ overlap. See the [copyable speech quick start](ai/browser-speech.md).
160
+
161
+ Materialized speech graphs use their file inventory as a routing table, not an
162
+ admission policy. Known downloaded imports, fetches, Workers, and cache reads
163
+ route to their materialized URLs; unmapped operations fall through to the
164
+ native browser API with caller options preserved, and native cache writes are
165
+ not disabled.
166
+
167
+ The projected [`AIProviderRuntime`](runtime-modules.md#aiproviderruntimejs)
168
+ normalizes those browser providers and can admit an externally supplied native
169
+ or cloud provider/2 adapter. `AI.js` also supplies built-in adapters for
170
+ an already-selected TWiN Cloud LLM route, Ollama route, or admitted local Core
171
+ speech route. Its built-in audio selections are on-device only: saved `OPENAI`
172
+ speech selections migrate to `LOCAL_SPEACH` with `whisper-small` for STT and
173
+ `kokoro` for TTS. The SDK publishes no privileged Core implementation,
174
+ credential,
175
+ model, or speech-runtime authority, and those adapters never probe, select,
176
+ download, or fall back. The sticky
177
+ [`AIRuntimeState`](runtime-modules.md#airuntimestatejs) surface keeps
178
+ application UI independent of transport. A selected route remains explicit:
179
+ browser failure is not permission to invoke Core or cloud.
180
+
181
+ ### Arcane bridge-normalized
182
+
183
+ Core-backed calls return promises and reject with `Arcane.Error`. Transport
184
+ selection, request correlation, JSON framing, capability denial, diagnostics,
185
+ and public operation events are normalized at the bridge. Method data contracts
186
+ remain authoritative; a method that documents platform-dependent fields is not
187
+ silently widened into a fictional common shape.
188
+
189
+ ### Helper-normalized
190
+
191
+ Renderer helpers can deliberately collapse provider detail. For example,
192
+ `ollama.chatText()` returns a string extracted from the final chat envelope and
193
+ `ollama.generateText()` returns a string extracted from the final generation
194
+ envelope. `ollama.readiness()` returns a frozen `{ready, version, errorCode}`
195
+ snapshot.
196
+
197
+ ### Provider-native within an Arcane boundary
198
+
199
+ Direct `Arcane.ollama.chat()`, `generate()`, `show()`, `embed()`, and lifecycle
200
+ methods return complete Ollama-compatible envelopes. Arcane still owns error
201
+ normalization, chunk correlation, and host transport, but it does
202
+ not rename every provider response field. Feature-detect optional Ollama fields
203
+ and use the high-level helpers when an application needs a smaller common
204
+ contract.
205
+
206
+ ### Platform-dependent by design
207
+
208
+ Host service settings, machine evidence, permissions, installation state, and
209
+ native build artifacts can differ between Microsoft NT, Linux, Android, and a
210
+ development browser. Those methods provide a stable outer contract and mark
211
+ platform-specific fields or unsupported states. `supported: false` is a valid
212
+ result where documented; it is not permission to bypass the host from renderer
213
+ code.
214
+
215
+ ## No implicit protocol or provider fallback
216
+
217
+ Arcane can expose the same method over different host transports, but it does
218
+ not reinterpret a failed native call as authorization to send data to a cloud
219
+ provider. Provider selection is explicit application/user profile state. A
220
+ remote or development HTTP bridge transports an admitted Arcane call; it is not
221
+ an automatic OpenAI fallback and does not turn a standalone browser into a
222
+ native host.
223
+
224
+ Deep details: [protocol selection and host boundaries](protocols.md).
@@ -0,0 +1,129 @@
1
+ # Behavioral testing
2
+
3
+ Reference completeness and runtime behavior are distinct evidence boundaries.
4
+ Neither runs automatically during ordinary implementation, packaging, commit,
5
+ push, or handoff. Use them only when the user explicitly requests the check or
6
+ when required for a separately selected release output.
7
+
8
+ Completeness is bidirectional: implementation additions require documentation,
9
+ and documentation keys that no longer exist fail just as visibly.
10
+
11
+ ## Fast contract path
12
+
13
+ ```bash
14
+ npm run test:unit
15
+ npm run test:functional
16
+ ```
17
+
18
+ Unit coverage verifies schemas, descriptors, target contracts, error behavior,
19
+ and public reference inventories. Functional coverage exercises CLI parsing and
20
+ output, the development server, runtime verification, packaging, scaffolding,
21
+ events, and the generated documentation/site contract.
22
+
23
+ ## Explicit full check
24
+
25
+ ```bash
26
+ npm run check
27
+ ```
28
+
29
+ When explicitly selected, the full check validates source policy and runs the
30
+ non-overlapping unit, functional, integration, and regression sets. It remains
31
+ development evidence; it is not native artifact or release acceptance.
32
+
33
+ ## Behavioral coverage model
34
+
35
+ | Surface | Minimum behavior proved locally | Heavier evidence boundary |
36
+ | --- | --- | --- |
37
+ | Package entrypoints | Every declared JavaScript export imports; documented names match; constants and synchronous validators preserve their public contracts. | None for import itself. Operations that invoke tools use the matching boundary below. |
38
+ | Canonical events, EventManager, and event stacks | One branded/versioned `globalThis.arcaneEvents` per realm, duplicate-module reuse, declared source ownership, canonical/source delivery order, frozen occurrence metadata, exact cancellation, AbortSignal cleanup, disposable subscriptions, source teardown/re-registration, observational listener failure, EventTarget compatibility, one-way DOM projection, live isolated-bus pub/sub, nested causation, complete credential-redacted stacks, import, seek, playback, and DOM privacy/lifecycle. | Real user journeys and browser layout belong in a browser harness; an occurrence, EventTarget/DOM projection, or event-stack review never proves that external side effects stopped, completed, or can be replayed. |
39
+ | 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. |
40
+ | Selected app tests and packaging | When explicitly selected, external app tests resolve cross-host names such as `arcane-os/speech-playback`, preserve browser-runtime names such as `arcane/SpeechPlayback`, exercise materialized `TimeGuard`/`DBOPFS` self-imports through `arcane-os/event-manager`, and resolve URL-like compatibility keys. Packaging itself copies complete selected content and never runs tests or checks automatically. | A passing app test proves only its exercised behavior. Dry-run packaging remains non-mutating, raw Node imports of projected runtime files are not promised, and direct shared-SDK test files retain their no-app-context behavior. |
41
+ | 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. |
42
+ | Provider-neutral AI runtime and chat/speech activation | Provider/2 registration, three-role configuration, TWiN Cloud LLM readiness, on-device Whisper/Kokoro selection, opt-in STT startup, Core speech readiness, independent LLM/STT/TTS load/unload/status, capacity-1 FIFO settlement for LLM/STT, bounded parallel synthesis with FIFO admission for an explicitly capable TTS provider, owned STT signals, TTS mute lifecycle, route-owned voice defaults, immediate chunk synthesis admission, original-order audio-clock scheduling, sticky-state-only readiness for both speech components, selected-unloaded activation request/cancellation/error behavior, programmatic voice recording, transcript-replacement supersession of late settlement, direct `AI.fetchSTT` result delivery, rejection of non-local speech configuration, and absence of silent provider fallback are represented against complete providers and host callbacks. | Real model/runtime availability remains the selected provider's evidence boundary; provider-promise settlement, state, an abort signal, or an activation event does not by itself prove underlying provider work stopped or native, cloud, or browser-model availability. |
43
+ | Browser-WASM local AI | The exported namespace, canonical ordered `{id, files:[{name?,url},...]}` descriptor, nonempty provider `sources` catalog, default `secure:false`, dormant `secure:true` intent, public AI API module lifecycle, lazy/manual policy, successful Wllama-load requirement, abort normalization, complete output and reasoning, all-choice validation, required structural-call `arguments.message`, exact call identity, and matching tool-result sequencing are represented in deterministic fixture sources. | A real Chrome exercise may load the selected Wllama runtime and model only after explicit user action. It is not an ordinary publication gate or an implicit model download. |
44
+ | Browser speech | Caller-owned Whisper/Kokoro selection, independent STT/TTS routes, ordinary direct upstream runtime/model use, dormant `secure:true` intent, DBOPFS cache, materialized known-route/native-fallback behavior, GPU-first device selection with explicit WASM fallback, bounded Kokoro Worker/session pools, out-of-order synthesis settlement with FIFO admission, request-targeted TTS cancellation, destructive lifecycle cleanup, Blob/File STT conversion, WAV TTS conversion, complete text/audio, and no cloud fallback are represented with synthetic artifacts and adapters. | A real runtime/model/voice download, WebGPU model load, physical accelerator behavior, and actual transcription or synthesis use the application's selected upstream packages/providers, browser media support, and explicit user action. |
45
+ | Persistent chat and document context | Atomic in-memory/history commit, explicit per-turn persistence, streamed/non-stream fallback, session-owned callback fields, complete data callbacks, per-turn request options, exact per-choice streamed/terminal call correlation before publication, terminal-only call acceptance, ordered parallel-call sequencing, atomic all-ID nonblank executed/declined/cancelled/not-executed result batches, readable unmodified malformed pre-existing rows, complete UI transcript metadata, generic visible failure outcomes with complete console diagnostics, BFCache-preserving component lifecycle, complete bootstrap/search/context, caller-source evaluation, cancellation, and partial-read handling are represented with app-scoped adapters. | Live Core/provider inference and durable browser storage remain separate authorities; tests never treat a fake chat function or in-memory adapter as host/storage proof. |
46
+ | 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. |
47
+ | 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. |
48
+ | Native providers | Plan/provider protocol, explicit target, complete artifact reading, and unavailable-path honesty are tested with fixtures. | Windows, Linux, or Android artifact verification and launch must run on that actual platform/architecture and only when explicitly selected. |
49
+
50
+ ## Executable examples
51
+
52
+ Examples should be safe to run repeatedly and should stop at the last boundary
53
+ they can honestly prove. Documentation examples that would download a model,
54
+ restart a service, create a user, install software, log out, delete a model, or
55
+ launch an external resource define a function but do not invoke it.
56
+
57
+ Behavior tests replace real authority with an explicit fake only for the public
58
+ client contract. They must assert the exact request sent to the fake and the
59
+ normalized result returned to the application. A fake provider never counts as
60
+ native host, artifact, installation, or model-service evidence.
61
+
62
+ The app-scoped Node runner receives the selected map context. It removes the
63
+ reserved environment field before importing application code and passes the
64
+ mapping to the existing Node loader. Managed names and URL-like keys resolve to
65
+ the workspace's projected `arcane/` files. Unrelated Node resolution and direct
66
+ runner use without a selected app context remain unchanged.
67
+
68
+ The browser-WASM guide follows the same rule: it shows exact model authority
69
+ and wiring, but leaves the download/load call behind an explicit user action.
70
+ Focused fixture sources cover SDK default `secure:false`, omission of security
71
+ for the fully functional ordinary path, and `secure:true` as a dormant intent
72
+ that does not activate historical checks. Neither path requires byte counts,
73
+ byte limits, hashes, digests, freezes, or content-identity receipts. The browser
74
+ contract separately represents `AbortSignal` settlement as
75
+ `ARCANE_AI_REQUEST_ABORTED` and complete tool-call arguments with required
76
+ user-facing `message`, without invoking application handlers. Model license
77
+ metadata is not a runtime permission grant. Run those sources only when the
78
+ user explicitly requests tests or as required for a selected release output.
79
+
80
+ ## Host and normalization cases
81
+
82
+ Cross-host APIs should cover at least these cases at their owning layer:
83
+
84
+ 1. standalone browser with no `Arcane` host;
85
+ 2. development HTTP transport with normalized request/error settlement;
86
+ 3. native transport with capability admitted;
87
+ 4. native transport with method or capability denied;
88
+ 5. platform-dependent `supported: false` result where documented;
89
+ 6. provider-native success envelope passed through unchanged;
90
+ 7. helper-normalized text/readiness result;
91
+ 8. stream chunk correlation and late/foreign chunk rejection;
92
+ 9. abort or timeout behavior, including whether host work can continue;
93
+ 10. explicit provider selection with no implicit local-to-cloud fallback.
94
+
95
+ Central-event changes additionally cover complete retention until the caller
96
+ clears history or disables recording. DOM cases assert that private values,
97
+ credentials, sensitive attributes, URLs, and markup remain redacted under every
98
+ capture-option combination.
99
+
100
+ The focused singleton contract also owns these cases in
101
+ `test/event-manager.test.mjs`: global property/brand/protocol/API descriptor
102
+ admission; same-object reuse across duplicate module URLs and package
103
+ entrypoints; exact `subscribe(type,handler,{once,signal})` behavior; idempotent
104
+ `unsubscribe()`/`unsubscribe.dispose()`; one active
105
+ `createSource(owner,{source,eventTypes,onListenerError})` handle; immutable
106
+ `arcane-event-occurrence/1` values and privacy separation; synchronous
107
+ cancellation; dispatch-safe removal and reentry; final source disposal;
108
+ EventTarget deduplication/admission; one-way `CustomEvent` projection; and
109
+ nonrecursive listener-error publication. Runtime behavior tests own the
110
+ module and component instance-scoped projections and cleanup. Reference-completeness tests own the
111
+ public export names and exact focused-guide coverage.
112
+
113
+ Canonical event publication itself is deliberately synchronous and
114
+ observational. Tests must not await listener return values or present
115
+ `arcaneEvents` as backpressure. Promise settlement, async callback failure, and
116
+ ordered delivery belong to the operation promise or `createEventQueue()` test
117
+ that owns that work. Abort-driven listener removal proves cleanup only; it does
118
+ not prove already-started host, provider, worker, or queue work stopped.
119
+
120
+ ## Test ownership
121
+
122
+ The SDK owns the singleton authority, its per-realm source adapters, package and
123
+ managed-browser projections, focused event/source/DOM contracts, runtime
124
+ compatibility views, package, CLI, synchronized renderer, documentation, and
125
+ injected provider-boundary behavior. Arcane OS owns live Core dispatch, native host
126
+ bridges, capability policy, host service adapters, and real ArcaneOllama
127
+ integration. A change that crosses both repositories needs focused tests at both
128
+ owners; copying a Core test into this package would not make the SDK the Core
129
+ implementation owner.