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.
- package/CHANGELOG.md +27 -3
- package/README.md +18 -12
- package/browser-runtime/ai/browser-speech-providers.mjs +64 -60
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +31 -11
- package/browser-runtime/ai/browser-wllama-runtime.mjs +78 -0
- package/browser-runtime/ai/speech-worker-runtime.mjs +4 -5
- package/docs/architecture.md +1 -1
- package/docs/publishing.md +10 -4
- package/docs/reference/ai/browser-speech.md +65 -38
- package/docs/reference/ai/browser-wasm.md +29 -6
- package/docs/reference/behavioral-testing.md +1 -1
- package/docs/reference/inventory/runtime-modules.json +2 -2
- package/docs/reference/runtime-modules.md +32 -17
- package/docs/reference/sdk-api.md +32 -11
- package/examples/wasm-ai-demo/README.md +5 -3
- package/examples/wasm-ai-demo/app.js +1 -1
- package/package.json +1 -1
- package/runtime/arcane/components/chat.html +53 -10
- package/runtime/arcane/modules/AI.js +27 -29
|
@@ -27,11 +27,8 @@ const DEFAULT_TTS_SEGMENTATION={
|
|
|
27
27
|
punctuation:'sentence',
|
|
28
28
|
wordCadence:null
|
|
29
29
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
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
|
|
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({
|
|
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
|
-
|
|
832
|
+
label
|
|
829
833
|
);
|
|
830
834
|
const device=descriptors.device
|
|
831
835
|
?descriptors.device.value
|
|
832
|
-
:
|
|
836
|
+
:DEFAULT_BROWSER_SPEECH_EXECUTION_DEVICE;
|
|
833
837
|
const maxConcurrentRequests=descriptors.maxConcurrentRequests
|
|
834
838
|
?descriptors.maxConcurrentRequests.value
|
|
835
|
-
:
|
|
836
|
-
if(!is.string(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
|
-
|
|
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>
|
|
849
|
+
||maxConcurrentRequests>maximumConcurrentRequests){
|
|
846
850
|
throw aiBrowserSpeechError(
|
|
847
851
|
AI_BROWSER_SPEECH_ERROR_CODES.configurationContractMismatch,
|
|
848
852
|
AI_BROWSER_SPEECH_REASONS.configurationContractMismatch,
|
|
849
|
-
|
|
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
|
-
|
|
941
|
-
|
|
942
|
-
|
|
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
|
-
|
|
3146
|
+
execution:configured.execution
|
|
3149
3147
|
});
|
|
3150
3148
|
}
|
|
3151
3149
|
providers=completeValue({...candidateProviders});
|