arcane-os 0.5.17 → 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 (183) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +9 -9
  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 +46 -43
  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 +5 -1
  17. package/docs/reference/ai/browser-speech.md +198 -5
  18. package/docs/reference/availability-and-normalization.md +40 -0
  19. package/docs/reference/inventory/package-api.json +1 -1
  20. package/docs/reference/inventory/runtime-components.json +1 -1
  21. package/docs/reference/inventory/runtime-modules.json +20 -24
  22. package/docs/reference/protocols.md +1 -1
  23. package/docs/reference/runtime-modules.md +125 -35
  24. package/docs/reference/sdk-api.md +23 -7
  25. package/examples/wasm-ai-demo/index.html +1 -0
  26. package/node_modules/event-pubsub/node_modules/strong-type/README.md +408 -0
  27. package/node_modules/event-pubsub/node_modules/strong-type/assets/strong-type-header.png +0 -0
  28. package/node_modules/event-pubsub/node_modules/strong-type/index.js +1151 -0
  29. package/node_modules/event-pubsub/node_modules/strong-type/licence +21 -0
  30. package/node_modules/event-pubsub/node_modules/strong-type/node.js +125 -0
  31. package/node_modules/event-pubsub/node_modules/strong-type/package.json +61 -0
  32. package/node_modules/strong-type/README.md +42 -24
  33. package/node_modules/strong-type/benchmark/core.js +324 -0
  34. package/node_modules/strong-type/index.js +207 -82
  35. package/node_modules/strong-type/package.json +14 -6
  36. package/package.json +3 -3
  37. package/runtime/arcane/components/app-bar.html +5 -2
  38. package/runtime/arcane/components/assistant-panel.html +5 -2
  39. package/runtime/arcane/components/chart.html +15 -12
  40. package/runtime/arcane/components/chat.html +117 -138
  41. package/runtime/arcane/components/dashboard-config.html +6 -3
  42. package/runtime/arcane/components/data-view.html +4 -1
  43. package/runtime/arcane/components/directory-picker.html +5 -2
  44. package/runtime/arcane/components/document-inspector.html +6 -3
  45. package/runtime/arcane/components/file-drop.html +5 -2
  46. package/runtime/arcane/components/file-inspector.html +9 -6
  47. package/runtime/arcane/components/file-manager.html +16 -13
  48. package/runtime/arcane/components/local-ai-status.html +5 -2
  49. package/runtime/arcane/components/markdown-document.html +14 -11
  50. package/runtime/arcane/components/markdown-editor.html +4 -1
  51. package/runtime/arcane/components/modal.html +4 -1
  52. package/runtime/arcane/components/output-panel.html +6 -3
  53. package/runtime/arcane/components/preferences-form.html +4 -1
  54. package/runtime/arcane/components/record-timeline.html +8 -5
  55. package/runtime/arcane/components/relationship-board.html +9 -6
  56. package/runtime/arcane/components/source-code-viewer.html +12 -9
  57. package/runtime/arcane/components/source-explanation.html +8 -5
  58. package/runtime/arcane/components/speech.html +24 -21
  59. package/runtime/arcane/components/summary-strip.html +4 -1
  60. package/runtime/arcane/components/task-progress.html +6 -3
  61. package/runtime/arcane/components/terminal-workspace.html +4 -1
  62. package/runtime/arcane/components/voice-transcription.html +11 -8
  63. package/runtime/arcane/components/web-navigator.html +5 -2
  64. package/runtime/arcane/entities/ApiModelRecord.js +5 -2
  65. package/runtime/arcane/entities/Calculation.js +5 -2
  66. package/runtime/arcane/entities/Chat.js +33 -33
  67. package/runtime/arcane/entities/CommunicationMessage.js +4 -1
  68. package/runtime/arcane/entities/CommunicationThread.js +4 -1
  69. package/runtime/arcane/entities/File.js +1 -1
  70. package/runtime/arcane/entities/Image.js +8 -5
  71. package/runtime/arcane/entities/IntentEnvelope.js +20 -17
  72. package/runtime/arcane/entities/Preference.js +9 -6
  73. package/runtime/arcane/entities/Theme.js +5 -2
  74. package/runtime/arcane/entities/User.js +11 -11
  75. package/runtime/arcane/entities/Weather.js +5 -2
  76. package/runtime/arcane/modules/AI.js +491 -165
  77. package/runtime/arcane/modules/AIPreferenceRuntime.js +5 -2
  78. package/runtime/arcane/modules/AIPreferenceTuple.js +9 -6
  79. package/runtime/arcane/modules/AIProviderRuntime.js +88 -85
  80. package/runtime/arcane/modules/AIResponseURLPolicy.js +148 -62
  81. package/runtime/arcane/modules/AIRuntimeState.js +29 -26
  82. package/runtime/arcane/modules/AnsiText.js +4 -1
  83. package/runtime/arcane/modules/ApiModelDatabase.js +22 -19
  84. package/runtime/arcane/modules/AppDataScope.js +8 -5
  85. package/runtime/arcane/modules/ArcaneCommunicationBridge.js +4 -1
  86. package/runtime/arcane/modules/ArcaneNavigationPolicy.js +8 -5
  87. package/runtime/arcane/modules/ArcaneNetworkPolicy.js +18 -15
  88. package/runtime/arcane/modules/AsyncBoundary.js +13 -10
  89. package/runtime/arcane/modules/BrowserTestSuite.js +19 -16
  90. package/runtime/arcane/modules/CalculatorEngine.js +5 -2
  91. package/runtime/arcane/modules/ChatRecords.js +18 -15
  92. package/runtime/arcane/modules/CommunicationAppController.js +9 -6
  93. package/runtime/arcane/modules/CommunicationHub.js +9 -6
  94. package/runtime/arcane/modules/CommunicationPreferences.js +4 -1
  95. package/runtime/arcane/modules/CommunicationProviderRegistry.js +4 -1
  96. package/runtime/arcane/modules/ComponentContracts.js +56 -53
  97. package/runtime/arcane/modules/ConfiguredAIChatSession.js +30 -27
  98. package/runtime/arcane/modules/ConversationActionItems.js +15 -12
  99. package/runtime/arcane/modules/ConversationClosingReport.js +11 -8
  100. package/runtime/arcane/modules/ConversationTimebox.js +28 -25
  101. package/runtime/arcane/modules/CoreLocalModelCatalog.js +17 -14
  102. package/runtime/arcane/modules/DBLS.js +7 -4
  103. package/runtime/arcane/modules/DBOPFS.js +7 -7
  104. package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +34 -31
  105. package/runtime/arcane/modules/DevelopmentWorkspace.js +4 -1
  106. package/runtime/arcane/modules/DirectoryPicker.js +8 -5
  107. package/runtime/arcane/modules/DocumentLexicalSearch.js +11 -8
  108. package/runtime/arcane/modules/DocumentNavigation.js +7 -4
  109. package/runtime/arcane/modules/Errors.js +28 -25
  110. package/runtime/arcane/modules/HTMLImport.js +7 -4
  111. package/runtime/arcane/modules/IsolatedModelQuestionRunner.js +15 -12
  112. package/runtime/arcane/modules/LocalAIReadiness.js +21 -18
  113. package/runtime/arcane/modules/LocalAIReadinessController.js +6 -3
  114. package/runtime/arcane/modules/MD.js +1 -1
  115. package/runtime/arcane/modules/Mail.js +46 -43
  116. package/runtime/arcane/modules/MailOutbox.mjs +48 -45
  117. package/runtime/arcane/modules/MailTransport.mjs +29 -26
  118. package/runtime/arcane/modules/MemoryRecords.js +7 -4
  119. package/runtime/arcane/modules/MessageAdvisory.js +6 -3
  120. package/runtime/arcane/modules/ModelDefinition.js +7 -4
  121. package/runtime/arcane/modules/Ollama.js +6 -3
  122. package/runtime/arcane/modules/OllamaModelIdentifier.js +4 -1
  123. package/runtime/arcane/modules/OpenMeteoWeatherProvider.js +18 -15
  124. package/runtime/arcane/modules/PersistentAIChatSession.js +33 -30
  125. package/runtime/arcane/modules/PreferenceStore.js +20 -17
  126. package/runtime/arcane/modules/PreparedSpeech.js +485 -0
  127. package/runtime/arcane/modules/Questionnaire.js +6 -3
  128. package/runtime/arcane/modules/RecordLinkIndex.js +4 -1
  129. package/runtime/arcane/modules/RecordPassageIndex.js +9 -6
  130. package/runtime/arcane/modules/RecordReviewStore.js +12 -9
  131. package/runtime/arcane/modules/RiskSignalAnalyzer.js +4 -1
  132. package/runtime/arcane/modules/ScopedOPFSCache.js +6 -3
  133. package/runtime/arcane/modules/ScreenCapture.js +20 -17
  134. package/runtime/arcane/modules/SpeechPlayback.js +29 -26
  135. package/runtime/arcane/modules/StaticDocumentCatalog.js +33 -30
  136. package/runtime/arcane/modules/SystemAppearance.js +5 -2
  137. package/runtime/arcane/modules/SystemToolRegistry.js +6 -3
  138. package/runtime/arcane/modules/TerminalClient.js +14 -11
  139. package/runtime/arcane/modules/TerminalCommandRegistry.js +4 -1
  140. package/runtime/arcane/modules/ThemeBootstrap.js +9 -6
  141. package/runtime/arcane/modules/ThemeManager.js +5 -2
  142. package/runtime/arcane/modules/TimeGuard.js +1 -1
  143. package/runtime/arcane/modules/ToolCallRouter.js +11 -8
  144. package/runtime/arcane/modules/WaitForComponent.js +19 -16
  145. package/runtime/arcane/modules/YouTubeMedia.js +4 -1
  146. package/runtime/strong-type/index.js +1276 -352
  147. package/runtime/strong-type/package.json +69 -45
  148. package/src/app-descriptor.mjs +17 -14
  149. package/src/application-tests.mjs +4 -1
  150. package/src/cli/main.mjs +8 -5
  151. package/src/constants.mjs +4 -1
  152. package/src/dev-server.mjs +8 -5
  153. package/src/doctor.mjs +5 -2
  154. package/src/dom-event-instrumentation.mjs +24 -20
  155. package/src/errors.mjs +7 -3
  156. package/src/event-manager.mjs +111 -108
  157. package/src/event-queue.mjs +8 -5
  158. package/src/events.mjs +12 -9
  159. package/src/import-map.mjs +35 -27
  160. package/src/installed-sdk-runtime.mjs +4 -1
  161. package/src/integrated-provider-loader.mjs +9 -6
  162. package/src/mail-credentials.mjs +16 -13
  163. package/src/mail-server.mjs +53 -50
  164. package/src/mail.mjs +18 -15
  165. package/src/native-plan.mjs +12 -9
  166. package/src/native-provider-loader.mjs +7 -4
  167. package/src/packager/core.mjs +18 -15
  168. package/src/process.mjs +6 -3
  169. package/src/release-bundle.mjs +14 -11
  170. package/src/runtime.mjs +4 -1
  171. package/src/scaffold.mjs +9 -6
  172. package/src/sdk-browser-runtime.mjs +4 -1
  173. package/src/source-server.mjs +17 -14
  174. package/src/targets/index.mjs +5 -2
  175. package/src/templates/workspace-template.mjs +13 -6
  176. package/src/testing-loader.mjs +7 -4
  177. package/src/testing.mjs +10 -7
  178. package/src/toolchain.mjs +13 -10
  179. package/src/update-check.mjs +9 -6
  180. package/src/workspace-operation-lock.mjs +14 -11
  181. package/src/workspace-runtime.mjs +4 -1
  182. package/src/workspace.mjs +17 -14
  183. package/runtime/arcane/modules/AIResponseLength.js +0 -32
