@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.
Files changed (354) hide show
  1. package/RunAnywhereCore.podspec +130 -0
  2. package/android/CMakeLists.txt +92 -0
  3. package/android/build.gradle +321 -0
  4. package/android/consumer-rules.pro +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/cpp/cpp-adapter.cpp +271 -0
  7. package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
  8. package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
  9. package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
  10. package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
  11. package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
  12. package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
  13. package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
  14. package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
  15. package/android/src/main/include/rac/core/rac_component_types.h +160 -0
  16. package/android/src/main/include/rac/core/rac_core.h +331 -0
  17. package/android/src/main/include/rac/core/rac_error.h +469 -0
  18. package/android/src/main/include/rac/core/rac_events.h +334 -0
  19. package/android/src/main/include/rac/core/rac_logger.h +416 -0
  20. package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
  21. package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
  22. package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
  23. package/android/src/main/include/rac/core/rac_types.h +264 -0
  24. package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
  25. package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
  26. package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
  27. package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
  28. package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
  29. package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
  30. package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
  31. package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
  32. package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
  33. package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
  34. package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
  35. package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
  36. package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
  37. package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
  38. package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
  39. package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
  40. package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
  41. package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
  42. package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
  43. package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
  44. package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
  45. package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
  46. package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
  47. package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
  48. package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
  49. package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
  50. package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
  51. package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
  52. package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
  53. package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
  54. package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
  55. package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
  56. package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
  57. package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
  58. package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
  59. package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
  60. package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
  61. package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
  62. package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
  63. package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
  64. package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
  65. package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
  66. package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
  67. package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
  68. package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
  69. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
  70. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
  71. package/android/src/main/java/com/margelo/nitro/runanywhere/ArchiveUtility.kt +308 -0
  72. package/android/src/main/java/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfo.kt +229 -0
  73. package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +392 -0
  74. package/android/src/main/java/com/margelo/nitro/runanywhere/RunAnywhereCorePackage.kt +28 -0
  75. package/android/src/main/java/com/margelo/nitro/runanywhere/SDKLogger.kt +357 -0
  76. package/android/src/main/java/com/margelo/nitro/runanywhere/SecureStorageManager.kt +147 -0
  77. package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
  78. package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
  79. package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
  80. package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
  81. package/cpp/HybridRunAnywhereCore.cpp +2505 -0
  82. package/cpp/HybridRunAnywhereCore.hpp +271 -0
  83. package/cpp/bridges/AuthBridge.cpp +209 -0
  84. package/cpp/bridges/AuthBridge.hpp +157 -0
  85. package/cpp/bridges/DeviceBridge.cpp +257 -0
  86. package/cpp/bridges/DeviceBridge.hpp +155 -0
  87. package/cpp/bridges/DownloadBridge.cpp +299 -0
  88. package/cpp/bridges/DownloadBridge.hpp +197 -0
  89. package/cpp/bridges/EventBridge.cpp +125 -0
  90. package/cpp/bridges/EventBridge.hpp +139 -0
  91. package/cpp/bridges/HTTPBridge.cpp +96 -0
  92. package/cpp/bridges/HTTPBridge.hpp +144 -0
  93. package/cpp/bridges/InitBridge.cpp +1273 -0
  94. package/cpp/bridges/InitBridge.hpp +306 -0
  95. package/cpp/bridges/ModelRegistryBridge.cpp +394 -0
  96. package/cpp/bridges/ModelRegistryBridge.hpp +177 -0
  97. package/cpp/bridges/StorageBridge.cpp +269 -0
  98. package/cpp/bridges/StorageBridge.hpp +172 -0
  99. package/cpp/bridges/TelemetryBridge.cpp +352 -0
  100. package/cpp/bridges/TelemetryBridge.hpp +126 -0
  101. package/ios/.testlocal +0 -0
  102. package/ios/ArchiveUtility.swift +526 -0
  103. package/ios/ArchiveUtilityBridge.m +52 -0
  104. package/ios/AudioDecoder.h +38 -0
  105. package/ios/AudioDecoder.m +162 -0
  106. package/ios/Binaries/RACommons.xcframework/Info.plist +44 -0
  107. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +67 -0
  108. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_analytics_events.h +610 -0
  109. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_api_types.h +335 -0
  110. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_audio_utils.h +88 -0
  111. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_auth_manager.h +252 -0
  112. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_component_types.h +160 -0
  113. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +331 -0
  114. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_dev_config.h +85 -0
  115. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_device_manager.h +176 -0
  116. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_download.h +418 -0
  117. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +102 -0
  118. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_environment.h +220 -0
  119. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_error.h +469 -0
  120. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_events.h +177 -0
  121. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_http_client.h +233 -0
  122. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +290 -0
  123. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm.h +17 -0
  124. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
  125. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_component.h +228 -0
  126. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_events.h +215 -0
  127. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
  128. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
  129. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_platform.h +204 -0
  130. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_service.h +163 -0
  131. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
  132. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_types.h +384 -0
  133. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_logger.h +416 -0
  134. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +169 -0
  135. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_paths.h +258 -0
  136. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +357 -0
  137. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_strategy.h +374 -0
  138. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +613 -0
  139. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
  140. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h +292 -0
  141. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
  142. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_structured_error.h +594 -0
  143. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt.h +17 -0
  144. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
  145. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_component.h +162 -0
  146. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_events.h +62 -0
  147. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
  148. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_service.h +154 -0
  149. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_types.h +389 -0
  150. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
  151. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
  152. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
  153. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts.h +17 -0
  154. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
  155. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_component.h +158 -0
  156. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_events.h +54 -0
  157. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
  158. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_platform.h +197 -0
  159. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_service.h +162 -0
  160. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_types.h +374 -0
  161. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +264 -0
  162. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad.h +17 -0
  163. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
  164. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_component.h +185 -0
  165. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +443 -0
  166. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_events.h +76 -0
  167. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
  168. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_service.h +167 -0
  169. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_types.h +244 -0
  170. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_voice_agent.h +612 -0
  171. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Info.plist +11 -0
  172. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Modules/module.modulemap +5 -0
  173. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
  174. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +67 -0
  175. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_analytics_events.h +610 -0
  176. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_api_types.h +335 -0
  177. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_audio_utils.h +88 -0
  178. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_auth_manager.h +252 -0
  179. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_component_types.h +160 -0
  180. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +331 -0
  181. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_dev_config.h +85 -0
  182. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_device_manager.h +176 -0
  183. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_download.h +418 -0
  184. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +102 -0
  185. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_environment.h +220 -0
  186. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_error.h +469 -0
  187. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_events.h +177 -0
  188. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_http_client.h +233 -0
  189. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +290 -0
  190. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm.h +17 -0
  191. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
  192. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_component.h +228 -0
  193. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_events.h +215 -0
  194. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
  195. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
  196. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_platform.h +204 -0
  197. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_service.h +163 -0
  198. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
  199. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_types.h +384 -0
  200. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_logger.h +416 -0
  201. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +169 -0
  202. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_paths.h +258 -0
  203. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +357 -0
  204. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_strategy.h +374 -0
  205. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +613 -0
  206. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
  207. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_sdk_state.h +292 -0
  208. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
  209. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_structured_error.h +594 -0
  210. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt.h +17 -0
  211. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
  212. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_component.h +162 -0
  213. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_events.h +62 -0
  214. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
  215. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_service.h +154 -0
  216. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_types.h +389 -0
  217. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
  218. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
  219. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
  220. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts.h +17 -0
  221. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
  222. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_component.h +158 -0
  223. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_events.h +54 -0
  224. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
  225. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_platform.h +197 -0
  226. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_service.h +162 -0
  227. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_types.h +374 -0
  228. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +264 -0
  229. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad.h +17 -0
  230. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
  231. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_component.h +185 -0
  232. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +443 -0
  233. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_events.h +76 -0
  234. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
  235. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_service.h +167 -0
  236. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_types.h +244 -0
  237. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_voice_agent.h +612 -0
  238. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Info.plist +11 -0
  239. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Modules/module.modulemap +5 -0
  240. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
  241. package/ios/HybridRunAnywhereDeviceInfo.swift +214 -0
  242. package/ios/KeychainManager.swift +116 -0
  243. package/ios/PlatformAdapter.swift +100 -0
  244. package/ios/PlatformAdapterBridge.h +152 -0
  245. package/ios/PlatformAdapterBridge.m +570 -0
  246. package/ios/RNSDKLoggerBridge.h +41 -0
  247. package/ios/RNSDKLoggerBridge.m +66 -0
  248. package/ios/SDKLogger.swift +329 -0
  249. package/nitro.json +20 -0
  250. package/nitrogen/generated/.gitattributes +1 -0
  251. package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.cpp +257 -0
  252. package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.hpp +77 -0
  253. package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfoSpec.kt +106 -0
  254. package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/runanywherecoreOnLoad.kt +35 -0
  255. package/nitrogen/generated/android/runanywherecore+autolinking.cmake +82 -0
  256. package/nitrogen/generated/android/runanywherecore+autolinking.gradle +27 -0
  257. package/nitrogen/generated/android/runanywherecoreOnLoad.cpp +54 -0
  258. package/nitrogen/generated/android/runanywherecoreOnLoad.hpp +25 -0
  259. package/nitrogen/generated/ios/RunAnywhereCore+autolinking.rb +60 -0
  260. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.cpp +65 -0
  261. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.hpp +197 -0
  262. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Umbrella.hpp +45 -0
  263. package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.mm +43 -0
  264. package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.swift +25 -0
  265. package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.cpp +11 -0
  266. package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.hpp +173 -0
  267. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  268. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  269. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  270. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  271. package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec.swift +68 -0
  272. package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec_cxx.swift +366 -0
  273. package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +92 -0
  274. package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +138 -0
  275. package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.cpp +33 -0
  276. package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.hpp +75 -0
  277. package/package.json +76 -0
  278. package/react-native.config.js +14 -0
  279. package/src/Features/VoiceSession/AudioCaptureManager.ts +286 -0
  280. package/src/Features/VoiceSession/AudioPlaybackManager.ts +300 -0
  281. package/src/Features/VoiceSession/VoiceSessionHandle.ts +530 -0
  282. package/src/Features/VoiceSession/index.ts +20 -0
  283. package/src/Features/index.ts +7 -0
  284. package/src/Foundation/Constants/SDKConstants.ts +47 -0
  285. package/src/Foundation/Constants/index.ts +8 -0
  286. package/src/Foundation/DependencyInjection/ServiceContainer.ts +154 -0
  287. package/src/Foundation/DependencyInjection/ServiceRegistry.ts +51 -0
  288. package/src/Foundation/DependencyInjection/index.ts +6 -0
  289. package/src/Foundation/ErrorTypes/ErrorCategory.ts +184 -0
  290. package/src/Foundation/ErrorTypes/ErrorCodes.ts +151 -0
  291. package/src/Foundation/ErrorTypes/ErrorContext.ts +201 -0
  292. package/src/Foundation/ErrorTypes/SDKError.ts +507 -0
  293. package/src/Foundation/ErrorTypes/index.ts +57 -0
  294. package/src/Foundation/Initialization/InitializationPhase.ts +85 -0
  295. package/src/Foundation/Initialization/InitializationState.ts +168 -0
  296. package/src/Foundation/Initialization/index.ts +26 -0
  297. package/src/Foundation/Logging/Destinations/NativeLogBridge.ts +147 -0
  298. package/src/Foundation/Logging/Destinations/SentryDestination.ts +209 -0
  299. package/src/Foundation/Logging/Logger/SDKLogger.ts +232 -0
  300. package/src/Foundation/Logging/Models/LogLevel.ts +36 -0
  301. package/src/Foundation/Logging/Models/LoggingConfiguration.ts +117 -0
  302. package/src/Foundation/Logging/Services/LoggingManager.ts +407 -0
  303. package/src/Foundation/Logging/index.ts +59 -0
  304. package/src/Foundation/Security/DeviceIdentity.ts +92 -0
  305. package/src/Foundation/Security/SecureStorageError.ts +132 -0
  306. package/src/Foundation/Security/SecureStorageKeys.ts +35 -0
  307. package/src/Foundation/Security/SecureStorageService.ts +449 -0
  308. package/src/Foundation/Security/index.ts +17 -0
  309. package/src/Foundation/index.ts +26 -0
  310. package/src/Infrastructure/Events/EventPublisher.ts +165 -0
  311. package/src/Infrastructure/Events/SDKEvent.ts +214 -0
  312. package/src/Infrastructure/Events/index.ts +15 -0
  313. package/src/Infrastructure/index.ts +9 -0
  314. package/src/Public/Events/EventBus.ts +488 -0
  315. package/src/Public/Events/index.ts +8 -0
  316. package/src/Public/Extensions/RunAnywhere+Logging.ts +51 -0
  317. package/src/Public/Extensions/RunAnywhere+Models.ts +392 -0
  318. package/src/Public/Extensions/RunAnywhere+STT.ts +424 -0
  319. package/src/Public/Extensions/RunAnywhere+Storage.ts +151 -0
  320. package/src/Public/Extensions/RunAnywhere+StructuredOutput.ts +316 -0
  321. package/src/Public/Extensions/RunAnywhere+TTS.ts +430 -0
  322. package/src/Public/Extensions/RunAnywhere+TextGeneration.ts +320 -0
  323. package/src/Public/Extensions/RunAnywhere+VAD.ts +359 -0
  324. package/src/Public/Extensions/RunAnywhere+VoiceAgent.ts +225 -0
  325. package/src/Public/Extensions/RunAnywhere+VoiceSession.ts +155 -0
  326. package/src/Public/Extensions/index.ts +126 -0
  327. package/src/Public/RunAnywhere.ts +695 -0
  328. package/src/index.ts +238 -0
  329. package/src/native/NativeRunAnywhereCore.ts +291 -0
  330. package/src/native/NativeRunAnywhereModule.ts +32 -0
  331. package/src/native/index.ts +21 -0
  332. package/src/services/DownloadService.ts +282 -0
  333. package/src/services/FileSystem.ts +810 -0
  334. package/src/services/ModelRegistry.ts +246 -0
  335. package/src/services/Network/APIEndpoints.ts +84 -0
  336. package/src/services/Network/HTTPService.ts +479 -0
  337. package/src/services/Network/NetworkConfiguration.ts +130 -0
  338. package/src/services/Network/TelemetryService.ts +318 -0
  339. package/src/services/Network/index.ts +29 -0
  340. package/src/services/SystemTTSService.ts +130 -0
  341. package/src/services/index.ts +66 -0
  342. package/src/specs/RunAnywhereCore.nitro.ts +627 -0
  343. package/src/specs/RunAnywhereDeviceInfo.nitro.ts +73 -0
  344. package/src/types/LLMTypes.ts +127 -0
  345. package/src/types/STTTypes.ts +124 -0
  346. package/src/types/StructuredOutputTypes.ts +156 -0
  347. package/src/types/TTSTypes.ts +126 -0
  348. package/src/types/VADTypes.ts +70 -0
  349. package/src/types/VoiceAgentTypes.ts +182 -0
  350. package/src/types/enums.ts +258 -0
  351. package/src/types/events.ts +337 -0
  352. package/src/types/external.d.ts +142 -0
  353. package/src/types/index.ts +146 -0
  354. package/src/types/models.ts +579 -0
