arcane-os 0.92.0 → 0.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +1 -1
  3. package/browser-runtime/ai/twin-cloud.mjs +109 -46
  4. package/browser-runtime/core/client.mjs +20 -0
  5. package/browser-runtime/core/contracts.mjs +20 -0
  6. package/browser-runtime/core/native-diagnostics.mjs +217 -0
  7. package/docs/reference/ai/twin-cloud.md +35 -14
  8. package/docs/reference/availability-and-normalization.md +1 -1
  9. package/docs/reference/core/arcane-api.md +32 -0
  10. package/docs/reference/core/arcane-events.md +25 -0
  11. package/docs/reference/core-client.md +99 -0
  12. package/docs/reference/inventory/package-api.json +97 -13
  13. package/docs/reference/local-ai.md +81 -5
  14. package/docs/reference/native-diagnostics.md +167 -0
  15. package/docs/reference/native-speech.md +220 -11
  16. package/docs/reference/runtime-modules.md +21 -18
  17. package/docs/reference/sdk-api.md +152 -11
  18. package/package.json +4 -1
  19. package/schemas/arcane-app.schema.json +2 -2
  20. package/schemas/arcane-package.schema.json +2 -2
  21. package/src/core/app-control.mjs +1 -0
  22. package/src/core/hosts/windows/ArcaneAppControl.cs +1 -1
  23. package/src/core/hosts/windows/ArcaneHost.cs +167 -0
  24. package/src/core/hosts/windows/ArcaneLauncher.cs +1 -0
  25. package/src/core/hosts/windows/ArcaneNativeDiagnostics.cs +137 -0
  26. package/src/core/hosts/windows/ArcaneNotifications.cs +822 -0
  27. package/src/core/hosts/windows/ArcaneWindowControl.cs +3 -2
  28. package/src/core/services/speech.mjs +85 -23
  29. package/src/core-native-diagnostics-source.mjs +13 -0
  30. package/src/import-map.mjs +1 -0
  31. package/src/local-ai/config.mjs +12 -1
  32. package/src/local-ai/dev.mjs +71 -4
  33. package/src/local-ai/install.mjs +113 -5
  34. package/src/local-ai/kokoro/frontend.mjs +219 -0
  35. package/src/local-ai/kokoro/helper.mjs +168 -0
  36. package/src/local-ai/kokoro/index.mjs +645 -0
  37. package/src/local-ai/kokoro/native/CMakeLists.txt +45 -0
  38. package/src/local-ai/kokoro/native/main.cpp +249 -0
  39. package/src/native/portable-layout.mjs +67 -9
@@ -49,6 +49,7 @@ This inventory covers every enumerable, non-method member exposed directly or th
49
49
  | `Arcane.storage` | Namespace | App-scoped native key/value storage. |
50
50
  | `Arcane.preferences` | Namespace | App-scoped preference reads and atomic writes. |
51
51
  | `Arcane.window` | Namespace | SDK host window presentation for the calling document; adapter availability is independent of the OS-user appearance service. |
