@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,102 @@
1
+ /**
2
+ * @file rac_endpoints.h
3
+ * @brief API endpoint definitions
4
+ *
5
+ * Defines all API endpoint paths as constants.
6
+ * This is the canonical source of truth - platform SDKs should not duplicate these.
7
+ */
8
+
9
+ #ifndef RAC_ENDPOINTS_H
10
+ #define RAC_ENDPOINTS_H
11
+
12
+ #include "rac/infrastructure/network/rac_environment.h"
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ // =============================================================================
19
+ // Authentication & Health Endpoints
20
+ // =============================================================================
21
+
22
+ #define RAC_ENDPOINT_AUTHENTICATE "/api/v1/auth/sdk/authenticate"
23
+ #define RAC_ENDPOINT_REFRESH "/api/v1/auth/sdk/refresh"
24
+ #define RAC_ENDPOINT_HEALTH "/v1/health"
25
+
26
+ // =============================================================================
27
+ // Device Management - Production/Staging
28
+ // =============================================================================
29
+
30
+ #define RAC_ENDPOINT_DEVICE_REGISTER "/api/v1/devices/register"
31
+ #define RAC_ENDPOINT_TELEMETRY "/api/v1/sdk/telemetry"
32
+
33
+ // =============================================================================
34
+ // Device Management - Development (Supabase REST API)
35
+ // =============================================================================
36
+
37
+ #define RAC_ENDPOINT_DEV_DEVICE_REGISTER "/rest/v1/sdk_devices"
38
+ #define RAC_ENDPOINT_DEV_TELEMETRY "/rest/v1/telemetry_events"
39
+
40
+ // =============================================================================
41
+ // Model Management
42
+ // =============================================================================
43
+
44
+ #define RAC_ENDPOINT_MODELS_AVAILABLE "/api/v1/models/available"
45
+
46
+ // =============================================================================
47
+ // Environment-Based Endpoint Selection
48
+ // =============================================================================
49
+
50
+ /**
51
+ * @brief Get device registration endpoint for environment
52
+ * @param env The environment
53
+ * @return Endpoint path string
54
+ */
55
+ const char* rac_endpoint_device_registration(rac_environment_t env);
56
+
57
+ /**
58
+ * @brief Get telemetry endpoint for environment
59
+ * @param env The environment
60
+ * @return Endpoint path string
61
+ */
62
+ const char* rac_endpoint_telemetry(rac_environment_t env);
63
+
64
+ /**
65
+ * @brief Build model assignments endpoint with query params
66
+ * @param device_type Device type (e.g., "iphone", "android_phone")
67
+ * @param platform Platform (e.g., "ios", "android")
68
+ * @param out_buffer Buffer to write endpoint path
69
+ * @param buffer_size Size of buffer
70
+ * @return Length of written string, or -1 on error
71
+ */
72
+ int rac_endpoint_model_assignments(const char* device_type, const char* platform, char* out_buffer,
73
+ size_t buffer_size);
74
+
75
+ /**
76
+ * @brief Build model download endpoint
77
+ * @param model_id The model ID
78
+ * @param out_buffer Buffer to write endpoint path
79
+ * @param buffer_size Size of buffer
80
+ * @return Length of written string, or -1 on error
81
+ */
82
+ int rac_endpoint_model_download(const char* model_id, char* out_buffer, size_t buffer_size);
83
+
84
+ // =============================================================================
85
+ // Full URL Building
86
+ // =============================================================================
87
+
88
+ /**
89
+ * @brief Build full URL from base URL and endpoint
90
+ * @param base_url The base URL (e.g., "https://api.runanywhere.ai")
91
+ * @param endpoint The endpoint path (e.g., "/api/v1/health")
92
+ * @param out_buffer Buffer to write full URL
93
+ * @param buffer_size Size of buffer
94
+ * @return Length of written string, or -1 on error
95
+ */
96
+ int rac_build_url(const char* base_url, const char* endpoint, char* out_buffer, size_t buffer_size);
97
+
98
+ #ifdef __cplusplus
99
+ }
100
+ #endif
101
+
102
+ #endif // RAC_ENDPOINTS_H
@@ -0,0 +1,220 @@
1
+ /**
2
+ * @file rac_environment.h
3
+ * @brief SDK environment configuration
4
+ *
5
+ * Defines environment types (development, staging, production) and their
6
+ * associated settings like authentication requirements, log levels, etc.
7
+ * This is the canonical source of truth - platform SDKs create thin wrappers.
8
+ */
9
+
10
+ #ifndef RAC_ENVIRONMENT_H
11
+ #define RAC_ENVIRONMENT_H
12
+
13
+ #include <stdbool.h>
14
+ #include <stdint.h>
15
+
16
+ #include "rac/core/rac_types.h" // For rac_log_level_t
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // Environment Types
24
+ // =============================================================================
25
+
26
+ /**
27
+ * @brief SDK environment mode
28
+ *
29
+ * - DEVELOPMENT: Local/testing mode, no auth required, uses Supabase
30
+ * - STAGING: Testing with real services, requires API key + URL
31
+ * - PRODUCTION: Live environment, requires API key + HTTPS URL
32
+ */
33
+ typedef enum {
34
+ RAC_ENV_DEVELOPMENT = 0,
35
+ RAC_ENV_STAGING = 1,
36
+ RAC_ENV_PRODUCTION = 2
37
+ } rac_environment_t;
38
+
39
+ // Note: rac_log_level_t is defined in rac_types.h
40
+ // We use the existing definition for consistency
41
+
42
+ // =============================================================================
43
+ // SDK Configuration
44
+ // =============================================================================
45
+
46
+ /**
47
+ * @brief SDK initialization configuration
48
+ *
49
+ * Contains all parameters needed to initialize the SDK.
50
+ * Platform SDKs populate this from their native config types.
51
+ */
52
+ typedef struct {
53
+ rac_environment_t environment;
54
+ const char* api_key; // Required for staging/production
55
+ const char* base_url; // Required for staging/production
56
+ const char* device_id; // Set by platform (Keychain UUID, etc.)
57
+ const char* platform; // "ios", "android", "flutter", etc.
58
+ const char* sdk_version; // SDK version string
59
+ } rac_sdk_config_t;
60
+
61
+ /**
62
+ * @brief Development network configuration
63
+ *
64
+ * Contains Supabase credentials for development mode.
65
+ * These are built into the SDK binary.
66
+ */
67
+ typedef struct {
68
+ const char* base_url; // Supabase project URL
69
+ const char* api_key; // Supabase anon key
70
+ const char* build_token; // SDK build token for validation
71
+ } rac_dev_config_t;
72
+
73
+ // =============================================================================
74
+ // Environment Query Functions
75
+ // =============================================================================
76
+
77
+ /**
78
+ * @brief Check if environment requires API authentication
79
+ * @param env The environment to check
80
+ * @return true for staging/production, false for development
81
+ */
82
+ bool rac_env_requires_auth(rac_environment_t env);
83
+
84
+ /**
85
+ * @brief Check if environment requires a backend URL
86
+ * @param env The environment to check
87
+ * @return true for staging/production, false for development
88
+ */
89
+ bool rac_env_requires_backend_url(rac_environment_t env);
90
+
91
+ /**
92
+ * @brief Check if environment is production
93
+ * @param env The environment to check
94
+ * @return true only for production
95
+ */
96
+ bool rac_env_is_production(rac_environment_t env);
97
+
98
+ /**
99
+ * @brief Check if environment is a testing environment
100
+ * @param env The environment to check
101
+ * @return true for development and staging
102
+ */
103
+ bool rac_env_is_testing(rac_environment_t env);
104
+
105
+ /**
106
+ * @brief Get the default log level for an environment
107
+ * @param env The environment
108
+ * @return DEBUG for development, INFO for staging, WARNING for production
109
+ */
110
+ rac_log_level_t rac_env_default_log_level(rac_environment_t env);
111
+
112
+ /**
113
+ * @brief Check if telemetry should be sent for this environment
114
+ * @param env The environment
115
+ * @return true only for production
116
+ */
117
+ bool rac_env_should_send_telemetry(rac_environment_t env);
118
+
119
+ /**
120
+ * @brief Check if environment should sync with backend
121
+ * @param env The environment
122
+ * @return true for staging/production, false for development
123
+ */
124
+ bool rac_env_should_sync_with_backend(rac_environment_t env);
125
+
126
+ /**
127
+ * @brief Get human-readable environment description
128
+ * @param env The environment
129
+ * @return String like "Development Environment"
130
+ */
131
+ const char* rac_env_description(rac_environment_t env);
132
+
133
+ // =============================================================================
134
+ // Validation Functions
135
+ // =============================================================================
136
+
137
+ /**
138
+ * @brief Validation result codes
139
+ */
140
+ typedef enum {
141
+ RAC_VALIDATION_OK = 0,
142
+ RAC_VALIDATION_API_KEY_REQUIRED,
143
+ RAC_VALIDATION_API_KEY_TOO_SHORT,
144
+ RAC_VALIDATION_URL_REQUIRED,
145
+ RAC_VALIDATION_URL_INVALID_SCHEME,
146
+ RAC_VALIDATION_URL_HTTPS_REQUIRED,
147
+ RAC_VALIDATION_URL_INVALID_HOST,
148
+ RAC_VALIDATION_URL_LOCALHOST_NOT_ALLOWED,
149
+ RAC_VALIDATION_PRODUCTION_DEBUG_BUILD
150
+ } rac_validation_result_t;
151
+
152
+ /**
153
+ * @brief Validate API key for the given environment
154
+ * @param api_key The API key to validate (can be NULL)
155
+ * @param env The target environment
156
+ * @return RAC_VALIDATION_OK if valid, error code otherwise
157
+ */
158
+ rac_validation_result_t rac_validate_api_key(const char* api_key, rac_environment_t env);
159
+
160
+ /**
161
+ * @brief Validate base URL for the given environment
162
+ * @param url The URL to validate (can be NULL)
163
+ * @param env The target environment
164
+ * @return RAC_VALIDATION_OK if valid, error code otherwise
165
+ */
166
+ rac_validation_result_t rac_validate_base_url(const char* url, rac_environment_t env);
167
+
168
+ /**
169
+ * @brief Validate complete SDK configuration
170
+ * @param config The configuration to validate
171
+ * @return RAC_VALIDATION_OK if valid, first error code otherwise
172
+ */
173
+ rac_validation_result_t rac_validate_config(const rac_sdk_config_t* config);
174
+
175
+ /**
176
+ * @brief Get error message for validation result
177
+ * @param result The validation result code
178
+ * @return Human-readable error message
179
+ */
180
+ const char* rac_validation_error_message(rac_validation_result_t result);
181
+
182
+ // =============================================================================
183
+ // Global SDK State
184
+ // =============================================================================
185
+
186
+ /**
187
+ * @brief Initialize SDK with configuration
188
+ * @param config The SDK configuration
189
+ * @return RAC_VALIDATION_OK on success, error code on validation failure
190
+ */
191
+ RAC_API rac_validation_result_t rac_sdk_init(const rac_sdk_config_t* config);
192
+
193
+ /**
194
+ * @brief Get current SDK configuration
195
+ * @return Pointer to current config, or NULL if not initialized
196
+ */
197
+ RAC_API const rac_sdk_config_t* rac_sdk_get_config(void);
198
+
199
+ /**
200
+ * @brief Get current environment
201
+ * @return Current environment, or RAC_ENV_DEVELOPMENT if not initialized
202
+ */
203
+ RAC_API rac_environment_t rac_sdk_get_environment(void);
204
+
205
+ /**
206
+ * @brief Check if SDK is initialized
207
+ * @return true if rac_sdk_init has been called successfully
208
+ */
209
+ RAC_API bool rac_sdk_is_initialized(void);
210
+
211
+ /**
212
+ * @brief Reset SDK state (for testing)
213
+ */
214
+ RAC_API void rac_sdk_reset(void);
215
+
216
+ #ifdef __cplusplus
217
+ }
218
+ #endif
219
+
220
+ #endif // RAC_ENVIRONMENT_H
@@ -0,0 +1,233 @@
1
+ /**
2
+ * @file rac_http_client.h
3
+ * @brief HTTP client abstraction
4
+ *
5
+ * Defines a platform-agnostic HTTP interface. Platform SDKs implement
6
+ * the actual HTTP transport (URLSession, OkHttp, etc.) and register
7
+ * it via callback.
8
+ */
9
+
10
+ #ifndef RAC_HTTP_CLIENT_H
11
+ #define RAC_HTTP_CLIENT_H
12
+
13
+ #include <stdbool.h>
14
+ #include <stddef.h>
15
+ #include <stdint.h>
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ // =============================================================================
22
+ // HTTP Types
23
+ // =============================================================================
24
+
25
+ /**
26
+ * @brief HTTP method enum
27
+ */
28
+ typedef enum {
29
+ RAC_HTTP_GET = 0,
30
+ RAC_HTTP_POST = 1,
31
+ RAC_HTTP_PUT = 2,
32
+ RAC_HTTP_DELETE = 3,
33
+ RAC_HTTP_PATCH = 4
34
+ } rac_http_method_t;
35
+
36
+ /**
37
+ * @brief HTTP header key-value pair
38
+ */
39
+ typedef struct {
40
+ const char* key;
41
+ const char* value;
42
+ } rac_http_header_t;
43
+
44
+ /**
45
+ * @brief HTTP request structure
46
+ */
47
+ typedef struct {
48
+ rac_http_method_t method;
49
+ const char* url; // Full URL
50
+ const char* body; // JSON body (can be NULL for GET)
51
+ size_t body_length;
52
+ rac_http_header_t* headers;
53
+ size_t header_count;
54
+ int32_t timeout_ms; // Request timeout in milliseconds
55
+ } rac_http_request_t;
56
+
57
+ /**
58
+ * @brief HTTP response structure
59
+ */
60
+ typedef struct {
61
+ int32_t status_code; // HTTP status code (200, 401, etc.)
62
+ char* body; // Response body (caller frees)
63
+ size_t body_length;
64
+ rac_http_header_t* headers;
65
+ size_t header_count;
66
+ char* error_message; // Non-HTTP error (network failure, etc.)
67
+ } rac_http_response_t;
68
+
69
+ // =============================================================================
70
+ // Response Memory Management
71
+ // =============================================================================
72
+
73
+ /**
74
+ * @brief Free HTTP response
75
+ */
76
+ void rac_http_response_free(rac_http_response_t* response);
77
+
78
+ // =============================================================================
79
+ // Platform Callback Interface
80
+ // =============================================================================
81
+
82
+ /**
83
+ * @brief Callback type for receiving HTTP response
84
+ *
85
+ * @param response The HTTP response (platform must free after callback returns)
86
+ * @param user_data Opaque user data passed to request
87
+ */
88
+ typedef void (*rac_http_callback_t)(const rac_http_response_t* response, void* user_data);
89
+
90
+ /**
91
+ * @brief HTTP executor function type
92
+ *
93
+ * Platform implements this to perform actual HTTP requests.
94
+ * Must call callback when request completes (success or failure).
95
+ *
96
+ * @param request The HTTP request to execute
97
+ * @param callback Callback to invoke with response
98
+ * @param user_data Opaque user data to pass to callback
99
+ */
100
+ typedef void (*rac_http_executor_t)(const rac_http_request_t* request, rac_http_callback_t callback,
101
+ void* user_data);
102
+
103
+ /**
104
+ * @brief Register platform HTTP executor
105
+ *
106
+ * Platform SDKs must call this during initialization to provide
107
+ * their HTTP implementation.
108
+ *
109
+ * @param executor The executor function
110
+ */
111
+ void rac_http_set_executor(rac_http_executor_t executor);
112
+
113
+ /**
114
+ * @brief Check if HTTP executor is registered
115
+ * @return true if executor has been set
116
+ */
117
+ bool rac_http_has_executor(void);
118
+
119
+ // =============================================================================
120
+ // Request Building Helpers
121
+ // =============================================================================
122
+
123
+ /**
124
+ * @brief Create a new HTTP request
125
+ * @param method HTTP method
126
+ * @param url Full URL
127
+ * @return New request (caller must free with rac_http_request_free)
128
+ */
129
+ rac_http_request_t* rac_http_request_create(rac_http_method_t method, const char* url);
130
+
131
+ /**
132
+ * @brief Set request body
133
+ * @param request The request
134
+ * @param body JSON body string
135
+ */
136
+ void rac_http_request_set_body(rac_http_request_t* request, const char* body);
137
+
138
+ /**
139
+ * @brief Add header to request
140
+ * @param request The request
141
+ * @param key Header key
142
+ * @param value Header value
143
+ */
144
+ void rac_http_request_add_header(rac_http_request_t* request, const char* key, const char* value);
145
+
146
+ /**
147
+ * @brief Set request timeout
148
+ * @param request The request
149
+ * @param timeout_ms Timeout in milliseconds
150
+ */
151
+ void rac_http_request_set_timeout(rac_http_request_t* request, int32_t timeout_ms);
152
+
153
+ /**
154
+ * @brief Free HTTP request
155
+ */
156
+ void rac_http_request_free(rac_http_request_t* request);
157
+
158
+ // =============================================================================
159
+ // Standard Headers
160
+ // =============================================================================
161
+
162
+ /**
163
+ * @brief Add standard SDK headers to request
164
+ *
165
+ * Adds: Content-Type, X-SDK-Client, X-SDK-Version, X-Platform
166
+ *
167
+ * @param request The request
168
+ * @param sdk_version SDK version string
169
+ * @param platform Platform string
170
+ */
171
+ void rac_http_add_sdk_headers(rac_http_request_t* request, const char* sdk_version,
172
+ const char* platform);
173
+
174
+ /**
175
+ * @brief Add authorization header
176
+ * @param request The request
177
+ * @param token Bearer token
178
+ */
179
+ void rac_http_add_auth_header(rac_http_request_t* request, const char* token);
180
+
181
+ /**
182
+ * @brief Add API key header (for Supabase compatibility)
183
+ * @param request The request
184
+ * @param api_key API key
185
+ */
186
+ void rac_http_add_api_key_header(rac_http_request_t* request, const char* api_key);
187
+
188
+ // =============================================================================
189
+ // High-Level Request Functions
190
+ // =============================================================================
191
+
192
+ /**
193
+ * @brief Context for async HTTP operations
194
+ */
195
+ typedef struct {
196
+ void* user_data;
197
+ void (*on_success)(const char* response_body, void* user_data);
198
+ void (*on_error)(int status_code, const char* error_message, void* user_data);
199
+ } rac_http_context_t;
200
+
201
+ /**
202
+ * @brief Execute HTTP request asynchronously
203
+ *
204
+ * Uses the registered platform executor.
205
+ *
206
+ * @param request The request to execute
207
+ * @param context Callback context
208
+ */
209
+ void rac_http_execute(const rac_http_request_t* request, rac_http_context_t* context);
210
+
211
+ /**
212
+ * @brief Helper: POST JSON to endpoint
213
+ * @param url Full URL
214
+ * @param json_body JSON body
215
+ * @param auth_token Bearer token (can be NULL)
216
+ * @param context Callback context
217
+ */
218
+ void rac_http_post_json(const char* url, const char* json_body, const char* auth_token,
219
+ rac_http_context_t* context);
220
+
221
+ /**
222
+ * @brief Helper: GET from endpoint
223
+ * @param url Full URL
224
+ * @param auth_token Bearer token (can be NULL)
225
+ * @param context Callback context
226
+ */
227
+ void rac_http_get(const char* url, const char* auth_token, rac_http_context_t* context);
228
+
229
+ #ifdef __cplusplus
230
+ }
231
+ #endif
232
+
233
+ #endif // RAC_HTTP_CLIENT_H