@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,35 @@
1
+ /**
2
+ * SecureStorageKeys.ts
3
+ *
4
+ * Keychain/secure storage key constants
5
+ *
6
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Security/KeychainManager.swift
7
+ */
8
+
9
+ /**
10
+ * Keys for secure storage (keychain on iOS, keystore on Android)
11
+ *
12
+ * These match the iOS KeychainKey enum values exactly.
13
+ */
14
+ export const SecureStorageKeys = {
15
+ // SDK Core
16
+ apiKey: 'com.runanywhere.sdk.apiKey',
17
+ baseURL: 'com.runanywhere.sdk.baseURL',
18
+ environment: 'com.runanywhere.sdk.environment',
19
+
20
+ // Device Identity
21
+ deviceUUID: 'com.runanywhere.sdk.device.uuid',
22
+
23
+ // Authentication Tokens
24
+ accessToken: 'com.runanywhere.sdk.accessToken',
25
+ refreshToken: 'com.runanywhere.sdk.refreshToken',
26
+ tokenExpiresAt: 'com.runanywhere.sdk.tokenExpiresAt',
27
+
28
+ // User/Org Identity
29
+ deviceId: 'com.runanywhere.sdk.deviceId',
30
+ userId: 'com.runanywhere.sdk.userId',
31
+ organizationId: 'com.runanywhere.sdk.organizationId',
32
+ } as const;
33
+
34
+ export type SecureStorageKey =
35
+ (typeof SecureStorageKeys)[keyof typeof SecureStorageKeys];
@@ -0,0 +1,449 @@
1
+ /**
2
+ * SecureStorageService.ts
3
+ *
4
+ * Secure storage abstraction for React Native
5
+ *
6
+ * This service provides secure key-value storage that uses:
7
+ * - iOS: Keychain (via native module)
8
+ * - Android: Keystore (via native module)
9
+ *
10
+ * In React Native, actual secure storage is delegated to the native layer.
11
+ * This TS layer provides type-safe APIs and caching.
12
+ *
13
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Security/KeychainManager.swift
14
+ */
15
+
16
+ import { requireNativeModule } from '../../native';
17
+ import { SDKLogger } from '../Logging/Logger/SDKLogger';
18
+ import { SecureStorageError, isItemNotFoundError } from './SecureStorageError';
19
+ import { SecureStorageKeys, type SecureStorageKey } from './SecureStorageKeys';
20
+ import type { SDKInitParams } from '../Initialization';
21
+ import type { SDKEnvironment } from '../../types';
22
+
23
+ /**
24
+ * Extended native module type for secure storage methods
25
+ * These methods are optional and may not be available on all platforms
26
+ */
27
+ interface SecureStorageNativeModule {
28
+ secureStorageIsAvailable?: () => Promise<boolean>;
29
+ secureStorageStore?: (key: string, value: string) => Promise<void>;
30
+ secureStorageRetrieve?: (key: string) => Promise<string | null>;
31
+ secureStorageDelete?: (key: string) => Promise<void>;
32
+ secureStorageExists?: (key: string) => Promise<boolean>;
33
+ }
34
+
35
+ /**
36
+ * Secure storage service
37
+ *
38
+ * Provides secure key-value storage matching iOS KeychainManager.
39
+ * All actual storage is delegated to the native layer.
40
+ */
41
+ class SecureStorageServiceImpl {
42
+ private readonly logger = new SDKLogger('SecureStorageService');
43
+
44
+ // In-memory cache for frequently accessed values
45
+ private cache: Map<string, string> = new Map();
46
+
47
+ // Flag to track if native storage is available
48
+ private _isAvailable: boolean | null = null;
49
+
50
+ /**
51
+ * Check if secure storage is available
52
+ *
53
+ * Secure storage uses platform-native storage:
54
+ * - iOS: Keychain (always available)
55
+ * - Android: Keystore/EncryptedSharedPreferences (always available)
56
+ */
57
+ async isAvailable(): Promise<boolean> {
58
+ if (this._isAvailable !== null) {
59
+ return this._isAvailable;
60
+ }
61
+
62
+ try {
63
+ const native = requireNativeModule();
64
+ // Verify native module is available by checking for secure storage methods
65
+ // The methods are implemented in C++ and use platform callbacks
66
+ this._isAvailable =
67
+ typeof native.secureStorageSet === 'function' &&
68
+ typeof native.secureStorageGet === 'function';
69
+ return this._isAvailable;
70
+ } catch {
71
+ this._isAvailable = false;
72
+ return false;
73
+ }
74
+ }
75
+
76
+ // ============================================================
77
+ // Generic Storage Methods
78
+ // ============================================================
79
+
80
+ /**
81
+ * Store a string value securely
82
+ *
83
+ * Uses native secure storage:
84
+ * - iOS: Keychain
85
+ * - Android: Keystore/EncryptedSharedPreferences
86
+ *
87
+ * @param value - String value to store
88
+ * @param key - Storage key
89
+ */
90
+ async store(value: string, key: SecureStorageKey | string): Promise<void> {
91
+ try {
92
+ const native = requireNativeModule() as unknown as SecureStorageNativeModule;
93
+
94
+ // Use the new native method
95
+ const success = await native.secureStorageSet(key, value);
96
+
97
+ if (!success) {
98
+ throw new Error(`Native secureStorageSet returned false for key: ${key}`);
99
+ }
100
+
101
+ // Update cache
102
+ this.cache.set(key, value);
103
+ this.logger.debug(`Stored value for key: ${key}`);
104
+ } catch (error) {
105
+ this.logger.error(`Failed to store value for key: ${key}`, { error });
106
+ throw SecureStorageError.storageError(
107
+ error instanceof Error ? error : undefined
108
+ );
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Retrieve a string value from secure storage
114
+ *
115
+ * Uses native secure storage:
116
+ * - iOS: Keychain
117
+ * - Android: Keystore/EncryptedSharedPreferences
118
+ *
119
+ * @param key - Storage key
120
+ * @returns Stored value or null if not found
121
+ */
122
+ async retrieve(key: SecureStorageKey | string): Promise<string | null> {
123
+ // Check cache first
124
+ const cached = this.cache.get(key);
125
+ if (cached !== undefined) {
126
+ return cached;
127
+ }
128
+
129
+ try {
130
+ const native = requireNativeModule() as unknown as SecureStorageNativeModule;
131
+
132
+ // Use the new native method
133
+ const value = await native.secureStorageGet(key);
134
+
135
+ if (value !== null && value !== undefined) {
136
+ this.cache.set(key, value);
137
+ }
138
+ return value ?? null;
139
+ } catch (error) {
140
+ // Item not found is not an error - just return null
141
+ if (isItemNotFoundError(error)) {
142
+ return null;
143
+ }
144
+
145
+ this.logger.error(`Failed to retrieve value for key: ${key}`, { error });
146
+ throw SecureStorageError.retrievalError(
147
+ error instanceof Error ? error : undefined
148
+ );
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Delete a value from secure storage
154
+ *
155
+ * Uses native secure storage:
156
+ * - iOS: Keychain
157
+ * - Android: Keystore/EncryptedSharedPreferences
158
+ *
159
+ * @param key - Storage key
160
+ */
161
+ async delete(key: SecureStorageKey | string): Promise<void> {
162
+ try {
163
+ const native = requireNativeModule() as unknown as SecureStorageNativeModule;
164
+
165
+ // Use the new native method
166
+ await native.secureStorageDelete(key);
167
+
168
+ // Remove from cache
169
+ this.cache.delete(key);
170
+ this.logger.debug(`Deleted value for key: ${key}`);
171
+ } catch (error) {
172
+ // Ignore "not found" errors on delete
173
+ if (!isItemNotFoundError(error)) {
174
+ this.logger.error(`Failed to delete value for key: ${key}`, { error });
175
+ throw SecureStorageError.deletionError(
176
+ error instanceof Error ? error : undefined
177
+ );
178
+ }
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Check if a key exists in secure storage
184
+ *
185
+ * Uses native secure storage:
186
+ * - iOS: Keychain
187
+ * - Android: Keystore/EncryptedSharedPreferences
188
+ *
189
+ * @param key - Storage key
190
+ * @returns True if key exists
191
+ */
192
+ async exists(key: SecureStorageKey | string): Promise<boolean> {
193
+ // Check cache first
194
+ if (this.cache.has(key)) {
195
+ return true;
196
+ }
197
+
198
+ try {
199
+ const native = requireNativeModule() as unknown as SecureStorageNativeModule;
200
+
201
+ // Use the new native method
202
+ return await native.secureStorageExists(key);
203
+ } catch {
204
+ return false;
205
+ }
206
+ }
207
+
208
+ // ============================================================
209
+ // SDK Parameters Storage (matching iOS KeychainManager)
210
+ // ============================================================
211
+
212
+ /**
213
+ * Store SDK initialization parameters
214
+ *
215
+ * @param params - SDK init params
216
+ */
217
+ async storeSDKParams(params: SDKInitParams): Promise<void> {
218
+ const promises: Promise<void>[] = [];
219
+
220
+ if (params.apiKey) {
221
+ promises.push(this.store(params.apiKey, SecureStorageKeys.apiKey));
222
+ }
223
+ if (params.baseURL) {
224
+ promises.push(this.store(params.baseURL, SecureStorageKeys.baseURL));
225
+ }
226
+ promises.push(this.store(params.environment, SecureStorageKeys.environment));
227
+
228
+ await Promise.all(promises);
229
+ this.logger.info('SDK parameters stored securely');
230
+ }
231
+
232
+ /**
233
+ * Retrieve stored SDK parameters
234
+ *
235
+ * @returns Stored SDK params or null if not found
236
+ */
237
+ async retrieveSDKParams(): Promise<SDKInitParams | null> {
238
+ const [apiKey, baseURL, environment] = await Promise.all([
239
+ this.retrieve(SecureStorageKeys.apiKey),
240
+ this.retrieve(SecureStorageKeys.baseURL),
241
+ this.retrieve(SecureStorageKeys.environment),
242
+ ]);
243
+
244
+ if (!apiKey || !baseURL || !environment) {
245
+ this.logger.debug('No stored SDK parameters found');
246
+ return null;
247
+ }
248
+
249
+ this.logger.debug('Retrieved SDK parameters from secure storage');
250
+ return {
251
+ apiKey,
252
+ baseURL,
253
+ environment: environment as SDKEnvironment,
254
+ };
255
+ }
256
+
257
+ /**
258
+ * Clear stored SDK parameters
259
+ */
260
+ async clearSDKParams(): Promise<void> {
261
+ await Promise.all([
262
+ this.delete(SecureStorageKeys.apiKey),
263
+ this.delete(SecureStorageKeys.baseURL),
264
+ this.delete(SecureStorageKeys.environment),
265
+ ]);
266
+ this.logger.info('SDK parameters cleared from secure storage');
267
+ }
268
+
269
+ // ============================================================
270
+ // Device Identity Storage
271
+ // ============================================================
272
+
273
+ /**
274
+ * Store device UUID
275
+ *
276
+ * @param uuid - Device UUID
277
+ */
278
+ async storeDeviceUUID(uuid: string): Promise<void> {
279
+ await this.store(uuid, SecureStorageKeys.deviceUUID);
280
+ this.logger.debug('Device UUID stored');
281
+ }
282
+
283
+ /**
284
+ * Retrieve device UUID
285
+ *
286
+ * @returns Stored device UUID or null
287
+ */
288
+ async retrieveDeviceUUID(): Promise<string | null> {
289
+ return this.retrieve(SecureStorageKeys.deviceUUID);
290
+ }
291
+
292
+ // ============================================================
293
+ // Authentication Token Storage
294
+ // ============================================================
295
+
296
+ /**
297
+ * Store authentication tokens
298
+ *
299
+ * @param accessToken - Access token
300
+ * @param refreshToken - Refresh token
301
+ * @param expiresAt - Token expiration timestamp (Unix ms)
302
+ */
303
+ async storeAuthTokens(
304
+ accessToken: string,
305
+ refreshToken: string,
306
+ expiresAt: number
307
+ ): Promise<void> {
308
+ await Promise.all([
309
+ this.store(accessToken, SecureStorageKeys.accessToken),
310
+ this.store(refreshToken, SecureStorageKeys.refreshToken),
311
+ this.store(expiresAt.toString(), SecureStorageKeys.tokenExpiresAt),
312
+ ]);
313
+ this.logger.debug('Auth tokens stored');
314
+ }
315
+
316
+ /**
317
+ * Retrieve stored auth tokens
318
+ *
319
+ * @returns Stored tokens or null if not found
320
+ */
321
+ async retrieveAuthTokens(): Promise<{
322
+ accessToken: string;
323
+ refreshToken: string;
324
+ expiresAt: number;
325
+ } | null> {
326
+ const [accessToken, refreshToken, expiresAtStr] = await Promise.all([
327
+ this.retrieve(SecureStorageKeys.accessToken),
328
+ this.retrieve(SecureStorageKeys.refreshToken),
329
+ this.retrieve(SecureStorageKeys.tokenExpiresAt),
330
+ ]);
331
+
332
+ if (!accessToken || !refreshToken) {
333
+ return null;
334
+ }
335
+
336
+ const expiresAt = expiresAtStr ? parseInt(expiresAtStr, 10) : 0;
337
+ return { accessToken, refreshToken, expiresAt };
338
+ }
339
+
340
+ /**
341
+ * Clear stored auth tokens
342
+ */
343
+ async clearAuthTokens(): Promise<void> {
344
+ await Promise.all([
345
+ this.delete(SecureStorageKeys.accessToken),
346
+ this.delete(SecureStorageKeys.refreshToken),
347
+ this.delete(SecureStorageKeys.tokenExpiresAt),
348
+ ]);
349
+ this.logger.debug('Auth tokens cleared');
350
+ }
351
+
352
+ // ============================================================
353
+ // Identity Storage
354
+ // ============================================================
355
+
356
+ /**
357
+ * Store identity information
358
+ *
359
+ * @param deviceId - Device ID from backend
360
+ * @param userId - User ID (optional)
361
+ * @param organizationId - Organization ID
362
+ */
363
+ async storeIdentity(
364
+ deviceId: string,
365
+ organizationId: string,
366
+ userId?: string
367
+ ): Promise<void> {
368
+ const promises = [
369
+ this.store(deviceId, SecureStorageKeys.deviceId),
370
+ this.store(organizationId, SecureStorageKeys.organizationId),
371
+ ];
372
+
373
+ if (userId) {
374
+ promises.push(this.store(userId, SecureStorageKeys.userId));
375
+ }
376
+
377
+ await Promise.all(promises);
378
+ this.logger.debug('Identity info stored');
379
+ }
380
+
381
+ /**
382
+ * Retrieve stored identity
383
+ *
384
+ * @returns Stored identity or null
385
+ */
386
+ async retrieveIdentity(): Promise<{
387
+ deviceId: string;
388
+ userId?: string;
389
+ organizationId: string;
390
+ } | null> {
391
+ const [deviceId, userId, organizationId] = await Promise.all([
392
+ this.retrieve(SecureStorageKeys.deviceId),
393
+ this.retrieve(SecureStorageKeys.userId),
394
+ this.retrieve(SecureStorageKeys.organizationId),
395
+ ]);
396
+
397
+ if (!deviceId || !organizationId) {
398
+ return null;
399
+ }
400
+
401
+ return {
402
+ deviceId,
403
+ userId: userId ?? undefined,
404
+ organizationId,
405
+ };
406
+ }
407
+
408
+ /**
409
+ * Clear all stored identity info
410
+ */
411
+ async clearIdentity(): Promise<void> {
412
+ await Promise.all([
413
+ this.delete(SecureStorageKeys.deviceId),
414
+ this.delete(SecureStorageKeys.userId),
415
+ this.delete(SecureStorageKeys.organizationId),
416
+ ]);
417
+ this.logger.debug('Identity info cleared');
418
+ }
419
+
420
+ // ============================================================
421
+ // Utility
422
+ // ============================================================
423
+
424
+ /**
425
+ * Clear all cached values
426
+ */
427
+ clearCache(): void {
428
+ this.cache.clear();
429
+ }
430
+
431
+ /**
432
+ * Clear all stored data (for logout/reset)
433
+ */
434
+ async clearAll(): Promise<void> {
435
+ await Promise.all([
436
+ this.clearSDKParams(),
437
+ this.clearAuthTokens(),
438
+ this.clearIdentity(),
439
+ this.delete(SecureStorageKeys.deviceUUID),
440
+ ]);
441
+ this.clearCache();
442
+ this.logger.info('All secure storage cleared');
443
+ }
444
+ }
445
+
446
+ /**
447
+ * Singleton instance
448
+ */
449
+ export const SecureStorageService = new SecureStorageServiceImpl();
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Security Module
3
+ *
4
+ * Secure storage and credential management
5
+ *
6
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Foundation/Security/
7
+ */
8
+
9
+ export { SecureStorageService } from './SecureStorageService';
10
+ export { SecureStorageKeys, type SecureStorageKey } from './SecureStorageKeys';
11
+ export {
12
+ SecureStorageError,
13
+ SecureStorageErrorCode,
14
+ isSecureStorageError,
15
+ isItemNotFoundError,
16
+ } from './SecureStorageError';
17
+ export { DeviceIdentity } from './DeviceIdentity';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Foundation Module
3
+ *
4
+ * Core infrastructure for the SDK.
5
+ * Matches iOS SDK: Foundation/
6
+ */
7
+
8
+ // Constants
9
+ export { SDKConstants } from './Constants';
10
+
11
+ // Error Types
12
+ export * from './ErrorTypes';
13
+
14
+ // Initialization
15
+ export * from './Initialization';
16
+
17
+ // Security
18
+ export * from './Security';
19
+
20
+ // Dependency Injection
21
+ export * from './DependencyInjection';
22
+
23
+ // Logging
24
+ export { SDKLogger } from './Logging/Logger/SDKLogger';
25
+ export { LogLevel } from './Logging/Models/LogLevel';
26
+ export { LoggingManager } from './Logging/Services/LoggingManager';
@@ -0,0 +1,165 @@
1
+ /**
2
+ * EventPublisher
3
+ *
4
+ * Single entry point for all SDK event tracking.
5
+ * Routes events to EventBus for public consumption.
6
+ * Analytics/telemetry is now handled by native commons.
7
+ *
8
+ * Reference: sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Events/EventPublisher.swift
9
+ */
10
+
11
+ import { EventDestination, type SDKEvent } from './SDKEvent';
12
+ import { EventBus } from '../../Public/Events/EventBus';
13
+ import type { AnySDKEvent } from '../../types/events';
14
+ import { SDKLogger } from '../../Foundation/Logging/Logger/SDKLogger';
15
+
16
+ const logger = new SDKLogger('EventPublisher');
17
+
18
+ // ============================================================================
19
+ // EventPublisher Class
20
+ // ============================================================================
21
+
22
+ /**
23
+ * Central event publisher that routes SDK events to appropriate destinations.
24
+ *
25
+ * Design:
26
+ * - Single entry point for all event tracking in the SDK
27
+ * - Routes to EventBus for public events
28
+ * - Analytics/telemetry is handled by native commons
29
+ *
30
+ * Usage:
31
+ * ```typescript
32
+ * // Track an event
33
+ * EventPublisher.shared.track(myEvent);
34
+ * ```
35
+ */
36
+ class EventPublisherImpl {
37
+ private isInitialized = false;
38
+
39
+ /**
40
+ * Initialize the publisher.
41
+ * Should be called during SDK startup.
42
+ */
43
+ initialize(): void {
44
+ this.isInitialized = true;
45
+ logger.debug('EventPublisher initialized');
46
+ }
47
+
48
+ /**
49
+ * Check if the publisher is initialized.
50
+ */
51
+ get initialized(): boolean {
52
+ return this.isInitialized;
53
+ }
54
+
55
+ /**
56
+ * Track an event synchronously.
57
+ * Routes to EventBus based on event.destination.
58
+ *
59
+ * @param event - The SDK event to track
60
+ */
61
+ track(event: SDKEvent): void {
62
+ const destination = event.destination;
63
+
64
+ // Route to EventBus (public) - unless analyticsOnly
65
+ if (destination !== EventDestination.AnalyticsOnly) {
66
+ this.publishToEventBus(event);
67
+ }
68
+
69
+ // Analytics events are now handled by native commons via
70
+ // the rac_* API - no JS-side analytics queue needed
71
+ }
72
+
73
+ /**
74
+ * Track an event asynchronously.
75
+ * Use this in async contexts.
76
+ *
77
+ * @param event - The SDK event to track
78
+ */
79
+ async trackAsync(event: SDKEvent): Promise<void> {
80
+ this.track(event);
81
+ }
82
+
83
+ /**
84
+ * Track multiple events at once.
85
+ *
86
+ * @param events - Array of SDK events to track
87
+ */
88
+ trackBatch(events: SDKEvent[]): void {
89
+ for (const event of events) {
90
+ this.track(event);
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Publish an event to the EventBus for public consumption.
96
+ */
97
+ private publishToEventBus(event: SDKEvent): void {
98
+ // Map category to native event type for EventBus
99
+ const eventTypeMap: Record<string, string> = {
100
+ sdk: 'Initialization',
101
+ model: 'Model',
102
+ llm: 'Generation',
103
+ stt: 'Voice',
104
+ tts: 'Voice',
105
+ voice: 'Voice',
106
+ storage: 'Storage',
107
+ device: 'Device',
108
+ network: 'Network',
109
+ error: 'Initialization', // Errors go through initialization channel
110
+ };
111
+
112
+ const eventType = eventTypeMap[event.category] ?? 'Model';
113
+
114
+ // Create a simplified event object for EventBus
115
+ // EventBus expects events with { type: string, ...properties }
116
+ const busEvent = {
117
+ type: event.type,
118
+ timestamp: event.timestamp.toISOString(),
119
+ ...event.properties,
120
+ } as AnySDKEvent;
121
+
122
+ EventBus.publish(eventType, busEvent);
123
+ }
124
+
125
+ /**
126
+ * Flush all pending analytics events.
127
+ * No-op since analytics is now in native commons.
128
+ */
129
+ async flush(): Promise<void> {
130
+ // Analytics flushing is handled by native commons
131
+ }
132
+
133
+ /**
134
+ * Reset the publisher state.
135
+ * Primarily used for testing.
136
+ */
137
+ reset(): void {
138
+ this.isInitialized = false;
139
+ }
140
+ }
141
+
142
+ // ============================================================================
143
+ // Singleton Instance
144
+ // ============================================================================
145
+
146
+ /**
147
+ * Shared EventPublisher singleton.
148
+ *
149
+ * Usage:
150
+ * ```typescript
151
+ * import { EventPublisher } from './Infrastructure/Events';
152
+ *
153
+ * // Initialize once during SDK startup
154
+ * EventPublisher.shared.initialize();
155
+ *
156
+ * // Track events anywhere in the SDK
157
+ * EventPublisher.shared.track(myEvent);
158
+ * ```
159
+ */
160
+ export const EventPublisher = {
161
+ /** Singleton instance */
162
+ shared: new EventPublisherImpl(),
163
+ };
164
+
165
+ export type { EventPublisherImpl };