@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,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServiceContainer.ts
|
|
3
|
+
*
|
|
4
|
+
* Service container for managing SDK services.
|
|
5
|
+
* Simplified to work with native HTTP transport.
|
|
6
|
+
*
|
|
7
|
+
* Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/DI/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { SDKLogger } from '../Logging/Logger/SDKLogger';
|
|
11
|
+
import {
|
|
12
|
+
HTTPService,
|
|
13
|
+
SDKEnvironment,
|
|
14
|
+
} from '../../services/Network';
|
|
15
|
+
|
|
16
|
+
const logger = new SDKLogger('ServiceContainer');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Service container for SDK dependency management
|
|
20
|
+
* Manages network configuration and service lifecycle
|
|
21
|
+
*/
|
|
22
|
+
export class ServiceContainer {
|
|
23
|
+
public static shared: ServiceContainer = new ServiceContainer();
|
|
24
|
+
|
|
25
|
+
private _apiKey?: string;
|
|
26
|
+
private _baseURL?: string;
|
|
27
|
+
private _environment: SDKEnvironment = SDKEnvironment.Development;
|
|
28
|
+
private _isInitialized: boolean = false;
|
|
29
|
+
|
|
30
|
+
public constructor() {}
|
|
31
|
+
|
|
32
|
+
// ==========================================================================
|
|
33
|
+
// API Configuration
|
|
34
|
+
// ==========================================================================
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Store API configuration
|
|
38
|
+
*
|
|
39
|
+
* @param apiKey API key for authentication
|
|
40
|
+
* @param environment SDK environment
|
|
41
|
+
* @param baseURL Optional base URL for production/staging
|
|
42
|
+
*/
|
|
43
|
+
public setAPIConfig(
|
|
44
|
+
apiKey: string,
|
|
45
|
+
environment: SDKEnvironment | string,
|
|
46
|
+
baseURL?: string
|
|
47
|
+
): void {
|
|
48
|
+
this._apiKey = apiKey;
|
|
49
|
+
this._baseURL = baseURL;
|
|
50
|
+
|
|
51
|
+
// Convert string to enum if needed
|
|
52
|
+
if (typeof environment === 'string') {
|
|
53
|
+
this._environment = this.parseEnvironment(environment);
|
|
54
|
+
} else {
|
|
55
|
+
this._environment = environment;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
logger.debug(`API config stored: env=${this.environmentString}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ==========================================================================
|
|
62
|
+
// Service Access
|
|
63
|
+
// ==========================================================================
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get the HTTP service instance
|
|
67
|
+
* Note: HTTP is primarily handled by native layer
|
|
68
|
+
*/
|
|
69
|
+
public get httpService(): HTTPService {
|
|
70
|
+
return HTTPService.shared;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ==========================================================================
|
|
74
|
+
// Getters
|
|
75
|
+
// ==========================================================================
|
|
76
|
+
|
|
77
|
+
public get apiKey(): string | undefined {
|
|
78
|
+
return this._apiKey;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public get baseURL(): string | undefined {
|
|
82
|
+
return this._baseURL;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public get environment(): SDKEnvironment {
|
|
86
|
+
return this._environment;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public get environmentString(): string {
|
|
90
|
+
switch (this._environment) {
|
|
91
|
+
case SDKEnvironment.Development:
|
|
92
|
+
return 'development';
|
|
93
|
+
case SDKEnvironment.Staging:
|
|
94
|
+
return 'staging';
|
|
95
|
+
case SDKEnvironment.Production:
|
|
96
|
+
return 'production';
|
|
97
|
+
default:
|
|
98
|
+
return 'unknown';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
public get isInitialized(): boolean {
|
|
103
|
+
return this._isInitialized;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ==========================================================================
|
|
107
|
+
// Initialization
|
|
108
|
+
// ==========================================================================
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Mark services as initialized
|
|
112
|
+
*/
|
|
113
|
+
public markInitialized(): void {
|
|
114
|
+
this._isInitialized = true;
|
|
115
|
+
logger.debug('ServiceContainer marked as initialized');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Reset all services (for testing or SDK destruction)
|
|
120
|
+
*/
|
|
121
|
+
public reset(): void {
|
|
122
|
+
this._apiKey = undefined;
|
|
123
|
+
this._baseURL = undefined;
|
|
124
|
+
this._environment = SDKEnvironment.Development;
|
|
125
|
+
this._isInitialized = false;
|
|
126
|
+
|
|
127
|
+
logger.debug('ServiceContainer reset');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ==========================================================================
|
|
131
|
+
// Private Helpers
|
|
132
|
+
// ==========================================================================
|
|
133
|
+
|
|
134
|
+
private parseEnvironment(env: string): SDKEnvironment {
|
|
135
|
+
const normalized = env.toLowerCase();
|
|
136
|
+
switch (normalized) {
|
|
137
|
+
case 'development':
|
|
138
|
+
case 'dev':
|
|
139
|
+
case '0':
|
|
140
|
+
return SDKEnvironment.Development;
|
|
141
|
+
case 'staging':
|
|
142
|
+
case 'stage':
|
|
143
|
+
case '1':
|
|
144
|
+
return SDKEnvironment.Staging;
|
|
145
|
+
case 'production':
|
|
146
|
+
case 'prod':
|
|
147
|
+
case '2':
|
|
148
|
+
return SDKEnvironment.Production;
|
|
149
|
+
default:
|
|
150
|
+
logger.warning(`Unknown environment '${env}', defaulting to Development`);
|
|
151
|
+
return SDKEnvironment.Development;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServiceRegistry.ts
|
|
3
|
+
*
|
|
4
|
+
* Simplified service registry.
|
|
5
|
+
* Service registration is now handled by native commons.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { SDKLogger } from '../Logging/Logger/SDKLogger';
|
|
9
|
+
|
|
10
|
+
const logger = new SDKLogger('ServiceRegistry');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Minimal service registry
|
|
14
|
+
* Service registration is handled by native commons
|
|
15
|
+
*/
|
|
16
|
+
export class ServiceRegistry {
|
|
17
|
+
private static _instance: ServiceRegistry | null = null;
|
|
18
|
+
private initialized = false;
|
|
19
|
+
|
|
20
|
+
static get shared(): ServiceRegistry {
|
|
21
|
+
if (!ServiceRegistry._instance) {
|
|
22
|
+
ServiceRegistry._instance = new ServiceRegistry();
|
|
23
|
+
}
|
|
24
|
+
return ServiceRegistry._instance;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initialize (signals native to register services)
|
|
29
|
+
*/
|
|
30
|
+
async initialize(): Promise<void> {
|
|
31
|
+
if (this.initialized) return;
|
|
32
|
+
|
|
33
|
+
logger.debug('Service registry initialized - services in native');
|
|
34
|
+
this.initialized = true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Check if initialized
|
|
39
|
+
*/
|
|
40
|
+
isInitialized(): boolean {
|
|
41
|
+
return this.initialized;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Reset (for testing)
|
|
46
|
+
*/
|
|
47
|
+
reset(): void {
|
|
48
|
+
this.initialized = false;
|
|
49
|
+
ServiceRegistry._instance = null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorCategory.ts
|
|
3
|
+
*
|
|
4
|
+
* Logical grouping for error filtering and analytics.
|
|
5
|
+
* Matches iOS SDK: Foundation/ErrorTypes/ErrorCategory.swift
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { ErrorCode } from './ErrorCodes';
|
|
9
|
+
|
|
10
|
+
export enum ErrorCategory {
|
|
11
|
+
/** SDK initialization errors */
|
|
12
|
+
Initialization = 'initialization',
|
|
13
|
+
/** Model loading and validation errors */
|
|
14
|
+
Model = 'model',
|
|
15
|
+
/** LLM/text generation errors */
|
|
16
|
+
Generation = 'generation',
|
|
17
|
+
/** Network and API errors */
|
|
18
|
+
Network = 'network',
|
|
19
|
+
/** File system and disk space errors */
|
|
20
|
+
Storage = 'storage',
|
|
21
|
+
/** Out-of-memory conditions */
|
|
22
|
+
Memory = 'memory',
|
|
23
|
+
/** Device compatibility issues */
|
|
24
|
+
Hardware = 'hardware',
|
|
25
|
+
/** Input validation failures */
|
|
26
|
+
Validation = 'validation',
|
|
27
|
+
/** Auth/API key errors */
|
|
28
|
+
Authentication = 'authentication',
|
|
29
|
+
/** Individual component failures */
|
|
30
|
+
Component = 'component',
|
|
31
|
+
/** Core framework errors */
|
|
32
|
+
Framework = 'framework',
|
|
33
|
+
/** Unclassified errors */
|
|
34
|
+
Unknown = 'unknown',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* All error categories for iteration.
|
|
39
|
+
*/
|
|
40
|
+
export const allErrorCategories: ErrorCategory[] = Object.values(ErrorCategory);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Infer error category from an error code.
|
|
44
|
+
*/
|
|
45
|
+
export function getCategoryFromCode(code: ErrorCode): ErrorCategory {
|
|
46
|
+
// General errors (1000-1099)
|
|
47
|
+
if (code >= 1000 && code < 1100) {
|
|
48
|
+
if (
|
|
49
|
+
code === ErrorCode.NotInitialized ||
|
|
50
|
+
code === ErrorCode.AlreadyInitialized
|
|
51
|
+
) {
|
|
52
|
+
return ErrorCategory.Initialization;
|
|
53
|
+
}
|
|
54
|
+
if (code === ErrorCode.InvalidInput) {
|
|
55
|
+
return ErrorCategory.Validation;
|
|
56
|
+
}
|
|
57
|
+
return ErrorCategory.Framework;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Model errors (1100-1199)
|
|
61
|
+
if (code >= 1100 && code < 1200) {
|
|
62
|
+
return ErrorCategory.Model;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Network errors (1200-1299)
|
|
66
|
+
if (code >= 1200 && code < 1300) {
|
|
67
|
+
return ErrorCategory.Network;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Storage errors (1300-1399)
|
|
71
|
+
if (code >= 1300 && code < 1400) {
|
|
72
|
+
return ErrorCategory.Storage;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Hardware errors (1500-1599)
|
|
76
|
+
if (code >= 1500 && code < 1600) {
|
|
77
|
+
return ErrorCategory.Hardware;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Authentication errors (1600-1699)
|
|
81
|
+
if (code >= 1600 && code < 1700) {
|
|
82
|
+
return ErrorCategory.Authentication;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Generation errors (1700-1799)
|
|
86
|
+
if (code >= 1700 && code < 1800) {
|
|
87
|
+
return ErrorCategory.Generation;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return ErrorCategory.Unknown;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Infer error category from an error object by inspecting its properties.
|
|
95
|
+
* Used for automatic categorization of unknown error types.
|
|
96
|
+
*/
|
|
97
|
+
export function inferCategoryFromError(error: Error): ErrorCategory {
|
|
98
|
+
const message = error.message.toLowerCase();
|
|
99
|
+
const name = error.name.toLowerCase();
|
|
100
|
+
|
|
101
|
+
// Check for network-related errors
|
|
102
|
+
if (
|
|
103
|
+
name.includes('network') ||
|
|
104
|
+
name.includes('fetch') ||
|
|
105
|
+
message.includes('network') ||
|
|
106
|
+
message.includes('connection') ||
|
|
107
|
+
message.includes('timeout') ||
|
|
108
|
+
message.includes('offline')
|
|
109
|
+
) {
|
|
110
|
+
return ErrorCategory.Network;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Check for authentication errors
|
|
114
|
+
if (
|
|
115
|
+
message.includes('unauthorized') ||
|
|
116
|
+
message.includes('authentication') ||
|
|
117
|
+
message.includes('api key') ||
|
|
118
|
+
message.includes('token') ||
|
|
119
|
+
message.includes('401') ||
|
|
120
|
+
message.includes('403')
|
|
121
|
+
) {
|
|
122
|
+
return ErrorCategory.Authentication;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Check for storage/file errors
|
|
126
|
+
if (
|
|
127
|
+
message.includes('storage') ||
|
|
128
|
+
message.includes('disk') ||
|
|
129
|
+
message.includes('file') ||
|
|
130
|
+
message.includes('enoent') ||
|
|
131
|
+
message.includes('eacces') ||
|
|
132
|
+
message.includes('permission denied')
|
|
133
|
+
) {
|
|
134
|
+
return ErrorCategory.Storage;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Check for memory errors
|
|
138
|
+
if (
|
|
139
|
+
message.includes('memory') ||
|
|
140
|
+
message.includes('out of memory') ||
|
|
141
|
+
message.includes('heap')
|
|
142
|
+
) {
|
|
143
|
+
return ErrorCategory.Memory;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Check for model errors
|
|
147
|
+
if (
|
|
148
|
+
message.includes('model') ||
|
|
149
|
+
message.includes('inference') ||
|
|
150
|
+
message.includes('onnx') ||
|
|
151
|
+
message.includes('llama')
|
|
152
|
+
) {
|
|
153
|
+
return ErrorCategory.Model;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Check for generation errors
|
|
157
|
+
if (
|
|
158
|
+
message.includes('generation') ||
|
|
159
|
+
message.includes('token') ||
|
|
160
|
+
message.includes('context length')
|
|
161
|
+
) {
|
|
162
|
+
return ErrorCategory.Generation;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Check for validation errors
|
|
166
|
+
if (
|
|
167
|
+
message.includes('invalid') ||
|
|
168
|
+
message.includes('validation') ||
|
|
169
|
+
message.includes('required')
|
|
170
|
+
) {
|
|
171
|
+
return ErrorCategory.Validation;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Check for initialization errors
|
|
175
|
+
if (
|
|
176
|
+
message.includes('not initialized') ||
|
|
177
|
+
message.includes('already initialized') ||
|
|
178
|
+
message.includes('initialization')
|
|
179
|
+
) {
|
|
180
|
+
return ErrorCategory.Initialization;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return ErrorCategory.Unknown;
|
|
184
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorCodes.ts
|
|
3
|
+
*
|
|
4
|
+
* Machine-readable error codes for SDK errors.
|
|
5
|
+
* Matches iOS SDK: Foundation/ErrorTypes/ErrorCodes.swift
|
|
6
|
+
*
|
|
7
|
+
* Error code ranges:
|
|
8
|
+
* - 1000-1099: General SDK state errors
|
|
9
|
+
* - 1100-1199: Model loading and validation
|
|
10
|
+
* - 1200-1299: Network and API communication
|
|
11
|
+
* - 1300-1399: File system and storage
|
|
12
|
+
* - 1500-1599: Hardware compatibility
|
|
13
|
+
* - 1600-1699: Authentication and authorization
|
|
14
|
+
* - 1700-1799: Text generation and token limits
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export enum ErrorCode {
|
|
18
|
+
// General errors (1000-1099)
|
|
19
|
+
Unknown = 1000,
|
|
20
|
+
InvalidInput = 1001,
|
|
21
|
+
NotInitialized = 1002,
|
|
22
|
+
AlreadyInitialized = 1003,
|
|
23
|
+
OperationCancelled = 1004,
|
|
24
|
+
|
|
25
|
+
// Model errors (1100-1199)
|
|
26
|
+
ModelNotFound = 1100,
|
|
27
|
+
ModelLoadFailed = 1101,
|
|
28
|
+
ModelValidationFailed = 1102,
|
|
29
|
+
ModelFormatUnsupported = 1103,
|
|
30
|
+
ModelCorrupted = 1104,
|
|
31
|
+
ModelIncompatible = 1105,
|
|
32
|
+
|
|
33
|
+
// Network errors (1200-1299)
|
|
34
|
+
NetworkUnavailable = 1200,
|
|
35
|
+
NetworkTimeout = 1201,
|
|
36
|
+
DownloadFailed = 1202,
|
|
37
|
+
UploadFailed = 1203,
|
|
38
|
+
ApiError = 1204,
|
|
39
|
+
|
|
40
|
+
// Storage errors (1300-1399)
|
|
41
|
+
InsufficientStorage = 1300,
|
|
42
|
+
StorageFull = 1301,
|
|
43
|
+
FileNotFound = 1302,
|
|
44
|
+
FileAccessDenied = 1303,
|
|
45
|
+
FileCorrupted = 1304,
|
|
46
|
+
|
|
47
|
+
// Hardware errors (1500-1599)
|
|
48
|
+
HardwareUnsupported = 1500,
|
|
49
|
+
HardwareUnavailable = 1501,
|
|
50
|
+
|
|
51
|
+
// Authentication errors (1600-1699)
|
|
52
|
+
AuthenticationFailed = 1600,
|
|
53
|
+
AuthenticationExpired = 1601,
|
|
54
|
+
AuthorizationDenied = 1602,
|
|
55
|
+
ApiKeyInvalid = 1603,
|
|
56
|
+
|
|
57
|
+
// Generation errors (1700-1799)
|
|
58
|
+
GenerationFailed = 1700,
|
|
59
|
+
GenerationTimeout = 1701,
|
|
60
|
+
TokenLimitExceeded = 1702,
|
|
61
|
+
CostLimitExceeded = 1703,
|
|
62
|
+
ContextTooLong = 1704,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get a human-readable message for an error code.
|
|
67
|
+
*/
|
|
68
|
+
export function getErrorCodeMessage(code: ErrorCode): string {
|
|
69
|
+
switch (code) {
|
|
70
|
+
// General errors
|
|
71
|
+
case ErrorCode.Unknown:
|
|
72
|
+
return 'An unknown error occurred';
|
|
73
|
+
case ErrorCode.InvalidInput:
|
|
74
|
+
return 'Invalid input provided';
|
|
75
|
+
case ErrorCode.NotInitialized:
|
|
76
|
+
return 'SDK not initialized';
|
|
77
|
+
case ErrorCode.AlreadyInitialized:
|
|
78
|
+
return 'SDK already initialized';
|
|
79
|
+
case ErrorCode.OperationCancelled:
|
|
80
|
+
return 'Operation was cancelled';
|
|
81
|
+
|
|
82
|
+
// Model errors
|
|
83
|
+
case ErrorCode.ModelNotFound:
|
|
84
|
+
return 'Model not found';
|
|
85
|
+
case ErrorCode.ModelLoadFailed:
|
|
86
|
+
return 'Failed to load model';
|
|
87
|
+
case ErrorCode.ModelValidationFailed:
|
|
88
|
+
return 'Model validation failed';
|
|
89
|
+
case ErrorCode.ModelFormatUnsupported:
|
|
90
|
+
return 'Model format not supported';
|
|
91
|
+
case ErrorCode.ModelCorrupted:
|
|
92
|
+
return 'Model file is corrupted';
|
|
93
|
+
case ErrorCode.ModelIncompatible:
|
|
94
|
+
return 'Model is incompatible with current runtime';
|
|
95
|
+
|
|
96
|
+
// Network errors
|
|
97
|
+
case ErrorCode.NetworkUnavailable:
|
|
98
|
+
return 'Network is unavailable';
|
|
99
|
+
case ErrorCode.NetworkTimeout:
|
|
100
|
+
return 'Network request timed out';
|
|
101
|
+
case ErrorCode.DownloadFailed:
|
|
102
|
+
return 'Download failed';
|
|
103
|
+
case ErrorCode.UploadFailed:
|
|
104
|
+
return 'Upload failed';
|
|
105
|
+
case ErrorCode.ApiError:
|
|
106
|
+
return 'API request failed';
|
|
107
|
+
|
|
108
|
+
// Storage errors
|
|
109
|
+
case ErrorCode.InsufficientStorage:
|
|
110
|
+
return 'Insufficient storage space';
|
|
111
|
+
case ErrorCode.StorageFull:
|
|
112
|
+
return 'Storage is full';
|
|
113
|
+
case ErrorCode.FileNotFound:
|
|
114
|
+
return 'File not found';
|
|
115
|
+
case ErrorCode.FileAccessDenied:
|
|
116
|
+
return 'File access denied';
|
|
117
|
+
case ErrorCode.FileCorrupted:
|
|
118
|
+
return 'File is corrupted';
|
|
119
|
+
|
|
120
|
+
// Hardware errors
|
|
121
|
+
case ErrorCode.HardwareUnsupported:
|
|
122
|
+
return 'Hardware is not supported';
|
|
123
|
+
case ErrorCode.HardwareUnavailable:
|
|
124
|
+
return 'Hardware is unavailable';
|
|
125
|
+
|
|
126
|
+
// Authentication errors
|
|
127
|
+
case ErrorCode.AuthenticationFailed:
|
|
128
|
+
return 'Authentication failed';
|
|
129
|
+
case ErrorCode.AuthenticationExpired:
|
|
130
|
+
return 'Authentication has expired';
|
|
131
|
+
case ErrorCode.AuthorizationDenied:
|
|
132
|
+
return 'Authorization denied';
|
|
133
|
+
case ErrorCode.ApiKeyInvalid:
|
|
134
|
+
return 'API key is invalid';
|
|
135
|
+
|
|
136
|
+
// Generation errors
|
|
137
|
+
case ErrorCode.GenerationFailed:
|
|
138
|
+
return 'Text generation failed';
|
|
139
|
+
case ErrorCode.GenerationTimeout:
|
|
140
|
+
return 'Text generation timed out';
|
|
141
|
+
case ErrorCode.TokenLimitExceeded:
|
|
142
|
+
return 'Token limit exceeded';
|
|
143
|
+
case ErrorCode.CostLimitExceeded:
|
|
144
|
+
return 'Cost limit exceeded';
|
|
145
|
+
case ErrorCode.ContextTooLong:
|
|
146
|
+
return 'Context is too long';
|
|
147
|
+
|
|
148
|
+
default:
|
|
149
|
+
return 'An error occurred';
|
|
150
|
+
}
|
|
151
|
+
}
|