arcane-os 0.2.3 → 0.3.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 (118) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +8 -8
  3. package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +29 -22
  4. package/browser-runtime/ai/ARCANE_AI_BROWSER_SPEECH_COMPONENTS.json +203 -0
  5. package/browser-runtime/ai/browser-kokoro-worker.mjs +11 -2
  6. package/browser-runtime/ai/browser-speech-artifacts.mjs +3242 -391
  7. package/browser-runtime/ai/browser-speech-providers.mjs +1209 -157
  8. package/browser-runtime/ai/browser-speech.mjs +2 -0
  9. package/browser-runtime/ai/browser-whisper-worker.mjs +11 -2
  10. package/browser-runtime/ai/model-controller.mjs +285 -95
  11. package/browser-runtime/ai/speech-worker-client.mjs +249 -32
  12. package/browser-runtime/ai/speech-worker-runtime.mjs +2322 -167
  13. package/browser-runtime/event-manager.mjs +1097 -1
  14. package/docs/architecture.md +2 -2
  15. package/docs/event-manager.md +155 -27
  16. package/docs/reference/README.md +18 -20
  17. package/docs/reference/ai/browser-speech-package-authority.json +835 -0
  18. package/docs/reference/ai/browser-speech.md +1205 -246
  19. package/docs/reference/ai/browser-wasm.md +18 -7
  20. package/docs/reference/availability-and-normalization.md +2 -2
  21. package/docs/reference/behavioral-testing.md +28 -5
  22. package/docs/reference/cli.md +115 -7
  23. package/docs/reference/core/arcane-ai-contracts.md +1 -1
  24. package/docs/reference/event-manager.md +577 -32
  25. package/docs/reference/inventory/package-api.json +478 -2
  26. package/docs/reference/inventory/runtime-components.json +86 -37
  27. package/docs/reference/inventory/runtime-modules.json +126 -49
  28. package/docs/reference/mail.md +316 -0
  29. package/docs/reference/protocols.md +185 -33
  30. package/docs/reference/runtime-components.md +192 -80
  31. package/docs/reference/runtime-modules.md +589 -70
  32. package/docs/reference/sdk-api.md +1017 -24
  33. package/package.json +5 -4
  34. package/runtime/ARCANE_RUNTIME_RELEASE.json +145 -140
  35. package/runtime/arcane/components/app-bar.html +34 -13
  36. package/runtime/arcane/components/assistant-panel.html +110 -57
  37. package/runtime/arcane/components/calculator.html +7 -4
  38. package/runtime/arcane/components/chart.html +58 -17
  39. package/runtime/arcane/components/chat.html +606 -136
  40. package/runtime/arcane/components/conversation-view.html +13 -6
  41. package/runtime/arcane/components/dashboard-config.html +96 -59
  42. package/runtime/arcane/components/data-maintenance.html +69 -14
  43. package/runtime/arcane/components/data-view.html +53 -7
  44. package/runtime/arcane/components/directory-picker.html +118 -32
  45. package/runtime/arcane/components/document-inspector.html +47 -10
  46. package/runtime/arcane/components/file-drop.html +81 -35
  47. package/runtime/arcane/components/file-inspector.html +72 -22
  48. package/runtime/arcane/components/file-manager.html +374 -79
  49. package/runtime/arcane/components/integration-settings.html +12 -5
  50. package/runtime/arcane/components/local-ai-status.html +48 -19
  51. package/runtime/arcane/components/markdown-document.html +161 -68
  52. package/runtime/arcane/components/markdown-editor.html +110 -33
  53. package/runtime/arcane/components/media-embed.html +8 -5
  54. package/runtime/arcane/components/modal.html +15 -5
  55. package/runtime/arcane/components/output-panel.html +28 -23
  56. package/runtime/arcane/components/preferences-form.html +22 -4
  57. package/runtime/arcane/components/record-timeline.html +18 -2
  58. package/runtime/arcane/components/relationship-board.html +23 -3
  59. package/runtime/arcane/components/screen-capture.html +10 -4
  60. package/runtime/arcane/components/source-code-viewer.html +76 -9
  61. package/runtime/arcane/components/source-explanation.html +23 -3
  62. package/runtime/arcane/components/speech.html +453 -131
  63. package/runtime/arcane/components/summary-strip.html +22 -11
  64. package/runtime/arcane/components/table.html +39 -21
  65. package/runtime/arcane/components/task-progress.html +79 -21
  66. package/runtime/arcane/components/terminal-workspace.html +7 -4
  67. package/runtime/arcane/components/theme-editor.html +7 -3
  68. package/runtime/arcane/components/unified-inbox.html +9 -4
  69. package/runtime/arcane/components/voice-transcription.html +244 -72
  70. package/runtime/arcane/components/weather-widget.html +5 -3
  71. package/runtime/arcane/components/web-navigator.html +48 -8
  72. package/runtime/arcane/entities/Chat.js +1 -1
  73. package/runtime/arcane/entities/User.js +110 -23
  74. package/runtime/arcane/modules/AI.js +2117 -130
  75. package/runtime/arcane/modules/AIProviderRuntime.js +756 -13
  76. package/runtime/arcane/modules/AIRuntimeState.js +109 -52
  77. package/runtime/arcane/modules/ApiModelDatabase.js +390 -17
  78. package/runtime/arcane/modules/BrowserTestSuite.js +205 -28
  79. package/runtime/arcane/modules/CalculatorEngine.js +63 -3
  80. package/runtime/arcane/modules/CommunicationAppController.js +588 -28
  81. package/runtime/arcane/modules/CommunicationHub.js +590 -10
  82. package/runtime/arcane/modules/ComponentContracts.js +235 -37
  83. package/runtime/arcane/modules/ConversationTimebox.js +152 -33
  84. package/runtime/arcane/modules/DBLS.js +40 -7
  85. package/runtime/arcane/modules/DBOPFS.js +35 -11
  86. package/runtime/arcane/modules/DataMaintenance.js +12 -2
  87. package/runtime/arcane/modules/Errors.js +65 -7
  88. package/runtime/arcane/modules/HTMLImport.js +198 -14
  89. package/runtime/arcane/modules/LocalAIReadinessController.js +208 -29
  90. package/runtime/arcane/modules/Mail.js +738 -115
  91. package/runtime/arcane/modules/MailOutbox.mjs +1395 -0
  92. package/runtime/arcane/modules/MailTransport.mjs +197 -39
  93. package/runtime/arcane/modules/Ollama.js +36 -1
  94. package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +583 -7
  95. package/runtime/arcane/modules/PreferenceStore.js +367 -33
  96. package/runtime/arcane/modules/RecordReviewStore.js +322 -23
  97. package/runtime/arcane/modules/ScreenCapture.js +1397 -15
  98. package/runtime/arcane/modules/SpeechPlayback.js +438 -41
  99. package/runtime/arcane/modules/TerminalClient.js +277 -12
  100. package/runtime/arcane/modules/ThemeBootstrap.js +80 -6
  101. package/runtime/arcane/modules/ThemeManager.js +39 -7
  102. package/runtime/arcane/modules/TimeGuard.js +131 -20
  103. package/runtime/arcane/modules/WaitForComponent.js +386 -33
  104. package/schemas/arcane-lock.schema.json +2 -2
  105. package/src/cli/main.mjs +435 -9
  106. package/src/event-manager.mjs +1097 -1
  107. package/src/import-map.mjs +21 -3
  108. package/src/index.mjs +13 -0
  109. package/src/installed-sdk-runtime.mjs +130 -0
  110. package/src/mail-api.mjs +22 -0
  111. package/src/mail-credentials.mjs +667 -0
  112. package/src/mail-server.mjs +1769 -0
  113. package/src/mail.mjs +261 -0
  114. package/src/sdk-browser-runtime.mjs +85 -41
  115. package/src/testing-loader.mjs +7 -0
  116. package/src/toolchain.mjs +3 -0
  117. package/src/workspace-runtime.mjs +804 -22
  118. package/src/workspace.mjs +1 -1
@@ -17,7 +17,7 @@ This table is the Node `package.json#exports` map: it defines package
17
17
  entrypoints for SDK/tooling code. It is distinct from the generated browser
18
18
  import map that resolves application-facing `arcane/*` modules and the focused