@@ -0,0 +1,407 @@
1
+ /**
2
+ * LoggingManager.ts
3
+ *
4
+ * Centralized logging manager with multiple destination support.
5
+ * Routes logs to multiple destinations (Console, Sentry, etc.) based on configuration.
6
+ *
7
+ * Matches iOS: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/SDKLogger.swift
8
+ * (Logging class - central service)
9
+ *
10
+ * Usage:
11
+ * // Configure for environment
12
+ * LoggingManager.shared.configure({ environment: SDKEnvironment.Production });
13
+ *
14
+ * // Add Sentry destination
15
+ * LoggingManager.shared.addDestination(new SentryDestination(Sentry));
16
+ *
17
+ * // Subscribe to log events (for custom handling)
18
+ * const unsubscribe = LoggingManager.shared.onLog((entry) => {
19
+ * // Forward to your analytics, etc.
20
+ * });
21
+ */
22
+
23
+ import { LogLevel } from '../Models/LogLevel';
24
+ import {
25
+ type LoggingConfiguration,
26
+ SDKEnvironment,
27
+ getConfigurationForEnvironment,
28
+ } from '../Models/LoggingConfiguration';
29
+
30
+ // ============================================================================
31
+ // Log Entry
32
+ // ============================================================================
33
+
34
+ /**
35
+ * Log entry structure
36
+ * Matches iOS: LogEntry
37
+ */
38
+ export interface LogEntry {
39
+ /** Log level */
40
+ level: LogLevel;
41
+ /** Category/subsystem */
42
+ category: string;
43
+ /** Log message */
44
+ message: string;
45
+ /** Optional metadata */
46
+ metadata?: Record<string, unknown>;
47
+ /** Timestamp */
48
+ timestamp: Date;
49
+ }
50
+
51
+ // ============================================================================
52
+ // Log Destination Protocol
53
+ // ============================================================================
54
+
55
+ /**
56
+ * Log destination interface
57
+ * Matches iOS: LogDestination protocol
58
+ */
59
+ export interface LogDestination {
60
+ /** Unique identifier for this destination */
61
+ identifier: string;
62
+ /** Human-readable name */
63
+ name: string;
64
+ /** Whether destination is available */
65
+ isAvailable: boolean;
66
+ /** Write a log entry */
67
+ write(entry: LogEntry): void;
68
+ /** Flush pending writes */
69
+ flush(): void;
70
+ }
71
+
72
+ // ============================================================================
73
+ // Console Destination
74
+ // ============================================================================
75
+
76
+ /**
77
+ * Console log destination (default)
78
+ */
79
+ export class ConsoleLogDestination implements LogDestination {
80
+ readonly identifier = 'console';
81
+ readonly name = 'Console';
82
+ readonly isAvailable = true;
83
+
84
+ write(entry: LogEntry): void {
85
+ const timestamp = entry.timestamp.toISOString();
86
+ const levelStr = getLogLevelDescription(entry.level);
87
+ const logMessage = `[${timestamp}] [${levelStr}] [${entry.category}] ${entry.message}`;
88
+
89
+ switch (entry.level) {
90
+ case LogLevel.Debug:
91
+ // eslint-disable-next-line no-console
92
+ console.debug(logMessage, entry.metadata ?? '');
93
+ break;
94
+ case LogLevel.Info:
95
+ // eslint-disable-next-line no-console
96
+ console.info(logMessage, entry.metadata ?? '');
97
+ break;
98
+ case LogLevel.Warning:
99
+ // eslint-disable-next-line no-console
100
+ console.warn(logMessage, entry.metadata ?? '');
101
+ break;
102
+ case LogLevel.Error:
103
+ case LogLevel.Fault:
104
+ // eslint-disable-next-line no-console
105
+ console.error(logMessage, entry.metadata ?? '');
106
+ break;
107
+ }
108
+ }
109
+
110
+ flush(): void {
111
+ // Console doesn't need flushing
112
+ }
113
+ }
114
+
115
+ // ============================================================================
116
+ // Event Destination (for public exposure)
117
+ // ============================================================================
118
+
119
+ /**
120
+ * Log event callback type
121
+ */
122
+ export type LogEventCallback = (entry: LogEntry) => void;
123
+
124
+ /**
125
+ * Event-based log destination for public log exposure
126
+ * Allows external consumers to subscribe to log events
127
+ */
128
+ export class EventLogDestination implements LogDestination {
129
+ readonly identifier = 'event';
130
+ readonly name = 'Event Emitter';
131
+ readonly isAvailable = true;
132
+
133
+ private callbacks: Set<LogEventCallback> = new Set();
134
+
135
+ /**
136
+ * Subscribe to log events
137
+ * @returns Unsubscribe function
138
+ */
139
+ subscribe(callback: LogEventCallback): () => void {
140
+ this.callbacks.add(callback);
141
+ return () => {
142
+ this.callbacks.delete(callback);
143
+ };
144
+ }
145
+
146
+ write(entry: LogEntry): void {
147
+ for (const callback of this.callbacks) {
148
+ try {
149
+ callback(entry);
150
+ } catch {
151
+ // Ignore callback errors
152
+ }
153
+ }
154
+ }
155
+
156
+ flush(): void {
157
+ // No buffering
158
+ }
159
+ }
160
+
161
+ // ============================================================================
162
+ // Logging Manager
163
+ // ============================================================================
164
+
165
+ /**
166
+ * Centralized logging manager with multiple destination support.
167
+ * Matches iOS: Logging class (central service)
168
+ */
169
+ export class LoggingManager {
170
+ private static sharedInstance: LoggingManager | null = null;
171
+ private destinations: Map<string, LogDestination> = new Map();
172
+
173
+ // Configuration
174
+ private config: LoggingConfiguration;
175
+
176
+ // Default destinations
177
+ private readonly consoleDestination = new ConsoleLogDestination();
178
+ private readonly eventDestination = new EventLogDestination();
179
+
180
+ private constructor() {
181
+ // Initialize with default development config
182
+ this.config = getConfigurationForEnvironment(SDKEnvironment.Development);
183
+
184
+ // Add default console destination
185
+ this.addDestination(this.consoleDestination);
186
+ // Add event destination for public log exposure
187
+ this.addDestination(this.eventDestination);
188
+ }
189
+
190
+ // ============================================================================
191
+ // Configuration (matches iOS Logging.configure)
192
+ // ============================================================================
193
+
194
+ /**
195
+ * Get current configuration
196
+ */
197
+ public get configuration(): LoggingConfiguration {
198
+ return { ...this.config };
199
+ }
200
+
201
+ /**
202
+ * Configure the logging system.
203
+ * Matches iOS: Logging.configure(_ config: LoggingConfiguration)
204
+ *
205
+ * @param config - Partial configuration to apply
206
+ */
207
+ public configure(config: Partial<LoggingConfiguration>): void {
208
+ // If environment is specified, get defaults for that environment
209
+ if (config.environment && !config.minLogLevel) {
210
+ const envConfig = getConfigurationForEnvironment(config.environment);
211
+ this.config = { ...envConfig, ...config };
212
+ } else {
213
+ this.config = { ...this.config, ...config };
214
+ }
215
+
216
+ // Update console destination based on enableLocalLogging
217
+ if (!this.config.enableLocalLogging) {
218
+ this.removeDestination(this.consoleDestination.identifier);
219
+ } else if (!this.hasDestination(this.consoleDestination.identifier)) {
220
+ this.addDestination(this.consoleDestination);
221
+ }
222
+ }
223
+
224
+ /**
225
+ * Apply configuration for a specific environment.
226
+ * Matches iOS: Logging.applyEnvironmentConfiguration(_ environment:)
227
+ *
228
+ * @param environment - SDK environment
229
+ */
230
+ public applyEnvironmentConfiguration(environment: SDKEnvironment): void {
231
+ const envConfig = getConfigurationForEnvironment(environment);
232
+ this.configure(envConfig);
233
+ }
234
+
235
+ /**
236
+ * Set local logging enabled.
237
+ * Matches iOS: Logging.setLocalLoggingEnabled(_ enabled:)
238
+ */
239
+ public setLocalLoggingEnabled(enabled: boolean): void {
240
+ this.config.enableLocalLogging = enabled;
241
+ if (!enabled) {
242
+ this.removeDestination(this.consoleDestination.identifier);
243
+ } else if (!this.hasDestination(this.consoleDestination.identifier)) {
244
+ this.addDestination(this.consoleDestination);
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Set minimum log level.
250
+ * Matches iOS: Logging.setMinLogLevel(_ level:)
251
+ */
252
+ public setMinLogLevel(level: LogLevel): void {
253
+ this.config.minLogLevel = level;
254
+ }
255
+
256
+ /**
257
+ * Set include device metadata.
258
+ * Matches iOS: Logging.setIncludeDeviceMetadata(_ include:)
259
+ */
260
+ public setIncludeDeviceMetadata(include: boolean): void {
261
+ this.config.includeDeviceMetadata = include;
262
+ }
263
+
264
+ /**
265
+ * Get shared instance
266
+ */
267
+ public static get shared(): LoggingManager {
268
+ if (!LoggingManager.sharedInstance) {
269
+ LoggingManager.sharedInstance = new LoggingManager();
270
+ }
271
+ return LoggingManager.sharedInstance;
272
+ }
273
+
274
+ /**
275
+ * Get current log level
276
+ * @deprecated Use configuration.minLogLevel instead
277
+ */
278
+ public getLogLevel(): LogLevel {
279
+ return this.config.minLogLevel;
280
+ }
281
+
282
+ // ============================================================================
283
+ // Destination Management (matches iOS)
284
+ // ============================================================================
285
+
286
+ /**
287
+ * Add a log destination
288
+ * Matches iOS: addDestination(_ destination: LogDestination)
289
+ */
290
+ public addDestination(destination: LogDestination): void {
291
+ this.destinations.set(destination.identifier, destination);
292
+ }
293
+
294
+ /**
295
+ * Remove a log destination
296
+ * Matches iOS: removeDestination(_ identifier: String)
297
+ */
298
+ public removeDestination(identifier: string): void {
299
+ this.destinations.delete(identifier);
300
+ }
301
+
302
+ /**
303
+ * Get all registered destinations
304
+ */
305
+ public getDestinations(): LogDestination[] {
306
+ return Array.from(this.destinations.values());
307
+ }
308
+
309
+ /**
310
+ * Check if a destination is registered
311
+ */
312
+ public hasDestination(identifier: string): boolean {
313
+ return this.destinations.has(identifier);
314
+ }
315
+
316
+ // ============================================================================
317
+ // Public Log Event Subscription
318
+ // ============================================================================
319
+
320
+ /**
321
+ * Subscribe to all log events (for public exposure)
322
+ * This allows consumers to receive log events for their own logging infrastructure.
323
+ * Matches iOS pattern of exposing log events.
324
+ *
325
+ * @param callback - Function called for each log entry
326
+ * @returns Unsubscribe function
327
+ */
328
+ public onLog(callback: LogEventCallback): () => void {
329
+ return this.eventDestination.subscribe(callback);
330
+ }
331
+
332
+ // ============================================================================
333
+ // Logging Operations
334
+ // ============================================================================
335
+
336
+ /**
337
+ * Log a message.
338
+ * Matches iOS: Logging.log(level:category:message:metadata:)
339
+ */
340
+ public log(
341
+ level: LogLevel,
342
+ category: string,
343
+ message: string,
344
+ metadata?: Record<string, unknown>
345
+ ): void {
346
+ // Filter by minimum log level
347
+ if (level < this.config.minLogLevel) {
348
+ return;
349
+ }
350
+
351
+ // Check if logging is enabled at all
352
+ if (!this.config.enableLocalLogging && this.destinations.size <= 1) {
353
+ // Only event destination, check if there are subscribers
354
+ return;
355
+ }
356
+
357
+ const entry: LogEntry = {
358
+ level,
359
+ category,
360
+ message,
361
+ metadata,
362
+ timestamp: new Date(),
363
+ };
364
+
365
+ // Write to all available destinations
366
+ for (const destination of this.destinations.values()) {
367
+ if (destination.isAvailable) {
368
+ try {
369
+ destination.write(entry);
370
+ } catch {
371
+ // Silently ignore destination errors
372
+ }
373
+ }
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Flush all destinations
379
+ */
380
+ public flush(): void {
381
+ for (const destination of this.destinations.values()) {
382
+ try {
383
+ destination.flush();
384
+ } catch {
385
+ // Silently ignore flush errors
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Get log level description
393
+ */
394
+ function getLogLevelDescription(level: LogLevel): string {
395
+ switch (level) {
396
+ case LogLevel.Debug:
397
+ return 'DEBUG';
398
+ case LogLevel.Info:
399
+ return 'INFO';
400
+ case LogLevel.Warning:
401
+ return 'WARN';
402
+ case LogLevel.Error:
403
+ return 'ERROR';
404
+ case LogLevel.Fault:
405
+ return 'FAULT';
406
+ }
407
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Logging Module
3
+ *
4
+ * Centralized logging infrastructure with multiple destination support.
5
+ * Supports environment-based configuration and multiple log destinations (Console, Sentry, etc.)
6
+ *
7
+ * Matches iOS: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/
8
+ *
9
+ * Usage:
10
+ * import { SDKLogger, LoggingManager, SDKEnvironment, SentryDestination } from '@runanywhere/core';
11
+ *
12
+ * // Configure for production
13
+ * LoggingManager.shared.applyEnvironmentConfiguration(SDKEnvironment.Production);
14
+ *
15
+ * // Add Sentry destination (optional)
16
+ * LoggingManager.shared.addDestination(new SentryDestination(Sentry));
17
+ *
18
+ * // Use loggers
19
+ * SDKLogger.llm.info('Model loaded', { modelId: 'llama-3.2' });
20
+ */
21
+
22
+ // Logger
23
+ export { SDKLogger } from './Logger/SDKLogger';
24
+
25
+ // Log levels
26
+ export { LogLevel, getLogLevelDescription } from './Models/LogLevel';
27
+
28
+ // Configuration
29
+ export {
30
+ type LoggingConfiguration,
31
+ SDKEnvironment,
32
+ developmentConfig,
33
+ stagingConfig,
34
+ productionConfig,
35
+ getConfigurationForEnvironment,
36
+ createLoggingConfiguration,
37
+ } from './Models/LoggingConfiguration';
38
+
39
+ // Logging manager with destinations
40
+ export {
41
+ LoggingManager,
42
+ ConsoleLogDestination,
43
+ EventLogDestination,
44
+ type LogDestination,
45
+ type LogEntry,
46
+ type LogEventCallback,
47
+ } from './Services/LoggingManager';
48
+
49
+ // Sentry destination
50
+ export {
51
+ SentryDestination,
52
+ type SentryInterface,
53
+ } from './Destinations/SentryDestination';
54
+
55
+ // Native log bridge (for receiving logs from iOS/Android)
56
+ export {
57
+ NativeLogBridge,
58
+ type NativeLogEntryData,
59
+ } from './Destinations/NativeLogBridge';
@@ -0,0 +1,92 @@
1
+ /**
2
+ * DeviceIdentity.ts
3
+ *
4
+ * Simple utility for device identity management (UUID persistence)
5
+ *
6
+ * Provides persistent UUID that survives app reinstalls by storing in:
7
+ * - iOS: Keychain
8
+ * - Android: Keystore/EncryptedSharedPreferences
9
+ *
10
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Device/Services/DeviceIdentity.swift
11
+ */
12
+
13
+ import { requireNativeModule } from '../../native';
14
+ import { SDKLogger } from '../Logging/Logger/SDKLogger';
15
+
16
+ const logger = new SDKLogger('DeviceIdentity');
17
+
18
+ /**
19
+ * Cached UUID (matches Swift pattern - avoid repeated native calls)
20
+ */
21
+ let cachedUUID: string | null = null;
22
+
23
+ /**
24
+ * DeviceIdentity - Persistent device UUID management
25
+ *
26
+ * Matches Swift's DeviceIdentity enum pattern:
27
+ * - Uses keychain/keystore for persistence (survives reinstalls)
28
+ * - Caches result after first access
29
+ * - Falls back to UUID generation if needed
30
+ */
31
+ export const DeviceIdentity = {
32
+ /**
33
+ * Get a persistent device UUID that survives app reinstalls
34
+ *
35
+ * Strategy (matches Swift):
36
+ * 1. Return cached value if available (fast path)
37
+ * 2. Try to get from keychain (native call)
38
+ * 3. If not found, native will generate and store
39
+ *
40
+ * @returns Promise<string> Persistent device UUID
41
+ */
42
+ async getPersistentUUID(): Promise<string> {
43
+ // Fast path: return cached value
44
+ if (cachedUUID) {
45
+ return cachedUUID;
46
+ }
47
+
48
+ try {
49
+ const native = requireNativeModule();
50
+ const uuid = await native.getPersistentDeviceUUID();
51
+
52
+ if (uuid && uuid.length > 0) {
53
+ cachedUUID = uuid;
54
+ logger.debug('Got persistent device UUID from native');
55
+ return uuid;
56
+ }
57
+
58
+ throw new Error('Native returned empty UUID');
59
+ } catch (error) {
60
+ logger.error('Failed to get persistent device UUID', { error });
61
+ throw error;
62
+ }
63
+ },
64
+
65
+ /**
66
+ * Get the cached UUID if available (synchronous)
67
+ *
68
+ * @returns Cached UUID or null if not yet loaded
69
+ */
70
+ getCachedUUID(): string | null {
71
+ return cachedUUID;
72
+ },
73
+
74
+ /**
75
+ * Clear the cached UUID (for testing)
76
+ */
77
+ clearCache(): void {
78
+ cachedUUID = null;
79
+ },
80
+
81
+ /**
82
+ * Validate if a device UUID is properly formatted
83
+ *
84
+ * @param uuid UUID string to validate
85
+ * @returns true if valid UUID format
86
+ */
87
+ validateUUID(uuid: string): boolean {
88
+ // UUID format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx (36 chars)
89
+ return uuid.length === 36 && uuid.includes('-');
90
+ },
91
+ };
92
+
@@ -0,0 +1,132 @@
1
+ /**
2
+ * SecureStorageError.ts
3
+ *
4
+ * Errors for secure storage operations
5
+ *
6
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Security/KeychainManager.swift
7
+ */
8
+
9
+ /**
10
+ * Error codes for secure storage operations
11
+ */
12
+ export enum SecureStorageErrorCode {
13
+ EncodingError = 'SECURE_STORAGE_ENCODING_ERROR',
14
+ DecodingError = 'SECURE_STORAGE_DECODING_ERROR',
15
+ ItemNotFound = 'SECURE_STORAGE_ITEM_NOT_FOUND',
16
+ StorageError = 'SECURE_STORAGE_STORAGE_ERROR',
17
+ RetrievalError = 'SECURE_STORAGE_RETRIEVAL_ERROR',
18
+ DeletionError = 'SECURE_STORAGE_DELETION_ERROR',
19
+ UnavailableError = 'SECURE_STORAGE_UNAVAILABLE',
20
+ }
21
+
22
+ /**
23
+ * Secure storage error
24
+ *
25
+ * Matches iOS KeychainError enum.
26
+ */
27
+ export class SecureStorageError extends Error {
28
+ readonly code: SecureStorageErrorCode;
29
+ readonly underlyingError?: Error;
30
+
31
+ constructor(
32
+ code: SecureStorageErrorCode,
33
+ message?: string,
34
+ underlyingError?: Error
35
+ ) {
36
+ const msg = message ?? SecureStorageError.defaultMessage(code);
37
+ super(msg);
38
+ this.name = 'SecureStorageError';
39
+ this.code = code;
40
+ this.underlyingError = underlyingError;
41
+ }
42
+
43
+ private static defaultMessage(code: SecureStorageErrorCode): string {
44
+ switch (code) {
45
+ case SecureStorageErrorCode.EncodingError:
46
+ return 'Failed to encode data for secure storage';
47
+ case SecureStorageErrorCode.DecodingError:
48
+ return 'Failed to decode data from secure storage';
49
+ case SecureStorageErrorCode.ItemNotFound:
50
+ return 'Item not found in secure storage';
51
+ case SecureStorageErrorCode.StorageError:
52
+ return 'Failed to store item in secure storage';
53
+ case SecureStorageErrorCode.RetrievalError:
54
+ return 'Failed to retrieve item from secure storage';
55
+ case SecureStorageErrorCode.DeletionError:
56
+ return 'Failed to delete item from secure storage';
57
+ case SecureStorageErrorCode.UnavailableError:
58
+ return 'Secure storage is not available';
59
+ }
60
+ }
61
+
62
+ // Factory methods
63
+ static encodingError(underlyingError?: Error): SecureStorageError {
64
+ return new SecureStorageError(
65
+ SecureStorageErrorCode.EncodingError,
66
+ undefined,
67
+ underlyingError
68
+ );
69
+ }
70
+
71
+ static decodingError(underlyingError?: Error): SecureStorageError {
72
+ return new SecureStorageError(
73
+ SecureStorageErrorCode.DecodingError,
74
+ undefined,
75
+ underlyingError
76
+ );
77
+ }
78
+
79
+ static itemNotFound(key: string): SecureStorageError {
80
+ return new SecureStorageError(
81
+ SecureStorageErrorCode.ItemNotFound,
82
+ `Item not found in secure storage: ${key}`
83
+ );
84
+ }
85
+
86
+ static storageError(underlyingError?: Error): SecureStorageError {
87
+ return new SecureStorageError(
88
+ SecureStorageErrorCode.StorageError,
89
+ undefined,
90
+ underlyingError
91
+ );
92
+ }
93
+
94
+ static retrievalError(underlyingError?: Error): SecureStorageError {
95
+ return new SecureStorageError(
96
+ SecureStorageErrorCode.RetrievalError,
97
+ undefined,
98
+ underlyingError
99
+ );
100
+ }
101
+
102
+ static deletionError(underlyingError?: Error): SecureStorageError {
103
+ return new SecureStorageError(
104
+ SecureStorageErrorCode.DeletionError,
105
+ undefined,
106
+ underlyingError
107
+ );
108
+ }
109
+
110
+ static unavailable(): SecureStorageError {
111
+ return new SecureStorageError(SecureStorageErrorCode.UnavailableError);
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Type guard to check if an error is a SecureStorageError
117
+ */
118
+ export function isSecureStorageError(
119
+ error: unknown
120
+ ): error is SecureStorageError {
121
+ return error instanceof SecureStorageError;
122
+ }
123
+
124
+ /**
125
+ * Type guard to check if error is "item not found" specifically
126
+ */
127
+ export function isItemNotFoundError(error: unknown): boolean {
128
+ return (
129
+ isSecureStorageError(error) &&
130
+ error.code === SecureStorageErrorCode.ItemNotFound
131
+ );
132
+ }