arcane-os 0.5.18 → 0.6.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.
@@ -27,11 +27,8 @@ const DEFAULT_TTS_SEGMENTATION={
27
27
  punctuation:'sentence',
28
28
  wordCadence:null
29
29
  };
30
- const DEFAULT_BROWSER_TTS_EXECUTION={
31
- device:'auto',
32
- maxConcurrentRequests:4
33
- };
34
- const BROWSER_TTS_EXECUTION_DEVICES=new Set(['auto','webgpu','wasm']);
30
+ const DEFAULT_BROWSER_SPEECH_EXECUTION_DEVICE='auto';
31
+ const BROWSER_SPEECH_EXECUTION_DEVICES=new Set(['auto','webnn-npu','webgpu','wasm']);
35
32
  const MAX_BROWSER_TTS_CONCURRENT_REQUESTS=4;
36
33
  const TTS_PUNCTUATION_MODES=new Set(['sentence','any','none']);
37
34
  // A complete punctuation run is a boundary unless the whole run consists of
@@ -817,36 +814,45 @@ function browserSpeechIdentifier(value,label){
817
814
  return value;
818
815
  }
819
816
 
820
- function normalizeBrowserTTSExecution(value){
817
+ function normalizeBrowserSpeechExecution(role,value){
818
+ const label=`AI browser speech ${role}.execution`;
819
+ const maximumConcurrentRequests=role==='stt'
820
+ ?1
821
+ :MAX_BROWSER_TTS_CONCURRENT_REQUESTS;
821
822
  if(value===undefined){
822
- return completeValue({...DEFAULT_BROWSER_TTS_EXECUTION});
823
+ return completeValue({
824
+ device:DEFAULT_BROWSER_SPEECH_EXECUTION_DEVICE,
825
+ maxConcurrentRequests:maximumConcurrentRequests
826
+ });
823
827
  }
824
828
  const descriptors=closedRecord(
825
829
  value,
826
830
  ['device','maxConcurrentRequests'],
827
831
  [],
828
- 'AI browser speech tts.execution'
832
+ label
829
833
  );
830
834
  const device=descriptors.device
831
835
  ?descriptors.device.value
832
- :DEFAULT_BROWSER_TTS_EXECUTION.device;
836
+ :DEFAULT_BROWSER_SPEECH_EXECUTION_DEVICE;
833
837
  const maxConcurrentRequests=descriptors.maxConcurrentRequests
834
838
  ?descriptors.maxConcurrentRequests.value
835
- :DEFAULT_BROWSER_TTS_EXECUTION.maxConcurrentRequests;
836
- if(!is.string(device)||!BROWSER_TTS_EXECUTION_DEVICES.has(device)){
839
+ :maximumConcurrentRequests;
840
+ if(!is.string(device)||!BROWSER_SPEECH_EXECUTION_DEVICES.has(device)){
837
841
  throw aiBrowserSpeechError(
838
842
  AI_BROWSER_SPEECH_ERROR_CODES.configurationContractMismatch,
839
843
  AI_BROWSER_SPEECH_REASONS.configurationContractMismatch,
840
- 'AI browser speech tts.execution.device must be auto, webgpu, or wasm.'
844
+ `${label}.device must be auto, webnn-npu, webgpu, or wasm.`
841
845
  );
842
846
  }
843
847
  if(!is.safeInteger(maxConcurrentRequests)
844
848
  ||maxConcurrentRequests<1
845
- ||maxConcurrentRequests>MAX_BROWSER_TTS_CONCURRENT_REQUESTS){
849
+ ||maxConcurrentRequests>maximumConcurrentRequests){
846
850
  throw aiBrowserSpeechError(
847
851
  AI_BROWSER_SPEECH_ERROR_CODES.configurationContractMismatch,
848
852
  AI_BROWSER_SPEECH_REASONS.configurationContractMismatch,
849
- `AI browser speech tts.execution.maxConcurrentRequests must be an integer from 1 through ${MAX_BROWSER_TTS_CONCURRENT_REQUESTS}.`
853
+ role==='stt'
854
+ ?`${label}.maxConcurrentRequests must be 1.`
855
+ :`${label}.maxConcurrentRequests must be an integer from 1 through ${maximumConcurrentRequests}.`
850
856
  );
851
857
  }
852
858
  return completeValue({device,maxConcurrentRequests});
@@ -917,13 +923,6 @@ function normalizeBrowserSpeechRole(value,role){
917
923
  `${label}.offline must be a boolean.`
918
924
  );
919
925
  }
920
- if(role==='stt'&&descriptors.execution){
921
- throw aiBrowserSpeechError(
922
- AI_BROWSER_SPEECH_ERROR_CODES.configurationContractMismatch,
923
- AI_BROWSER_SPEECH_REASONS.configurationContractMismatch,
924
- 'AI browser speech execution policy is available only for TTS.'
925
- );
926
- }
927
926
  return completeValue({
928
927
  providerId,
929
928
  ...(hasGraph
@@ -937,11 +936,10 @@ function normalizeBrowserSpeechRole(value,role){
937
936
  ...(secure?{security:{secure:true}}:{})
938
937
  }),
939
938
  offline:descriptors.offline.value,
940
- ...(role==='tts'
941
- ?{execution:normalizeBrowserTTSExecution(
942
- descriptors.execution?.value
943
- )}
944
- :{})
939
+ execution:normalizeBrowserSpeechExecution(
940
+ role,
941
+ descriptors.execution?.value
942
+ )
945
943
  });
946
944
  }
947
945
 
@@ -2770,10 +2768,10 @@ class AI {
2770
2768
  ?{artifactGraphId:catalog.artifactGraphId}
2771
2769
  :{}),
2772
2770
  offline:configured.offline,
2771
+ execution:configured.execution,
2773
2772
  ...(role==='tts'
2774
2773
  ?{
2775
- defaultVoice:catalog.defaultVoice,
2776
- execution:configured.execution
2774
+ defaultVoice:catalog.defaultVoice
2777
2775
  }
2778
2776
  :{})
2779
2777
  });
@@ -3145,7 +3143,7 @@ class AI {
3145
3143
  }),
3146
3144
  store,
3147
3145
  offline:configured.offline,
3148
- ...(role==='tts'?{execution:configured.execution}:{})
3146
+ execution:configured.execution
3149
3147
  });
3150
3148
  }
3151
3149
  providers=completeValue({...candidateProviders});