arcane-os 0.5.16 → 0.5.18

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 (190) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +42 -19
  3. package/bin/arcane-test.mjs +16 -13
  4. package/browser-runtime/ai/browser-speech-artifacts.mjs +41 -38
  5. package/browser-runtime/ai/browser-speech-providers.mjs +53 -46
  6. package/browser-runtime/ai/browser-wasm-llm-provider.mjs +127 -124
  7. package/browser-runtime/ai/browser-wasm.mjs +6 -3
  8. package/browser-runtime/ai/browser-wllama-runtime.mjs +26 -23
  9. package/browser-runtime/ai/model-controller.mjs +94 -91
  10. package/browser-runtime/ai/speech-worker-client.mjs +12 -9
  11. package/browser-runtime/ai/speech-worker-runtime.mjs +56 -53
  12. package/browser-runtime/dependencies/strong-type/index.js +207 -82
  13. package/browser-runtime/dependencies/strong-type/package.json +15 -6
  14. package/browser-runtime/dom-event-instrumentation.mjs +24 -20
  15. package/browser-runtime/event-manager.mjs +111 -108
  16. package/browser-runtime/speech-text.mjs +35 -0
  17. package/docs/architecture.md +1 -1
  18. package/docs/reference/README.md +8 -8
  19. package/docs/reference/ai/browser-speech.md +230 -16
  20. package/docs/reference/ai/twin-cloud.md +1 -1
  21. package/docs/reference/availability-and-normalization.md +42 -1
  22. package/docs/reference/cli.md +1 -1
  23. package/docs/reference/core/arcane-ai-contracts.md +1 -1
  24. package/docs/reference/inventory/package-api.json +60 -4
  25. package/docs/reference/inventory/runtime-components.json +2 -2
  26. package/docs/reference/inventory/runtime-modules.json +29 -31
  27. package/docs/reference/protocols.md +17 -13
  28. package/docs/reference/runtime-components.md +6 -5
  29. package/docs/reference/runtime-modules.md +212 -70
  30. package/docs/reference/sdk-api.md +197 -11
  31. package/examples/wasm-ai-demo/index.html +1 -0
  32. package/node_modules/event-pubsub/node_modules/strong-type/README.md +408 -0
  33. package/node_modules/event-pubsub/node_modules/strong-type/assets/strong-type-header.png +0 -0
  34. package/node_modules/event-pubsub/node_modules/strong-type/index.js +1151 -0
  35. package/node_modules/event-pubsub/node_modules/strong-type/licence +21 -0
  36. package/node_modules/event-pubsub/node_modules/strong-type/node.js +125 -0
  37. package/node_modules/event-pubsub/node_modules/strong-type/package.json +61 -0
  38. package/node_modules/strong-type/README.md +42 -24
  39. package/node_modules/strong-type/benchmark/core.js +324 -0
  40. package/node_modules/strong-type/index.js +207 -82
  41. package/node_modules/strong-type/package.json +14 -6
  42. package/package.json +4 -3
  43. package/runtime/arcane/components/app-bar.html +5 -2
  44. package/runtime/arcane/components/assistant-panel.html +5 -2
  45. package/runtime/arcane/components/chart.html +15 -12
  46. package/runtime/arcane/components/chat.html +118 -141
  47. package/runtime/arcane/components/dashboard-config.html +6 -3
  48. package/runtime/arcane/components/data-view.html +4 -1
  49. package/runtime/arcane/components/directory-picker.html +5 -2
  50. package/runtime/arcane/components/document-inspector.html +6 -3
  51. package/runtime/arcane/components/file-drop.html +5 -2
  52. package/runtime/arcane/components/file-inspector.html +9 -6
  53. package/runtime/arcane/components/file-manager.html +16 -13
  54. package/runtime/arcane/components/local-ai-status.html +5 -2
  55. package/runtime/arcane/components/markdown-document.html +14 -11
  56. package/runtime/arcane/components/markdown-editor.html +4 -1
  57. package/runtime/arcane/components/modal.html +4 -1
  58. package/runtime/arcane/components/output-panel.html +6 -3
  59. package/runtime/arcane/components/preferences-form.html +4 -1
  60. package/runtime/arcane/components/record-timeline.html +8 -5
  61. package/runtime/arcane/components/relationship-board.html +9 -6
  62. package/runtime/arcane/components/source-code-viewer.html +12 -9
  63. package/runtime/arcane/components/source-explanation.html +8 -5
  64. package/runtime/arcane/components/speech.html +24 -21
  65. package/runtime/arcane/components/summary-strip.html +4 -1
  66. package/runtime/arcane/components/task-progress.html +6 -3
  67. package/runtime/arcane/components/terminal-workspace.html +4 -1
  68. package/runtime/arcane/components/voice-transcription.html +11 -8
  69. package/runtime/arcane/components/web-navigator.html +5 -2
  70. package/runtime/arcane/entities/ApiModelRecord.js +5 -2
  71. package/runtime/arcane/entities/Calculation.js +5 -2
  72. package/runtime/arcane/entities/Chat.js +33 -33
  73. package/runtime/arcane/entities/CommunicationMessage.js +4 -1
  74. package/runtime/arcane/entities/CommunicationThread.js +4 -1
  75. package/runtime/arcane/entities/File.js +1 -1
  76. package/runtime/arcane/entities/Image.js +8 -5
  77. package/runtime/arcane/entities/IntentEnvelope.js +20 -17
  78. package/runtime/arcane/entities/Preference.js +9 -6
  79. package/runtime/arcane/entities/Theme.js +5 -2
  80. package/runtime/arcane/entities/User.js +11 -11
  81. package/runtime/arcane/entities/Weather.js +5 -2
  82. package/runtime/arcane/modules/AI.js +503 -187
  83. package/runtime/arcane/modules/AIPreferenceRuntime.js +5 -2
  84. package/runtime/arcane/modules/AIPreferenceTuple.js +9 -6
  85. package/runtime/arcane/modules/AIProviderRuntime.js +117 -92
  86. package/runtime/arcane/modules/AIResponseURLPolicy.js +148 -62
  87. package/runtime/arcane/modules/AIRuntimeState.js +29 -26
  88. package/runtime/arcane/modules/AnsiText.js +4 -1
  89. package/runtime/arcane/modules/ApiModelDatabase.js +22 -19
  90. package/runtime/arcane/modules/AppDataScope.js +8 -5
  91. package/runtime/arcane/modules/ArcaneCommunicationBridge.js +4 -1
  92. package/runtime/arcane/modules/ArcaneNavigationPolicy.js +8 -5
  93. package/runtime/arcane/modules/ArcaneNetworkPolicy.js +18 -15
  94. package/runtime/arcane/modules/AsyncBoundary.js +13 -10
  95. package/runtime/arcane/modules/BrowserTestSuite.js +19 -16
  96. package/runtime/arcane/modules/CalculatorEngine.js +5 -2
  97. package/runtime/arcane/modules/ChatRecords.js +18 -15
  98. package/runtime/arcane/modules/CommunicationAppController.js +9 -6
  99. package/runtime/arcane/modules/CommunicationHub.js +9 -6
  100. package/runtime/arcane/modules/CommunicationPreferences.js +4 -1
  101. package/runtime/arcane/modules/CommunicationProviderRegistry.js +4 -1
  102. package/runtime/arcane/modules/ComponentContracts.js +56 -53
  103. package/runtime/arcane/modules/ConfiguredAIChatSession.js +30 -27
  104. package/runtime/arcane/modules/ConversationActionItems.js +15 -12
  105. package/runtime/arcane/modules/ConversationClosingReport.js +11 -8
  106. package/runtime/arcane/modules/ConversationTimebox.js +28 -25
  107. package/runtime/arcane/modules/CoreLocalModelCatalog.js +17 -14
  108. package/runtime/arcane/modules/DBLS.js +7 -4
  109. package/runtime/arcane/modules/DBOPFS.js +7 -7
  110. package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +34 -31
  111. package/runtime/arcane/modules/DevelopmentWorkspace.js +4 -1
  112. package/runtime/arcane/modules/DirectoryPicker.js +8 -5
  113. package/runtime/arcane/modules/DocumentLexicalSearch.js +11 -8
  114. package/runtime/arcane/modules/DocumentNavigation.js +7 -4
  115. package/runtime/arcane/modules/Errors.js +28 -25
  116. package/runtime/arcane/modules/HTMLImport.js +7 -4
  117. package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +15 -12
  118. package/runtime/arcane/modules/LocalAIReadiness.js +21 -18
  119. package/runtime/arcane/modules/LocalAIReadinessController.js +6 -3
  120. package/runtime/arcane/modules/MD.js +1 -1
  121. package/runtime/arcane/modules/Mail.js +46 -43
  122. package/runtime/arcane/modules/MailOutbox.mjs +48 -45
  123. package/runtime/arcane/modules/MailTransport.mjs +29 -26
  124. package/runtime/arcane/modules/MarkdownSpeech.js +1 -50
  125. package/runtime/arcane/modules/MemoryRecords.js +7 -4
  126. package/runtime/arcane/modules/MessageAdvisory.js +6 -3
  127. package/runtime/arcane/modules/ModelDefinition.js +7 -4
  128. package/runtime/arcane/modules/Ollama.js +6 -3
  129. package/runtime/arcane/modules/OllamaModelIdentifier.js +4 -1
  130. package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +18 -15
  131. package/runtime/arcane/modules/PersistentAIChatSession.js +33 -30
  132. package/runtime/arcane/modules/PreferenceStore.js +20 -17
  133. package/runtime/arcane/modules/PreparedSpeech.js +485 -0
  134. package/runtime/arcane/modules/Questionnaire.js +6 -3
  135. package/runtime/arcane/modules/RecordLinkIndex.js +4 -1
  136. package/runtime/arcane/modules/RecordPassageIndex.js +9 -6
  137. package/runtime/arcane/modules/RecordReviewStore.js +12 -9
  138. package/runtime/arcane/modules/RiskSignalAnalyzer.js +4 -1
  139. package/runtime/arcane/modules/ScopedOPFSCache.js +6 -3
  140. package/runtime/arcane/modules/ScreenCapture.js +20 -17
  141. package/runtime/arcane/modules/SpeechPlayback.js +61 -28
  142. package/runtime/arcane/modules/StaticDocumentCatalog.js +33 -30
  143. package/runtime/arcane/modules/SystemAppearance.js +5 -2
  144. package/runtime/arcane/modules/SystemToolRegistry.js +6 -3
  145. package/runtime/arcane/modules/TerminalClient.js +14 -11
  146. package/runtime/arcane/modules/TerminalCommandRegistry.js +4 -1
  147. package/runtime/arcane/modules/ThemeBootstrap.js +9 -6
  148. package/runtime/arcane/modules/ThemeManager.js +5 -2
  149. package/runtime/arcane/modules/TimeGuard.js +1 -1
  150. package/runtime/arcane/modules/ToolCallRouter.js +11 -8
  151. package/runtime/arcane/modules/WaitForComponent.js +19 -16
  152. package/runtime/arcane/modules/YouTubeMedia.js +4 -1
  153. package/runtime/strong-type/index.js +1276 -352
  154. package/runtime/strong-type/package.json +69 -45
  155. package/src/app-descriptor.mjs +17 -14
  156. package/src/application-tests.mjs +4 -1
  157. package/src/cli/main.mjs +8 -5
  158. package/src/constants.mjs +4 -1
  159. package/src/dev-server.mjs +8 -5
  160. package/src/doctor.mjs +5 -2
  161. package/src/dom-event-instrumentation.mjs +24 -20
  162. package/src/errors.mjs +7 -3
  163. package/src/event-manager.mjs +111 -108
  164. package/src/event-queue.mjs +8 -5
  165. package/src/events.mjs +12 -9
  166. package/src/import-map.mjs +36 -27
  167. package/src/installed-sdk-runtime.mjs +4 -1
  168. package/src/integrated-provider-loader.mjs +9 -6
  169. package/src/mail-credentials.mjs +16 -13
  170. package/src/mail-server.mjs +53 -50
  171. package/src/mail.mjs +18 -15
  172. package/src/native-plan.mjs +12 -9
  173. package/src/native-provider-loader.mjs +7 -4
  174. package/src/packager/core.mjs +18 -15
  175. package/src/process.mjs +6 -3
  176. package/src/release-bundle.mjs +14 -11
  177. package/src/runtime.mjs +4 -1
  178. package/src/scaffold.mjs +9 -6
  179. package/src/sdk-browser-runtime.mjs +4 -1
  180. package/src/source-server.mjs +17 -14
  181. package/src/targets/index.mjs +5 -2
  182. package/src/templates/workspace-template.mjs +13 -6
  183. package/src/testing-loader.mjs +7 -4
  184. package/src/testing.mjs +10 -7
  185. package/src/toolchain.mjs +13 -10
  186. package/src/update-check.mjs +9 -6
  187. package/src/workspace-operation-lock.mjs +14 -11
  188. package/src/workspace-runtime.mjs +4 -1
  189. package/src/workspace.mjs +17 -14
  190. package/runtime/arcane/modules/AIResponseLength.js +0 -32