19
19
  EventManager entry. See [browser runtime delivery](protocols.md#browser-runtime-delivery)
20
- for that 91-entry physical-runtime contract in SDK `0.2.2`.
20
+ for the installed-inventory-derived physical-runtime contract in SDK `0.3.1`.
21
21
 
22
22
  | Specifier | Purpose |
23
23
  | --- | --- |
@@ -34,6 +34,7 @@ for that 91-entry physical-runtime contract in SDK `0.2.2`.
34
34
  | `arcane-os/event-manager` | Central synchronous events, bounded time-travel history, playback, and optional DOM instrumentation. |
35
35
  | `arcane-os/ai/browser-wasm` | Caller-selected browser-local Wllama inference, configurable DBOPFS model checks, streaming, cancellation, and structural tool-call results. |
36
36
  | `arcane-os/ai/browser-speech` | Caller-selected browser-local Whisper STT and Kokoro TTS provider mechanisms, authenticated DBOPFS artifacts, Workers, and cancellation; no model or adapter bytes. |
37
+ | `arcane-os/mail` | Portable Mail runtime, durable outbox, bounded transport, and provider-neutral acceptance contracts. |
37
38
 
38
39
  JSON schemas, the runtime manifest, and `package.json` are data-only export subpaths. In Node ESM, import JSON with `with {type: 'json'}`, or resolve and read it explicitly.
39
40
 
@@ -47,11 +48,14 @@ Protocol mechanics are intentionally kept in the [deep protocol guide](protocols
47
48
 
48
49
  ## Canonical member inventory
49
50
 
50
- SDK `0.2.2` exports exactly 169 distinct JavaScript members across 13
51
- JavaScript entrypoints. The complete export map has 23 subpaths: the other 10
52
- are the runtime manifest, eight JSON Schemas, and package metadata. Runtime
53
- projection modules in the managed browser map are cataloged separately in
54
- [Runtime modules](runtime-modules.md).
51
+ The current JavaScript member total is derived mechanically from every `.mjs`
52
+ entrypoint in `package.json#exports`. Records are grouped by export name and
53
+ `Object.is()` binding identity, then retain the sorted entrypoints that expose
54
+ that binding; `memberCount` in
55
+ [`inventory/package-api.json`](inventory/package-api.json) is the resulting
56
+ graph-node count. The remaining data-only subpaths are the runtime manifest,
57
+ JSON Schemas, and package metadata. Runtime projection modules in the managed
58
+ browser map are cataloged separately in [Runtime modules](runtime-modules.md).
55
59
 
56
60
  | Member | Kind | Import | Group | Availability |
57
61
  | --- | --- | --- | --- | --- |
@@ -90,6 +94,7 @@ projection modules in the managed browser map are cataloged separately in
90
94
  | `authenticateSharedPayloadSnapshot()` | function | `arcane-os` | Packaging and release bundles | Node |
91
95
  | `buildApplication()` | function | `arcane-os` | Headless toolchain operations | Node; selected operation may produce browser or native output |
92
96
  | `buildTarget()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
97
+ | `BROWSER_SPEECH_ARTIFACT_GRAPH_PROTOCOL` | constant | `arcane-os/ai/browser-speech` | Browser speech providers | Browser metadata; graph construction starts no fetch, cache, Worker, provider, or event operation |
93
98
  | `BROWSER_SPEECH_ARTIFACT_PROTOCOL` | constant | `arcane-os/ai/browser-speech` | Browser speech providers | Browser metadata; model/runtime use requires DBOPFS, Web Locks, Workers, and caller-supplied immutable artifacts |
94
99
  | `BROWSER_WASM_RUNTIME_AUTHORITY` | constant | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser metadata; no model or DBOPFS required to inspect |
95
100
  | `bumpVersion()` | function | `arcane-os/packager` | Packaging and release bundles | Node |
@@ -102,6 +107,7 @@ projection modules in the managed browser map are cataloged separately in
102
107
  | `createAppReleaseBundle()` | function | `arcane-os` | Packaging and release bundles | Node |
103
108
  | `createBrowserKokoroProvider()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser with DBOPFS, Web Locks, Workers, object URLs, and caller-admitted Kokoro runtime/model artifacts |
104
109
  | `createBrowserModelSource()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser Fetch with a readable response body |
110
+ | `createBrowserSpeechArtifactGraph()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser metadata; construction starts no fetch, cache, Worker, provider, or event operation |
105
111
  | `createBrowserSpeechAuthority()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser descriptor construction; use requires the selected storage and provider Web APIs |
106
112
  | `createBrowserWasmLlmProvider()` | function | `arcane-os/ai/browser-wasm` | Browser-WASM local AI | Browser secure context with WebAssembly, OPFS/DBOPFS, WebGPU, and admitted full-offload evidence; no CPU fallback |
107
113
  | `createBrowserWhisperProvider()` | function | `arcane-os/ai/browser-speech` | Browser speech providers | Browser with DBOPFS, Web Locks, Workers, object URLs, and caller-admitted Whisper runtime/model artifacts |
@@ -139,6 +145,7 @@ projection modules in the managed browser map are cataloged separately in
139
145
  | `loadArcaneNativeProvider()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
140
146
  | `loadArcanePortableProvider()` | function | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
141
147
  | `loadRuntimeRelease()` | function | `arcane-os` | Runtime and app descriptors | Node |
148
+ | `materializeInstalledSdkRuntime()` | function | `arcane-os` | Runtime and app descriptors | Node |
142
149
  | `NATIVE_BUILD_PLAN_PROTOCOL` | constant | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
143
150
  | `NATIVE_BUILDER_PROTOCOL` | constant | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
144
151
  | `normalizeError()` | function | `arcane-os` | Errors | Node |
@@ -204,6 +211,15 @@ projection modules in the managed browser map are cataloged separately in
204
211
  | `compareSdkVersions()` | function | `arcane-os` | Explicit SDK update checks | Node; on-demand CLI or maintainer check only |
205
212
  | `updateTagForVersion()` | function | `arcane-os` | Explicit SDK update checks | Node; on-demand CLI or maintainer check only |
206
213
  | `validateUpdateRegistry()` | function | `arcane-os` | Explicit SDK update checks | Node; on-demand CLI or maintainer check only |
214
+ | `ARCANE_EVENT_AUTHORITY_BRAND` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
215
+ | `ARCANE_EVENT_AUTHORITY_KIND` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
216
+ | `ARCANE_EVENT_AUTHORITY_PROTOCOL` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
217
+ | `ARCANE_EVENT_ERROR_CODES` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
218
+ | `ARCANE_EVENT_LISTENER_ERROR_EVENT` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
219
+ | `ARCANE_EVENT_OCCURRENCE_PROTOCOL` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
220
+ | `ARCANE_EVENT_SOURCE_DISPOSED_EVENT` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
221
+ | `ARCANE_EVENT_SOURCE_KIND` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
222
+ | `ARCANE_EVENT_SOURCE_PROTOCOL` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
207
223
  | `ARCANE_EVENT_STACK_PROTOCOL` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
208
224
  | `DEFAULT_DOM_EVENT_TYPES` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler; meaningful to browser DOM instrumentation |
209
225
  | `DOM_INTERACTION_EVENT` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or a DOM-compatible test host; constant imports in Node |
@@ -219,11 +235,30 @@ projection modules in the managed browser map are cataloged separately in
219
235
  | `TIME_TRAVEL_OVERFLOW_EVENT` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
220
236
  | `TIME_TRAVEL_SEEK_EVENT` | constant | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
221
237
  | `arcaneEvents` | singleton | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler; DOM capture requires a compatible DOM |
238
+ | `createArcaneEventSource()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
222
239
  | `createDOMInstrumentation()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or a DOM-compatible test host |
223
240
  | `createEventManager()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler; DOM capture requires a compatible DOM |
224
241
  | `describeDOMTarget()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or DOM-compatible objects; importable in Node |
225
242
  | `domSelector()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or DOM-compatible objects; importable in Node |
243
+ | `isArcaneEventOccurrence()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
226
244
  | `parseEventStack()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Node and browser/bundler |
245
+ | `projectArcaneDOMEvent()` | function | `arcane-os/event-manager` | Central events, time travel, and DOM instrumentation | Browser DOM or a DOM-compatible test host |
246
+ | `DEFAULT_MAIL_REQUEST_TIMEOUT_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser with Fetch and AbortController for transport use |
247
+ | `MAIL_OUTBOX_ACCEPTANCE_AUTHORITIES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
248
+ | `MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
249
+ | `MAIL_OUTBOX_PROTOCOL` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
250
+ | `MAIL_OUTBOX_STATES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
251
+ | `MAIL_OUTBOX_TABLE` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
252
+ | `MAX_MAIL_RESPONSE_BYTES` | constant | `arcane-os/mail` | Portable Mail | Node and browser metadata |
253
+ | `Mail` | class | `arcane-os/mail` | Portable Mail | Node with injected host adapters, or browser/native WebView with durable storage and Web Locks |
254
+ | `MailOutbox` | class | `arcane-os/mail` | Portable Mail | Node or browser with injected DBOPFS-compatible storage and a Web Locks-compatible lock manager |
255
+ | `MailTransportError` | class | `arcane-os/mail` | Portable Mail | Node and browser |
256
+ | `createMailOutbox()` | function | `arcane-os/mail` | Portable Mail | Node or browser with the required injected outbox adapters |
257
+ | `Mail default export` | class | `arcane-os/mail` | Portable Mail | Node with injected host adapters, or browser/native WebView with durable storage and Web Locks |
258
+ | `normalizeMailEndpoint()` | function | `arcane-os/mail` | Portable Mail | Node and browser with URL support; relative endpoints require an explicit or global base URL |
259
+ | `resolveMailConfig()` | function | `arcane-os/mail` | Portable Mail | Node with explicit configuration, or browser/native WebView with optional document and location defaults |
260
+ | `sendMailReport()` | function | `arcane-os/mail` | Portable Mail | Node and browser with Fetch and AbortController, or an explicit fetch implementation |
261
+ | `serializeMailReport()` | function | `arcane-os/mail` | Portable Mail | Node and browser |
227
262
 
228
263
  # Packaging and release bundles
229
264
 
@@ -814,7 +849,7 @@ same deterministic map. The package root also contains the public
814
849
  {
815
850
  schemaVersion: 1,
816
851
  kind: 'arcane-app-runtime-projection',
817
- sdkVersion: '0.2.2',
852
+ sdkVersion: '0.3.1',
818
853
  pathPrefix: 'arcane/',
819
854
  fileCount,
820
855
  totalBytes,
@@ -1365,6 +1400,36 @@ async function useloadRuntimeRelease(...arguments_) {
1365
1400
  }
1366
1401
  ```
1367
1402
 
1403
+ ## materializeInstalledSdkRuntime()
1404
+
1405
+ ### Overview
1406
+
1407
+ Verifies the workspace's exact installed SDK runtime and browser runtime, then creates, reuses, or transactionally refreshes their dynamic projection.
1408
+
1409
+ ### Signature and result
1410
+
1411
+ ```text
1412
+ async materializeInstalledSdkRuntime({workspaceRoot,sdkPackageSource,workspaceOperationLease,signal,onEvent}={})
1413
+ ```
1414
+
1415
+ Import it through the exact dependency key declared by the workspace: normally `arcane-os`, or the alias name such as `arcane-sdk` when the declaration is `npm:arcane-os@<version>`. It resolves that declaration under the shared workspace-operation lock, verifies both physical runtime receipts, and creates or refreshes the complete projection by staged whole-tree replacement. The frozen result includes `status` (`created`, `reused`, or `refreshed`), `generation`, `receiptPath`, `persistentReceipt`, `cleanupWarnings`, the installed-package authority, and all three process-local verification receipts.
1416
+
1417
+ The canonical `.arcane/installed-sdk-runtime.json` receipt binds the physical package and exact destination inventory. A later process reauthenticates that receipt against the current installed package, freshly issued source receipts, and all destination bytes before returning `reused`; the JSON file alone grants no authority. Refresh prunes bytes absent from the new inventory and restores the prior tree and receipt on commit or post-commit verification failure. `signal` and `onEvent` remain caller-owned before commit. Once the bounded commit starts, it completes verification or rollback without observing cancellation or invoking callbacks.
1418
+
1419
+ ### Availability and normalization
1420
+
1421
+ **Node.** Canonical workspace and installed-package identity, verified runtime receipts, a persistent reauthenticatable generation receipt, and a frozen materialization result. Deep protocol: [Installed SDK runtime materialization](protocols.md#installed-sdk-runtime-materialization).
1422
+
1423
+ ### Example
1424
+
1425
+ ```javascript
1426
+ import {materializeInstalledSdkRuntime} from 'arcane-os';
1427
+ // If package.json declares the SDK under the arcane-sdk alias, import from
1428
+ // 'arcane-sdk' instead.
1429
+
1430
+ const result=await materializeInstalledSdkRuntime({workspaceRoot});
1431
+ ```
1432
+
1368
1433
  ## projectNativeDescriptor()
1369
1434
 
1370
1435
  ### Overview
@@ -2698,7 +2763,7 @@ The import-map operation also reports the stable operation-specific strings
2698
2763
  `ARCANE_IMPORT_MAP_COLLISION`; package assembly can additionally report
2699
2764
  `ARCANE_IMPORT_MAP_CLEANUP_FAILED`. They are normalized `ArcaneError.code`
2700
2765
  values, but are not properties added to this frozen general registry in SDK
2701
- `0.2.2`.
2766
+ `0.3.1`.
2702
2767
 
2703
2768
  ### Value and import
2704
2769
 
@@ -3364,7 +3429,7 @@ workspace it additionally returns the exact installed package authority:
3364
3429
  packageSource,
3365
3430
  canonicalPackageRoot,
3366
3431
  packageName: 'arcane-os',
3367
- packageVersion: '0.2.2',
3432
+ packageVersion: '0.3.1',
3368
3433
  runtimeRoot,
3369
3434
  browserRuntimeRoot,
3370
3435
  runtimeManifest,
@@ -3374,9 +3439,9 @@ workspace it additionally returns the exact installed package authority:
3374
3439
  ```
3375
3440
 
3376
3441
  The dependency can be named `arcane-os` or be one exact npm alias for
3377
- `npm:arcane-os@0.2.2`. The selected installation must still be one direct,
3442
+ `npm:arcane-os@0.3.1`. The selected installation must still be one direct,
3378
3443
  physical, non-link package directory whose manifest identifies exactly as
3379
- `arcane-os@0.2.2`; duplicate canonical/alias declarations fail closed.
3444
+ `arcane-os@0.3.1`; duplicate canonical/alias declarations fail closed.
3380
3445
  `allowMissingManagedImportMap` is an internal packaging/development seam. An
3381
3446
  ordinary caller should leave it `false`.
3382
3447
 
@@ -3553,7 +3618,7 @@ const toolchain = createToolchain({
3553
3618
 
3554
3619
  // Only this explicit call refreshes the managed map and configured HTML entry.
3555
3620
  const result = await toolchain.importMap();
3556
- console.log(result.importMap.entryCount); // 91 in SDK 0.2.2
3621
+ console.log(result.importMap.entryCount); // derived from installed inventories
3557
3622
  console.log(result.importMap.documentPaths, result.importMap.documentCount);
3558
3623
  ```
3559
3624
 
@@ -4851,28 +4916,467 @@ arcaneEvents.on(TIME_TRAVEL_SEEK_EVENT, ({sequence}) => {
4851
4916
 
4852
4917
  ### Overview
4853
4918
 
4854
- The package-scoped EventManager singleton exposed from both the package root and `arcane-os/event-manager`. It provides one shared bus when explicit per-subsystem ownership is unnecessary.
4919
+ The one SDK-owned synchronous semantic event authority in the current
4920
+ JavaScript realm. Module evaluation installs or reuses the exact branded value
4921
+ at `globalThis.arcaneEvents`; duplicate module URLs do not create another bus.
4922
+ Window, frame, worker, Node realm, and process boundaries remain distinct and
4923
+ have no automatic transport between them.
4855
4924
 
4856
4925
  ### Value and use
4857
4926
 
4858
4927
  ```text
4859
- const arcaneEvents = new EventManager()
4928
+ globalThis.arcaneEvents === arcaneEvents
4929
+ arcaneEvents.protocol === 'arcane-event-authority/1'
4930
+ arcaneEvents[Symbol.for('arcane-os.arcane-events-authority')]
4931
+ === 'arcane-event-authority/1'
4932
+ ```
4933
+
4934
+ The global is an own, non-enumerable, non-writable, non-configurable data
4935
+ property. Its brand and public protocol descriptors are immutable. An accessor,
4936
+ inherited or unbranded value, mismatched descriptor/protocol, incomplete API,
4937
+ or failed installation is rejected with its exact
4938
+ `ARCANE_EVENT_AUTHORITY_*` code; the SDK never replaces the collision.
4939
+
4940
+ Canonical subscription is
4941
+ `arcaneEvents.subscribe(type,handler,{once=false,signal}={})`. It returns an
4942
+ idempotent `unsubscribe` function with
4943
+ `unsubscribe.dispose === unsubscribe`. An already-aborted signal installs
4944
+ nothing; later abort removes the registration synchronously. `handler` receives
4945
+ one frozen `arcane-event-occurrence/1`, and wildcard subscription is not
4946
+ admitted.
4947
+
4948
+ The source factory signatures are:
4949
+
4950
+ ```text
4951
+ arcaneEvents.createSource(owner,{source,eventTypes,onListenerError?})
4952
+ createArcaneEventSource(owner,{source,eventTypes,onListenerError?})
4953
+ ```
4954
+
4955
+ The exported wrapper calls the authority method and returns the same frozen
4956
+ handle. One owner may have one active source. The handle exposes
4957
+ `protocol`, `descriptor`, `source`, `instanceId`, `eventTypes`, `disposed`,
4958
+ `subscribe`, `on`, `once`, `addEventListener`, `removeEventListener`,
4959
+ `dispatch`, `dispatchEvent`, `dispose`, and `destroy`.
4960
+ `onListenerError(error,errorOccurrence)` receives the raw listener failure and
4961
+ the canonical listener-error occurrence at the owner-local boundary;
4962
+ `errorOccurrence` is `null` only when that secondary publication could not be
4963
+ constructed.
4964
+
4965
+ `source.dispatch(type,compatibilityDetail,{operationId=null,publicDetail={},
4966
+ cancelable=false}={})` synchronously returns the frozen
4967
+ `{occurrence,accepted}` publication. The occurrence contains immutable
4968
+ `protocol`, `occurrenceId`, `type`, `source`, `instanceId`, `operationId`,
4969
+ privacy-admitted deeply frozen `detail`, `cancelable`, live
4970
+ `defaultPrevented`, and `preventDefault()`. Canonical listeners run before the
4971
+ source's EventTarget-compatible listeners. Cancellation is synchronous and only
4972
+ sets acceptance; the publisher decides whether to begin or continue domain work.
4973
+
4974
+ Listener promises are not awaited. The authority is not an async queue:
4975
+ operation-owned promises and `createEventQueue()` own async ordering,
4976
+ backpressure, cancellation, and failure. Listener exceptions are observational;
4977
+ they publish one privacy-safe `arcane.event.listener.error` occurrence with code
4978
+ `ARCANE_EVENT_LISTENER_CALLBACK_FAILED` and do not throw from committed source
4979
+ dispatch.
4980
+
4981
+ `ARCANE_EVENT_ERROR_CODES` is frozen and maps each stable key to that identical
4982
+ string value: `ARCANE_EVENT_AUTHORITY_ACCESSOR_COLLISION`,
4983
+ `ARCANE_EVENT_AUTHORITY_VALUE_COLLISION`,
4984
+ `ARCANE_EVENT_AUTHORITY_DESCRIPTOR_MISMATCH`,
4985
+ `ARCANE_EVENT_AUTHORITY_PROTOCOL_MISMATCH`,
4986
+ `ARCANE_EVENT_AUTHORITY_API_MISMATCH`,
4987
+ `ARCANE_EVENT_AUTHORITY_INSTALL_FAILED`, `ARCANE_EVENT_SOURCE_INVALID`,
4988
+ `ARCANE_EVENT_SOURCE_ALREADY_REGISTERED`, `ARCANE_EVENT_SOURCE_DISPOSED`,
4989
+ `ARCANE_EVENT_SOURCE_EVENT_TYPE_UNDECLARED`,
4990
+ `ARCANE_EVENT_COMPATIBILITY_DETAIL_INVALID`, `ARCANE_EVENT_OCCURRENCE_INVALID`,
4991
+ `ARCANE_EVENT_OCCURRENCE_SEQUENCE_EXHAUSTED`,
4992
+ `ARCANE_EVENT_SOURCE_SEQUENCE_EXHAUSTED`,
4993
+ `ARCANE_EVENT_LISTENER_CALLBACK_FAILED`, `ARCANE_EVENT_DOM_DETAIL_COLLISION`,
4994
+ `ARCANE_EVENT_DOM_TARGET_INVALID`, `ARCANE_EVENT_DOM_OPTIONS_INVALID`,
4995
+ `ARCANE_EVENT_SUBSCRIPTION_TYPE_INVALID`,
4996
+ `ARCANE_EVENT_SUBSCRIPTION_HANDLER_INVALID`,
4997
+ `ARCANE_EVENT_SUBSCRIPTION_OPTIONS_INVALID`,
4998
+ `ARCANE_EVENT_SUBSCRIPTION_SIGNAL_INVALID`, and
4999
+ `ARCANE_EVENT_DISPATCH_EVENT_INVALID`. Thrown authority failures expose the
5000
+ matching value as `error.code`; the listener callback code is carried by its
5001
+ observational error occurrence.
5002
+
5003
+ `projectArcaneDOMEvent(target,occurrence,{type,bubbles=false,composed=false,
5004
+ cancelable=occurrence.cancelable}={})` is a one-way compatibility projection.
5005
+ Its frozen detail carries `occurrenceId`, `arcaneSource`, `instanceId`, and
5006
+ `operationId`; it never republishes the DOM event. DOM cancellation propagates
5007
+ back to a cancelable occurrence. `isArcaneEventOccurrence(value)` recognizes
5008
+ only canonical occurrences and source compatibility views created by this
5009
+ realm's authority.
5010
+
5011
+ The first `source.dispose()`/`destroy()` publishes the final noncancelable
5012
+ `arcane.event.source.disposed` occurrence, removes source-owned listeners, frees
5013
+ the owner for a new source, and returns `true`; later or reentrant calls return
5014
+ `false`. The deprecated `aiRuntimeEvents` export is a frozen, state-free
5015
+ EventTarget compatibility view over the AIRuntimeState source, not another event
5016
+ owner.
5017
+
5018
+ ### Availability and normalization
5019
+
5020
+ **Node and browser/bundler, once per JavaScript realm; DOM projection requires
5021
+ `CustomEvent` and a target with `dispatchEvent`.** Canonical public detail is
5022
+ defensively snapshotted and deeply frozen. Rich compatibility detail remains
5023
+ owner-local and is shallow-frozen only when it is a plain record or array.
5024
+
5025
+ ### Example
5026
+
5027
+ ```javascript
5028
+ import {arcaneEvents, createArcaneEventSource} from 'arcane-os/event-manager';
5029
+
5030
+ const owner = {};
5031
+ const source = createArcaneEventSource(owner, {
5032
+ source:'sdk.operation',
5033
+ eventTypes:['sdk.operation.completed']
5034
+ });
5035
+ const unsubscribe = arcaneEvents.subscribe(
5036
+ 'sdk.operation.completed',
5037
+ occurrence => console.log(occurrence.detail.operationId)
5038
+ );
5039
+ source.dispatch(
5040
+ 'sdk.operation.completed',
5041
+ Object.freeze({operationId:'operation-1'}),
5042
+ {operationId:'operation-1', publicDetail:{operationId:'operation-1'}}
5043
+ );
5044
+ unsubscribe.dispose();
5045
+ source.dispose();
5046
+ ```
5047
+
5048
+ ## ARCANE_EVENT_AUTHORITY_BRAND
5049
+
5050
+ ### Overview
5051
+
5052
+ Global registry symbol that brands the one compatible Arcane event authority in
5053
+ a JavaScript realm.
5054
+
5055
+ ### Value and import
5056
+
5057
+ ```text
5058
+ const ARCANE_EVENT_AUTHORITY_BRAND
5059
+ ```
5060
+
5061
+ Its exact value is `Symbol.for('arcane-os.arcane-events-authority')`.
5062
+
5063
+ ### Availability and normalization
5064
+
5065
+ **Node and browser/bundler.** The brand property is immutable and
5066
+ non-enumerable. It is a compatibility marker, not transport or authenticity.
5067
+
5068
+ ### Example
5069
+
5070
+ ```javascript
5071
+ import {ARCANE_EVENT_AUTHORITY_BRAND,arcaneEvents} from 'arcane-os/event-manager';
5072
+ console.log(arcaneEvents[ARCANE_EVENT_AUTHORITY_BRAND]);
5073
+ ```
5074
+
5075
+ ## ARCANE_EVENT_AUTHORITY_KIND
5076
+
5077
+ ### Overview
5078
+
5079
+ Stable kind discriminator for the frozen authority descriptor.
5080
+
5081
+ ### Value and import
5082
+
5083
+ ```text
5084
+ const ARCANE_EVENT_AUTHORITY_KIND
5085
+ ```
5086
+
5087
+ Its exact value is `arcane-event-authority`.
5088
+
5089
+ ### Availability and normalization
5090
+
5091
+ **Node and browser/bundler.** Reading it creates no authority or listener.
5092
+
5093
+ ### Example
5094
+
5095
+ ```javascript
5096
+ import {ARCANE_EVENT_AUTHORITY_KIND,arcaneEvents} from 'arcane-os/event-manager';
5097
+ console.log(arcaneEvents.descriptor.kind===ARCANE_EVENT_AUTHORITY_KIND);
5098
+ ```
5099
+
5100
+ ## ARCANE_EVENT_AUTHORITY_PROTOCOL
5101
+
5102
+ ### Overview
5103
+
5104
+ Stable protocol discriminator for compatible per-realm event authorities.
5105
+
5106
+ ### Value and import
5107
+
5108
+ ```text
5109
+ const ARCANE_EVENT_AUTHORITY_PROTOCOL
5110
+ ```
5111
+
5112
+ Its exact value is `arcane-event-authority/1`.
5113
+
5114
+ ### Availability and normalization
5115
+
5116
+ **Node and browser/bundler.** An incompatible installed protocol fails closed
5117
+ and is never replaced or wrapped.
5118
+
5119
+ ### Example
5120
+
5121
+ ```javascript
5122
+ import {ARCANE_EVENT_AUTHORITY_PROTOCOL,arcaneEvents} from 'arcane-os/event-manager';
5123
+ console.log(arcaneEvents.protocol===ARCANE_EVENT_AUTHORITY_PROTOCOL);
5124
+ ```
5125
+
5126
+ ## ARCANE_EVENT_ERROR_CODES
5127
+
5128
+ ### Overview
5129
+
5130
+ Frozen registry of every stable canonical event-authority failure code.
5131
+
5132
+ ### Value and import
5133
+
5134
+ ```text
5135
+ const ARCANE_EVENT_ERROR_CODES
5136
+ ```
5137
+
5138
+ Every key maps to its identical string value; thrown authority failures expose
5139
+ the matching value as `error.code`.
5140
+
5141
+ ### Availability and normalization
5142
+
5143
+ **Node and browser/bundler.** The registry contains no mutable registration API
5144
+ or vague fallback code.
5145
+
5146
+ ### Example
5147
+
5148
+ ```javascript
5149
+ import {ARCANE_EVENT_ERROR_CODES} from 'arcane-os/event-manager';
5150
+ console.log(ARCANE_EVENT_ERROR_CODES.ARCANE_EVENT_SOURCE_DISPOSED);
5151
+ ```
5152
+
5153
+ ## ARCANE_EVENT_LISTENER_ERROR_EVENT
5154
+
5155
+ ### Overview
5156
+
5157
+ Canonical observational event emitted when an event listener throws.
5158
+
5159
+ ### Value and import
5160
+
5161
+ ```text
5162
+ const ARCANE_EVENT_LISTENER_ERROR_EVENT
5163
+ ```
5164
+
5165
+ Its exact value is `arcane.event.listener.error`.
5166
+
5167
+ ### Availability and normalization
5168
+
5169
+ **Node and browser/bundler.** Frozen public detail carries the exact failure code
5170
+ and source occurrence identifiers, never the raw error. Its shape is exactly
5171
+ `{code:'ARCANE_EVENT_LISTENER_CALLBACK_FAILED',reason:'listener-threw',
5172
+ eventType,occurrenceId,source,instanceId,operationId}`. Publication is
5173
+ synchronous and nonrecursive.
5174
+
5175
+ ### Example
5176
+
5177
+ ```javascript
5178
+ import {ARCANE_EVENT_LISTENER_ERROR_EVENT,arcaneEvents} from 'arcane-os/event-manager';
5179
+ const unsubscribe=arcaneEvents.subscribe(ARCANE_EVENT_LISTENER_ERROR_EVENT,console.log);
5180
+ ```
5181
+
5182
+ ## ARCANE_EVENT_OCCURRENCE_PROTOCOL
5183
+
5184
+ ### Overview
5185
+
5186
+ Stable protocol discriminator for immutable canonical occurrences.
5187
+
5188
+ ### Value and import
5189
+
5190
+ ```text
5191
+ const ARCANE_EVENT_OCCURRENCE_PROTOCOL
5192
+ ```
5193
+
5194
+ Its exact value is `arcane-event-occurrence/1`.
5195
+
5196
+ ### Availability and normalization
5197
+
5198
+ **Node and browser/bundler.** Occurrences are realm-owned identity values with
5199
+ deeply frozen public detail and synchronous cancellation state.
5200
+
5201
+ ### Example
5202
+
5203
+ ```javascript
5204
+ import {ARCANE_EVENT_OCCURRENCE_PROTOCOL} from 'arcane-os/event-manager';
5205
+ console.log(publication.occurrence.protocol===ARCANE_EVENT_OCCURRENCE_PROTOCOL);
5206
+ ```
5207
+
5208
+ ## ARCANE_EVENT_SOURCE_DISPOSED_EVENT
5209
+
5210
+ ### Overview
5211
+
5212
+ Final noncancelable occurrence published during a source's first disposal.
5213
+
5214
+ ### Value and import
5215
+
5216
+ ```text
5217
+ const ARCANE_EVENT_SOURCE_DISPOSED_EVENT
5218
+ ```
5219
+
5220
+ Its exact value is `arcane.event.source.disposed`.
5221
+
5222
+ ### Availability and normalization
5223
+
5224
+ **Node and browser/bundler.** Public detail is exactly
5225
+ `{reason:'source-disposed'}`. Delivery precedes source-listener cleanup;
5226
+ reentrant or later disposal publishes nothing and returns `false`.
5227
+
5228
+ ### Example
5229
+
5230
+ ```javascript
5231
+ import {ARCANE_EVENT_SOURCE_DISPOSED_EVENT} from 'arcane-os/event-manager';
5232
+ source.once(ARCANE_EVENT_SOURCE_DISPOSED_EVENT,console.log);
5233
+ source.dispose();
5234
+ ```
5235
+
5236
+ ## ARCANE_EVENT_SOURCE_KIND
5237
+
5238
+ ### Overview
5239
+
5240
+ Stable kind discriminator for frozen source descriptors.
5241
+
5242
+ ### Value and import
5243
+
5244
+ ```text
5245
+ const ARCANE_EVENT_SOURCE_KIND
5246
+ ```
5247
+
5248
+ Its exact value is `arcane-event-source`.
5249
+
5250
+ ### Availability and normalization
5251
+
5252
+ **Node and browser/bundler.** Reading it does not register or dispose a source.
5253
+
5254
+ ### Example
5255
+
5256
+ ```javascript
5257
+ import {ARCANE_EVENT_SOURCE_KIND} from 'arcane-os/event-manager';
5258
+ console.log(source.descriptor.kind===ARCANE_EVENT_SOURCE_KIND);
5259
+ ```
5260
+
5261
+ ## ARCANE_EVENT_SOURCE_PROTOCOL
5262
+
5263
+ ### Overview
5264
+
5265
+ Stable protocol discriminator for frozen source handles and descriptors.
5266
+
5267
+ ### Value and import
5268
+
5269
+ ```text
5270
+ const ARCANE_EVENT_SOURCE_PROTOCOL
5271
+ ```
5272
+
5273
+ Its exact value is `arcane-event-source/1`.
5274
+
5275
+ ### Availability and normalization
5276
+
5277
+ **Node and browser/bundler.** One handle belongs to one active owner in one
5278
+ realm and declares every publishable type before use.
5279
+
5280
+ ### Example
5281
+
5282
+ ```javascript
5283
+ import {ARCANE_EVENT_SOURCE_PROTOCOL} from 'arcane-os/event-manager';
5284
+ console.log(source.protocol===ARCANE_EVENT_SOURCE_PROTOCOL);
5285
+ ```
5286
+
5287
+ ## createArcaneEventSource()
5288
+
5289
+ ### Overview
5290
+
5291
+ Registers one active declared semantic source for a non-null object or function
5292
+ owner on the installed per-realm authority.
5293
+
5294
+ ### Signature and result
5295
+
5296
+ ```text
5297
+ createArcaneEventSource(owner, options)
5298
+ ```
5299
+
5300
+ `options` is the closed data record `{source,eventTypes,onListenerError?}`. The
5301
+ result is one frozen `arcane-event-source/1` handle with synchronous
5302
+ subscription, publication, cancellation admission, EventTarget compatibility,
5303
+ and idempotent disposal. A second active source for the same owner fails with
5304
+ `ARCANE_EVENT_SOURCE_ALREADY_REGISTERED`.
5305
+
5306
+ ### Availability and normalization
5307
+
5308
+ **Node and browser/bundler, within the current JavaScript realm.** The wrapper
5309
+ reuses `globalThis.arcaneEvents`; it creates no second bus, queue, Worker, or
5310
+ transport. Provider or host work remains owned by its own promise and signal.
5311
+
5312
+ ### Example
5313
+
5314
+ ```javascript
5315
+ import {createArcaneEventSource} from 'arcane-os/event-manager';
5316
+ const source=createArcaneEventSource({}, {
5317
+ source:'sdk.example',
5318
+ eventTypes:['sdk.example.completed']
5319
+ });
5320
+ source.dispose();
5321
+ ```
5322
+
5323
+ ## isArcaneEventOccurrence()
5324
+
5325
+ ### Overview
5326
+
5327
+ Recognizes canonical occurrences and source compatibility views created by the
5328
+ current realm's authority.
5329
+
5330
+ ### Signature and result
5331
+
5332
+ ```text
5333
+ isArcaneEventOccurrence(value)
4860
5334
  ```
4861
5335
 
4862
- The singleton starts with time travel disabled and no DOM instrumentation. Its listeners and history are process/module state, so tests should remove handlers and clear history they create. Full operational guidance: [central events, DOM instrumentation, and time-travel review](event-manager.md).
5336
+ Returns a boolean. Structurally similar or protocol-shaped foreign values return
5337
+ `false`.
4863
5338
 
4864
5339
  ### Availability and normalization
4865
5340
 
4866
- **Node and browser/bundler; DOM capture requires a compatible DOM.** It is the same ESM singleton across documented entrypoints in one module graph.
5341
+ **Node and browser/bundler, within the current JavaScript realm.** Recognition
5342
+ is synchronous and identity-based, with no parsing, cloning, or transport.
4867
5343
 
4868
5344
  ### Example
4869
5345
 
4870
5346
  ```javascript
4871
- import {arcaneEvents} from 'arcane-os/event-manager';
5347
+ import {isArcaneEventOccurrence} from 'arcane-os/event-manager';
5348
+ console.log(isArcaneEventOccurrence(publication.occurrence));
5349
+ ```
5350
+
5351
+ ## projectArcaneDOMEvent()
5352
+
5353
+ ### Overview
5354
+
5355
+ Projects one authority-created occurrence to one `CustomEvent` without
5356
+ republishing the DOM event into the canonical authority.
5357
+
5358
+ ### Signature and result
5359
+
5360
+ ```text
5361
+ projectArcaneDOMEvent(target, occurrence, options)
5362
+ ```
5363
+
5364
+ The result is the combined DOM/canonical acceptance boolean. Frozen projection
5365
+ detail adds the occurrence, canonical source, source instance, and operation
5366
+ identifiers while preserving a caller-owned compatibility `source`. A
5367
+ pre-cancelled occurrence skips DOM dispatch; DOM cancellation propagates only
5368
+ to a cancelable occurrence.
4872
5369
 
4873
- const handler = value => console.log(value);
4874
- arcaneEvents.on('status', handler).emit('status', 'ready');
4875
- arcaneEvents.off('status', handler);
5370
+ ### Availability and normalization
5371
+
5372
+ **Browser DOM or a DOM-compatible host with `CustomEvent` and
5373
+ `dispatchEvent`.** Projection is synchronous, state-free, and one-way.
5374
+
5375
+ ### Example
5376
+
5377
+ ```javascript
5378
+ import {projectArcaneDOMEvent} from 'arcane-os/event-manager';
5379
+ projectArcaneDOMEvent(button,publication.occurrence,{bubbles:true});
4876
5380
  ```
4877
5381
 
4878
5382
  ## createDOMInstrumentation()
@@ -5120,6 +5624,25 @@ visibility. It neither selects a provider fallback nor executes an application
5120
5624
  tool. Persistent sessions additionally require ChatEntity/DBOPFS in the
5121
5625
  managed browser runtime.
5122
5626
 
5627
+ `ai.llm.addEventListener(type,listener,options)` and
5628
+ `removeEventListener(type,listener,options)` are EventTarget compatibility
5629
+ views over `globalThis.arcaneEvents`; null/non-listener callbacks and event names
5630
+ other than `statechange` or `progress` are compatibility no-ops.
5631
+ `ai.llm.on(type,listener)` installs through that same view and returns
5632
+ one idempotent removal closure whose `.dispose` property is that same closure.
5633
+ The controller exposes no public `dispatchEvent()` and
5634
+ therefore does not let consumers forge lifecycle occurrences. Compatibility
5635
+ listeners receive the frozen full status as `event.detail` with the controller
5636
+ as `this`, `target`, and `currentTarget`. Canonical `statechange` and `progress`
5637
+ occurrences use source `ai-model-controller`; every load or unload owns one
5638
+ non-null operation ID shared by its state and progress occurrences. Public
5639
+ progress retains the exact admitted `modelId`, `phase`, `loaded`, `total`,
5640
+ `percent`, and nested file-progress field names rather
5641
+ than relabeling byte counts. Accessor-bearing provider status and malformed
5642
+ progress fail at admission with `ARCANE_AI_PROVIDER_STATUS_INVALID` and
5643
+ `ARCANE_AI_PROVIDER_PROGRESS_INVALID`. After disposal, lifecycle operations fail with
5644
+ `ARCANE_AI_DISPOSED`.
5645
+
5123
5646
  ### Example
5124
5647
 
5125
5648
  ```javascript
@@ -5368,7 +5891,7 @@ releaseProvider();
5368
5891
 
5369
5892
  # Browser speech providers
5370
5893
 
5371
- `arcane-os/ai/browser-speech` exports exactly the five package members below.
5894
+ `arcane-os/ai/browser-speech` exports exactly the seven package members below.
5372
5895
  It ships provider, authority, artifact-store, and Worker mechanisms but no
5373
5896
  Whisper/Kokoro model weights, adapter runtime bytes, voices, download URLs,
5374
5897
  default catalog, CDN loader, native bridge, or cloud fallback. The providers
@@ -5376,6 +5899,41 @@ implement `arcane-ai-provider/2`; the managed `arcane/AIProviderRuntime` and
5376
5899
  `arcane/AIRuntimeState` projection modules can normalize their independent
5377
5900
  role lifecycle and observation, but are not exports of this package subpath.
5378
5901
 
5902
+ ## BROWSER_SPEECH_ARTIFACT_GRAPH_PROTOCOL
5903
+
5904
+ ### Overview
5905
+
5906
+ Stable protocol identifier for an SDK-created authenticated browser speech
5907
+ artifact graph. It identifies one complete caller-owned runtime, model, and
5908
+ voice dependency graph; it grants no provider, model, runtime, voice, network,
5909
+ or license authority.
5910
+
5911
+ ### Value and import
5912
+
5913
+ ```text
5914
+ const BROWSER_SPEECH_ARTIFACT_GRAPH_PROTOCOL
5915
+ ```
5916
+
5917
+ Its exact value is `arcane-ai-browser-speech-artifact-graph/1`, and it is
5918
+ exported only by `arcane-os/ai/browser-speech`.
5919
+
5920
+ ### Availability and normalization
5921
+
5922
+ **Browser metadata; the ESM binding is importable in Node.** Reading the
5923
+ constant starts no fetch, cache, Worker, provider, or event operation. Actual
5924
+ artifact preparation and provider use require the selected browser storage and
5925
+ Worker capabilities.
5926
+
5927
+ ### Example
5928
+
5929
+ ```javascript
5930
+ import {
5931
+ BROWSER_SPEECH_ARTIFACT_GRAPH_PROTOCOL
5932
+ } from 'arcane-os/ai/browser-speech';
5933
+
5934
+ console.log(BROWSER_SPEECH_ARTIFACT_GRAPH_PROTOCOL);
5935
+ ```
5936
+
5379
5937
  ## BROWSER_SPEECH_ARTIFACT_PROTOCOL
5380
5938
 
5381
5939
  ### Overview
@@ -5409,12 +5967,67 @@ import {
5409
5967
  console.log(BROWSER_SPEECH_ARTIFACT_PROTOCOL);
5410
5968
  ```
5411
5969
 
5412
- ## createBrowserSpeechAuthority()
5970
+ ## createBrowserSpeechArtifactGraph()
5413
5971
 
5414
5972
  ### Overview
5415
5973
 
5416
- Validates and freezes one caller-owned Whisper STT or Kokoro TTS model/runtime
5417
- closure. The application owns every model, runtime, revision, URL, hash, voice,
5974
+ Validates, canonicalizes, identifies, and freezes one complete caller-owned
5975
+ browser speech artifact graph. The caller declares every executable, WASM,
5976
+ model, and voice byte together with its immutable source identity, byte length,
5977
+ SHA-256 digest, license declaration, runtime route, dependency edge, transform,
5978
+ model/runtime identity, sample rate, and TTS default voice where applicable.
5979
+ The SDK selects none of those values.
5980
+
5981
+ ### Signature and result
5982
+
5983
+ ```text
5984
+ createBrowserSpeechArtifactGraph({ kind='browser-speech-authenticated-artifact-graph', identitySha256, providerId=null, role, model, runtime, files, edges, transforms }={})
5985
+ ```
5986
+
5987
+ `role` is exactly `stt` or `tts`; its model and runtime adapter fields must
5988
+ match that role. Every non-entry file must be reachable through the declared
5989
+ runtime, model, voice, or edge graph. Files are normalized into one unique
5990
+ path/source inventory with exact media types, positive byte lengths, lowercase
5991
+ SHA-256 values, immutable revisions, and explicitly admitted runtime routes.
5992
+ Unknown graph kinds, roles, adapters, paths, identities, files, edges,
5993
+ transforms, runtime routes, or voice policy fail closed with a concrete
5994
+ `artifact-graph-*` reason.
5995
+
5996
+ The result is one frozen
5997
+ `arcane-ai-browser-speech-artifact-graph/1` record containing
5998
+ `{kind,providerId,role,model,runtime,files,edges,transforms,identitySha256,
5999
+ artifactGraphStatus}`. `kind` and `runtime.moduleGraph` are exactly
6000
+ `browser-speech-authenticated-artifact-graph`; `artifactGraphStatus` is exactly
6001
+ `artifact-graph-descriptor-verified`. The SDK computes `identitySha256` from a
6002
+ canonical JSON projection. A supplied `identitySha256` is an assertion and must
6003
+ equal that computed value.
6004
+
6005
+ ### Availability and normalization
6006
+
6007
+ **Browser metadata; the ESM subpath is importable in Node.** Construction is
6008
+ synchronous and starts no fetch, cache, Worker, provider, or event operation.
6009
+ The graph is authority only because it was created and retained by this SDK
6010
+ realm; a structurally similar object is not admitted. Preparing and executing
6011
+ the graph requires the selected DBOPFS, Web Locks, Fetch, object URL, and Worker
6012
+ capabilities.
6013
+
6014
+ ### Example
6015
+
6016
+ ```javascript
6017
+ import {
6018
+ createBrowserSpeechArtifactGraph
6019
+ } from 'arcane-os/ai/browser-speech';
6020
+
6021
+ const graph = createBrowserSpeechArtifactGraph(callerOwnedGraphDescriptor);
6022
+ console.log(graph.identitySha256, graph.artifactGraphStatus);
6023
+ ```
6024
+
6025
+ ## createBrowserSpeechAuthority()
6026
+
6027
+ ### Overview
6028
+
6029
+ Validates and freezes one caller-owned Whisper STT or Kokoro TTS model/runtime
6030
+ closure. The application owns every model, runtime, revision, URL, hash, voice,
5418
6031
  license, and business-policy choice; the SDK supplies no artifact selection.
5419
6032
 
5420
6033
  ### Signature and result
@@ -5700,6 +6313,386 @@ async function synthesizeAfterUserChoice() {
5700
6313
  }
5701
6314
  ```
5702
6315
 
6316
+ # Portable Mail
6317
+
6318
+ The `arcane-os/mail` subpath is the dependency-free portable Mail boundary.
6319
+ Node credentials, Resend commands, and the loopback gateway remain toolchain
6320
+ and CLI responsibilities rather than browser-package exports.
6321
+
6322
+ ## DEFAULT_MAIL_REQUEST_TIMEOUT_MS
6323
+
6324
+ ### Overview
6325
+
6326
+ Default upper bound for one Mail HTTP request in milliseconds.
6327
+
6328
+ ### Value and import
6329
+
6330
+ ```text
6331
+ const DEFAULT_MAIL_REQUEST_TIMEOUT_MS
6332
+ ```
6333
+
6334
+ ### Availability and normalization
6335
+
6336
+ Node and browser with Fetch and AbortController. The immutable value is 590000.
6337
+
6338
+ ### Example
6339
+
6340
+ ```js
6341
+ import {DEFAULT_MAIL_REQUEST_TIMEOUT_MS} from 'arcane-os/mail';
6342
+ ```
6343
+
6344
+ ## MAIL_OUTBOX_ACCEPTANCE_AUTHORITIES
6345
+
6346
+ ### Overview
6347
+
6348
+ Frozen acceptance-authority allowlist for durable outbox delivery evidence.
6349
+
6350
+ ### Value and import
6351
+
6352
+ ```text
6353
+ const MAIL_OUTBOX_ACCEPTANCE_AUTHORITIES
6354
+ ```
6355
+
6356
+ ### Availability and normalization
6357
+
6358
+ Node and browser metadata. Acceptance means admitted provider or Core
6359
+ acceptance, not independent inbox delivery.
6360
+
6361
+ ### Example
6362
+
6363
+ ```js
6364
+ import {MAIL_OUTBOX_ACCEPTANCE_AUTHORITIES} from 'arcane-os/mail';
6365
+ ```
6366
+
6367
+ ## MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS
6368
+
6369
+ ### Overview
6370
+
6371
+ Duration for same-key retry before ambiguous delivery requires reconciliation.
6372
+
6373
+ ### Value and import
6374
+
6375
+ ```text
6376
+ const MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS
6377
+ ```
6378
+
6379
+ ### Availability and normalization
6380
+
6381
+ Node and browser metadata. The immutable value is 86400000 milliseconds.
6382
+
6383
+ ### Example
6384
+
6385
+ ```js
6386
+ import {MAIL_OUTBOX_IDEMPOTENCY_WINDOW_MS} from 'arcane-os/mail';
6387
+ ```
6388
+
6389
+ ## MAIL_OUTBOX_PROTOCOL
6390
+
6391
+ ### Overview
6392
+
6393
+ Stable protocol identifier written to durable Mail outbox records.
6394
+
6395
+ ### Value and import
6396
+
6397
+ ```text
6398
+ const MAIL_OUTBOX_PROTOCOL
6399
+ ```
6400
+
6401
+ ### Availability and normalization
6402
+
6403
+ Node and browser metadata. The immutable value is `arcane-mail-outbox/1`.
6404
+
6405
+ ### Example
6406
+
6407
+ ```js
6408
+ import {MAIL_OUTBOX_PROTOCOL} from 'arcane-os/mail';
6409
+ ```
6410
+
6411
+ ## MAIL_OUTBOX_STATES
6412
+
6413
+ ### Overview
6414
+
6415
+ Frozen ordered vocabulary for durable Mail outbox lifecycle states.
6416
+
6417
+ ### Value and import
6418
+
6419
+ ```text
6420
+ const MAIL_OUTBOX_STATES
6421
+ ```
6422
+
6423
+ ### Availability and normalization
6424
+
6425
+ Node and browser metadata. States are queued, sending, retry_wait, accepted,
6426
+ failed, and reconciliation_required.
6427
+
6428
+ ### Example
6429
+
6430
+ ```js
6431
+ import {MAIL_OUTBOX_STATES} from 'arcane-os/mail';
6432
+ ```
6433
+
6434
+ ## MAIL_OUTBOX_TABLE
6435
+
6436
+ ### Overview
6437
+
6438
+ Default DBOPFS-compatible table name for durable Mail outbox records.
6439
+
6440
+ ### Value and import
6441
+
6442
+ ```text
6443
+ const MAIL_OUTBOX_TABLE
6444
+ ```
6445
+
6446
+ ### Availability and normalization
6447
+
6448
+ Node and browser metadata. The immutable value is `mail_outbox`.
6449
+
6450
+ ### Example
6451
+
6452
+ ```js
6453
+ import {MAIL_OUTBOX_TABLE} from 'arcane-os/mail';
6454
+ ```
6455
+
6456
+ ## MAX_MAIL_RESPONSE_BYTES
6457
+
6458
+ ### Overview
6459
+
6460
+ Maximum response-body bytes admitted by the Mail HTTP transport.
6461
+
6462
+ ### Value and import
6463
+
6464
+ ```text
6465
+ const MAX_MAIL_RESPONSE_BYTES
6466
+ ```
6467
+
6468
+ ### Availability and normalization
6469
+
6470
+ Node and browser metadata. The immutable bound is 65536 bytes.
6471
+
6472
+ ### Example
6473
+
6474
+ ```js
6475
+ import {MAX_MAIL_RESPONSE_BYTES} from 'arcane-os/mail';
6476
+ ```
6477
+
6478
+ ## Mail
6479
+
6480
+ ### Overview
6481
+
6482
+ Owns the application Mail singleton, durable lifecycle, report normalization,
6483
+ and explicit transport selection.
6484
+
6485
+ ### Signature and result
6486
+
6487
+ ```text
6488
+ new Mail(config=globalThis.arcane?.config?.mail||{}, options={})
6489
+ ```
6490
+
6491
+ ### Availability and normalization
6492
+
6493
+ Node with injected host adapters, or browser/native WebView with durable
6494
+ storage and Web Locks. Reports persist before delivery and results are frozen.
6495
+
6496
+ ### Example
6497
+
6498
+ ```js
6499
+ import {Mail} from 'arcane-os/mail';
6500
+ const mail = new Mail({}, options);
6501
+ ```
6502
+
6503
+ ## MailOutbox
6504
+
6505
+ ### Overview
6506
+
6507
+ Owns durable FIFO delivery, retry classification, and invalid-record
6508
+ maintenance.
6509
+
6510
+ ### Signature and result
6511
+
6512
+ ```text
6513
+ new MailOutbox(options={})
6514
+ ```
6515
+
6516
+ ### Availability and normalization
6517
+
6518
+ Node or browser with injected DBOPFS-compatible storage and a Web
6519
+ Locks-compatible lock manager. Records and summaries are deeply frozen.
6520
+
6521
+ ### Example
6522
+
6523
+ ```js
6524
+ import {MailOutbox} from 'arcane-os/mail';
6525
+ const outbox = new MailOutbox(options);
6526
+ ```
6527
+
6528
+ ## MailTransportError
6529
+
6530
+ ### Overview
6531
+
6532
+ Normalized Mail transport failure with stable retry and uncertainty metadata.
6533
+
6534
+ ### Signature and result
6535
+
6536
+ ```text
6537
+ new MailTransportError(message, options={})
6538
+ ```
6539
+
6540
+ ### Availability and normalization
6541
+
6542
+ Node and browser. It exposes code, retryable, retryAfterMs, statusCode, and
6543
+ uncertain without unbounded remote detail.
6544
+
6545
+ ### Example
6546
+
6547
+ ```js
6548
+ import {MailTransportError} from 'arcane-os/mail';
6549
+ ```
6550
+
6551
+ ## createMailOutbox()
6552
+
6553
+ ### Overview
6554
+
6555
+ Creates a MailOutbox from caller-owned storage, locking, delivery, and
6556
+ lifecycle adapters.
6557
+
6558
+ ### Signature and result
6559
+
6560
+ ```text
6561
+ createMailOutbox(options)
6562
+ ```
6563
+
6564
+ ### Availability and normalization
6565
+
6566
+ Node or browser with the required injected adapters. The result is the same
6567
+ validated contract as direct MailOutbox construction.
6568
+
6569
+ ### Example
6570
+
6571
+ ```js
6572
+ import {createMailOutbox} from 'arcane-os/mail';
6573
+ const outbox = createMailOutbox(options);
6574
+ ```
6575
+
6576
+ ## Mail default export
6577
+
6578
+ ### Overview
6579
+
6580
+ Default package binding for the same Mail class exposed by the named export.
6581
+
6582
+ ### Signature and result
6583
+
6584
+ ```text
6585
+ default as Mail
6586
+ ```
6587
+
6588
+ ### Availability and normalization
6589
+
6590
+ Node with injected host adapters, or browser/native WebView with durable
6591
+ storage and Web Locks. Binding identity equals the named `Mail` export.
6592
+
6593
+ ### Example
6594
+
6595
+ ```js
6596
+ import Mail from 'arcane-os/mail';
6597
+ ```
6598
+
6599
+ ## normalizeMailEndpoint()
6600
+
6601
+ ### Overview
6602
+
6603
+ Resolves and validates one credential-free HTTPS or loopback-HTTP endpoint.
6604
+
6605
+ ### Signature and result
6606
+
6607
+ ```text
6608
+ normalizeMailEndpoint(endpoint, base=globalThis.location?.href)
6609
+ ```
6610
+
6611
+ ### Availability and normalization
6612
+
6613
+ Node and browser with URL support. Relative endpoints require a base;
6614
+ credentials, queries, fragments, and insecure non-loopback transport reject.
6615
+
6616
+ ### Example
6617
+
6618
+ ```js
6619
+ import {normalizeMailEndpoint} from 'arcane-os/mail';
6620
+ const endpoint = normalizeMailEndpoint('/v1/mail', location.href);
6621
+ ```
6622
+
6623
+ ## resolveMailConfig()
6624
+
6625
+ ### Overview
6626
+
6627
+ Resolves application identity, key, endpoint, and timeout without delivery.
6628
+
6629
+ ### Signature and result
6630
+
6631
+ ```text
6632
+ resolveMailConfig(config=globalThis.arcane?.config?.mail||{}, options={})
6633
+ ```
6634
+
6635
+ ### Availability and normalization
6636
+
6637
+ Node with explicit configuration, or browser/native WebView with optional
6638
+ document and location defaults. The returned configuration is frozen.
6639
+
6640
+ ### Example
6641
+
6642
+ ```js
6643
+ import {resolveMailConfig} from 'arcane-os/mail';
6644
+ const config = resolveMailConfig();
6645
+ ```
6646
+
6647
+ ## sendMailReport()
6648
+
6649
+ ### Overview
6650
+
6651
+ Sends one immutable Mail report with an idempotency key through bounded HTTP.
6652
+
6653
+ ### Signature and result
6654
+
6655
+ ```text
6656
+ sendMailReport({ appKey, appName, endpoint, fetchImpl=globalThis.fetch, report, reportKey, requestTimeout=590000, serializedReport, signal })
6657
+ ```
6658
+
6659
+ ### Availability and normalization
6660
+
6661
+ Node and browser with Fetch and AbortController, or an explicit fetch
6662
+ implementation. The response is bounded and normalized as acceptance or a
6663
+ `MailTransportError`.
6664
+
6665
+ ### Example
6666
+
6667
+ ```js
6668
+ import {sendMailReport} from 'arcane-os/mail';
6669
+ const result = await sendMailReport(options);
6670
+ ```
6671
+
6672
+ ## serializeMailReport()
6673
+
6674
+ ### Overview
6675
+
6676
+ Serializes one JSON-object Mail report for immutable body comparison.
6677
+
6678
+ ### Signature and result
6679
+
6680
+ ```text
6681
+ serializeMailReport(report)
6682
+ ```
6683
+
6684
+ ### Availability and normalization
6685
+
6686
+ Node and browser. Returns compact JSON and rejects non-object or
6687
+ non-serializable reports.
6688
+
6689
+ ### Example
6690
+
6691
+ ```js
6692
+ import {serializeMailReport} from 'arcane-os/mail';
6693
+ const body = serializeMailReport(report);
6694
+ ```
6695
+
5703
6696
  ## Data export subpaths
5704
6697
 
5705
6698
  The package also exposes the exact runtime manifest, eight JSON Schemas (including `arcane-os/schemas/event-stack.json`), and its package manifest. These are data contracts, not callable JavaScript members. See [schema and manifest contracts](../architecture.md) and the files under `schemas/`.