@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,570 @@
1
+ /**
2
+ * PlatformAdapterBridge.m
3
+ *
4
+ * C bridge to call Swift PlatformAdapter/KeychainManager from C++.
5
+ * This bridge is necessary because C++ cannot directly call Swift code.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <UIKit/UIKit.h>
10
+
11
+ // Import the generated Swift header from the pod
12
+ #if __has_include(<RunAnywhereCore/RunAnywhereCore-Swift.h>)
13
+ #import <RunAnywhereCore/RunAnywhereCore-Swift.h>
14
+ #elif __has_include("RunAnywhereCore-Swift.h")
15
+ #import "RunAnywhereCore-Swift.h"
16
+ #else
17
+ // Forward declare the Swift classes if header not found
18
+ @interface KeychainManager : NSObject
19
+ + (KeychainManager * _Nonnull)shared;
20
+ - (BOOL)set:(NSString * _Nonnull)value forKey:(NSString * _Nonnull)key;
21
+ - (NSString * _Nullable)getForKey:(NSString * _Nonnull)key;
22
+ - (BOOL)deleteForKey:(NSString * _Nonnull)key;
23
+ - (BOOL)existsForKey:(NSString * _Nonnull)key;
24
+ @end
25
+
26
+ @interface PlatformAdapter : NSObject
27
+ + (PlatformAdapter * _Nonnull)shared;
28
+ - (NSString * _Nonnull)getPersistentDeviceUUID;
29
+ @end
30
+ #endif
31
+
32
+ // ============================================================================
33
+ // Secure Storage (Keychain)
34
+ // ============================================================================
35
+
36
+ /**
37
+ * Set a value in the Keychain
38
+ * @param key The key to store under
39
+ * @param value The value to store
40
+ * @return true if successful
41
+ */
42
+ bool PlatformAdapter_secureSet(const char* key, const char* value) {
43
+ @autoreleasepool {
44
+ if (key == NULL || value == NULL) {
45
+ NSLog(@"[PlatformAdapterBridge] secureSet: Invalid null key or value");
46
+ return false;
47
+ }
48
+
49
+ NSString* keyStr = [NSString stringWithUTF8String:key];
50
+ NSString* valueStr = [NSString stringWithUTF8String:value];
51
+
52
+ if (keyStr == nil || valueStr == nil) {
53
+ NSLog(@"[PlatformAdapterBridge] secureSet: Failed to create NSString");
54
+ return false;
55
+ }
56
+
57
+ @try {
58
+ BOOL result = [[KeychainManager shared] set:valueStr forKey:keyStr];
59
+ NSLog(@"[PlatformAdapterBridge] secureSet key=%@ result=%d", keyStr, result);
60
+ return result;
61
+ } @catch (NSException *exception) {
62
+ NSLog(@"[PlatformAdapterBridge] secureSet exception: %@", exception);
63
+ return false;
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Get a value from the Keychain
70
+ * @param key The key to retrieve
71
+ * @param outValue Pointer to store the result (must be freed by caller)
72
+ * @return true if found
73
+ */
74
+ bool PlatformAdapter_secureGet(const char* key, char** outValue) {
75
+ @autoreleasepool {
76
+ if (key == NULL || outValue == NULL) {
77
+ NSLog(@"[PlatformAdapterBridge] secureGet: Invalid null key or outValue");
78
+ return false;
79
+ }
80
+
81
+ *outValue = NULL;
82
+
83
+ NSString* keyStr = [NSString stringWithUTF8String:key];
84
+ if (keyStr == nil) {
85
+ NSLog(@"[PlatformAdapterBridge] secureGet: Failed to create NSString for key");
86
+ return false;
87
+ }
88
+
89
+ @try {
90
+ NSString* value = [[KeychainManager shared] getForKey:keyStr];
91
+ if (value == nil) {
92
+ NSLog(@"[PlatformAdapterBridge] secureGet key=%@ not found", keyStr);
93
+ return false;
94
+ }
95
+
96
+ const char* utf8Value = [value UTF8String];
97
+ if (utf8Value == NULL) {
98
+ return false;
99
+ }
100
+
101
+ *outValue = strdup(utf8Value);
102
+ NSLog(@"[PlatformAdapterBridge] secureGet key=%@ found", keyStr);
103
+ return *outValue != NULL;
104
+ } @catch (NSException *exception) {
105
+ NSLog(@"[PlatformAdapterBridge] secureGet exception: %@", exception);
106
+ return false;
107
+ }
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Delete a value from the Keychain
113
+ * @param key The key to delete
114
+ * @return true if successful
115
+ */
116
+ bool PlatformAdapter_secureDelete(const char* key) {
117
+ @autoreleasepool {
118
+ if (key == NULL) {
119
+ NSLog(@"[PlatformAdapterBridge] secureDelete: Invalid null key");
120
+ return false;
121
+ }
122
+
123
+ NSString* keyStr = [NSString stringWithUTF8String:key];
124
+ if (keyStr == nil) {
125
+ return false;
126
+ }
127
+
128
+ @try {
129
+ BOOL result = [[KeychainManager shared] deleteForKey:keyStr];
130
+ return result;
131
+ } @catch (NSException *exception) {
132
+ NSLog(@"[PlatformAdapterBridge] secureDelete exception: %@", exception);
133
+ return false;
134
+ }
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Check if a key exists in the Keychain
140
+ * @param key The key to check
141
+ * @return true if exists
142
+ */
143
+ bool PlatformAdapter_secureExists(const char* key) {
144
+ @autoreleasepool {
145
+ if (key == NULL) {
146
+ return false;
147
+ }
148
+
149
+ NSString* keyStr = [NSString stringWithUTF8String:key];
150
+ if (keyStr == nil) {
151
+ return false;
152
+ }
153
+
154
+ @try {
155
+ return [[KeychainManager shared] existsForKey:keyStr];
156
+ } @catch (NSException *exception) {
157
+ return false;
158
+ }
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Get persistent device UUID (from Keychain or generate new)
164
+ * @param outValue Pointer to store the UUID (must be freed by caller)
165
+ * @return true if successful
166
+ */
167
+ bool PlatformAdapter_getPersistentDeviceUUID(char** outValue) {
168
+ @autoreleasepool {
169
+ if (outValue == NULL) {
170
+ return false;
171
+ }
172
+
173
+ *outValue = NULL;
174
+
175
+ @try {
176
+ NSString* uuid = [[PlatformAdapter shared] getPersistentDeviceUUID];
177
+ if (uuid == nil || uuid.length == 0) {
178
+ NSLog(@"[PlatformAdapterBridge] getPersistentDeviceUUID: Failed to get UUID");
179
+ return false;
180
+ }
181
+
182
+ const char* utf8Value = [uuid UTF8String];
183
+ if (utf8Value == NULL) {
184
+ return false;
185
+ }
186
+
187
+ *outValue = strdup(utf8Value);
188
+ NSLog(@"[PlatformAdapterBridge] getPersistentDeviceUUID: %@", uuid);
189
+ return *outValue != NULL;
190
+ } @catch (NSException *exception) {
191
+ NSLog(@"[PlatformAdapterBridge] getPersistentDeviceUUID exception: %@", exception);
192
+ return false;
193
+ }
194
+ }
195
+ }
196
+
197
+ // ============================================================================
198
+ // Device Info (Synchronous)
199
+ // ============================================================================
200
+
201
+ #import <sys/utsname.h>
202
+ #import <mach/mach.h>
203
+
204
+ /**
205
+ * Get the raw machine identifier (e.g., "iPhone17,1")
206
+ */
207
+ static NSString* getMachineIdentifier(void) {
208
+ struct utsname systemInfo;
209
+ uname(&systemInfo);
210
+ return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
211
+ }
212
+
213
+ /**
214
+ * Get human-readable device model name
215
+ */
216
+ static NSString* getDeviceModelName(NSString* identifier) {
217
+ // iPhone models
218
+ NSDictionary* models = @{
219
+ // iPhone 16 series
220
+ @"iPhone17,1": @"iPhone 16 Pro",
221
+ @"iPhone17,2": @"iPhone 16 Pro Max",
222
+ @"iPhone17,3": @"iPhone 16",
223
+ @"iPhone17,4": @"iPhone 16 Plus",
224
+ // iPhone 15 series
225
+ @"iPhone16,1": @"iPhone 15 Pro",
226
+ @"iPhone16,2": @"iPhone 15 Pro Max",
227
+ @"iPhone15,4": @"iPhone 15",
228
+ @"iPhone15,5": @"iPhone 15 Plus",
229
+ // iPhone 14 series
230
+ @"iPhone15,2": @"iPhone 14 Pro",
231
+ @"iPhone15,3": @"iPhone 14 Pro Max",
232
+ @"iPhone14,7": @"iPhone 14",
233
+ @"iPhone14,8": @"iPhone 14 Plus",
234
+ // iPad models
235
+ @"iPad14,1": @"iPad Pro 11-inch (4th generation)",
236
+ @"iPad14,2": @"iPad Pro 12.9-inch (6th generation)",
237
+ // Simulator
238
+ @"x86_64": @"Simulator",
239
+ @"arm64": @"Simulator",
240
+ };
241
+
242
+ NSString* name = models[identifier];
243
+ return name ?: identifier;
244
+ }
245
+
246
+ /**
247
+ * Get chip name for device model
248
+ */
249
+ static NSString* getChipNameForModel(NSString* identifier) {
250
+ NSDictionary* chips = @{
251
+ // A18 Pro
252
+ @"iPhone17,1": @"A18 Pro",
253
+ @"iPhone17,2": @"A18 Pro",
254
+ // A18
255
+ @"iPhone17,3": @"A18",
256
+ @"iPhone17,4": @"A18",
257
+ // A17 Pro
258
+ @"iPhone16,1": @"A17 Pro",
259
+ @"iPhone16,2": @"A17 Pro",
260
+ // A16 Bionic
261
+ @"iPhone15,2": @"A16 Bionic",
262
+ @"iPhone15,3": @"A16 Bionic",
263
+ @"iPhone15,4": @"A16 Bionic",
264
+ @"iPhone15,5": @"A16 Bionic",
265
+ // A15 Bionic
266
+ @"iPhone14,7": @"A15 Bionic",
267
+ @"iPhone14,8": @"A15 Bionic",
268
+ // M2
269
+ @"iPad14,1": @"M2",
270
+ @"iPad14,2": @"M2",
271
+ };
272
+
273
+ NSString* chip = chips[identifier];
274
+ return chip ?: @"Apple Silicon";
275
+ }
276
+
277
+ bool PlatformAdapter_getDeviceModel(char** outValue) {
278
+ @autoreleasepool {
279
+ if (!outValue) return false;
280
+ *outValue = NULL;
281
+
282
+ @try {
283
+ NSString* identifier = getMachineIdentifier();
284
+
285
+ // Check for simulator
286
+ #if TARGET_OS_SIMULATOR
287
+ NSDictionary* env = [[NSProcessInfo processInfo] environment];
288
+ NSString* simModelId = env[@"SIMULATOR_MODEL_IDENTIFIER"];
289
+ if (simModelId) {
290
+ identifier = simModelId;
291
+ }
292
+ #endif
293
+
294
+ NSString* modelName = getDeviceModelName(identifier);
295
+ *outValue = strdup([modelName UTF8String]);
296
+ return *outValue != NULL;
297
+ } @catch (NSException* exception) {
298
+ return false;
299
+ }
300
+ }
301
+ }
302
+
303
+ bool PlatformAdapter_getOSVersion(char** outValue) {
304
+ @autoreleasepool {
305
+ if (!outValue) return false;
306
+ *outValue = NULL;
307
+
308
+ @try {
309
+ NSString* version = [[UIDevice currentDevice] systemVersion];
310
+ *outValue = strdup([version UTF8String]);
311
+ return *outValue != NULL;
312
+ } @catch (NSException* exception) {
313
+ return false;
314
+ }
315
+ }
316
+ }
317
+
318
+ bool PlatformAdapter_getChipName(char** outValue) {
319
+ @autoreleasepool {
320
+ if (!outValue) return false;
321
+ *outValue = NULL;
322
+
323
+ @try {
324
+ NSString* identifier = getMachineIdentifier();
325
+
326
+ // Check for simulator
327
+ #if TARGET_OS_SIMULATOR
328
+ NSDictionary* env = [[NSProcessInfo processInfo] environment];
329
+ NSString* simModelId = env[@"SIMULATOR_MODEL_IDENTIFIER"];
330
+ if (simModelId) {
331
+ identifier = simModelId;
332
+ }
333
+ #endif
334
+
335
+ NSString* chipName = getChipNameForModel(identifier);
336
+ *outValue = strdup([chipName UTF8String]);
337
+ return *outValue != NULL;
338
+ } @catch (NSException* exception) {
339
+ return false;
340
+ }
341
+ }
342
+ }
343
+
344
+ uint64_t PlatformAdapter_getTotalMemory(void) {
345
+ return [NSProcessInfo processInfo].physicalMemory;
346
+ }
347
+
348
+ uint64_t PlatformAdapter_getAvailableMemory(void) {
349
+ vm_statistics64_data_t vmStats;
350
+ mach_msg_type_number_t infoCount = HOST_VM_INFO64_COUNT;
351
+ kern_return_t result = host_statistics64(mach_host_self(), HOST_VM_INFO64,
352
+ (host_info64_t)&vmStats, &infoCount);
353
+ if (result != KERN_SUCCESS) {
354
+ return 0;
355
+ }
356
+
357
+ uint64_t pageSize = vm_page_size;
358
+ uint64_t freeMemory = vmStats.free_count * pageSize;
359
+ uint64_t inactiveMemory = vmStats.inactive_count * pageSize;
360
+
361
+ return freeMemory + inactiveMemory;
362
+ }
363
+
364
+ int PlatformAdapter_getCoreCount(void) {
365
+ return (int)[[NSProcessInfo processInfo] processorCount];
366
+ }
367
+
368
+ bool PlatformAdapter_getArchitecture(char** outValue) {
369
+ @autoreleasepool {
370
+ if (!outValue) return false;
371
+ *outValue = NULL;
372
+
373
+ @try {
374
+ #if __arm64__
375
+ *outValue = strdup("arm64");
376
+ #elif __x86_64__
377
+ *outValue = strdup("x86_64");
378
+ #else
379
+ *outValue = strdup("unknown");
380
+ #endif
381
+ return *outValue != NULL;
382
+ } @catch (NSException* exception) {
383
+ return false;
384
+ }
385
+ }
386
+ }
387
+
388
+ bool PlatformAdapter_getGPUFamily(char** outValue) {
389
+ @autoreleasepool {
390
+ if (!outValue) return false;
391
+ *outValue = NULL;
392
+
393
+ @try {
394
+ // All iOS/macOS devices use Apple's custom GPUs
395
+ *outValue = strdup("apple");
396
+ return *outValue != NULL;
397
+ } @catch (NSException* exception) {
398
+ return false;
399
+ }
400
+ }
401
+ }
402
+
403
+ /**
404
+ * Check if device is a tablet
405
+ * Uses UIDevice.userInterfaceIdiom to determine form factor
406
+ * Matches Swift SDK: device.userInterfaceIdiom == .pad
407
+ */
408
+ bool PlatformAdapter_isTablet(void) {
409
+ @autoreleasepool {
410
+ @try {
411
+ UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
412
+ return idiom == UIUserInterfaceIdiomPad;
413
+ } @catch (NSException* exception) {
414
+ NSLog(@"[PlatformAdapterBridge] isTablet exception: %@", exception);
415
+ return false;
416
+ }
417
+ }
418
+ }
419
+
420
+ // ============================================================================
421
+ // HTTP POST for Device Registration (Synchronous)
422
+ // Matches Swift's CppBridge+Device.swift http_post callback
423
+ // ============================================================================
424
+
425
+ /**
426
+ * Synchronous HTTP POST for device registration
427
+ * Called from C++ device manager callbacks
428
+ *
429
+ * @param url Full URL to POST to
430
+ * @param jsonBody JSON body string
431
+ * @param supabaseKey Supabase API key (for dev mode, can be NULL)
432
+ * @param outStatusCode Pointer to store HTTP status code
433
+ * @param outResponseBody Pointer to store response body (must be freed by caller)
434
+ * @param outErrorMessage Pointer to store error message (must be freed by caller)
435
+ * @return true if request succeeded (2xx or 409)
436
+ */
437
+ bool PlatformAdapter_httpPostSync(
438
+ const char* url,
439
+ const char* jsonBody,
440
+ const char* supabaseKey,
441
+ int* outStatusCode,
442
+ char** outResponseBody,
443
+ char** outErrorMessage
444
+ ) {
445
+ @autoreleasepool {
446
+ if (!url || !jsonBody || !outStatusCode) {
447
+ if (outErrorMessage) *outErrorMessage = strdup("Invalid arguments");
448
+ return false;
449
+ }
450
+
451
+ *outStatusCode = 0;
452
+ if (outResponseBody) *outResponseBody = NULL;
453
+ if (outErrorMessage) *outErrorMessage = NULL;
454
+
455
+ NSString* urlStr = [NSString stringWithUTF8String:url];
456
+ NSString* bodyStr = [NSString stringWithUTF8String:jsonBody];
457
+ NSString* apiKey = supabaseKey ? [NSString stringWithUTF8String:supabaseKey] : nil;
458
+
459
+ if (!urlStr || !bodyStr) {
460
+ if (outErrorMessage) *outErrorMessage = strdup("Invalid URL or body");
461
+ return false;
462
+ }
463
+
464
+ NSURL* nsUrl = [NSURL URLWithString:urlStr];
465
+ if (!nsUrl) {
466
+ if (outErrorMessage) *outErrorMessage = strdup("Invalid URL format");
467
+ return false;
468
+ }
469
+
470
+ NSLog(@"[PlatformAdapterBridge] HTTP POST to: %@", urlStr);
471
+
472
+ // For Supabase device registration, add ?on_conflict=device_id for UPSERT
473
+ // This matches Swift's HTTPService.swift logic
474
+ if ([urlStr containsString:@"/rest/v1/sdk_devices"]) {
475
+ if (![urlStr containsString:@"on_conflict="]) {
476
+ NSString* separator = [urlStr containsString:@"?"] ? @"&" : @"?";
477
+ urlStr = [NSString stringWithFormat:@"%@%@on_conflict=device_id", urlStr, separator];
478
+ nsUrl = [NSURL URLWithString:urlStr];
479
+ NSLog(@"[PlatformAdapterBridge] Added on_conflict for UPSERT: %@", urlStr);
480
+ }
481
+ }
482
+
483
+ // Create request
484
+ NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:nsUrl];
485
+ request.HTTPMethod = @"POST";
486
+ request.HTTPBody = [bodyStr dataUsingEncoding:NSUTF8StringEncoding];
487
+ request.timeoutInterval = 30.0;
488
+
489
+ // Headers
490
+ [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
491
+ [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
492
+
493
+ // Supabase headers (for device registration UPSERT)
494
+ if (apiKey) {
495
+ [request setValue:apiKey forHTTPHeaderField:@"apikey"];
496
+ [request setValue:[NSString stringWithFormat:@"Bearer %@", apiKey] forHTTPHeaderField:@"Authorization"];
497
+ [request setValue:@"resolution=merge-duplicates" forHTTPHeaderField:@"Prefer"];
498
+ }
499
+
500
+ // Synchronous request using semaphore (like Swift SDK)
501
+ __block NSData* responseData = nil;
502
+ __block NSHTTPURLResponse* httpResponse = nil;
503
+ __block NSError* error = nil;
504
+
505
+ dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
506
+
507
+ NSURLSessionDataTask* task = [[NSURLSession sharedSession]
508
+ dataTaskWithRequest:request
509
+ completionHandler:^(NSData* data, NSURLResponse* response, NSError* err) {
510
+ responseData = data;
511
+ httpResponse = (NSHTTPURLResponse*)response;
512
+ error = err;
513
+ dispatch_semaphore_signal(semaphore);
514
+ }];
515
+
516
+ [task resume];
517
+
518
+ // Wait with 30 second timeout
519
+ dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC);
520
+ long result = dispatch_semaphore_wait(semaphore, timeout);
521
+
522
+ if (result != 0) {
523
+ if (outErrorMessage) *outErrorMessage = strdup("Request timed out");
524
+ NSLog(@"[PlatformAdapterBridge] HTTP POST timed out");
525
+ return false;
526
+ }
527
+
528
+ if (error) {
529
+ if (outErrorMessage) *outErrorMessage = strdup([[error localizedDescription] UTF8String]);
530
+ NSLog(@"[PlatformAdapterBridge] HTTP POST error: %@", error);
531
+ return false;
532
+ }
533
+
534
+ *outStatusCode = (int)httpResponse.statusCode;
535
+
536
+ // Store response body
537
+ if (responseData && outResponseBody) {
538
+ NSString* bodyString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
539
+ if (bodyString) {
540
+ *outResponseBody = strdup([bodyString UTF8String]);
541
+ }
542
+ }
543
+
544
+ // 2xx or 409 (conflict/already exists) = success for device registration
545
+ BOOL isSuccess = (httpResponse.statusCode >= 200 && httpResponse.statusCode < 300) ||
546
+ httpResponse.statusCode == 409;
547
+
548
+ // Log response body for debugging (especially on errors)
549
+ NSString* responseBodyStr = nil;
550
+ if (responseData) {
551
+ responseBodyStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
552
+ }
553
+
554
+ if (!isSuccess) {
555
+ NSLog(@"[PlatformAdapterBridge] HTTP POST failed with status=%ld, response: %@",
556
+ (long)httpResponse.statusCode, responseBodyStr ?: @"(empty)");
557
+ if (outErrorMessage) {
558
+ NSString* errorMsg = [NSString stringWithFormat:@"HTTP %ld: %@",
559
+ (long)httpResponse.statusCode, responseBodyStr ?: @"Unknown error"];
560
+ *outErrorMessage = strdup([errorMsg UTF8String]);
561
+ }
562
+ }
563
+
564
+ NSLog(@"[PlatformAdapterBridge] HTTP POST completed: status=%d success=%d",
565
+ *outStatusCode, isSuccess);
566
+
567
+ return isSuccess;
568
+ }
569
+ }
570
+
@@ -0,0 +1,41 @@
1
+ /**
2
+ * RNSDKLoggerBridge.h
3
+ *
4
+ * Objective-C bridge header for SDKLogger.
5
+ * Allows C and Objective-C code to use the Swift SDKLogger.
6
+ */
7
+
8
+ #ifndef RNSDKLoggerBridge_h
9
+ #define RNSDKLoggerBridge_h
10
+
11
+ #import <Foundation/Foundation.h>
12
+
13
+ /**
14
+ * Log level enum matching Swift RNLogLevel
15
+ */
16
+ typedef NS_ENUM(NSInteger, RNLogLevelObjC) {
17
+ RNLogLevelObjCDebug = 0,
18
+ RNLogLevelObjCInfo = 1,
19
+ RNLogLevelObjCWarning = 2,
20
+ RNLogLevelObjCError = 3,
21
+ RNLogLevelObjCFault = 4
22
+ };
23
+
24
+ /**
25
+ * Log a message with the specified category and level.
26
+ * @param category Logger category (e.g., "Archive", "AudioDecoder")
27
+ * @param level Log level
28
+ * @param message Log message
29
+ */
30
+ void RNSDKLoggerLog(NSString * _Nonnull category, RNLogLevelObjC level, NSString * _Nonnull message);
31
+
32
+ /**
33
+ * Convenience macros for logging from Objective-C
34
+ */
35
+ #define RN_LOG_DEBUG(category, ...) RNSDKLoggerLog(category, RNLogLevelObjCDebug, [NSString stringWithFormat:__VA_ARGS__])
36
+ #define RN_LOG_INFO(category, ...) RNSDKLoggerLog(category, RNLogLevelObjCInfo, [NSString stringWithFormat:__VA_ARGS__])
37
+ #define RN_LOG_WARNING(category, ...) RNSDKLoggerLog(category, RNLogLevelObjCWarning, [NSString stringWithFormat:__VA_ARGS__])
38
+ #define RN_LOG_ERROR(category, ...) RNSDKLoggerLog(category, RNLogLevelObjCError, [NSString stringWithFormat:__VA_ARGS__])
39
+ #define RN_LOG_FAULT(category, ...) RNSDKLoggerLog(category, RNLogLevelObjCFault, [NSString stringWithFormat:__VA_ARGS__])
40
+
41
+ #endif /* RNSDKLoggerBridge_h */
@@ -0,0 +1,66 @@
1
+ /**
2
+ * RNSDKLoggerBridge.m
3
+ *
4
+ * Implementation of the Objective-C bridge for SDKLogger.
5
+ * Routes log messages to the Swift SDKLogger.
6
+ */
7
+
8
+ #import "RNSDKLoggerBridge.h"
9
+
10
+ // Import the generated Swift header from the pod
11
+ #if __has_include(<RunAnywhereCore/RunAnywhereCore-Swift.h>)
12
+ #import <RunAnywhereCore/RunAnywhereCore-Swift.h>
13
+ #elif __has_include("RunAnywhereCore-Swift.h")
14
+ #import "RunAnywhereCore-Swift.h"
15
+ #else
16
+ // Fallback: Forward declare the Swift class if header not found
17
+ @interface SDKLogger : NSObject
18
+ - (instancetype _Nonnull)initWithCategory:(NSString * _Nonnull)category;
19
+ - (void)debug:(NSString * _Nonnull)message metadata:(NSDictionary<NSString *, id> * _Nullable)metadata;
20
+ - (void)info:(NSString * _Nonnull)message metadata:(NSDictionary<NSString *, id> * _Nullable)metadata;
21
+ - (void)warning:(NSString * _Nonnull)message metadata:(NSDictionary<NSString *, id> * _Nullable)metadata;
22
+ - (void)error:(NSString * _Nonnull)message metadata:(NSDictionary<NSString *, id> * _Nullable)metadata;
23
+ - (void)fault:(NSString * _Nonnull)message metadata:(NSDictionary<NSString *, id> * _Nullable)metadata;
24
+ @end
25
+ #endif
26
+
27
+ // Cache loggers for common categories
28
+ static NSMutableDictionary<NSString *, SDKLogger *> *loggerCache = nil;
29
+
30
+ static SDKLogger *getLogger(NSString *category) {
31
+ static dispatch_once_t onceToken;
32
+ dispatch_once(&onceToken, ^{
33
+ loggerCache = [NSMutableDictionary new];
34
+ });
35
+
36
+ @synchronized (loggerCache) {
37
+ SDKLogger *logger = loggerCache[category];
38
+ if (!logger) {
39
+ logger = [[SDKLogger alloc] initWithCategory:category];
40
+ loggerCache[category] = logger;
41
+ }
42
+ return logger;
43
+ }
44
+ }
45
+
46
+ void RNSDKLoggerLog(NSString * _Nonnull category, RNLogLevelObjC level, NSString * _Nonnull message) {
47
+ SDKLogger *logger = getLogger(category);
48
+
49
+ switch (level) {
50
+ case RNLogLevelObjCDebug:
51
+ [logger debug:message metadata:nil];
52
+ break;
53
+ case RNLogLevelObjCInfo:
54
+ [logger info:message metadata:nil];
55
+ break;
56
+ case RNLogLevelObjCWarning:
57
+ [logger warning:message metadata:nil];
58
+ break;
59
+ case RNLogLevelObjCError:
60
+ [logger error:message metadata:nil];
61
+ break;
62
+ case RNLogLevelObjCFault:
63
+ [logger fault:message metadata:nil];
64
+ break;
65
+ }
66
+ }