52
+ | `Arcane.notifications` | Namespace | Native app-scoped desktop notifications and retained host-lifetime outcomes; see the [notification contract](../core-client.md#native-desktop-notifications). |
52
53
  | `Arcane.appearance` | Namespace | Native appearance state and application. |
53
54
  | `Arcane.session` | Namespace | Current Arcane session lifecycle. |
54
55
  | `Arcane.provisioning` | Namespace | Provisioning-plan operations. |
@@ -394,6 +395,37 @@ product-neutral reference.
394
395
 
395
396
  Terminal output and lifecycle changes are event-driven. The canonical [Arcane event inventory](arcane-events.md#event-inventory) defines `terminal.output`, `terminal.exit`, and the Android `terminal.error` payload. The shared `TerminalClient` adapter correlates those deliveries with owned sessions and re-emits DOM events for reusable UI code.
396
397
 
398
+ ## Native desktop notifications
399
+
400
+ These methods use the actual application's native window bridge. Windows source
401
+ support is pending selected native build and OS delivery verification. Direct
402
+ shared-Core listeners and other unimplemented host adapters are unavailable;
403
+ there is no browser or audio substitute. The [complete contract](../core-client.md#native-desktop-notifications)
404
+ defines records, cancellation, duplicate IDs, permission reporting and recovery.
405
+
406
+ | Method | Parameters | Return | Description |
407
+ | --- | --- | --- | --- |
408
+ | `Arcane.notifications.status(options?)` | `options`: standard `signal`, `timeoutMs`, `onRequest` request options | `Promise<{supported,available,permissionDisabled,reason?,error?}>` | Reports actual host support and permission state without changing preferences. Only an exact unavailable Core namespace is normalized, retaining its original complete error. |
409
+ | `Arcane.notifications.show(request, options?)` | `request`: `{id,title,body,data}`; `options`: standard request options | `Promise<NotificationRecord>` | Submits exact title/body and opaque JSON-compatible data for the application's stable ID. Native submission is distinct from visual display or human receipt; a reused ID rejects with the existing record. |
410
+ | `Arcane.notifications.state(selection?, options?)` | `selection`: `{id?}`, defaults to `{}`; `options`: standard request options | `Promise<{revision,notifications:NotificationRecord[]}>` | Returns complete retained records for the current host lifetime. Subscribe to `notifications.state` first and merge by revision. |
411
+ | `Arcane.notifications.close(selection, options?)` | `selection`: `{id}`; `options`: standard request options | `Promise<NotificationRecord>` | Removes the exact owned notice and retains its record; no implicit resend or replacement. |
412
+
413
+ `NotificationRecord` contains `{id,title,body,data,state,revision}` plus actual
414
+ timestamps, reasons and complete errors. `event` identifies the latest observed
415
+ event and `events` retains its ordered history; activation can race removal
416
+ without changing an already `closed` state. Accepted notices survive renderer
417
+ navigation. Terminal callbacks remain retained; timeout dismissal does not mean
418
+ Notification Center removal. Recipients, triggers, text, deduplication and
419
+ navigation belong to the application. Cross-process persistence and cold-start
420
+ activation are outside this contract.
421
+
422
+ Windows keeps a stable native identity per WebView profile so the OS retains
423
+ that profile's notification preferences. The SDK persists registration metadata
424
+ only; its notification text/data records remain in host memory. A second
425
+ simultaneous notifier for the same profile reports
426
+ `notification-owner-already-running`; distinct profiles remain independent.
427
+ Live COM ownership and notices drain at host shutdown.
428
+
397
429
  ## Platform, installation, users, and system
398
430
 
399
431
  | Method | Parameters | Return | Description |
@@ -26,6 +26,31 @@ Every subscription method returns an unsubscribe function. Call it when the owni
26
26
  | `terminal.exit` | Live, future-only terminal session notification. | Core-backed Arcane Terminal and Android Arcane Terminal hosts. | A terminal process exits and the host removes its session. | `sessionId` identifies the terminal session; `exitCode` is the process exit code when available; `signal` is the terminating signal name or `null`. |
27
27
  | `terminal.error` | Live, future-only terminal session notification. | Android Arcane Terminal hosts. | Android stops a session at its output limit or cannot read one of its output streams. | `sessionId` identifies the terminal session; `message` explains the output-limit or stream-reading failure. |
28
28
  | `appearance.changed` | Live, future-only host notification. | Microsoft NT WebView2 hosts. | The host observes an operating-system appearance change. | `scheme` is the configured host scheme; `effectiveScheme` is the resolved `dark` or `light` scheme; `source` is `windows`. |
29
+ | `notifications.state` | Live, future-only complete notification record; retained state is read separately. | SDK Windows application-window adapter; native build and OS delivery verification pending. Other unimplemented hosts and direct shared-Core listeners are unavailable. | An owned native notification changes submission, activation, dismissal, closure or failure state. | Complete `{id,title,body,data,state,revision}` record plus actual timestamps, reasons and errors. Caller `id` correlates the record; `revision` orders updates. Native submission is not a display or human-receipt acknowledgement. |
30
+
31
+ ### Recover native notification state
32
+
33
+ Subscribe to `notifications.state` before calling `Arcane.notifications.state()`
34
+ and merge each record by revision. The event is not a durable completion event
35
+ for `when()`. A later renderer reads the host's retained records, including
36
+ actual terminal outcomes; accepted notices survive navigation. Retire old-client
37
+ subscriptions and pending snapshots when the installed client changes.
38
+ The record's `event` names its latest observation and `events` retains complete
39
+ ordered history. A raced `event:'activated'` can accompany `state:'closed'`;
40
+ the application decides how to route that actual activation.
41
+
42
+ Windows profile identity/shortcut registration persists across launches to
43
+ preserve OS preferences; the SDK's notification text, data and event records
44
+ remain in host memory for the current lifetime. A second simultaneous notifier
45
+ for that profile is unavailable with `notification-owner-already-running`;
46
+ other profiles are independent. Shutdown drains owned notices and live COM
47
+ ownership.
48
+
49
+ `submitted` means native `Show` returned. Later failure remains possible, and a
50
+ timeout dismissal does not establish removal from Notification Center. Explicit
51
+ `Arcane.notifications.close({id})` removes the owned notice while retaining its
52
+ record. See the [complete notification contract](../core-client.md#native-desktop-notifications)
53
+ for cancellation, permissions, exact content and host-lifetime limits.
29
54
 
30
55
  ### Subscribe and clean up
31
56
 
@@ -284,6 +284,105 @@ forwards the app's computed `--background` and `--text-color` in native hosts.
284
284
  Applications using that owner need no duplicate theme listener. Ordinary
285
285
  browsers keep their CSS presentation without making a native request.
286
286
 
287
+ ## Native desktop notifications
288
+
289
+ `Arcane.notifications` uses the existing Core request transport to the actual
290
+ application window's native host. The Windows adapter is source implementation;
291
+ selected native build and actual OS delivery verification remain pending. A
292
+ matching published host is required for delivery. The portable facade is the
293
+ same on Windows, Linux and macOS, with Android requiring a host adapter; other
294
+ unimplemented hosts and direct shared-Core listener connections are unavailable.
295
+ Those listener connections bypass the window bridge. There is no browser
296
+ `Notification`, audio or simulated delivery substitute.
297
+
298
+ | Method | Parameters | Result |
299
+ | --- | --- | --- |
300
+ | `status(options?)` | Request options only | Actual native `supported`, `available` and `permissionDisabled`, with the host's reason/error when present |
301
+ | `show(request, options?)` | `{id,title,body,data}` | Complete notification record for the actual submission outcome |
302
+ | `state(selection = {}, options?)` | Optional `{id}` selects one owned ID; omission selects all retained records | `{revision,notifications:[complete records]}` |
303
+ | `close(selection, options?)` | `{id}` | Complete record after the exact owned notice's removal operation |
304
+
305
+ Every method accepts the standard `invoke` options `signal`, `timeoutMs` and
306
+ `onRequest({requestId})`. Requests, title/body strings and opaque JSON-compatible
307
+ `data` pass through unchanged. The application owns recipients, triggers, text,
308
+ deduplication and navigation. The OS controls presentation; preserving the
309
+ complete request does not establish that every character was visibly displayed.
310
+
311
+ `status()` changes no OS permissions or preferences. Only the exact Core error
312
+ `METHOD_NOT_ALLOWED` with `reason:'core-namespace-unavailable'` becomes
313
+ `{supported:false,available:false,permissionDisabled:null,
314
+ reason:'host-notifications-unavailable',error}`; `error` is the original complete
315
+ error and no platform is invented. All other invocation rejections propagate
316
+ unchanged. The native adapter can return an unavailable result with the complete
317
+ OS initialization or settings error. `permissionDisabled:null` means the permission state is
318
+ unknown. Use this status operation to discover the window adapter; Core's
319
+ service capability list does not describe host-intercepted notification methods.
320
+ Native `supported:null` means initialization could not establish OS support;
321
+ `available:false` retains its actual reason and complete error when supplied.
322
+
323
+ A retained record contains `{id,title,body,data,state,revision}` and the actual
324
+ timestamps, reasons and complete errors supplied by its owner. `submitted` means
325
+ the native `Show` call returned. It does not establish visible display or human
326
+ receipt. Later activation, dismissal and failure remain observable and retained.
327
+ A dismissal due to timeout does not establish removal from Notification Center.
328
+ Use `close({id})` for explicit OS removal. Closing retains the record; showing
329
+ the same caller ID again during this host lifetime rejects with its existing
330
+ record instead of resending or replacing it.
331
+ The top-level `event` names the latest observation, while `events` retains the
332
+ complete ordered history. An activation racing successful removal can report
333
+ `event:'activated'` with `state:'closed'`; the application owns action routing.
334
+
335
+ The live `notifications.state` event carries one complete updated record. It is
336
+ future-only. Subscribe before requesting the snapshot, then merge records by
337
+ their revisions so a delayed snapshot cannot overwrite a newer event:
338
+
339
+ ```js
340
+ const records = new Map();
341
+ function receiveNotification(record) {
342
+ const previous = records.get(record.id);
343
+ if (!previous || record.revision >= previous.revision) records.set(record.id, record);
344
+ }
345
+ const stop = Arcane.events.on('notifications.state', receiveNotification);
346
+ try {
347
+ const snapshot = await Arcane.notifications.state();
348
+ for (const record of snapshot.notifications) receiveNotification(record);
349
+ } catch (error) {
350
+ stop();
351
+ throw error;
352
+ }
353
+ // Call stop() when this observation ends; it does not remove native notices.
354
+ ```
355
+
356
+ When the installed Core client changes, detach the old event listener and ignore
357
+ its outstanding snapshot response. Recreate the records map for the new
358
+ client/host lifetime so an earlier host's revisions cannot suppress its records.
359
+ Subscribe and read the new client's snapshot
360
+ through [installation observation](#observe-installation-and-retirement).
361
+ Accepted notices and their records survive renderer navigation within the same
362
+ native host. There is no persisted cross-process recovery or cold-process
363
+ activation contract.
364
+
365
+ Windows reuses an SDK-created native identity and shortcut for the existing
366
+ WebView profile across launches, preserving that profile's OS notification
367
+ preferences. Its owned `AppUserModelId` registration stores the application's
368
+ display name, icon and live activator identity without changing notification
369
+ preferences or registering a cold-start launch command.
370
+ The SDK persists registration metadata only; its notification text
371
+ and data records remain in host memory. OS notification retention remains
372
+ platform-owned.
373
+ Distinct profiles have independent notification settings. One live notifier
374
+ owns a profile's COM activation registration; a second simultaneous host using
375
+ that profile reports `available:false` with
376
+ `reason:'notification-owner-already-running'` and may retry explicitly later.
377
+ Shutdown releases live COM ownership and owned notices while preserving the
378
+ identity registration for a later launch.
379
+
380
+ Cancellation observed before submission prevents that pending show from
381
+ submitting. After submission, request cancellation or renderer retirement cannot
382
+ reverse human interaction and does not remove the accepted notice; `close` is
383
+ explicit. Host shutdown drains owned operations, removes owned notices and
384
+ detaches callbacks, surfacing complete cleanup errors.
385
+
287
386
  ## Events and request lifetime
288
387
 
289
388
  `events.on(name, listener)`, `once(name, listener)` and
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sdkVersion": "0.91.0",
3
+ "sdkVersion": "0.92.0",
4
4
  "environment": {
5
5
  "runtime": "Node.js for Node entrypoints; browser for browser-only entrypoints",
6
6
  "minimumVersion": "22.23.2 for Node entrypoints",
7
7
  "moduleSystem": "ESM"
8
8
  },
9
- "memberCount": 308,
9
+ "memberCount": 314,
10
10
  "runtimeSubpathPatterns": {
11
11
  "arcane-os/modules/*": "./runtime/arcane/modules/*",
12
12
  "arcane-os/entities/*": "./runtime/arcane/entities/*"
@@ -166,6 +166,90 @@
166
166
  "protocol": "arcane/1 service definition",
167
167
  "normalization": "Binding identity equals the named createNativeDecisionService export"
168
168
  },
169
+ {
170
+ "id": "local-ai-kokoro:createNativeKokoroRuntime",
171
+ "name": "createNativeKokoroRuntime",
172
+ "displayName": "createNativeKokoroRuntime()",
173
+ "kind": "function",
174
+ "signature": "createNativeKokoroRuntime({onnx,modelAssets,runtime,prepare,modelId='kokoro',model=KOKORO_MODEL,revision=KOKORO_REVISION,dtype='fp32',paths,assetProjectionId,resourcePaths,sessionOptions,executionPreference='gpu',executionTarget,signal,onEvent}={})",
175
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
176
+ "primaryImport": "arcane-os/local-ai/kokoro",
177
+ "group": "Core native speech",
178
+ "summary": "Composes the selected Kokoro FP32 graph with the host's existing ONNX/model-resource owners and a persistent native phonemization/Opus helper.",
179
+ "availability": "Node with matching prepared helper/data and ONNX resources; SDK helper archive for Windows x64, other hosts require a matching custom helper distribution",
180
+ "protocol": "Replaying kokoro.state, retained ONNX activation and complete ordered native speech requests",
181
+ "normalization": "Returns current/subscribe/load/synthesize/unload/close; construction performs no preparation or inference. Explicit load selects a DBOPFS projection or complete native resource paths; synthesis retains complete ordered input, selected US/GB voice and 24kHz mono WAV or Ogg Opus output. Active cancellation joins owned helper/session retirement and preserves surviving queued work on the same configured provider; ONNX native interruption may wait for the current call. No alternate model, voice or provider retry is introduced. See native-speech.md for exact activation, selection and result contracts."
182
+ },
183
+ {
184
+ "id": "local-ai-kokoro:default",
185
+ "name": "default",
186
+ "displayName": "createNativeKokoroRuntime default export",
187
+ "kind": "function",
188
+ "signature": "default as createNativeKokoroRuntime",
189
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
190
+ "primaryImport": "arcane-os/local-ai/kokoro",
191
+ "group": "Core native speech",
192
+ "summary": "Default binding for the same native Kokoro engine factory.",
193
+ "availability": "Node with matching prepared native resources",
194
+ "protocol": "Native Kokoro engine lifecycle",
195
+ "normalization": "Binding identity equals the named createNativeKokoroRuntime export"
196
+ },
197
+ {
198
+ "id": "local-ai-kokoro:KOKORO_MODEL",
199
+ "name": "KOKORO_MODEL",
200
+ "displayName": "KOKORO_MODEL",
201
+ "kind": "constant",
202
+ "signature": "const KOKORO_MODEL",
203
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
204
+ "primaryImport": "arcane-os/local-ai/kokoro",
205
+ "group": "Core native speech",
206
+ "summary": "Identifies the Kokoro model implemented by the native frontend.",
207
+ "availability": "Node",
208
+ "protocol": "Native model selection",
209
+ "normalization": "Value is onnx-community/Kokoro-82M-v1.0-ONNX; constructor selection preserves this model's FP32 graph and resource contract"
210
+ },
211
+ {
212
+ "id": "local-ai-kokoro:KOKORO_REVISION",
213
+ "name": "KOKORO_REVISION",
214
+ "displayName": "KOKORO_REVISION",
215
+ "kind": "constant",
216
+ "signature": "const KOKORO_REVISION",
217
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
218
+ "primaryImport": "arcane-os/local-ai/kokoro",
219
+ "group": "Core native speech",
220
+ "summary": "Identifies the selected upstream Kokoro model revision.",
221
+ "availability": "Node",
222
+ "protocol": "Native model resource selection",
223
+ "normalization": "Value is 1939ad2a8e416c0acfeecc08a694d14ef25f2231; graph, tokenizer and voice resources use this same revision"
224
+ },
225
+ {
226
+ "id": "local-ai-kokoro:KOKORO_SAMPLE_RATE",
227
+ "name": "KOKORO_SAMPLE_RATE",
228
+ "displayName": "KOKORO_SAMPLE_RATE",
229
+ "kind": "constant",
230
+ "signature": "const KOKORO_SAMPLE_RATE",
231
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
232
+ "primaryImport": "arcane-os/local-ai/kokoro",
233
+ "group": "Core native speech",
234
+ "summary": "Native Kokoro PCM synthesis rate in samples per second.",
235
+ "availability": "Node",
236
+ "protocol": "Audio format",
237
+ "normalization": "Value is 24000; the selected output is mono WAV or Ogg Opus with the complete synthesized sample sequence"
238
+ },
239
+ {
240
+ "id": "local-ai-kokoro:KOKORO_VOICES",
241
+ "name": "KOKORO_VOICES",
242
+ "displayName": "KOKORO_VOICES",
243
+ "kind": "constant",
244
+ "signature": "const KOKORO_VOICES",
245
+ "entrypoints": ["arcane-os/local-ai/kokoro"],
246
+ "primaryImport": "arcane-os/local-ai/kokoro",
247
+ "group": "Core native speech",
248
+ "summary": "The 28 supported US and British English voice identifiers for the selected native Kokoro resources.",
249
+ "availability": "Node",
250
+ "protocol": "Native speech voice selection",
251
+ "normalization": "Complete ordered voice array exported by the frontend; af_heart is the omitted voice default. An unsupported explicit voice reports its actual incompatibility without substitution."
252
+ },
169
253
  {
170
254
  "id": "local-ai-whisper:createWhisperRuntime",
171
255
  "name": "createWhisperRuntime",
@@ -345,8 +429,8 @@
345
429
  "group": "Core native speech",
346
430
  "summary": "Composes host-supplied transcription and synthesis engines with independent loading and role readiness.",
347
431
  "availability": "Node Core with explicitly supplied engines; engine platform, model and format support remain engine-owned",
348
- "protocol": "arcane/1 speech.status/transcribe/synthesize with speech.state/progress",
349
- "normalization": "Returns current/subscribe/close/start/methods/drain/dispose; forwards complete requests and results unchanged; replaying service state, synchronous accepted Thinking, combined request/lifetime cancellation and concurrent joined engine shutdown; no engine installation or automatic provider selection"
432
+ "protocol": "arcane/1 speech.status/load/unload/transcribe/synthesize with speech.state/progress",
433
+ "normalization": "Returns current/subscribe/close/start/methods/drain/dispose; forwards complete requests and results unchanged; replaying service state, synchronous accepted Thinking, combined request/lifetime cancellation and concurrent joined engine shutdown. Explicit load/unload require role stt or tts and forward the remaining activation fields and complete result through that role's configured engine; supported preparation remains with that engine. Startup waiting is independently owned from caller cancellation; no automatic provider selection is introduced."
350
434
  },
351
435
  {
352
436
  "id": "core-speech:default",
@@ -609,10 +693,10 @@
609
693
  "entrypoints": ["arcane-os/local-ai"],
610
694
  "primaryImport": "arcane-os/local-ai",
611
695
  "group": "Core local AI",
612
- "summary": "Reuses selected managed native runtimes or installs complete llama.cpp/Ollama/image distributions, ONNX npm runtime trees with selected SDK native libraries, or NeMo libraries.",
696
+ "summary": "Reuses selected managed native runtimes or installs complete llama.cpp/Ollama/image distributions, ONNX npm runtime trees with selected SDK native libraries, NeMo libraries, or Kokoro native helper/data trees.",
613
697
  "availability": "Node; selected distribution platform and architecture assets determine runtime availability",
614
698
  "protocol": "Upstream release archives and selected ONNX/Koffi npm installations; corrected Windows x64 ONNX native libraries from the installed SDK numeric release",
615
- "normalization": "Returns absolute runtime records, including image library/binding/variant/model metadata; Windows x64 ONNX with no explicit URL and omitted version or 1.30.0 adds nativeDistributionRevision 1.30.0-directml-reshape-1, reuses that revision or prepares a fresh installation while preserving older trees; explicit URLs and other ONNX versions/platforms retain their upstream package path; shares matching installs, preserves libraries, reports failures without changing global PATH or services and prepares no model files"
699
+ "normalization": "Returns absolute runtime records, including image library/binding/variant/model metadata; Windows x64 ONNX with no explicit URL and omitted version or 1.30.0 adds nativeDistributionRevision 1.30.0-directml-reshape-1, reuses that revision or prepares a fresh installation while preserving older trees; explicit URLs and other ONNX versions/platforms retain their upstream package path; shares matching installs, preserves libraries, reports failures without changing global PATH or services and prepares no model files. Kokoro returns helperExecutable, espeakDataDirectory and libraryDirectory for the complete selected helper tree; Windows x64 defaults to the installed SDK numeric release, while explicit url/helperRoot supplies another prepared distribution and preserves model/ONNX ownership."
616
700
  },
617
701
  {
618
702
  "id": "local-ai:bundleLocalAIRuntimes",
@@ -626,7 +710,7 @@
626
710
  "summary": "Copies selected complete runtime distributions into a fresh native artifact staging root.",
627
711
  "availability": "Node; supports bundling selected published platform assets independently of the build host",
628
712
  "protocol": "Artifact-relative runtime/local-ai layout",
629
- "normalization": "Returns {runtimes,files} with artifact-relative runtime/variant paths and complete inventory; corrected Windows x64 ONNX retains nativeDistributionRevision and complete native libraries while modulePath becomes artifact-relative; image URL descriptors remain for post-launch preparation and external model working paths report portability incompatibility"
713
+ "normalization": "Returns {runtimes,files} with artifact-relative runtime/variant paths and complete inventory; corrected Windows x64 ONNX retains nativeDistributionRevision and complete native libraries while modulePath becomes artifact-relative; image URL descriptors remain for post-launch preparation and external model working paths report portability incompatibility. Kokoro retains the complete helper/data tree and relocates helperExecutable, espeakDataDirectory and libraryDirectory; ONNX and model resources retain their separate owners."
630
714
  },
631
715
  {
632
716
  "id": "root:WS",
@@ -4122,7 +4206,7 @@
4122
4206
  "summary": "Sends one complete TWiN Cloud request with an explicit caller-owned key and model.",
4123
4207
  "availability": "Node and Browser; remote HTTPS provider",
4124
4208
  "protocol": "TWiN Cloud complete-response chat",
4125
- "normalization": "Preserves complete messages and parsed provider JSON; maps explicit structured-output, tool, and reasoning options; shares overload-only HTTP 429 retry after 3000 ms and cancellation; retains no browser profile, storage, or request history"
4209
+ "normalization": "Preserves complete messages and provider JSON; Fetch rejection and all HTTP 429/529 share three retries; quota recovery honors Retry-After or exponential delay with transient same-endpoint/credential pacing, complete terminal errors and cancellation; retains no browser profile, storage, or history"
4126
4210
  },
4127
4211
  {
4128
4212
  "id": "twin-cloud:fetchSystemOneRequest",
@@ -4171,21 +4255,21 @@
4171
4255
  "name": "fetchHTTPResponse",
4172
4256
  "displayName": "fetchHTTPResponse()",
4173
4257
  "kind": "function",
4174
- "signature": "async fetchHTTPResponse(url,options)",
4258
+ "signature": "async fetchHTTPResponse(url,options,{onRetry=null}={})",
4175
4259
  "entrypoints": ["arcane-os/ai/twin-cloud"],
4176
4260
  "primaryImport": "arcane-os/ai/twin-cloud",
4177
4261
  "group": "Shared AI transport integration",
4178
4262
  "summary": "Returns a successful unconsumed Fetch Response through the shared AI HTTP owner.",
4179
4263
  "availability": "Node and Browser",
4180
4264
  "protocol": "Shared AI HTTP transport",
4181
- "normalization": "Preserves caller Fetch options and complete error bodies; repeats only overload HTTP 429 after 3000 ms; signal cancellation uses ARCANE_AI_REQUEST_ABORTED"
4265
+ "normalization": "Preserves caller Fetch options and complete errors; Fetch rejection and all HTTP 429/529 share three retries; Retry-After or exponential quota delay and transient same-endpoint/credential pacing remain abortable; onRetry observes waiting/requesting; cancellation uses ARCANE_AI_REQUEST_ABORTED"
4182
4266
  },
4183
4267
  {
4184
4268
  "id": "twin-cloud:fetchJSONResponse",
4185
4269
  "name": "fetchJSONResponse",
4186
4270
  "displayName": "fetchJSONResponse()",
4187
4271
  "kind": "function",
4188
- "signature": "async fetchJSONResponse(url,options)",
4272
+ "signature": "async fetchJSONResponse(url,options,{onRetry=null}={})",
4189
4273
  "entrypoints": ["arcane-os/ai/twin-cloud"],
4190
4274
  "primaryImport": "arcane-os/ai/twin-cloud",
4191
4275
  "group": "Shared AI transport integration",
@@ -4304,7 +4388,7 @@
4304
4388
  "summary": "Describes existing Core method input, output and semantic shapes.",
4305
4389
  "availability": "Node and browser/bundler",
4306
4390
  "protocol": "arcane/1 method descriptions",
4307
- "normalization": "Descriptive data only, including independent localai.devices inventory and localai.resolveTarget physical-selection records; presence does not establish engine support or observed execution. The active host and its registered services remain the authority for method availability"
4391
+ "normalization": "Descriptive data only, including independent localai.devices inventory and localai.resolveTarget physical-selection records; presence does not establish engine support or observed execution. Native notifications.status/show/state/close describe actual host support, exact caller content, retained host-lifetime outcomes and explicit owned removal; native submission does not establish display or human receipt. The active host and its registered services remain the authority for method availability"
4308
4392
  },
4309
4393
  {
4310
4394
  "id": "core-contracts:CoreError",
@@ -4360,7 +4444,7 @@
4360
4444
  "summary": "Projects a Core client into the established application-facing Arcane namespace.",
4361
4445
  "availability": "Browser and native WebView JavaScript hosts with a Core client",
4362
4446
  "protocol": "arcane/1 compatibility facade",
4363
- "normalization": "Routes namespace methods through client.invoke while retaining operation-specific parameters, correlation, streaming callbacks, timeouts and cancellation; window.state({signal}?) reads the requesting window and window.setState({state},{signal}?) selects normal, maximized or fullscreen. The matching Windows host returns {platform:'windows',supported:true,state}, including observed minimized state, restores normal bounds/frame controls on leaving fullscreen and prevents activation/focus assignment during visible state transitions without changing TopMost, Core, origin or profile. Saved Settings remain application-owned; cancellation does not undo an applied change and unavailable hosts retain their actual errors without fallback. window.setTheme(presentation,{signal}?) forwards the complete per-window backgroundColor/textColor record, with omitted fields unchanged and null reset, and returns the host's actual applied/unsupported result without changing system appearance"
4447
+ "normalization": "Routes namespace methods through client.invoke while retaining operation-specific parameters, correlation, streaming callbacks, timeouts and cancellation; window.state({signal}?) reads the requesting window and window.setState({state},{signal}?) selects normal, maximized or fullscreen. The matching Windows host returns {platform:'windows',supported:true,state}, including observed minimized state, restores normal bounds/frame controls on leaving fullscreen and prevents activation/focus assignment during visible state transitions without changing TopMost, Core, origin or profile. Saved Settings remain application-owned; cancellation does not undo an applied change and unavailable hosts retain their actual errors without fallback. window.setTheme(presentation,{signal}?) forwards the complete per-window backgroundColor/textColor record, with omitted fields unchanged and null reset, and returns the host's actual applied/unsupported result without changing system appearance. notifications.status/show/state/close forward complete caller requests and standard invoke options; status normalizes only METHOD_NOT_ALLOWED with core-namespace-unavailable while retaining the complete original error. Matching native window hosts retain complete notification records and ordered revisions across renderer navigation, with notifications.state events and subscribe-before-snapshot recovery. Submitted means native Show returned, not displayed or read; cancellation after submission does not remove an accepted notice, and explicit close retains its record. Recipient, text, trigger, deduplication and navigation policy remains application-owned. speech.load(request,options) and speech.unload(request,options) forward complete activation requests, cancellation and request observers with no elapsed-time cutoff; selected engines own preparation and native retirement."
4364
4448
  },
4365
4449
  {
4366
4450
  "id": "core-client:installCoreClient",
@@ -1,13 +1,16 @@
1
1
  # Local AI through Core
2
2
 
3
3
  Core owns native llama.cpp and Ollama processes, ONNX worker sessions,
4
- selected local image generation and retained Whisper transcription. The browser retains its own
4
+ selected local image generation, retained Whisper transcription and native
5
+ Kokoro synthesis. The browser retains its own
5
6
  Wllama and ONNX implementations, and can also use an explicitly connected Core
6
7
  when that system service is available. Runtime installation, model loading and
7
8
  inference are separate operations.
8
9
 
9
10
  Native ONNX runs caller-selected graphs with complete named input/output tensors.
10
- Applications own preprocessing, tokenization and model-specific pipelines.
11
+ Applications own preprocessing, tokenization and model-specific pipelines unless
12
+ they explicitly select an SDK engine such as native Kokoro, which owns its
13
+ versioned speech frontend.
11
14
  Browser ONNX continues through its existing browser implementation.
12
15
 
13
16
  ## Application requirements
@@ -113,6 +116,71 @@ the SDK does not guess a companion location. Installation records distinguish
113
116
  the distribution's `backend` from its `requestedBackend` execution mode.
114
117
  Selecting an unavailable distribution reports its actual error.
115
118
 
119
+ ### Native Kokoro selection
120
+
121
+ Select both the existing ONNX runtime and the native speech helper:
122
+
123
+ ```json
124
+ {
125
+ "runtimes": [
126
+ {"id": "onnx"},
127
+ {"id": "kokoro-native", "modelId": "kokoro"}
128
+ ]
129
+ }
130
+ ```
131
+
132
+ `kokoro-native` is the installable helper ID, `kokoro-onnx` is the speech
133
+ provider ID, and `kokoro` is the default model alias. The requirement also
134
+ preserves `model`, `revision`, `dtype`, prepared `paths`, `assetProjectionId`,
135
+ `resourcePaths`, `sessionOptions`, `executionPreference` and `executionTarget`
136
+ for the engine. The implemented model/revision, complete resource mapping,
137
+ voices, synthesis formats and cancellation contract are in
138
+ [native speech](native-speech.md#native-kokoro-engine).
139
+
140
+ With no `helperRoot` or `url`, Windows x64 preparation selects
141
+ `arcane-kokoro-windows-x64.tar.gz` from the installed SDK's numeric release:
142
+ `https://github.com/TheWizardNexus/arcane-os-sdk/releases/download/<sdk-version>/arcane-kokoro-windows-x64.tar.gz`.
143
+ That SDK version selects the default helper release; an authored runtime
144
+ `version` alone does not select another SDK release's helper.
145
+ An explicit `url` selects a complete platform-matching archive, with optional
146
+ `version` metadata. Alternatively, `helperRoot` supplies an already prepared
147
+ complete tree copied into the new installation. Select one of these sources.
148
+ Linux and macOS currently require that explicit archive or prepared tree;
149
+ the native CMake source is available, with no claim of an exercised helper
150
+ build on those platforms.
151
+
152
+ The helper record accepts `helperExecutable`, `espeakDataDirectory` and
153
+ `libraryDirectory` overrides within the selected tree. Defaults are
154
+ `bin/arcane-kokoro.exe` on Windows (`bin/arcane-kokoro` elsewhere), `share`, and
155
+ `bin`. The data field identifies the parent containing `espeak-ng-data`.
156
+ Overrides are relative to the selected tree or absolute locations inside
157
+ `helperRoot`; all three paths relocate with that complete tree. Installation
158
+ prepares the helper and its matching data, independently of ONNX and without
159
+ downloading model weights, tokenizer files or voices.
160
+
161
+ Development and generated native composition register this engine as the TTS
162
+ role of `createSpeechService`, sharing the existing model-assets service and
163
+ the selected local-ai ONNX owner. Whisper, when selected, retains the separate
164
+ STT role and device choice. Construction and no-assets startup leave Kokoro
165
+ unloaded without helper preparation. An explicit activation with prepared
166
+ resources acquires the helper in development and waits only for that existing
167
+ ONNX owner. Native packaging has already bundled the helper. These waits stay
168
+ inside speech activation; page rendering and independent services continue.
169
+ Omitting the explicit `onnx` requirement reports unavailability on activation.
170
+ After an explicit `localai.services.recover({runtimes: ['onnx']})` completes,
171
+ the next explicit `speech.load({role: 'tts', ...selection})` reacquires the
172
+ current ONNX owner through existing preparation, after prior activation cleanup.
173
+
174
+ For saved browser assets, prepare the complete projection through the existing
175
+ [`model-assets` owner](model-assets.md), then call
176
+ `Arcane.speech.load({role: 'tts', modelId: 'kokoro', assetProjectionId,
177
+ resourcePaths, executionTarget}, {signal})`. Core retains the incoming
178
+ projection before replacing its activation and releases it only after native
179
+ exit. Preparing/loading a model remains separate from installing the helper.
180
+ Raw constructor `paths` are caller-prepared native paths; portable assembly
181
+ does not turn external model paths or a prior process's projection ID into
182
+ packaged resources. Prepare the intended model resources at their actual host.
183
+
116
184
  ## Development
117
185
 
118
186
  ```sh
@@ -125,6 +193,8 @@ configuration. Subsequent `arcane dev` runs reuse the saved requirements.
125
193
  application selects its `models` in the runtime record before requesting a
126
194
  load or generation. The development owner composes separate image and
127
195
  model-assets services alongside the existing chat/ONNX service.
196
+ `--local-ai onnx,kokoro-native` records the native TTS requirements above;
197
+ its model activation remains explicit when no assets are configured.
128
198
  Development checks selected endpoints and existing executable paths, then
129
199
  installs missing runtimes under the application's `.arcane/local-ai/runtimes`.
130
200
  Runtime preparation runs alongside HTTP serving. Browser rendering continues
@@ -174,8 +244,8 @@ processes. An already running external service remains running.
174
244
  handle with `ready`, `current()`, `handler()` and `close()`. Its `ready` promise
175
245
  means Core composition has started, not that installation or a selected model
176
246
  is ready. Runtime preparation continues at each owning service. `current()`
177
- includes separate `core`, `localAI` and optional `image` state; image status
178
- remains callable during preparation. Composition failures reject `ready`;
247
+ includes separate `core`, `localAI` and optional `image` and `speech` state;
248
+ image status remains callable during preparation. Composition failures reject `ready`;
179
249
  later service preparation failures remain on Core lifecycle and diagnostic
180
250
  events. Page rendering waits for neither.
181
251
 
@@ -227,7 +297,8 @@ owner; it neither prepares another runtime nor loads a model. An unselected
227
297
  engine reports `LOCAL_AI_RUNTIME_NOT_SELECTED`; an unavailable or recovering
228
298
  owner reports `LOCAL_AI_RUNTIME_UNAVAILABLE`, and an aborted service lifetime
229
299
  retains its abort reason. Development and generated native compositions register
230
- one shared model-assets service when ONNX or image generation is selected.
300
+ one shared model-assets service when ONNX, llama.cpp, image generation or
301
+ native Kokoro is selected.
231
302
 
232
303
  Reacquire `getONNXRuntime()` on each explicit model load because runtime recovery
233
304
  replaces that owner. Retain the acquired handle for that session's cleanup and
@@ -757,6 +828,11 @@ retains that metadata with the complete native libraries. Image records include
757
828
  `libraryPath`,
758
829
  `bindingModulePath`, requested `backend`, installed `variants` and selected
759
830
  `models` metadata. Variant records carry backend, runtime root and library path.
831
+ Kokoro records include `helperExecutable`, `espeakDataDirectory` and
832
+ `libraryDirectory`; bundling preserves the complete helper tree under
833
+ `runtime/local-ai/kokoro-native` and makes all three paths artifact-relative.
834
+ The generated entry resolves them on the destination host and obtains the
835
+ existing ONNX owner when the selected TTS activation needs it.
760
836
  Bundle returns `{runtimes,files}`,
761
837
  with artifact-relative runtime paths and a complete emitted file inventory.
762
838
  Bundling requires a fresh native staging destination, preserving existing