@runanywhere/core 0.16.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/RunAnywhereCore.podspec +130 -0
- package/android/CMakeLists.txt +92 -0
- package/android/build.gradle +321 -0
- package/android/consumer-rules.pro +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +271 -0
- package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
- package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
- package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
- package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
- package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
- package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
- package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
- package/android/src/main/include/rac/core/rac_component_types.h +160 -0
- package/android/src/main/include/rac/core/rac_core.h +331 -0
- package/android/src/main/include/rac/core/rac_error.h +469 -0
- package/android/src/main/include/rac/core/rac_events.h +334 -0
- package/android/src/main/include/rac/core/rac_logger.h +416 -0
- package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
- package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
- package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
- package/android/src/main/include/rac/core/rac_types.h +264 -0
- package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
- package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
- package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
- package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
- package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
- package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
- package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
- package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
- package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
- package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
- package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
- package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
- package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
- package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
- package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
- package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
- package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
- package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
- package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
- package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
- package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
- package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
- package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
- package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
- package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
- package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
- package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
- package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
- package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
- package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
- package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
- package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
- package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
- package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
- package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
- package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
- package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
- package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
- package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
- package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/ArchiveUtility.kt +308 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfo.kt +229 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +392 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/RunAnywhereCorePackage.kt +28 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SDKLogger.kt +357 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/SecureStorageManager.kt +147 -0
- package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
- package/cpp/HybridRunAnywhereCore.cpp +2505 -0
- package/cpp/HybridRunAnywhereCore.hpp +271 -0
- package/cpp/bridges/AuthBridge.cpp +209 -0
- package/cpp/bridges/AuthBridge.hpp +157 -0
- package/cpp/bridges/DeviceBridge.cpp +257 -0
- package/cpp/bridges/DeviceBridge.hpp +155 -0
- package/cpp/bridges/DownloadBridge.cpp +299 -0
- package/cpp/bridges/DownloadBridge.hpp +197 -0
- package/cpp/bridges/EventBridge.cpp +125 -0
- package/cpp/bridges/EventBridge.hpp +139 -0
- package/cpp/bridges/HTTPBridge.cpp +96 -0
- package/cpp/bridges/HTTPBridge.hpp +144 -0
- package/cpp/bridges/InitBridge.cpp +1273 -0
- package/cpp/bridges/InitBridge.hpp +306 -0
- package/cpp/bridges/ModelRegistryBridge.cpp +394 -0
- package/cpp/bridges/ModelRegistryBridge.hpp +177 -0
- package/cpp/bridges/StorageBridge.cpp +269 -0
- package/cpp/bridges/StorageBridge.hpp +172 -0
- package/cpp/bridges/TelemetryBridge.cpp +352 -0
- package/cpp/bridges/TelemetryBridge.hpp +126 -0
- package/ios/.testlocal +0 -0
- package/ios/ArchiveUtility.swift +526 -0
- package/ios/ArchiveUtilityBridge.m +52 -0
- package/ios/AudioDecoder.h +38 -0
- package/ios/AudioDecoder.m +162 -0
- package/ios/Binaries/RACommons.xcframework/Info.plist +44 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +67 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_analytics_events.h +610 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_api_types.h +335 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_audio_utils.h +88 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_auth_manager.h +252 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_component_types.h +160 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +331 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_dev_config.h +85 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_device_manager.h +176 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_download.h +418 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +102 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_environment.h +220 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_error.h +469 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_events.h +177 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_http_client.h +233 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +290 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_component.h +228 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_events.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_platform.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_service.h +163 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_types.h +384 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_logger.h +416 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +169 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_paths.h +258 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +357 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_strategy.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +613 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_sdk_state.h +292 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_structured_error.h +594 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_component.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_events.h +62 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_service.h +154 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_types.h +389 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_component.h +158 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_events.h +54 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_platform.h +197 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_service.h +162 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_types.h +374 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +264 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad.h +17 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_component.h +185 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +443 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_events.h +76 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_service.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_types.h +244 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_voice_agent.h +612 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Info.plist +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Modules/module.modulemap +5 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
- package/ios/HybridRunAnywhereDeviceInfo.swift +214 -0
- package/ios/KeychainManager.swift +116 -0
- package/ios/PlatformAdapter.swift +100 -0
- package/ios/PlatformAdapterBridge.h +152 -0
- package/ios/PlatformAdapterBridge.m +570 -0
- package/ios/RNSDKLoggerBridge.h +41 -0
- package/ios/RNSDKLoggerBridge.m +66 -0
- package/ios/SDKLogger.swift +329 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.cpp +257 -0
- package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfoSpec.kt +106 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/runanywherecoreOnLoad.kt +35 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.cmake +82 -0
- package/nitrogen/generated/android/runanywherecore+autolinking.gradle +27 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.cpp +54 -0
- package/nitrogen/generated/android/runanywherecoreOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/RunAnywhereCore+autolinking.rb +60 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.hpp +197 -0
- package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Umbrella.hpp +45 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.mm +43 -0
- package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.hpp +173 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec_cxx.swift +366 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +92 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +138 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.cpp +33 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.hpp +75 -0
- package/package.json +76 -0
- package/react-native.config.js +14 -0
- package/src/Features/VoiceSession/AudioCaptureManager.ts +286 -0
- package/src/Features/VoiceSession/AudioPlaybackManager.ts +300 -0
- package/src/Features/VoiceSession/VoiceSessionHandle.ts +530 -0
- package/src/Features/VoiceSession/index.ts +20 -0
- package/src/Features/index.ts +7 -0
- package/src/Foundation/Constants/SDKConstants.ts +47 -0
- package/src/Foundation/Constants/index.ts +8 -0
- package/src/Foundation/DependencyInjection/ServiceContainer.ts +154 -0
- package/src/Foundation/DependencyInjection/ServiceRegistry.ts +51 -0
- package/src/Foundation/DependencyInjection/index.ts +6 -0
- package/src/Foundation/ErrorTypes/ErrorCategory.ts +184 -0
- package/src/Foundation/ErrorTypes/ErrorCodes.ts +151 -0
- package/src/Foundation/ErrorTypes/ErrorContext.ts +201 -0
- package/src/Foundation/ErrorTypes/SDKError.ts +507 -0
- package/src/Foundation/ErrorTypes/index.ts +57 -0
- package/src/Foundation/Initialization/InitializationPhase.ts +85 -0
- package/src/Foundation/Initialization/InitializationState.ts +168 -0
- package/src/Foundation/Initialization/index.ts +26 -0
- package/src/Foundation/Logging/Destinations/NativeLogBridge.ts +147 -0
- package/src/Foundation/Logging/Destinations/SentryDestination.ts +209 -0
- package/src/Foundation/Logging/Logger/SDKLogger.ts +232 -0
- package/src/Foundation/Logging/Models/LogLevel.ts +36 -0
- package/src/Foundation/Logging/Models/LoggingConfiguration.ts +117 -0
- package/src/Foundation/Logging/Services/LoggingManager.ts +407 -0
- package/src/Foundation/Logging/index.ts +59 -0
- package/src/Foundation/Security/DeviceIdentity.ts +92 -0
- package/src/Foundation/Security/SecureStorageError.ts +132 -0
- package/src/Foundation/Security/SecureStorageKeys.ts +35 -0
- package/src/Foundation/Security/SecureStorageService.ts +449 -0
- package/src/Foundation/Security/index.ts +17 -0
- package/src/Foundation/index.ts +26 -0
- package/src/Infrastructure/Events/EventPublisher.ts +165 -0
- package/src/Infrastructure/Events/SDKEvent.ts +214 -0
- package/src/Infrastructure/Events/index.ts +15 -0
- package/src/Infrastructure/index.ts +9 -0
- package/src/Public/Events/EventBus.ts +488 -0
- package/src/Public/Events/index.ts +8 -0
- package/src/Public/Extensions/RunAnywhere+Logging.ts +51 -0
- package/src/Public/Extensions/RunAnywhere+Models.ts +392 -0
- package/src/Public/Extensions/RunAnywhere+STT.ts +424 -0
- package/src/Public/Extensions/RunAnywhere+Storage.ts +151 -0
- package/src/Public/Extensions/RunAnywhere+StructuredOutput.ts +316 -0
- package/src/Public/Extensions/RunAnywhere+TTS.ts +430 -0
- package/src/Public/Extensions/RunAnywhere+TextGeneration.ts +320 -0
- package/src/Public/Extensions/RunAnywhere+VAD.ts +359 -0
- package/src/Public/Extensions/RunAnywhere+VoiceAgent.ts +225 -0
- package/src/Public/Extensions/RunAnywhere+VoiceSession.ts +155 -0
- package/src/Public/Extensions/index.ts +126 -0
- package/src/Public/RunAnywhere.ts +695 -0
- package/src/index.ts +238 -0
- package/src/native/NativeRunAnywhereCore.ts +291 -0
- package/src/native/NativeRunAnywhereModule.ts +32 -0
- package/src/native/index.ts +21 -0
- package/src/services/DownloadService.ts +282 -0
- package/src/services/FileSystem.ts +810 -0
- package/src/services/ModelRegistry.ts +246 -0
- package/src/services/Network/APIEndpoints.ts +84 -0
- package/src/services/Network/HTTPService.ts +479 -0
- package/src/services/Network/NetworkConfiguration.ts +130 -0
- package/src/services/Network/TelemetryService.ts +318 -0
- package/src/services/Network/index.ts +29 -0
- package/src/services/SystemTTSService.ts +130 -0
- package/src/services/index.ts +66 -0
- package/src/specs/RunAnywhereCore.nitro.ts +627 -0
- package/src/specs/RunAnywhereDeviceInfo.nitro.ts +73 -0
- package/src/types/LLMTypes.ts +127 -0
- package/src/types/STTTypes.ts +124 -0
- package/src/types/StructuredOutputTypes.ts +156 -0
- package/src/types/TTSTypes.ts +126 -0
- package/src/types/VADTypes.ts +70 -0
- package/src/types/VoiceAgentTypes.ts +182 -0
- package/src/types/enums.ts +258 -0
- package/src/types/events.ts +337 -0
- package/src/types/external.d.ts +142 -0
- package/src/types/index.ts +146 -0
- package/src/types/models.ts +579 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunAnywhere+VoiceAgent.ts
|
|
3
|
+
*
|
|
4
|
+
* Voice Agent extension for the full voice pipeline.
|
|
5
|
+
* Delegates to native VoiceAgentBridge.
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/VoiceAgent/RunAnywhere+VoiceAgent.swift
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { requireNativeModule, isNativeModuleAvailable } from '../../native';
|
|
11
|
+
import { SDKLogger } from '../../Foundation/Logging/Logger/SDKLogger';
|
|
12
|
+
import type {
|
|
13
|
+
VoiceAgentConfig,
|
|
14
|
+
VoiceAgentComponentStates,
|
|
15
|
+
VoiceTurnResult,
|
|
16
|
+
} from '../../types/VoiceAgentTypes';
|
|
17
|
+
|
|
18
|
+
const logger = new SDKLogger('RunAnywhere.VoiceAgent');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get voice agent component states
|
|
22
|
+
* @returns Component load states for STT, LLM, TTS
|
|
23
|
+
*/
|
|
24
|
+
export async function getVoiceAgentComponentStates(): Promise<VoiceAgentComponentStates> {
|
|
25
|
+
if (!isNativeModuleAvailable()) {
|
|
26
|
+
throw new Error('Native module not available');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const native = requireNativeModule();
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const resultJson = await native.getVoiceAgentComponentStates();
|
|
33
|
+
return JSON.parse(resultJson) as VoiceAgentComponentStates;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
36
|
+
logger.error(`Failed to get component states: ${msg}`);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Check if all voice components are ready
|
|
43
|
+
*/
|
|
44
|
+
export async function areAllVoiceComponentsReady(): Promise<boolean> {
|
|
45
|
+
const states = await getVoiceAgentComponentStates();
|
|
46
|
+
return states.isFullyReady;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initialize voice agent with configuration
|
|
51
|
+
* @param config Voice agent configuration
|
|
52
|
+
* @returns true if initialized successfully
|
|
53
|
+
*/
|
|
54
|
+
export async function initializeVoiceAgent(
|
|
55
|
+
config: VoiceAgentConfig
|
|
56
|
+
): Promise<boolean> {
|
|
57
|
+
if (!isNativeModuleAvailable()) {
|
|
58
|
+
throw new Error('Native module not available');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const native = requireNativeModule();
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
logger.info('Initializing voice agent...');
|
|
65
|
+
const result = await native.initializeVoiceAgent(JSON.stringify(config));
|
|
66
|
+
if (result) {
|
|
67
|
+
logger.info('Voice agent initialized successfully');
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
72
|
+
logger.error(`Failed to initialize voice agent: ${msg}`);
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Initialize voice agent using already-loaded models
|
|
79
|
+
* Uses the current STT, LLM, and TTS models
|
|
80
|
+
* @returns true if initialized successfully
|
|
81
|
+
*/
|
|
82
|
+
export async function initializeVoiceAgentWithLoadedModels(): Promise<boolean> {
|
|
83
|
+
if (!isNativeModuleAvailable()) {
|
|
84
|
+
throw new Error('Native module not available');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const native = requireNativeModule();
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
logger.info('Initializing voice agent with loaded models...');
|
|
91
|
+
const result = await native.initializeVoiceAgentWithLoadedModels();
|
|
92
|
+
if (result) {
|
|
93
|
+
logger.info('Voice agent initialized with loaded models');
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
98
|
+
logger.error(`Failed to initialize voice agent: ${msg}`);
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Check if voice agent is ready
|
|
105
|
+
*/
|
|
106
|
+
export async function isVoiceAgentReady(): Promise<boolean> {
|
|
107
|
+
if (!isNativeModuleAvailable()) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const native = requireNativeModule();
|
|
112
|
+
return native.isVoiceAgentReady();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Process a complete voice turn: audio -> transcription -> response -> speech
|
|
117
|
+
* @param audioData Audio data as ArrayBuffer or base64 string
|
|
118
|
+
* @returns Voice turn result
|
|
119
|
+
*/
|
|
120
|
+
export async function processVoiceTurn(
|
|
121
|
+
audioData: ArrayBuffer | string
|
|
122
|
+
): Promise<VoiceTurnResult> {
|
|
123
|
+
if (!isNativeModuleAvailable()) {
|
|
124
|
+
throw new Error('Native module not available');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const native = requireNativeModule();
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
// Convert to base64 if ArrayBuffer
|
|
131
|
+
let base64Audio: string;
|
|
132
|
+
if (audioData instanceof ArrayBuffer) {
|
|
133
|
+
const bytes = new Uint8Array(audioData);
|
|
134
|
+
base64Audio = btoa(String.fromCharCode(...bytes));
|
|
135
|
+
} else {
|
|
136
|
+
base64Audio = audioData;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const resultJson = await native.processVoiceTurn(base64Audio);
|
|
140
|
+
const result = JSON.parse(resultJson);
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
speechDetected: result.speechDetected === true || result.speechDetected === 'true',
|
|
144
|
+
transcription: result.transcription || '',
|
|
145
|
+
response: result.response || '',
|
|
146
|
+
synthesizedAudio: result.synthesizedAudio || undefined,
|
|
147
|
+
sampleRate: result.sampleRate || 16000,
|
|
148
|
+
};
|
|
149
|
+
} catch (error) {
|
|
150
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
151
|
+
logger.error(`Voice turn failed: ${msg}`);
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Transcribe audio using voice agent (voice agent must be initialized)
|
|
158
|
+
* @param audioData Audio data as ArrayBuffer or base64 string
|
|
159
|
+
* @returns Transcription text
|
|
160
|
+
*/
|
|
161
|
+
export async function voiceAgentTranscribe(
|
|
162
|
+
audioData: ArrayBuffer | string
|
|
163
|
+
): Promise<string> {
|
|
164
|
+
if (!isNativeModuleAvailable()) {
|
|
165
|
+
throw new Error('Native module not available');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const native = requireNativeModule();
|
|
169
|
+
|
|
170
|
+
let base64Audio: string;
|
|
171
|
+
if (audioData instanceof ArrayBuffer) {
|
|
172
|
+
const bytes = new Uint8Array(audioData);
|
|
173
|
+
base64Audio = btoa(String.fromCharCode(...bytes));
|
|
174
|
+
} else {
|
|
175
|
+
base64Audio = audioData;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return native.voiceAgentTranscribe(base64Audio);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Generate response using voice agent LLM
|
|
183
|
+
* @param prompt Input text
|
|
184
|
+
* @returns Generated response text
|
|
185
|
+
*/
|
|
186
|
+
export async function voiceAgentGenerateResponse(
|
|
187
|
+
prompt: string
|
|
188
|
+
): Promise<string> {
|
|
189
|
+
if (!isNativeModuleAvailable()) {
|
|
190
|
+
throw new Error('Native module not available');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const native = requireNativeModule();
|
|
194
|
+
return native.voiceAgentGenerateResponse(prompt);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Synthesize speech using voice agent TTS
|
|
199
|
+
* @param text Text to synthesize
|
|
200
|
+
* @returns Base64-encoded audio data
|
|
201
|
+
*/
|
|
202
|
+
export async function voiceAgentSynthesizeSpeech(
|
|
203
|
+
text: string
|
|
204
|
+
): Promise<string> {
|
|
205
|
+
if (!isNativeModuleAvailable()) {
|
|
206
|
+
throw new Error('Native module not available');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const native = requireNativeModule();
|
|
210
|
+
return native.voiceAgentSynthesizeSpeech(text);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Cleanup voice agent resources
|
|
215
|
+
*/
|
|
216
|
+
export async function cleanupVoiceAgent(): Promise<void> {
|
|
217
|
+
if (!isNativeModuleAvailable()) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const native = requireNativeModule();
|
|
222
|
+
logger.info('Cleaning up voice agent...');
|
|
223
|
+
await native.cleanupVoiceAgent();
|
|
224
|
+
logger.info('Voice agent cleaned up');
|
|
225
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunAnywhere+VoiceSession.ts
|
|
3
|
+
*
|
|
4
|
+
* High-level voice session API for simplified voice assistant integration.
|
|
5
|
+
* Handles audio capture, VAD, and processing internally.
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Public/Extensions/VoiceAgent/RunAnywhere+VoiceSession.swift
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Start a voice session with async iterator
|
|
12
|
+
* const session = await startVoiceSession();
|
|
13
|
+
*
|
|
14
|
+
* for await (const event of session.events()) {
|
|
15
|
+
* switch (event.type) {
|
|
16
|
+
* case 'listening':
|
|
17
|
+
* updateAudioMeter(event.audioLevel);
|
|
18
|
+
* break;
|
|
19
|
+
* case 'processing':
|
|
20
|
+
* showProcessingIndicator();
|
|
21
|
+
* break;
|
|
22
|
+
* case 'turnCompleted':
|
|
23
|
+
* updateUI(event.transcription, event.response);
|
|
24
|
+
* break;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* // Or use callbacks
|
|
29
|
+
* const session = await startVoiceSessionWithCallback({}, (event) => {
|
|
30
|
+
* // Handle event
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Stop the session
|
|
34
|
+
* session.stop();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { SDKLogger } from '../../Foundation/Logging/Logger/SDKLogger';
|
|
39
|
+
import {
|
|
40
|
+
VoiceSessionHandle,
|
|
41
|
+
DEFAULT_VOICE_SESSION_CONFIG,
|
|
42
|
+
type VoiceSessionConfig,
|
|
43
|
+
type VoiceSessionEvent,
|
|
44
|
+
type VoiceSessionEventCallback,
|
|
45
|
+
} from '../../Features/VoiceSession';
|
|
46
|
+
|
|
47
|
+
const logger = new SDKLogger('RunAnywhere.VoiceSession');
|
|
48
|
+
|
|
49
|
+
// Re-export types for convenience
|
|
50
|
+
export type {
|
|
51
|
+
VoiceSessionConfig,
|
|
52
|
+
VoiceSessionEvent,
|
|
53
|
+
VoiceSessionEventCallback
|
|
54
|
+
};
|
|
55
|
+
export { DEFAULT_VOICE_SESSION_CONFIG };
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Start a voice session with async event iteration
|
|
59
|
+
*
|
|
60
|
+
* This is the simplest way to integrate voice assistant.
|
|
61
|
+
* The session handles audio capture, VAD, and processing internally.
|
|
62
|
+
*
|
|
63
|
+
* Example:
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const session = await startVoiceSession();
|
|
66
|
+
*
|
|
67
|
+
* // Consume events using async iteration
|
|
68
|
+
* for await (const event of session.events()) {
|
|
69
|
+
* switch (event.type) {
|
|
70
|
+
* case 'listening':
|
|
71
|
+
* audioMeter = event.audioLevel ?? 0;
|
|
72
|
+
* break;
|
|
73
|
+
* case 'processing':
|
|
74
|
+
* status = 'Processing...';
|
|
75
|
+
* break;
|
|
76
|
+
* case 'turnCompleted':
|
|
77
|
+
* userText = event.transcription ?? '';
|
|
78
|
+
* assistantText = event.response ?? '';
|
|
79
|
+
* break;
|
|
80
|
+
* case 'stopped':
|
|
81
|
+
* // Session ended
|
|
82
|
+
* break;
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param config Session configuration (optional)
|
|
88
|
+
* @returns Session handle with events iterator
|
|
89
|
+
*/
|
|
90
|
+
export async function startVoiceSession(
|
|
91
|
+
config: VoiceSessionConfig = {}
|
|
92
|
+
): Promise<VoiceSessionHandle> {
|
|
93
|
+
logger.info('Starting voice session...');
|
|
94
|
+
|
|
95
|
+
const session = new VoiceSessionHandle(config);
|
|
96
|
+
await session.start();
|
|
97
|
+
|
|
98
|
+
logger.info('Voice session started');
|
|
99
|
+
return session;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Start a voice session with callback-based event handling
|
|
104
|
+
*
|
|
105
|
+
* Alternative API using callbacks instead of async iterator.
|
|
106
|
+
*
|
|
107
|
+
* Example:
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const session = await startVoiceSessionWithCallback({}, (event) => {
|
|
110
|
+
* switch (event.type) {
|
|
111
|
+
* case 'listening':
|
|
112
|
+
* setAudioLevel(event.audioLevel ?? 0);
|
|
113
|
+
* break;
|
|
114
|
+
* case 'turnCompleted':
|
|
115
|
+
* setUserText(event.transcription ?? '');
|
|
116
|
+
* setAssistantText(event.response ?? '');
|
|
117
|
+
* break;
|
|
118
|
+
* }
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Later...
|
|
122
|
+
* session.stop();
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @param config Session configuration
|
|
126
|
+
* @param onEvent Callback for each event
|
|
127
|
+
* @returns Session handle for control
|
|
128
|
+
*/
|
|
129
|
+
export async function startVoiceSessionWithCallback(
|
|
130
|
+
config: VoiceSessionConfig = {},
|
|
131
|
+
onEvent: VoiceSessionEventCallback
|
|
132
|
+
): Promise<VoiceSessionHandle> {
|
|
133
|
+
logger.info('Starting voice session with callback...');
|
|
134
|
+
|
|
135
|
+
const session = new VoiceSessionHandle(config);
|
|
136
|
+
session.setEventCallback(onEvent);
|
|
137
|
+
await session.start();
|
|
138
|
+
|
|
139
|
+
logger.info('Voice session with callback started');
|
|
140
|
+
return session;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Create a voice session handle without starting it
|
|
145
|
+
*
|
|
146
|
+
* Useful when you want to configure the session before starting.
|
|
147
|
+
*
|
|
148
|
+
* @param config Session configuration
|
|
149
|
+
* @returns Session handle (not started)
|
|
150
|
+
*/
|
|
151
|
+
export function createVoiceSession(
|
|
152
|
+
config: VoiceSessionConfig = {}
|
|
153
|
+
): VoiceSessionHandle {
|
|
154
|
+
return new VoiceSessionHandle(config);
|
|
155
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunAnywhere Extensions
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all extension modules for convenient importing.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Text Generation (LLM)
|
|
8
|
+
export {
|
|
9
|
+
loadModel,
|
|
10
|
+
isModelLoaded,
|
|
11
|
+
unloadModel,
|
|
12
|
+
chat,
|
|
13
|
+
generate,
|
|
14
|
+
generateStream,
|
|
15
|
+
cancelGeneration,
|
|
16
|
+
} from './RunAnywhere+TextGeneration';
|
|
17
|
+
|
|
18
|
+
// Speech-to-Text
|
|
19
|
+
export {
|
|
20
|
+
loadSTTModel,
|
|
21
|
+
isSTTModelLoaded,
|
|
22
|
+
unloadSTTModel,
|
|
23
|
+
transcribe,
|
|
24
|
+
transcribeSimple,
|
|
25
|
+
transcribeBuffer,
|
|
26
|
+
transcribeStream,
|
|
27
|
+
transcribeFile,
|
|
28
|
+
startStreamingSTT,
|
|
29
|
+
stopStreamingSTT,
|
|
30
|
+
isStreamingSTT,
|
|
31
|
+
} from './RunAnywhere+STT';
|
|
32
|
+
|
|
33
|
+
// Text-to-Speech
|
|
34
|
+
export {
|
|
35
|
+
loadTTSModel,
|
|
36
|
+
loadTTSVoice,
|
|
37
|
+
unloadTTSVoice,
|
|
38
|
+
isTTSModelLoaded,
|
|
39
|
+
isTTSVoiceLoaded,
|
|
40
|
+
unloadTTSModel,
|
|
41
|
+
synthesize,
|
|
42
|
+
synthesizeStream,
|
|
43
|
+
speak,
|
|
44
|
+
isSpeaking,
|
|
45
|
+
stopSpeaking,
|
|
46
|
+
availableTTSVoices,
|
|
47
|
+
getTTSVoices,
|
|
48
|
+
getTTSVoiceInfo,
|
|
49
|
+
stopSynthesis,
|
|
50
|
+
cancelTTS,
|
|
51
|
+
cleanupTTS,
|
|
52
|
+
} from './RunAnywhere+TTS';
|
|
53
|
+
|
|
54
|
+
// Voice Activity Detection
|
|
55
|
+
export {
|
|
56
|
+
initializeVAD,
|
|
57
|
+
isVADReady,
|
|
58
|
+
loadVADModel,
|
|
59
|
+
isVADModelLoaded,
|
|
60
|
+
unloadVADModel,
|
|
61
|
+
detectSpeech,
|
|
62
|
+
processVAD,
|
|
63
|
+
startVAD,
|
|
64
|
+
stopVAD,
|
|
65
|
+
resetVAD,
|
|
66
|
+
setVADSpeechActivityCallback,
|
|
67
|
+
setVADAudioBufferCallback,
|
|
68
|
+
cleanupVAD,
|
|
69
|
+
getVADState,
|
|
70
|
+
} from './RunAnywhere+VAD';
|
|
71
|
+
|
|
72
|
+
// Voice Agent
|
|
73
|
+
export {
|
|
74
|
+
initializeVoiceAgent,
|
|
75
|
+
initializeVoiceAgentWithLoadedModels,
|
|
76
|
+
isVoiceAgentReady,
|
|
77
|
+
getVoiceAgentComponentStates,
|
|
78
|
+
areAllVoiceComponentsReady,
|
|
79
|
+
processVoiceTurn,
|
|
80
|
+
voiceAgentTranscribe,
|
|
81
|
+
voiceAgentGenerateResponse,
|
|
82
|
+
voiceAgentSynthesizeSpeech,
|
|
83
|
+
cleanupVoiceAgent,
|
|
84
|
+
} from './RunAnywhere+VoiceAgent';
|
|
85
|
+
|
|
86
|
+
// Voice Session
|
|
87
|
+
export {
|
|
88
|
+
startVoiceSession,
|
|
89
|
+
startVoiceSessionWithCallback,
|
|
90
|
+
createVoiceSession,
|
|
91
|
+
DEFAULT_VOICE_SESSION_CONFIG,
|
|
92
|
+
} from './RunAnywhere+VoiceSession';
|
|
93
|
+
export type {
|
|
94
|
+
VoiceSessionConfig,
|
|
95
|
+
VoiceSessionEvent,
|
|
96
|
+
VoiceSessionEventCallback
|
|
97
|
+
} from './RunAnywhere+VoiceSession';
|
|
98
|
+
|
|
99
|
+
// Structured Output
|
|
100
|
+
export {
|
|
101
|
+
generateStructured,
|
|
102
|
+
generateStructuredStream,
|
|
103
|
+
generate as generateStructuredType,
|
|
104
|
+
extractEntities,
|
|
105
|
+
classify,
|
|
106
|
+
} from './RunAnywhere+StructuredOutput';
|
|
107
|
+
export type {
|
|
108
|
+
StreamToken,
|
|
109
|
+
StructuredOutputStreamResult
|
|
110
|
+
} from './RunAnywhere+StructuredOutput';
|
|
111
|
+
|
|
112
|
+
// Logging
|
|
113
|
+
export { setLogLevel } from './RunAnywhere+Logging';
|
|
114
|
+
|
|
115
|
+
// Storage
|
|
116
|
+
export { getStorageInfo, clearCache } from './RunAnywhere+Storage';
|
|
117
|
+
|
|
118
|
+
// Models
|
|
119
|
+
export {
|
|
120
|
+
getAvailableModels,
|
|
121
|
+
getModelInfo,
|
|
122
|
+
isModelDownloaded,
|
|
123
|
+
downloadModel,
|
|
124
|
+
cancelDownload,
|
|
125
|
+
deleteModel,
|
|
126
|
+
} from './RunAnywhere+Models';
|