@@ -1,8 +1,9 @@
1
1
  # Arcane OS SDK JavaScript API
2
2
 
3
3
  The npm package exposes a Node.js ESM control plane, the portable
4
- `arcane-os/event-manager`, `arcane-os/logging`, `arcane-os/mail`, `arcane-os/preference-store`, and
5
- `arcane-os/speech-playback` entrypoints, and the browser-only
4
+ `arcane-os/event-manager`, `arcane-os/logging`, `arcane-os/mail`,
5
+ `arcane-os/preference-store`, `arcane-os/speech-playback`, and
6
+ `arcane-os/speech-text` entrypoints, and the browser-only
6
7
  `arcane-os/ai/browser-wasm` and `arcane-os/ai/browser-speech` entrypoints.
7
8
  Those package subpaths are distinct from application-facing projection modules
8
9
  in the managed browser map, such as `arcane/AIProviderRuntime`,
@@ -18,7 +19,7 @@ This table is the Node `package.json#exports` map: it defines package
18
19
  entrypoints for SDK/tooling code. It is distinct from the generated browser
19
20
  import map that resolves application-facing `arcane/*` modules and the focused
20
21
  EventManager entry. See [browser runtime delivery](protocols.md#browser-runtime-delivery)
21
- for the installed-inventory-derived physical-runtime contract in SDK `0.5.16`.
22
+ for the installed-inventory-derived physical-runtime contract in SDK `0.5.18`.
22
23
 
23
24
  | Specifier | Purpose |
24
25
  | --- | --- |
@@ -36,12 +37,29 @@ for the installed-inventory-derived physical-runtime contract in SDK `0.5.16`.
36
37
  | `arcane-os/logging` | Shared console diagnostics controlled by the existing `user.developer` preference. |
37
38
  | `arcane-os/preference-store` | Portable preference records and injected storage adapters. |
38
39
  | `arcane-os/speech-playback` | Portable speech preparation, playback state, and injected media adapters. |
40
+ | `arcane-os/speech-text` | Speech-input formatting cleanup for complete text and streamed chunks. |
39
41
  | `arcane-os/ai/browser-wasm` | Caller-selected browser-local Wllama inference, complete DBOPFS model storage, streaming, cancellation, and structural tool-call results. |
40
42
  | `arcane-os/ai/browser-speech` | Caller-selected browser-local Whisper STT and Kokoro TTS provider mechanisms, ordinary upstream assets, materialized/native routing, Workers, and cancellation. |
41
43
  | `arcane-os/mail` | Portable Mail runtime, durable outbox, complete transport responses, and provider-neutral acceptance contracts. |
42
44
 
43
45
  Eight JSON schemas and `package.json` are data-only export subpaths. In Node ESM, import JSON with `with {type: 'json'}`, or resolve and read it explicitly.
44
46
 
47
+ ### Managed AI narration
48
+
49
+ Applications import `AI` through `arcane/AI` in the managed browser map.
50
+ `ai.prepareTTS({parts,storage,identity,signal,onState})` prepares complete
51
+ punctuation segments without playing them and optionally saves/reuses their
52
+ audio through application-owned DBOPFS. Its immediate handle exposes ordered
53
+ segments, preparation state, `ready`, `getAudio(index)`, and `cancel()`.
54
+ `ai.playPreparedTTS(prepared,{signal,onState})` attaches ordered playback and
55
+ returns `state`, `error`, `finished`, `pause()`, `resume()`, and `stop()`.
56
+ Each AI has one playback lane; replacing playback preserves independent
57
+ preparation. Fully cached replay does not load the speech
58
+ model. See [prepared narration](ai/browser-speech.md#prepare-narration-once-and-replay-stored-audio)
59
+ for complete inputs, storage ownership, progress, errors, and cancellation,
60
+ and [AI.js](runtime-modules.md#aijs) for the managed runtime contract.
61
+ These are AI instance methods, not new npm export names.
62
+
45
63
  ## Shared operation contract
46
64
 
47
65
  High-level operations accept one options object. Common fields are `workspaceRoot`, `appId`, `target`, `signal`, and `onEvent`; only fields meaningful to that operation are consumed. Long work acknowledges first, owns its child tasks, keeps event delivery ordered and backpressured, emits progress or heartbeats, observes cancellation where safe, and rejects with `ArcaneError` on failure.
@@ -143,6 +161,7 @@ browser map are cataloged separately in [Runtime modules](runtime-modules.md).
143
161
  | `loadSdkBrowserRuntimeRelease()` | function | `arcane-os` | Runtime and app descriptors | Node |
144
162
  | `materializeInstalledSdkRuntime()` | function | `arcane-os` | Runtime and app descriptors | Node |
145
163
  | `materializeWorkspaceRuntimeContent()` | function | `arcane-os` | Runtime and app descriptors | Node |
164
+ | `MarkdownSpeech` | class | `arcane-os/speech-text` | Portable runtime modules | Node and browser |
146
165
  | `NATIVE_BUILD_PLAN_PROTOCOL` | constant | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
147
166
  | `NATIVE_BUILDER_PROTOCOL` | constant | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
148
167
  | `normalizeError()` | function | `arcane-os` | Errors | Node |
@@ -187,8 +206,11 @@ browser map are cataloged separately in [Runtime modules](runtime-modules.md).
187
206
  | `selectApp()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node |
188
207
  | `SpeechPlayback default export` | class | `arcane-os/speech-playback` | Portable runtime modules | Node with injected media adapters, or browser/native WebView media |
189
208
  | `SPEECH_PLAYBACK_STATE_EVENT` | constant | `arcane-os/speech-playback` | Portable runtime modules | Node and browser |
209
+ | `SPEECH_VOICE_ALIASES` | constant | `arcane-os/speech-playback` | Portable runtime modules | Node and browser |
210
+ | `SPEECH_VOICE_OPTIONS` | constant | `arcane-os/speech-playback` | Portable runtime modules | Node and browser |
190
211
  | `SpeechPlayback` | class | `arcane-os/speech-playback` | Portable runtime modules | Node with injected media adapters, or browser/native WebView media |
191
212
  | `splitSpeechText()` | function | `arcane-os/speech-playback` | Portable runtime modules | Node and browser |
213
+ | `stripSpeechFormatting()` | function | `arcane-os/speech-text` | Portable runtime modules | Node and browser |
192
214
  | `startDevServer()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node control plane; browser data plane |
193
215
  | `startSourceExampleServer()` | function | `arcane-os` | Workspace, doctor, repository, and server | Node control plane; browser data plane |
194
216
  | `TARGET_ADAPTER_PROTOCOL` | constant | `arcane-os` | Targets, native plans, and providers | Node; selected browser/native target or provider as documented |
@@ -751,7 +773,7 @@ deterministic map. The package root also contains the public
751
773
  {
752
774
  schemaVersion: 1,
753
775
  kind: 'arcane-app-runtime-projection',
754
- sdkVersion: '0.5.16',
776
+ sdkVersion: '0.5.18',
755
777
  pathPrefix: 'arcane/',
756
778
  files: [{path}]
757
779
  }
@@ -1507,6 +1529,16 @@ bounded FIFO queue (browser Kokoro defaults to four), while Blob URLs and
1507
1529
  playback remain in exact input order. A native or custom client without that
1508
1530
  advertised capacity stays serialized with one lookahead. Replay keeps completed
1509
1531
  URLs and pending requests while retrying failed missing provider segments.
1532
+ The optional constructor `onState(detail)` callback runs synchronously after
1533
+ the canonical state occurrence is dispatched; callback failures are reported
1534
+ without replacing playback settlement.
1535
+
1536
+ `prepare()` keeps every nonblank stored part exact. At synthesis time,
1537
+ `SpeechPlayback` copies the part and automatically removes repeated formatting
1538
+ marks from only that outbound speech input. It passes SDK-internal preparation
1539
+ metadata so a downstream SDK speech boundary does not apply the filter again;
1540
+ applications do not supply that metadata. Original part objects, displayed or
1541
+ stored content, and every non-input payload field remain unchanged.
1510
1542
 
1511
1543
  ### Signature and result
1512
1544
 
@@ -1526,7 +1558,13 @@ runtime module; provider and media availability remain host-owned.
1526
1558
  import SpeechPlayback from 'arcane-os/speech-playback';
1527
1559
 
1528
1560
  const audio=document.body.appendChild(document.createElement('audio'));
1529
- const playback=new SpeechPlayback({audio,speech:globalThis.ai});
1561
+ const playback=new SpeechPlayback({
1562
+ audio,
1563
+ speech:globalThis.ai,
1564
+ onState(detail) {
1565
+ console.log(detail.state);
1566
+ }
1567
+ });
1530
1568
  const button=document.body.appendChild(document.createElement('button'));
1531
1569
  button.textContent='Speak';
1532
1570
  button.addEventListener('click',async function speakCompleteSegments(){
@@ -1561,18 +1599,91 @@ import {SPEECH_PLAYBACK_STATE_EVENT} from 'arcane-os/speech-playback';
1561
1599
  console.log(SPEECH_PLAYBACK_STATE_EVENT);
1562
1600
  ```
1563
1601
 
1602
+ ## SPEECH_VOICE_ALIASES
1603
+
1604
+ ### Overview
1605
+
1606
+ Mutable compatibility membership for the ten shared voice identifiers used by
1607
+ existing speech controls. `SpeechPlayback` does not select a voice from this
1608
+ set, and membership does not promise support from the selected provider.
1609
+
1610
+ ### Signature and result
1611
+
1612
+ ```text
1613
+ const SPEECH_VOICE_ALIASES
1614
+ ```
1615
+
1616
+ ### Availability and normalization
1617
+
1618
+ **Node and browser.** Ordinary mutable `Set`, derived once in
1619
+ `SPEECH_VOICE_OPTIONS` order, containing `alloy`, `ash`, `ballad`, `coral`,
1620
+ `echo`, `fable`, `nova`, `onyx`, `sage`, and `shimmer`.
1621
+
1622
+ ### Example
1623
+
1624
+ ```javascript
1625
+ import {SPEECH_VOICE_ALIASES} from 'arcane-os/speech-playback';
1626
+ console.log(SPEECH_VOICE_ALIASES.has('alloy')); // true
1627
+ ```
1628
+
1629
+ ## SPEECH_VOICE_OPTIONS
1630
+
1631
+ ### Overview
1632
+
1633
+ Mutable ordered compatibility records for existing speech voice controls.
1634
+ Each record has a lowercase `value` and matching title-case `label`. Provider
1635
+ support and voice selection remain caller-owned.
1636
+
1637
+ ### Signature and result
1638
+
1639
+ ```text
1640
+ const SPEECH_VOICE_OPTIONS
1641
+ ```
1642
+
1643
+ ### Availability and normalization
1644
+
1645
+ **Node and browser.** Ordinary mutable array and mutable `{value,label}`
1646
+ records ordered as Alloy, Ash, Ballad, Coral, Echo, Fable, Nova, Onyx, Sage,
1647
+ and Shimmer.
1648
+
1649
+ ### Example
1650
+
1651
+ ```javascript
1652
+ import {SPEECH_VOICE_OPTIONS} from 'arcane-os/speech-playback';
1653
+ console.log(SPEECH_VOICE_OPTIONS[0]); // {value: 'alloy', label: 'Alloy'}
1654
+ ```
1655
+
1564
1656
  ## SpeechPlayback
1565
1657
 
1566
1658
  ### Overview
1567
1659
 
1568
1660
  Named binding for the same capability-aware, exact-order canonical class exposed
1569
1661
  as the speech-playback default. `prepare()` preserves each nonblank part's exact
1570
- input string without trimming, splitting, or freezing that content.
1662
+ input string without trimming, splitting, or freezing that content. An optional
1663
+ `onState(detail)` constructor callback receives every state synchronously after
1664
+ the canonical occurrence is dispatched. Both surfaces expose the same public
1665
+ field values at dispatch time; object identity is not promised. Callback
1666
+ failures are reported through `globalThis.reportError` when available,
1667
+ otherwise `console.error`, and do not replace playback settlement.
1668
+ Only the outbound synthesis copy receives automatic repeated-formatting-mark
1669
+ cleanup; the original part and stored preparation record stay exact.
1571
1670
 
1572
1671
  ### Signature and result
1573
1672
 
1574
1673
  ```text
1575
- new SpeechPlayback(options={})
1674
+ new SpeechPlayback({
1675
+ audio,
1676
+ speech?,
1677
+ model?,
1678
+ voice?,
1679
+ responseFormat?,
1680
+ speed=1,
1681
+ onState=()=>{},
1682
+ createObjectURL?,
1683
+ revokeObjectURL?,
1684
+ delay?,
1685
+ messages?
1686
+ })
1576
1687
  ```
1577
1688
 
1578
1689
  ### Availability and normalization
@@ -1586,7 +1697,15 @@ serialized, and media availability remains host-owned.
1586
1697
 
1587
1698
  ```javascript
1588
1699
  import SpeechPlayback,{SpeechPlayback as NamedSpeechPlayback} from 'arcane-os/speech-playback';
1589
- console.log(SpeechPlayback===NamedSpeechPlayback);
1700
+
1701
+ const audio=document.body.appendChild(document.createElement('audio'));
1702
+ const playback=new NamedSpeechPlayback({
1703
+ audio,
1704
+ onState(detail) {
1705
+ console.log(detail.state);
1706
+ }
1707
+ });
1708
+ console.log(playback instanceof SpeechPlayback); // true
1590
1709
  ```
1591
1710
 
1592
1711
  ## splitSpeechText()
@@ -1612,6 +1731,73 @@ import {splitSpeechText} from 'arcane-os/speech-playback';
1612
1731
  console.log(splitSpeechText('Hello world.'));
1613
1732
  ```
1614
1733
 
1734
+ ## MarkdownSpeech
1735
+
1736
+ ### Overview
1737
+
1738
+ Streams the SDK's speech formatting cleanup across input chunk
1739
+ boundaries. `append()` removes runs of two or more identical `*`, `#`, `_`,
1740
+ backtick, or `~` marks while retaining single marks and every other character.
1741
+ It is a narrow speech filter, not a Markdown parser. Normal SDK TTS calls use
1742
+ this cleanup automatically; applications do not need to construct this class
1743
+ or opt in.
1744
+
1745
+ ### Signature and result
1746
+
1747
+ ```text
1748
+ new MarkdownSpeech()
1749
+ ```
1750
+
1751
+ `append(text='',end=false)` returns only newly available narration. It retains
1752
+ one trailing candidate formatting mark across calls so a repeated run split
1753
+ between chunks is still removed. A terminal `end:true` append flushes any
1754
+ single pending mark and resets the instance. `reset()` discards pending state.
1755
+
1756
+ ### Availability and normalization
1757
+
1758
+ **Node and browser.** The implementation has no runtime dependency. Caller
1759
+ strings remain unchanged. Non-string input throws `TypeError`.
1760
+
1761
+ ### Example
1762
+
1763
+ ```javascript
1764
+ import {MarkdownSpeech} from 'arcane-os/speech-text';
1765
+
1766
+ const speechText=new MarkdownSpeech();
1767
+ console.log(speechText.append('*')); // '' (held for the next chunk)
1768
+ console.log(speechText.append('*Hello.',true)); // 'Hello.'
1769
+ ```
1770
+
1771
+ ## stripSpeechFormatting()
1772
+
1773
+ ### Overview
1774
+
1775
+ Removes repeated same formatting marks from one complete speech text value.
1776
+ Single marks, ordinary punctuation, links, code contents, and every other
1777
+ character remain literal. Normal SDK TTS calls already apply this function to
1778
+ an outbound copy; the public helper is available when another speech-text owner
1779
+ needs the same one-pass result.
1780
+
1781
+ ### Signature and result
1782
+
1783
+ ```text
1784
+ stripSpeechFormatting(text='')
1785
+ ```
1786
+
1787
+ ### Availability and normalization
1788
+
1789
+ **Node and browser.** Calls the supplied value's `replace()` method and returns
1790
+ its filtered result without modifying the supplied value. Pass a string;
1791
+ values without a callable `replace()` fail with the native `TypeError`.
1792
+
1793
+ ### Example
1794
+
1795
+ ```javascript
1796
+ import {stripSpeechFormatting} from 'arcane-os/speech-text';
1797
+
1798
+ console.log(stripSpeechFormatting('**Hello**')); // 'Hello'
1799
+ ```
1800
+
1615
1801
  ## projectNativeDescriptor()
1616
1802
 
1617
1803
  ### Overview
@@ -3463,7 +3649,7 @@ workspace it additionally returns the exact installed package authority:
3463
3649
  packageSource,
3464
3650
  canonicalPackageRoot,
3465
3651
  packageName: 'arcane-os',
3466
- packageVersion: '0.5.16',
3652
+ packageVersion: '0.5.18',
3467
3653
  runtimeRoot,
3468
3654
  browserRuntimeRoot
3469
3655
  }
@@ -3471,9 +3657,9 @@ workspace it additionally returns the exact installed package authority:
3471
3657
  ```
3472
3658
 
3473
3659
  The dependency can be named `arcane-os` or be one exact npm alias for
3474
- `npm:arcane-os@0.5.16`. The selected installation must still be one direct,
3660
+ `npm:arcane-os@0.5.18`. The selected installation must still be one direct,
3475
3661
  physical, non-link package directory whose manifest identifies exactly as
3476
- `arcane-os@0.5.16`; duplicate canonical/alias declarations reject.
3662
+ `arcane-os@0.5.18`; duplicate canonical/alias declarations reject.
3477
3663
  `allowMissingManagedImportMap` is an internal packaging/development seam. An
3478
3664
  ordinary caller should leave it `false`.
3479
3665
 
@@ -319,6 +319,7 @@
319
319
  "arcane-os/event-manager": "/src/event-manager.mjs",
320
320
  "arcane-os/dom-event-instrumentation": "/src/dom-event-instrumentation.mjs",
321
321
  "event-pubsub": "/browser-runtime/dependencies/event-pubsub/index.js",
322
+ "strong-type": "/runtime/strong-type/index.js",
322
323
  "arcane-os/ai/browser-wasm": "/browser-runtime/ai/browser-wasm.mjs",
323
324
  "arcane-os/ai/browser-speech": "/browser-runtime/ai/browser-speech.mjs",
324
325
  "arcane-os/preference-store": "/runtime/arcane/modules/PreferenceStore.js",