@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,335 @@
1
+ /**
2
+ * @file rac_api_types.h
3
+ * @brief API request and response data types
4
+ *
5
+ * Defines all data structures for API communication.
6
+ * This is the canonical source of truth - platform SDKs create thin wrappers.
7
+ */
8
+
9
+ #ifndef RAC_API_TYPES_H
10
+ #define RAC_API_TYPES_H
11
+
12
+ #include <stdbool.h>
13
+ #include <stddef.h>
14
+ #include <stdint.h>
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ // =============================================================================
21
+ // Authentication Types
22
+ // =============================================================================
23
+
24
+ /**
25
+ * @brief Authentication request payload
26
+ * Sent to POST /api/v1/auth/sdk/authenticate
27
+ */
28
+ typedef struct {
29
+ const char* api_key;
30
+ const char* device_id;
31
+ const char* platform; // "ios", "android", etc.
32
+ const char* sdk_version;
33
+ } rac_auth_request_t;
34
+
35
+ /**
36
+ * @brief Authentication response payload
37
+ * Received from authentication and refresh endpoints
38
+ */
39
+ typedef struct {
40
+ char* access_token;
41
+ char* refresh_token;
42
+ char* device_id;
43
+ char* user_id; // Can be NULL (org-level auth)
44
+ char* organization_id;
45
+ char* token_type; // Usually "bearer"
46
+ int32_t expires_in; // Seconds until expiry
47
+ } rac_auth_response_t;
48
+
49
+ /**
50
+ * @brief Refresh token request payload
51
+ * Sent to POST /api/v1/auth/sdk/refresh
52
+ */
53
+ typedef struct {
54
+ const char* device_id;
55
+ const char* refresh_token;
56
+ } rac_refresh_request_t;
57
+
58
+ // =============================================================================
59
+ // Health Check Types
60
+ // =============================================================================
61
+
62
+ /**
63
+ * @brief Health status enum
64
+ */
65
+ typedef enum {
66
+ RAC_HEALTH_HEALTHY = 0,
67
+ RAC_HEALTH_DEGRADED = 1,
68
+ RAC_HEALTH_UNHEALTHY = 2
69
+ } rac_health_status_t;
70
+
71
+ /**
72
+ * @brief Health check response
73
+ * Received from GET /v1/health
74
+ */
75
+ typedef struct {
76
+ rac_health_status_t status;
77
+ char* version;
78
+ int64_t timestamp; // Unix timestamp
79
+ } rac_health_response_t;
80
+
81
+ // =============================================================================
82
+ // Device Registration Types
83
+ // =============================================================================
84
+
85
+ /**
86
+ * @brief Device hardware information
87
+ */
88
+ typedef struct {
89
+ const char* device_fingerprint;
90
+ const char* device_model; // e.g., "iPhone15,2"
91
+ const char* os_version; // e.g., "17.0"
92
+ const char* platform; // "ios", "android", etc.
93
+ const char* architecture; // "arm64", "x86_64", etc.
94
+ int64_t total_memory; // Bytes
95
+ int32_t cpu_cores;
96
+ bool has_neural_engine;
97
+ bool has_gpu;
98
+ } rac_device_info_t;
99
+
100
+ /**
101
+ * @brief Device registration request
102
+ * Sent to POST /api/v1/devices/register
103
+ */
104
+ typedef struct {
105
+ rac_device_info_t device_info;
106
+ const char* sdk_version;
107
+ const char* build_token;
108
+ int64_t last_seen_at; // Unix timestamp
109
+ } rac_device_reg_request_t;
110
+
111
+ /**
112
+ * @brief Device registration response
113
+ */
114
+ typedef struct {
115
+ char* device_id;
116
+ char* status; // "registered" or "updated"
117
+ char* sync_status; // "synced" or "pending"
118
+ } rac_device_reg_response_t;
119
+
120
+ // =============================================================================
121
+ // Telemetry Types
122
+ // =============================================================================
123
+
124
+ /**
125
+ * @brief Telemetry event payload
126
+ * Contains all possible fields for LLM, STT, TTS, VAD events
127
+ */
128
+ typedef struct {
129
+ // Required fields
130
+ const char* id;
131
+ const char* event_type;
132
+ int64_t timestamp; // Unix timestamp ms
133
+ int64_t created_at; // Unix timestamp ms
134
+
135
+ // Event classification
136
+ const char* modality; // "llm", "stt", "tts", "model", "system"
137
+
138
+ // Device identification
139
+ const char* device_id;
140
+ const char* session_id;
141
+
142
+ // Model info
143
+ const char* model_id;
144
+ const char* model_name;
145
+ const char* framework;
146
+
147
+ // Device info
148
+ const char* device;
149
+ const char* os_version;
150
+ const char* platform;
151
+ const char* sdk_version;
152
+
153
+ // Common metrics
154
+ double processing_time_ms;
155
+ bool success;
156
+ bool has_success; // Whether success field is set
157
+ const char* error_message;
158
+ const char* error_code;
159
+
160
+ // LLM-specific
161
+ int32_t input_tokens;
162
+ int32_t output_tokens;
163
+ int32_t total_tokens;
164
+ double tokens_per_second;
165
+ double time_to_first_token_ms;
166
+ double prompt_eval_time_ms;
167
+ double generation_time_ms;
168
+ int32_t context_length;
169
+ double temperature;
170
+ int32_t max_tokens;
171
+
172
+ // STT-specific
173
+ double audio_duration_ms;
174
+ double real_time_factor;
175
+ int32_t word_count;
176
+ double confidence;
177
+ const char* language;
178
+ bool is_streaming;
179
+ int32_t segment_index;
180
+
181
+ // TTS-specific
182
+ int32_t character_count;
183
+ double characters_per_second;
184
+ int32_t audio_size_bytes;
185
+ int32_t sample_rate;
186
+ const char* voice;
187
+ double output_duration_ms;
188
+
189
+ // Model lifecycle
190
+ int64_t model_size_bytes;
191
+ const char* archive_type;
192
+
193
+ // VAD-specific
194
+ double speech_duration_ms;
195
+
196
+ // SDK lifecycle
197
+ int32_t count;
198
+
199
+ // Storage
200
+ int64_t freed_bytes;
201
+
202
+ // Network
203
+ bool is_online;
204
+ bool has_is_online;
205
+ } rac_telemetry_event_t;
206
+
207
+ /**
208
+ * @brief Telemetry batch request
209
+ * Sent to POST /api/v1/sdk/telemetry
210
+ */
211
+ typedef struct {
212
+ rac_telemetry_event_t* events;
213
+ size_t event_count;
214
+ const char* device_id;
215
+ int64_t timestamp;
216
+ const char* modality; // Can be NULL for V1 path
217
+ } rac_telemetry_batch_t;
218
+
219
+ /**
220
+ * @brief Telemetry batch response
221
+ */
222
+ typedef struct {
223
+ bool success;
224
+ int32_t events_received;
225
+ int32_t events_stored;
226
+ int32_t events_skipped;
227
+ char** errors;
228
+ size_t error_count;
229
+ char* storage_version; // "V1" or "V2"
230
+ } rac_telemetry_response_t;
231
+
232
+ // =============================================================================
233
+ // API Error Types
234
+ // =============================================================================
235
+
236
+ /**
237
+ * @brief API error information
238
+ */
239
+ typedef struct {
240
+ int32_t status_code;
241
+ char* message;
242
+ char* code;
243
+ char* raw_body;
244
+ char* request_url;
245
+ } rac_api_error_t;
246
+
247
+ // =============================================================================
248
+ // Memory Management
249
+ // =============================================================================
250
+
251
+ /**
252
+ * @brief Free authentication response
253
+ */
254
+ void rac_auth_response_free(rac_auth_response_t* response);
255
+
256
+ /**
257
+ * @brief Free health response
258
+ */
259
+ void rac_health_response_free(rac_health_response_t* response);
260
+
261
+ /**
262
+ * @brief Free device registration response
263
+ */
264
+ void rac_device_reg_response_free(rac_device_reg_response_t* response);
265
+
266
+ /**
267
+ * @brief Free telemetry response
268
+ */
269
+ void rac_telemetry_response_free(rac_telemetry_response_t* response);
270
+
271
+ /**
272
+ * @brief Free API error
273
+ */
274
+ void rac_api_error_free(rac_api_error_t* error);
275
+
276
+ // =============================================================================
277
+ // JSON Serialization
278
+ // =============================================================================
279
+
280
+ /**
281
+ * @brief Serialize auth request to JSON
282
+ * @param request The request to serialize
283
+ * @return JSON string (caller must free), or NULL on error
284
+ */
285
+ char* rac_auth_request_to_json(const rac_auth_request_t* request);
286
+
287
+ /**
288
+ * @brief Parse auth response from JSON
289
+ * @param json The JSON string
290
+ * @param out_response Output response (caller must free with rac_auth_response_free)
291
+ * @return 0 on success, -1 on error
292
+ */
293
+ int rac_auth_response_from_json(const char* json, rac_auth_response_t* out_response);
294
+
295
+ /**
296
+ * @brief Serialize refresh request to JSON
297
+ */
298
+ char* rac_refresh_request_to_json(const rac_refresh_request_t* request);
299
+
300
+ /**
301
+ * @brief Serialize device registration request to JSON
302
+ */
303
+ char* rac_device_reg_request_to_json(const rac_device_reg_request_t* request);
304
+
305
+ /**
306
+ * @brief Parse device registration response from JSON
307
+ */
308
+ int rac_device_reg_response_from_json(const char* json, rac_device_reg_response_t* out_response);
309
+
310
+ /**
311
+ * @brief Serialize telemetry event to JSON
312
+ */
313
+ char* rac_telemetry_event_to_json(const rac_telemetry_event_t* event);
314
+
315
+ /**
316
+ * @brief Serialize telemetry batch to JSON
317
+ */
318
+ char* rac_telemetry_batch_to_json(const rac_telemetry_batch_t* batch);
319
+
320
+ /**
321
+ * @brief Parse telemetry response from JSON
322
+ */
323
+ int rac_telemetry_response_from_json(const char* json, rac_telemetry_response_t* out_response);
324
+
325
+ /**
326
+ * @brief Parse API error from HTTP response
327
+ */
328
+ int rac_api_error_from_response(int status_code, const char* body, const char* url,
329
+ rac_api_error_t* out_error);
330
+
331
+ #ifdef __cplusplus
332
+ }
333
+ #endif
334
+
335
+ #endif // RAC_API_TYPES_H
@@ -0,0 +1,252 @@
1
+ /**
2
+ * @file rac_auth_manager.h
3
+ * @brief Authentication state management
4
+ *
5
+ * Manages authentication state including tokens, expiry, and refresh logic.
6
+ * Platform SDKs provide HTTP transport and secure storage callbacks.
7
+ */
8
+
9
+ #ifndef RAC_AUTH_MANAGER_H
10
+ #define RAC_AUTH_MANAGER_H
11
+
12
+ #include <stdbool.h>
13
+ #include <stdint.h>
14
+
15
+ #include "rac/infrastructure/network/rac_api_types.h"
16
+ #include "rac/infrastructure/network/rac_environment.h"
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // Auth State
24
+ // =============================================================================
25
+
26
+ /**
27
+ * @brief Authentication state structure
28
+ *
29
+ * Managed internally - use accessor functions.
30
+ */
31
+ typedef struct {
32
+ char* access_token;
33
+ char* refresh_token;
34
+ char* device_id;
35
+ char* user_id; // Can be NULL
36
+ char* organization_id;
37
+ int64_t token_expires_at; // Unix timestamp (seconds)
38
+ bool is_authenticated;
39
+ } rac_auth_state_t;
40
+
41
+ // =============================================================================
42
+ // Platform Callbacks
43
+ // =============================================================================
44
+
45
+ /**
46
+ * @brief Callback for secure storage operations
47
+ *
48
+ * Platform implements to store tokens in Keychain/KeyStore.
49
+ */
50
+ typedef struct {
51
+ /**
52
+ * @brief Store string value securely
53
+ * @param key Storage key
54
+ * @param value Value to store
55
+ * @return 0 on success, -1 on error
56
+ */
57
+ int (*store)(const char* key, const char* value, void* context);
58
+
59
+ /**
60
+ * @brief Retrieve string value
61
+ * @param key Storage key
62
+ * @param out_value Output buffer (caller provides)
63
+ * @param buffer_size Size of output buffer
64
+ * @return Length of value, or -1 on error/not found
65
+ */
66
+ int (*retrieve)(const char* key, char* out_value, size_t buffer_size, void* context);
67
+
68
+ /**
69
+ * @brief Delete stored value
70
+ * @param key Storage key
71
+ * @return 0 on success, -1 on error
72
+ */
73
+ int (*delete_key)(const char* key, void* context);
74
+
75
+ /**
76
+ * @brief Context pointer passed to all callbacks
77
+ */
78
+ void* context;
79
+ } rac_secure_storage_t;
80
+
81
+ // =============================================================================
82
+ // Keychain Keys (for platform implementations)
83
+ // =============================================================================
84
+
85
+ #define RAC_KEY_ACCESS_TOKEN "com.runanywhere.sdk.accessToken"
86
+ #define RAC_KEY_REFRESH_TOKEN "com.runanywhere.sdk.refreshToken"
87
+ #define RAC_KEY_DEVICE_ID "com.runanywhere.sdk.deviceId"
88
+ #define RAC_KEY_USER_ID "com.runanywhere.sdk.userId"
89
+ #define RAC_KEY_ORGANIZATION_ID "com.runanywhere.sdk.organizationId"
90
+
91
+ // =============================================================================
92
+ // Initialization
93
+ // =============================================================================
94
+
95
+ /**
96
+ * @brief Initialize auth manager
97
+ * @param storage Secure storage callbacks (can be NULL for in-memory only)
98
+ */
99
+ void rac_auth_init(const rac_secure_storage_t* storage);
100
+
101
+ /**
102
+ * @brief Reset auth manager state
103
+ */
104
+ void rac_auth_reset(void);
105
+
106
+ // =============================================================================
107
+ // Token State
108
+ // =============================================================================
109
+
110
+ /**
111
+ * @brief Check if currently authenticated
112
+ * @return true if valid access token exists
113
+ */
114
+ bool rac_auth_is_authenticated(void);
115
+
116
+ /**
117
+ * @brief Check if token needs refresh
118
+ *
119
+ * Returns true if token expires within 60 seconds.
120
+ *
121
+ * @return true if token should be refreshed
122
+ */
123
+ bool rac_auth_needs_refresh(void);
124
+
125
+ /**
126
+ * @brief Get current access token
127
+ * @return Access token string, or NULL if not authenticated
128
+ */
129
+ const char* rac_auth_get_access_token(void);
130
+
131
+ /**
132
+ * @brief Get current device ID
133
+ * @return Device ID string, or NULL if not set
134
+ */
135
+ const char* rac_auth_get_device_id(void);
136
+
137
+ /**
138
+ * @brief Get current user ID
139
+ * @return User ID string, or NULL if not set
140
+ */
141
+ const char* rac_auth_get_user_id(void);
142
+
143
+ /**
144
+ * @brief Get current organization ID
145
+ * @return Organization ID string, or NULL if not set
146
+ */
147
+ const char* rac_auth_get_organization_id(void);
148
+
149
+ // =============================================================================
150
+ // Request Building
151
+ // =============================================================================
152
+
153
+ /**
154
+ * @brief Build authentication request JSON
155
+ *
156
+ * Creates JSON payload for POST /api/v1/auth/sdk/authenticate
157
+ *
158
+ * @param config SDK configuration with credentials
159
+ * @return JSON string (caller must free), or NULL on error
160
+ */
161
+ char* rac_auth_build_authenticate_request(const rac_sdk_config_t* config);
162
+
163
+ /**
164
+ * @brief Build token refresh request JSON
165
+ *
166
+ * Creates JSON payload for POST /api/v1/auth/sdk/refresh
167
+ *
168
+ * @return JSON string (caller must free), or NULL if no refresh token
169
+ */
170
+ char* rac_auth_build_refresh_request(void);
171
+
172
+ // =============================================================================
173
+ // Response Handling
174
+ // =============================================================================
175
+
176
+ /**
177
+ * @brief Parse and store authentication response
178
+ *
179
+ * Updates internal auth state and optionally persists to secure storage.
180
+ *
181
+ * @param json JSON response body
182
+ * @return 0 on success, -1 on parse error
183
+ */
184
+ int rac_auth_handle_authenticate_response(const char* json);
185
+
186
+ /**
187
+ * @brief Parse and store refresh response
188
+ *
189
+ * Updates internal auth state and optionally persists to secure storage.
190
+ *
191
+ * @param json JSON response body
192
+ * @return 0 on success, -1 on parse error
193
+ */
194
+ int rac_auth_handle_refresh_response(const char* json);
195
+
196
+ // =============================================================================
197
+ // Token Management
198
+ // =============================================================================
199
+
200
+ /**
201
+ * @brief Get valid access token, triggering refresh if needed
202
+ *
203
+ * This is the main entry point for getting a token. If the current token
204
+ * is expired or about to expire, it will:
205
+ * 1. Build a refresh request
206
+ * 2. Return a pending state indicating refresh is needed
207
+ *
208
+ * Platform must then:
209
+ * 1. Execute the HTTP request
210
+ * 2. Call rac_auth_handle_refresh_response with result
211
+ * 3. Call this function again to get the new token
212
+ *
213
+ * @param out_token Output pointer for token string
214
+ * @param out_needs_refresh Set to true if refresh HTTP call is needed
215
+ * @return 0 on success (token valid), 1 if refresh needed, -1 on error
216
+ */
217
+ int rac_auth_get_valid_token(const char** out_token, bool* out_needs_refresh);
218
+
219
+ /**
220
+ * @brief Clear all authentication state
221
+ *
222
+ * Clears in-memory state and secure storage.
223
+ */
224
+ void rac_auth_clear(void);
225
+
226
+ // =============================================================================
227
+ // Persistence
228
+ // =============================================================================
229
+
230
+ /**
231
+ * @brief Load tokens from secure storage
232
+ *
233
+ * Call during initialization to restore saved auth state.
234
+ *
235
+ * @return 0 on success (tokens loaded), -1 if not found or error
236
+ */
237
+ int rac_auth_load_stored_tokens(void);
238
+
239
+ /**
240
+ * @brief Save current tokens to secure storage
241
+ *
242
+ * Called automatically by response handlers, but can be called manually.
243
+ *
244
+ * @return 0 on success, -1 on error
245
+ */
246
+ int rac_auth_save_tokens(void);
247
+
248
+ #ifdef __cplusplus
249
+ }
250
+ #endif
251
+
252
+ #endif // RAC_AUTH_MANAGER_H
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @file rac_dev_config.h
3
+ * @brief Development mode configuration API
4
+ *
5
+ * Provides access to development mode configuration values.
6
+ * The actual values are defined in development_config.cpp which is git-ignored.
7
+ *
8
+ * This allows:
9
+ * - Cross-platform sharing of dev config (iOS, Android, Flutter)
10
+ * - Git-ignored secrets with template for developers
11
+ * - Consistent development environment across SDKs
12
+ *
13
+ * Security Model:
14
+ * - development_config.cpp is in .gitignore (not committed to main branch)
15
+ * - Real values are ONLY in release tags (for SPM/Maven distribution)
16
+ * - Used ONLY when SDK is in .development mode
17
+ * - Backend validates build token via POST /api/v1/devices/register/dev
18
+ */
19
+
20
+ #ifndef RAC_DEV_CONFIG_H
21
+ #define RAC_DEV_CONFIG_H
22
+
23
+ #include <stdbool.h>
24
+
25
+ #include "rac/core/rac_types.h"
26
+
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif
30
+
31
+ // =============================================================================
32
+ // Development Configuration API
33
+ // =============================================================================
34
+
35
+ /**
36
+ * @brief Check if development config is available
37
+ * @return true if development config is properly configured
38
+ */
39
+ RAC_API bool rac_dev_config_is_available(void);
40
+
41
+ /**
42
+ * @brief Get Supabase project URL for development mode
43
+ * @return URL string (static, do not free)
44
+ */
45
+ RAC_API const char* rac_dev_config_get_supabase_url(void);
46
+
47
+ /**
48
+ * @brief Get Supabase anon key for development mode
49
+ * @return API key string (static, do not free)
50
+ */
51
+ RAC_API const char* rac_dev_config_get_supabase_key(void);
52
+
53
+ /**
54
+ * @brief Get build token for development mode
55
+ * @return Build token string (static, do not free)
56
+ */
57
+ RAC_API const char* rac_dev_config_get_build_token(void);
58
+
59
+ /**
60
+ * @brief Get Sentry DSN for crash reporting (optional)
61
+ * @return Sentry DSN string, or NULL if not configured
62
+ */
63
+ RAC_API const char* rac_dev_config_get_sentry_dsn(void);
64
+
65
+ // =============================================================================
66
+ // Convenience Functions
67
+ // =============================================================================
68
+
69
+ /**
70
+ * @brief Check if Supabase config is valid
71
+ * @return true if URL and key are non-empty
72
+ */
73
+ RAC_API bool rac_dev_config_has_supabase(void);
74
+
75
+ /**
76
+ * @brief Check if build token is valid
77
+ * @return true if build token is non-empty
78
+ */
79
+ RAC_API bool rac_dev_config_has_build_token(void);
80
+
81
+ #ifdef __cplusplus
82
+ }
83
+ #endif
84
+
85
+ #endif // RAC_DEV_CONFIG_H