@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,130 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ # =============================================================================
6
+ # Version Constants (MUST match Swift Package.swift)
7
+ # =============================================================================
8
+ COMMONS_VERSION = "0.1.4"
9
+
10
+ # =============================================================================
11
+ # Binary Source - RACommons from runanywhere-sdks
12
+ # =============================================================================
13
+ GITHUB_ORG = "RunanywhereAI"
14
+ COMMONS_REPO = "runanywhere-sdks"
15
+
16
+ # =============================================================================
17
+ # testLocal Toggle
18
+ # Set RA_TEST_LOCAL=1 or create .testlocal file to use local binaries
19
+ # =============================================================================
20
+ TEST_LOCAL = ENV['RA_TEST_LOCAL'] == '1' || File.exist?(File.join(__dir__, '.testlocal'))
21
+
22
+ Pod::Spec.new do |s|
23
+ s.name = "RunAnywhereCore"
24
+ s.module_name = "RunAnywhereCore"
25
+ s.version = package["version"]
26
+ s.summary = package["description"]
27
+ s.homepage = "https://runanywhere.com"
28
+ s.license = package["license"]
29
+ s.authors = "RunAnywhere AI"
30
+
31
+ s.platforms = { :ios => "15.1" }
32
+ s.source = { :git => "https://github.com/RunanywhereAI/sdks.git", :tag => "#{s.version}" }
33
+
34
+ # =============================================================================
35
+ # Core SDK - RACommons Only
36
+ # No LLM/STT/TTS/VAD backends - those are in @runanywhere/llamacpp and @runanywhere/onnx
37
+ # =============================================================================
38
+ if TEST_LOCAL
39
+ puts "[RunAnywhereCore] Using LOCAL RACommons from ios/Binaries/"
40
+ s.vendored_frameworks = "ios/Binaries/RACommons.xcframework"
41
+ else
42
+ s.prepare_command = <<-CMD
43
+ set -e
44
+
45
+ FRAMEWORK_DIR="ios/Frameworks"
46
+ VERSION="#{COMMONS_VERSION}"
47
+ VERSION_FILE="$FRAMEWORK_DIR/.version"
48
+
49
+ # Check if already downloaded with correct version
50
+ if [ -f "$VERSION_FILE" ] && [ -d "$FRAMEWORK_DIR/RACommons.xcframework" ]; then
51
+ CURRENT_VERSION=$(cat "$VERSION_FILE")
52
+ if [ "$CURRENT_VERSION" = "$VERSION" ]; then
53
+ echo "āœ… RACommons.xcframework version $VERSION already downloaded"
54
+ exit 0
55
+ fi
56
+ fi
57
+
58
+ echo "šŸ“¦ Downloading RACommons.xcframework version $VERSION..."
59
+
60
+ mkdir -p "$FRAMEWORK_DIR"
61
+ rm -rf "$FRAMEWORK_DIR/RACommons.xcframework"
62
+
63
+ # Download RACommons from runanywhere-sdks
64
+ DOWNLOAD_URL="https://github.com/#{GITHUB_ORG}/#{COMMONS_REPO}/releases/download/commons-v$VERSION/RACommons-ios-v$VERSION.zip"
65
+ ZIP_FILE="/tmp/RACommons.zip"
66
+
67
+ echo " URL: $DOWNLOAD_URL"
68
+
69
+ curl -L -f -o "$ZIP_FILE" "$DOWNLOAD_URL" || {
70
+ echo "āŒ Failed to download RACommons from $DOWNLOAD_URL"
71
+ exit 1
72
+ }
73
+
74
+ echo "šŸ“‚ Extracting RACommons.xcframework..."
75
+ unzip -q -o "$ZIP_FILE" -d "$FRAMEWORK_DIR/"
76
+ rm -f "$ZIP_FILE"
77
+
78
+ echo "$VERSION" > "$VERSION_FILE"
79
+
80
+ if [ -d "$FRAMEWORK_DIR/RACommons.xcframework" ]; then
81
+ echo "āœ… RACommons.xcframework installed successfully"
82
+ else
83
+ echo "āŒ RACommons.xcframework extraction failed"
84
+ exit 1
85
+ fi
86
+ CMD
87
+
88
+ s.vendored_frameworks = "ios/Frameworks/RACommons.xcframework"
89
+ end
90
+
91
+ # Source files - Core only (no LLM/STT/TTS/VAD bridges)
92
+ s.source_files = [
93
+ "ios/**/*.{swift}",
94
+ "ios/**/*.{h,m,mm}",
95
+ "cpp/HybridRunAnywhereCore.cpp",
96
+ "cpp/HybridRunAnywhereCore.hpp",
97
+ "cpp/bridges/**/*.{cpp,hpp}",
98
+ ]
99
+
100
+ # Build settings with header paths for RACommons.xcframework
101
+ s.pod_target_xcconfig = {
102
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
103
+ "HEADER_SEARCH_PATHS" => [
104
+ "$(PODS_TARGET_SRCROOT)/cpp",
105
+ "$(PODS_TARGET_SRCROOT)/cpp/bridges",
106
+ "$(PODS_TARGET_SRCROOT)/ios/Frameworks/RACommons.xcframework/ios-arm64/RACommons.framework/Headers",
107
+ "$(PODS_TARGET_SRCROOT)/ios/Frameworks/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers",
108
+ "$(PODS_TARGET_SRCROOT)/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers",
109
+ "$(PODS_TARGET_SRCROOT)/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers",
110
+ "$(PODS_ROOT)/Headers/Public",
111
+ ].join(" "),
112
+ "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) HAS_RACOMMONS=1",
113
+ "DEFINES_MODULE" => "YES",
114
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
115
+ }
116
+
117
+ # Required system libraries and frameworks
118
+ s.libraries = "c++", "archive", "bz2"
119
+ s.frameworks = "Accelerate", "Foundation", "CoreML", "AudioToolbox"
120
+
121
+ # React Native dependencies
122
+ s.dependency 'React-jsi'
123
+ s.dependency 'React-callinvoker'
124
+
125
+ # Load Nitrogen-generated autolinking
126
+ load 'nitrogen/generated/ios/RunAnywhereCore+autolinking.rb'
127
+ add_nitrogen_files(s)
128
+
129
+ install_modules_dependencies(s)
130
+ end
@@ -0,0 +1,92 @@
1
+ project(runanywherecore)
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+
4
+ set(PACKAGE_NAME runanywherecore)
5
+ set(CMAKE_VERBOSE_MAKEFILE ON)
6
+ set(CMAKE_CXX_STANDARD 20)
7
+
8
+ # Path to pre-built native libraries (downloaded from runanywhere-sdks)
9
+ set(JNILIB_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI})
10
+
11
+ # Path to RAC headers (downloaded with native libraries)
12
+ set(RAC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/main/include)
13
+
14
+ # =============================================================================
15
+ # RACommons - Core SDK functionality (rac_* API)
16
+ # This is the ONLY native library in the core package
17
+ # RACommons is REQUIRED - it's downloaded via Gradle downloadNativeLibs task
18
+ # =============================================================================
19
+ if(NOT EXISTS "${JNILIB_DIR}/librac_commons.so")
20
+ message(FATAL_ERROR "[RunAnywhereCore] RACommons not found at ${JNILIB_DIR}/librac_commons.so\n"
21
+ "Run: ./gradlew :runanywhere_core:downloadNativeLibs")
22
+ endif()
23
+
24
+ add_library(rac_commons SHARED IMPORTED)
25
+ set_target_properties(rac_commons PROPERTIES
26
+ IMPORTED_LOCATION "${JNILIB_DIR}/librac_commons.so"
27
+ IMPORTED_NO_SONAME TRUE
28
+ )
29
+ message(STATUS "[RunAnywhereCore] Found RACommons at ${JNILIB_DIR}/librac_commons.so")
30
+
31
+ # =============================================================================
32
+ # Source files - Core bridges only (no LLM/STT/TTS/VAD)
33
+ # =============================================================================
34
+ # Collect core bridge source files
35
+ file(GLOB BRIDGE_SOURCES "../cpp/bridges/*.cpp")
36
+
37
+ add_library(${PACKAGE_NAME} SHARED
38
+ src/main/cpp/cpp-adapter.cpp
39
+ ../cpp/HybridRunAnywhereCore.cpp
40
+ ${BRIDGE_SOURCES}
41
+ )
42
+
43
+ # Add Nitrogen specs (this handles all React Native linking)
44
+ include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/runanywherecore+autolinking.cmake)
45
+
46
+ # =============================================================================
47
+ # Include directories
48
+ # =============================================================================
49
+ include_directories(
50
+ "src/main/cpp"
51
+ "../cpp"
52
+ "../cpp/bridges"
53
+ "${CMAKE_SOURCE_DIR}/include"
54
+ # RAC API headers from runanywhere-commons (flat access)
55
+ "${RAC_INCLUDE_DIR}"
56
+ "${RAC_INCLUDE_DIR}/rac"
57
+ "${RAC_INCLUDE_DIR}/rac/core"
58
+ "${RAC_INCLUDE_DIR}/rac/core/capabilities"
59
+ "${RAC_INCLUDE_DIR}/rac/features"
60
+ "${RAC_INCLUDE_DIR}/rac/features/llm"
61
+ "${RAC_INCLUDE_DIR}/rac/features/stt"
62
+ "${RAC_INCLUDE_DIR}/rac/features/tts"
63
+ "${RAC_INCLUDE_DIR}/rac/features/vad"
64
+ "${RAC_INCLUDE_DIR}/rac/features/voice_agent"
65
+ "${RAC_INCLUDE_DIR}/rac/features/platform"
66
+ "${RAC_INCLUDE_DIR}/rac/infrastructure"
67
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/device"
68
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/download"
69
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/events"
70
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/model_management"
71
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/network"
72
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/storage"
73
+ "${RAC_INCLUDE_DIR}/rac/infrastructure/telemetry"
74
+ )
75
+
76
+ # =============================================================================
77
+ # Linking
78
+ # =============================================================================
79
+ find_library(LOG_LIB log)
80
+
81
+ target_link_libraries(
82
+ ${PACKAGE_NAME}
83
+ ${LOG_LIB}
84
+ android
85
+ )
86
+
87
+ # Link RACommons - REQUIRED for core functionality
88
+ target_link_libraries(${PACKAGE_NAME} rac_commons)
89
+ target_compile_definitions(${PACKAGE_NAME} PRIVATE HAS_RACOMMONS=1)
90
+
91
+ # NOTE: No LlamaCPP or ONNX linking here
92
+ # Those are in @runanywhere/llamacpp and @runanywhere/onnx packages respectively
@@ -0,0 +1,321 @@
1
+ def getExtOrDefault(name) {
2
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RunAnywhereCore_' + name]
3
+ }
4
+
5
+ // Only arm64-v8a is supported - native libraries are only built for 64-bit ARM
6
+ def reactNativeArchitectures() {
7
+ return ["arm64-v8a"]
8
+ }
9
+
10
+ apply plugin: 'com.android.library'
11
+ apply plugin: 'kotlin-android'
12
+ apply from: '../nitrogen/generated/android/runanywherecore+autolinking.gradle'
13
+ apply plugin: 'com.facebook.react'
14
+
15
+ def getExtOrIntegerDefault(name) {
16
+ if (rootProject.ext.has(name)) {
17
+ return rootProject.ext.get(name)
18
+ } else if (project.properties.containsKey('RunAnywhereCore_' + name)) {
19
+ return (project.properties['RunAnywhereCore_' + name]).toInteger()
20
+ }
21
+ def defaults = [
22
+ 'compileSdkVersion': 36,
23
+ 'minSdkVersion': 24,
24
+ 'targetSdkVersion': 36
25
+ ]
26
+ return defaults[name] ?: 36
27
+ }
28
+
29
+ // =============================================================================
30
+ // Version Constants (MUST match Swift Package.swift and iOS Podspec)
31
+ // RACommons ONLY - no backend binaries
32
+ // =============================================================================
33
+ def commonsVersion = "0.1.4"
34
+
35
+ // =============================================================================
36
+ // Binary Source - RACommons from runanywhere-sdks
37
+ // =============================================================================
38
+ def githubOrg = "RunanywhereAI"
39
+ def commonsRepo = "runanywhere-sdks"
40
+
41
+ // =============================================================================
42
+ // testLocal Toggle
43
+ // =============================================================================
44
+ def useLocalBuild = project.findProperty("runanywhere.testLocal")?.toBoolean() ?:
45
+ System.getenv("RA_TEST_LOCAL") == "1" ?: false
46
+
47
+ // Native libraries directory
48
+ def jniLibsDir = file("src/main/jniLibs")
49
+ def downloadedLibsDir = file("build/downloaded-libs")
50
+ def includeDir = file("src/main/include")
51
+
52
+ // Local runanywhere-commons path (for local builds)
53
+ def runAnywhereCommonsDir = file("../../../../runanywhere-commons")
54
+
55
+ android {
56
+ namespace "com.margelo.nitro.runanywhere.core"
57
+
58
+ compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
59
+
60
+ defaultConfig {
61
+ minSdkVersion getExtOrIntegerDefault('minSdkVersion')
62
+ targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
63
+
64
+ ndk {
65
+ abiFilters 'arm64-v8a'
66
+ }
67
+
68
+ externalNativeBuild {
69
+ cmake {
70
+ cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
71
+ arguments "-DANDROID_STL=c++_shared"
72
+ abiFilters 'arm64-v8a'
73
+ }
74
+ }
75
+ }
76
+
77
+ externalNativeBuild {
78
+ cmake {
79
+ path "CMakeLists.txt"
80
+ }
81
+ }
82
+
83
+ packagingOptions {
84
+ excludes = [
85
+ "META-INF",
86
+ "META-INF/**"
87
+ ]
88
+ pickFirsts = [
89
+ "**/libc++_shared.so",
90
+ "**/libjsi.so",
91
+ "**/libfbjni.so",
92
+ "**/libfolly_runtime.so",
93
+ "**/librac_commons.so",
94
+ "**/librunanywhere_jni.so"
95
+ ]
96
+ jniLibs {
97
+ useLegacyPackaging = true
98
+ }
99
+ }
100
+
101
+ buildFeatures {
102
+ buildConfig true
103
+ prefab true
104
+ }
105
+
106
+ buildTypes {
107
+ release {
108
+ minifyEnabled false
109
+ }
110
+ }
111
+
112
+ lint {
113
+ disable 'GradleCompatible'
114
+ }
115
+
116
+ compileOptions {
117
+ sourceCompatibility JavaVersion.VERSION_17
118
+ targetCompatibility JavaVersion.VERSION_17
119
+ }
120
+
121
+ kotlinOptions {
122
+ jvmTarget = "17"
123
+ }
124
+
125
+ sourceSets {
126
+ main {
127
+ java.srcDirs += [
128
+ "generated/java",
129
+ "generated/jni"
130
+ ]
131
+
132
+ if (useLocalBuild) {
133
+ def commonsDistDir = new File(runAnywhereCommonsDir, "dist/android")
134
+ if (commonsDistDir.exists()) {
135
+ jniLibs.srcDirs = [commonsDistDir]
136
+ logger.lifecycle("[RunAnywhereCore] Using LOCAL native libraries from: $commonsDistDir")
137
+ } else {
138
+ logger.warn("[RunAnywhereCore] Local commons dist not found at: $commonsDistDir")
139
+ }
140
+ } else {
141
+ jniLibs.srcDirs = [jniLibsDir]
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ // =============================================================================
148
+ // Download Native Libraries (RACommons ONLY)
149
+ // Backend modules (LlamaCPP, ONNX) are downloaded by their respective packages
150
+ // =============================================================================
151
+
152
+ task downloadNativeLibs {
153
+ description = "Downloads RACommons from GitHub releases"
154
+ group = "build setup"
155
+
156
+ def versionFile = file("${jniLibsDir}/.version")
157
+ def expectedVersion = commonsVersion
158
+
159
+ outputs.dir(jniLibsDir)
160
+ outputs.upToDateWhen {
161
+ versionFile.exists() && versionFile.text.trim() == expectedVersion
162
+ }
163
+
164
+ doLast {
165
+ if (useLocalBuild) {
166
+ logger.lifecycle("[RunAnywhereCore] Skipping download - using local build mode")
167
+ return
168
+ }
169
+
170
+ def currentVersion = versionFile.exists() ? versionFile.text.trim() : ""
171
+ if (currentVersion == expectedVersion) {
172
+ logger.lifecycle("[RunAnywhereCore] RACommons version $expectedVersion already downloaded")
173
+ return
174
+ }
175
+
176
+ logger.lifecycle("[RunAnywhereCore] Downloading RACommons...")
177
+ logger.lifecycle(" Commons Version: $commonsVersion")
178
+
179
+ downloadedLibsDir.mkdirs()
180
+ jniLibsDir.deleteDir()
181
+ jniLibsDir.mkdirs()
182
+ includeDir.mkdirs()
183
+
184
+ // =============================================================================
185
+ // Download RACommons from runanywhere-sdks
186
+ // =============================================================================
187
+ def commonsUrl = "https://github.com/${githubOrg}/${commonsRepo}/releases/download/commons-v${commonsVersion}/RACommons-android-v${commonsVersion}.zip"
188
+ def commonsZip = file("${downloadedLibsDir}/RACommons.zip")
189
+
190
+ logger.lifecycle("\nšŸ“¦ Downloading RACommons...")
191
+ logger.lifecycle(" URL: $commonsUrl")
192
+
193
+ try {
194
+ new URL(commonsUrl).withInputStream { input ->
195
+ commonsZip.withOutputStream { output ->
196
+ output << input
197
+ }
198
+ }
199
+ logger.lifecycle(" Downloaded: ${commonsZip.length() / 1024}KB")
200
+
201
+ // Extract and flatten the archive structure
202
+ // Archive structure: jniLibs/arm64-v8a/*.so
203
+ // Target structure: arm64-v8a/*.so (directly in jniLibsDir)
204
+ copy {
205
+ from zipTree(commonsZip)
206
+ into jniLibsDir
207
+ // IMPORTANT: Exclude libc++_shared.so - React Native provides its own
208
+ // Using a different version causes ABI compatibility issues
209
+ exclude "**/libc++_shared.so"
210
+ eachFile { fileCopyDetails ->
211
+ def pathString = fileCopyDetails.relativePath.pathString
212
+ // Handle jniLibs/ABI/*.so structure -> flatten to ABI/*.so
213
+ if (pathString.startsWith("jniLibs/") && pathString.endsWith(".so")) {
214
+ def newPath = pathString.replaceFirst("^jniLibs/", "")
215
+ fileCopyDetails.relativePath = new RelativePath(true, newPath.split("/"))
216
+ } else if (pathString.endsWith(".so")) {
217
+ // Keep .so files as-is if already in correct structure
218
+ } else {
219
+ // Exclude non-so files from jniLibs
220
+ if (!pathString.contains("include/")) {
221
+ fileCopyDetails.exclude()
222
+ }
223
+ }
224
+ }
225
+ includeEmptyDirs = false
226
+ }
227
+
228
+ // Copy headers if present in the archive
229
+ def tempExtract = file("${downloadedLibsDir}/temp-commons")
230
+ tempExtract.deleteDir()
231
+ copy {
232
+ from zipTree(commonsZip)
233
+ into tempExtract
234
+ }
235
+ def headersDir = new File(tempExtract, "include")
236
+ if (headersDir.exists()) {
237
+ copy {
238
+ from headersDir
239
+ into includeDir
240
+ }
241
+ logger.lifecycle(" āœ… RACommons headers installed")
242
+ }
243
+ // Also check for nested jniLibs/include structure
244
+ def nestedHeadersDir = new File(tempExtract, "jniLibs/include")
245
+ if (nestedHeadersDir.exists()) {
246
+ copy {
247
+ from nestedHeadersDir
248
+ into includeDir
249
+ }
250
+ logger.lifecycle(" āœ… RACommons headers installed (from nested path)")
251
+ }
252
+ tempExtract.deleteDir()
253
+
254
+ logger.lifecycle(" āœ… RACommons installed")
255
+ } catch (Exception e) {
256
+ logger.error("āŒ Failed to download RACommons: ${e.message}")
257
+ throw new GradleException("Failed to download RACommons", e)
258
+ }
259
+
260
+ // =============================================================================
261
+ // List installed files
262
+ // =============================================================================
263
+ logger.lifecycle("\nšŸ“‹ Installed native libraries:")
264
+ jniLibsDir.listFiles()?.findAll { it.isDirectory() }?.each { abiDir ->
265
+ logger.lifecycle(" ${abiDir.name}/")
266
+ abiDir.listFiles()?.findAll { it.name.endsWith(".so") }?.sort()?.each { soFile ->
267
+ logger.lifecycle(" ${soFile.name} (${soFile.length() / 1024}KB)")
268
+ }
269
+ }
270
+
271
+ if (includeDir.exists() && includeDir.listFiles()?.size() > 0) {
272
+ logger.lifecycle("\nšŸ“‹ Installed headers:")
273
+ includeDir.eachFileRecurse { file ->
274
+ if (file.isFile() && file.name.endsWith(".h")) {
275
+ logger.lifecycle(" ${file.relativePath(includeDir)}")
276
+ }
277
+ }
278
+ }
279
+
280
+ versionFile.text = expectedVersion
281
+ logger.lifecycle("\nāœ… RACommons version $expectedVersion installed")
282
+ }
283
+ }
284
+
285
+ if (!useLocalBuild) {
286
+ preBuild.dependsOn downloadNativeLibs
287
+
288
+ afterEvaluate {
289
+ tasks.matching {
290
+ it.name.contains("generateCodegen") || it.name.contains("Codegen")
291
+ }.configureEach {
292
+ mustRunAfter downloadNativeLibs
293
+ }
294
+ }
295
+ }
296
+
297
+ task cleanNativeLibs(type: Delete) {
298
+ description = "Removes downloaded native libraries"
299
+ group = "build"
300
+ delete jniLibsDir
301
+ delete downloadedLibsDir
302
+ delete includeDir
303
+ }
304
+
305
+ clean.dependsOn cleanNativeLibs
306
+
307
+ repositories {
308
+ mavenCentral()
309
+ google()
310
+ }
311
+
312
+ dependencies {
313
+ implementation "com.facebook.react:react-android"
314
+ implementation project(":react-native-nitro-modules")
315
+
316
+ // Apache Commons Compress for tar.gz archive extraction
317
+ implementation "org.apache.commons:commons-compress:1.26.0"
318
+
319
+ // AndroidX Security for EncryptedSharedPreferences (device identity persistence)
320
+ implementation "androidx.security:security-crypto:1.1.0-alpha06"
321
+ }
@@ -0,0 +1,5 @@
1
+ # Keep ArchiveUtility for JNI access
2
+ -keep class com.margelo.nitro.runanywhere.ArchiveUtility { *; }
3
+ -keepclassmembers class com.margelo.nitro.runanywhere.ArchiveUtility {
4
+ public static *** extract(java.lang.String, java.lang.String);
5
+ }
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.margelo.nitro.runanywhere.core">
3
+ </manifest>