@@ -1,3 +1,7 @@
1
+ import Is from './dependencies/strong-type/index.js';
2
+
3
+ const is=new Is(false);
4
+
1
5
  export const DOM_INTERACTION_EVENT='arcane.dom.interaction';
2
6
  export const DOM_MUTATION_EVENT='arcane.dom.mutation';
3
7
  export const DOM_OBSERVATION_STARTED_EVENT='arcane.dom.observation.started';
@@ -25,13 +29,13 @@ function capturedString(value){
25
29
  }
26
30
 
27
31
  function cssEscape(value){
28
- if(typeof globalThis.CSS?.escape==='function')return globalThis.CSS.escape(value);
32
+ if(is.function(globalThis.CSS?.escape))return globalThis.CSS.escape(value);
29
33
  return String(value).replaceAll(/[^a-zA-Z0-9_-]/gu,character=>`\\${character.codePointAt(0).toString(16)} `);
30
34
  }
31
35
 
32
36
  function readAttribute(target,name){
33
37
  try{
34
- return typeof target?.getAttribute==='function'?target.getAttribute(name):null;
38
+ return is.function(target?.getAttribute)?target.getAttribute(name):null;
35
39
  }catch{
36
40
  return null;
37
41
  }
@@ -67,7 +71,7 @@ function selectorSegment(target){
67
71
  }
68
72
 
69
73
  export function domSelector(target,root){
70
- if(!target||typeof target!=='object')return null;
74
+ if(!target||!is.object(target))return null;
71
75
  if(target.nodeType===9)return ':document';
72
76
  if(target.nodeType===11)return ':shadow-root';
73
77
  if(target.nodeType===3)return domSelector(target.parentElement??target.parentNode,root);
@@ -111,7 +115,7 @@ export function domSelector(target,root){
111
115
  }
112
116
 
113
117
  export function describeDOMTarget(target,root){
114
- if(!target||typeof target!=='object')return null;
118
+ if(!target||!is.object(target))return null;
115
119
  if(target.nodeType===9){
116
120
  return {kind:'document',selector:':document'};
117
121
  }
@@ -145,7 +149,7 @@ export function describeDOMTarget(target,root){
145
149
  }
146
150
 
147
151
  function targetValue(target){
148
- if(!target||typeof target!=='object')return undefined;
152
+ if(!target||!is.object(target))return undefined;
149
153
  const type=String(target.type??'').toLowerCase();
150
154
  if(type==='checkbox'||type==='radio')return Boolean(target.checked);
151
155
  if(type==='file'){
@@ -156,24 +160,24 @@ function targetValue(target){
156
160
  }
157
161
 
158
162
  function safeEventDetail(value){
159
- if(typeof value==='string')return capturedString(value);
160
- if(value===null||typeof value==='number'||typeof value==='boolean')return value;
163
+ if(is.string(value))return capturedString(value);
164
+ if(value===null||is.number(value)||is.boolean(value))return value;
161
165
  return value;
162
166
  }
163
167
 
164
168
  function interactionRecord(event,root){
165
- const path=typeof event?.composedPath==='function'?event.composedPath():[event?.target];
166
- const target=path.find(item=>item&&typeof item==='object')??event?.target??null;
169
+ const path=is.function(event?.composedPath)?event.composedPath():[event?.target];
170
+ const target=path.find(item=>item&&is.object(item))??event?.target??null;
167
171
  const eventType=String(event?.type??'');
168
172
  const details={};
169
173
  const fields=new Set([
170
174
  ...EVENT_FIELDS,
171
- ...Reflect.ownKeys(event??{}).filter(field=>typeof field==='string')
175
+ ...Reflect.ownKeys(event??{}).filter(field=>is.string(field))
172
176
  ]);
173
177
  for(const field of fields){
174
178
  let value;
175
179
  try{value=event?.[field];}catch{continue;}
176
- if(value!==undefined&&typeof value!=='function'){
180
+ if(value!==undefined&&!is.function(value)){
177
181
  details[field]=safeEventDetail(value);
178
182
  }
179
183
  }
@@ -254,7 +258,7 @@ function collectOpenShadowRoots(root){
254
258
  const roots=[];
255
259
  const candidates=[];
256
260
  try{
257
- if(typeof root?.querySelectorAll==='function')candidates.push(...root.querySelectorAll('*'));
261
+ if(is.function(root?.querySelectorAll))candidates.push(...root.querySelectorAll('*'));
258
262
  }catch{}
259
263
  for(const candidate of candidates){
260
264
  if(candidate?.shadowRoot)roots.push(candidate.shadowRoot,...collectOpenShadowRoots(candidate.shadowRoot));
@@ -270,18 +274,18 @@ export function createDOMInstrumentation({
270
274
  captureMutations=true,
271
275
  observeOpenShadowRoots=true
272
276
  }={}){
273
- if(!eventManager||typeof eventManager.emit!=='function'){
277
+ if(!eventManager||!is.function(eventManager.emit)){
274
278
  throw new TypeError('DOM instrumentation requires an event manager.');
275
279
  }
276
- if(!root||typeof root.addEventListener!=='function'||typeof root.removeEventListener!=='function'){
280
+ if(!root||!is.function(root.addEventListener)||!is.function(root.removeEventListener)){
277
281
  throw new TypeError('DOM instrumentation requires an EventTarget-compatible root.');
278
282
  }
279
- if(!Array.isArray(eventTypes)||eventTypes.some(type=>typeof type!=='string'||!type)){
283
+ if(!is.array(eventTypes)||eventTypes.some(type=>!is.string(type)||!type)){
280
284
  throw new TypeError('DOM event types must be non-empty strings.');
281
285
  }
282
286
  eventTypes=[...new Set(eventTypes)];
283
287
  for(const [name,value] of Object.entries({captureMutations,observeOpenShadowRoots})){
284
- if(typeof value!=='boolean')throw new TypeError(`${name} must be boolean.`);
288
+ if(!is.boolean(value))throw new TypeError(`${name} must be boolean.`);
285
289
  }
286
290
  const observedRoots=new Set();
287
291
  const listenerRegistrations=new Map();
@@ -351,7 +355,7 @@ export function createDOMInstrumentation({
351
355
 
352
356
  const publish=(type,payload,metadata)=>{
353
357
  const before=Number(eventManager.eventCount??0);
354
- if(typeof eventManager.instrument==='function'){
358
+ if(is.function(eventManager.instrument)){
355
359
  eventManager.instrument(type,payload,{source:'dom',...metadata});
356
360
  }else{
357
361
  eventManager.emit(type,payload);
@@ -365,7 +369,7 @@ export function createDOMInstrumentation({
365
369
  const interaction=(event,observedRoot)=>{
366
370
  let path=[];
367
371
  try{
368
- if(typeof event?.composedPath==='function')path=event.composedPath();
372
+ if(is.function(event?.composedPath))path=event.composedPath();
369
373
  }catch{}
370
374
  const outermostObservedRoot=path.reduce(
371
375
  (selected,item)=>observedRoots.has(item)?item:selected,
@@ -446,7 +450,7 @@ export function createDOMInstrumentation({
446
450
  if(active)return api;
447
451
  try{
448
452
  if(captureMutations){
449
- if(typeof MutationObserverImpl!=='function'){
453
+ if(!is.function(MutationObserverImpl)){
450
454
  throw new TypeError('MutationObserver is required when DOM mutation capture is enabled.');
451
455
  }
452
456
  observer=new MutationObserverImpl(mutations);
@@ -473,7 +477,7 @@ export function createDOMInstrumentation({
473
477
  }
474
478
 
475
479
  function stop({emitLifecycle=true}={}){
476
- if(typeof emitLifecycle!=='boolean')throw new TypeError('emitLifecycle must be boolean.');
480
+ if(!is.boolean(emitLifecycle))throw new TypeError('emitLifecycle must be boolean.');
477
481
  if(!active)return api;
478
482
  const shouldEmitLifecycle=emitLifecycle&&lifecycleStarted;
479
483
  if(!emitLifecycle)lifecycleStarted=false;