@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,177 @@
1
+ /**
2
+ * @file rac_events.h
3
+ * @brief RunAnywhere Commons - Event Publishing and Subscription
4
+ *
5
+ * C port of Swift's SDKEvent protocol and EventPublisher from:
6
+ * Sources/RunAnywhere/Infrastructure/Events/SDKEvent.swift
7
+ * Sources/RunAnywhere/Infrastructure/Events/EventPublisher.swift
8
+ *
9
+ * Events are categorized and can be routed to different destinations
10
+ * (public EventBus or analytics).
11
+ */
12
+
13
+ #ifndef RAC_EVENTS_H
14
+ #define RAC_EVENTS_H
15
+
16
+ #include <RACommons/rac_types.h>
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // EVENT DESTINATION - Mirrors Swift's EventDestination
24
+ // =============================================================================
25
+
26
+ /**
27
+ * Where an event should be routed.
28
+ * Mirrors Swift's EventDestination enum.
29
+ */
30
+ typedef enum rac_event_destination {
31
+ /** Only to public EventBus (app developers) */
32
+ RAC_EVENT_DESTINATION_PUBLIC_ONLY = 0,
33
+ /** Only to analytics/telemetry (backend) */
34
+ RAC_EVENT_DESTINATION_ANALYTICS_ONLY = 1,
35
+ /** Both destinations (default) */
36
+ RAC_EVENT_DESTINATION_ALL = 2,
37
+ } rac_event_destination_t;
38
+
39
+ // =============================================================================
40
+ // EVENT CATEGORY - Mirrors Swift's EventCategory
41
+ // =============================================================================
42
+
43
+ /**
44
+ * Event categories for filtering/grouping.
45
+ * Mirrors Swift's EventCategory enum.
46
+ */
47
+ typedef enum rac_event_category {
48
+ RAC_EVENT_CATEGORY_SDK = 0,
49
+ RAC_EVENT_CATEGORY_MODEL = 1,
50
+ RAC_EVENT_CATEGORY_LLM = 2,
51
+ RAC_EVENT_CATEGORY_STT = 3,
52
+ RAC_EVENT_CATEGORY_TTS = 4,
53
+ RAC_EVENT_CATEGORY_VOICE = 5,
54
+ RAC_EVENT_CATEGORY_STORAGE = 6,
55
+ RAC_EVENT_CATEGORY_DEVICE = 7,
56
+ RAC_EVENT_CATEGORY_NETWORK = 8,
57
+ RAC_EVENT_CATEGORY_ERROR = 9,
58
+ } rac_event_category_t;
59
+
60
+ // =============================================================================
61
+ // EVENT STRUCTURE - Mirrors Swift's SDKEvent protocol
62
+ // =============================================================================
63
+
64
+ /**
65
+ * Event data structure.
66
+ * Mirrors Swift's SDKEvent protocol properties.
67
+ */
68
+ typedef struct rac_event {
69
+ /** Unique identifier for this event instance */
70
+ const char* id;
71
+
72
+ /** Event type string (used for analytics categorization) */
73
+ const char* type;
74
+
75
+ /** Category for filtering/routing */
76
+ rac_event_category_t category;
77
+
78
+ /** Timestamp in milliseconds since epoch */
79
+ int64_t timestamp_ms;
80
+
81
+ /** Optional session ID for grouping related events (can be NULL) */
82
+ const char* session_id;
83
+
84
+ /** Where to route this event */
85
+ rac_event_destination_t destination;
86
+
87
+ /** Event properties as JSON string (can be NULL) */
88
+ const char* properties_json;
89
+ } rac_event_t;
90
+
91
+ // =============================================================================
92
+ // EVENT CALLBACK
93
+ // =============================================================================
94
+
95
+ /**
96
+ * Event callback function type.
97
+ *
98
+ * @param event The event data (valid only during the callback)
99
+ * @param user_data User-provided context data
100
+ */
101
+ typedef void (*rac_event_callback_fn)(const rac_event_t* event, void* user_data);
102
+
103
+ // =============================================================================
104
+ // EVENT API
105
+ // =============================================================================
106
+
107
+ /**
108
+ * Subscribes to events of a specific category.
109
+ *
110
+ * @param category The category to subscribe to
111
+ * @param callback The callback function to invoke
112
+ * @param user_data User data passed to the callback
113
+ * @return Subscription ID (0 on failure), use with rac_event_unsubscribe
114
+ *
115
+ * @note The callback is invoked on the thread that publishes the event.
116
+ * Keep callback execution fast to avoid blocking.
117
+ */
118
+ RAC_API uint64_t rac_event_subscribe(rac_event_category_t category, rac_event_callback_fn callback,
119
+ void* user_data);
120
+
121
+ /**
122
+ * Subscribes to all events regardless of category.
123
+ *
124
+ * @param callback The callback function to invoke
125
+ * @param user_data User data passed to the callback
126
+ * @return Subscription ID (0 on failure)
127
+ */
128
+ RAC_API uint64_t rac_event_subscribe_all(rac_event_callback_fn callback, void* user_data);
129
+
130
+ /**
131
+ * Unsubscribes from events.
132
+ *
133
+ * @param subscription_id The subscription ID returned from subscribe
134
+ */
135
+ RAC_API void rac_event_unsubscribe(uint64_t subscription_id);
136
+
137
+ /**
138
+ * Publishes an event to all subscribers.
139
+ *
140
+ * This is called by the commons library to publish events.
141
+ * Swift's EventBridge subscribes to receive and re-publish to Swift consumers.
142
+ *
143
+ * @param event The event to publish
144
+ * @return RAC_SUCCESS on success, or an error code on failure
145
+ */
146
+ RAC_API rac_result_t rac_event_publish(const rac_event_t* event);
147
+
148
+ /**
149
+ * Track an event (convenience function matching Swift's EventPublisher.track).
150
+ *
151
+ * @param type Event type string
152
+ * @param category Event category
153
+ * @param destination Where to route this event
154
+ * @param properties_json Event properties as JSON (can be NULL)
155
+ * @return RAC_SUCCESS on success, or an error code on failure
156
+ */
157
+ RAC_API rac_result_t rac_event_track(const char* type, rac_event_category_t category,
158
+ rac_event_destination_t destination,
159
+ const char* properties_json);
160
+
161
+ // =============================================================================
162
+ // UTILITY FUNCTIONS
163
+ // =============================================================================
164
+
165
+ /**
166
+ * Gets a string name for an event category.
167
+ *
168
+ * @param category The event category
169
+ * @return A string name (never NULL)
170
+ */
171
+ RAC_API const char* rac_event_category_name(rac_event_category_t category);
172
+
173
+ #ifdef __cplusplus
174
+ }
175
+ #endif
176
+
177
+ #endif /* RAC_EVENTS_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
@@ -0,0 +1,290 @@
1
+ /**
2
+ * @file rac_lifecycle.h
3
+ * @brief RunAnywhere Commons - Lifecycle Management API
4
+ *
5
+ * C port of Swift's ManagedLifecycle.swift from:
6
+ * Sources/RunAnywhere/Core/Capabilities/ManagedLifecycle.swift
7
+ *
8
+ * Provides unified lifecycle management with integrated event tracking.
9
+ * Tracks lifecycle events (load, unload) via EventPublisher.
10
+ */
11
+
12
+ #ifndef RAC_LIFECYCLE_H
13
+ #define RAC_LIFECYCLE_H
14
+
15
+ #include <RACommons/rac_error.h>
16
+ #include <RACommons/rac_types.h>
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // TYPES - Mirrors Swift's CapabilityLoadingState
24
+ // =============================================================================
25
+
26
+ /**
27
+ * @brief Capability loading state
28
+ *
29
+ * Mirrors Swift's CapabilityLoadingState enum.
30
+ */
31
+ typedef enum rac_lifecycle_state {
32
+ RAC_LIFECYCLE_STATE_IDLE = 0, /**< Not loaded */
33
+ RAC_LIFECYCLE_STATE_LOADING = 1, /**< Currently loading */
34
+ RAC_LIFECYCLE_STATE_LOADED = 2, /**< Successfully loaded */
35
+ RAC_LIFECYCLE_STATE_FAILED = 3 /**< Load failed */
36
+ } rac_lifecycle_state_t;
37
+
38
+ /**
39
+ * @brief Resource type for lifecycle tracking
40
+ *
41
+ * Mirrors Swift's CapabilityResourceType enum.
42
+ */
43
+ typedef enum rac_resource_type {
44
+ RAC_RESOURCE_TYPE_LLM_MODEL = 0,
45
+ RAC_RESOURCE_TYPE_STT_MODEL = 1,
46
+ RAC_RESOURCE_TYPE_TTS_VOICE = 2,
47
+ RAC_RESOURCE_TYPE_VAD_MODEL = 3,
48
+ RAC_RESOURCE_TYPE_DIARIZATION_MODEL = 4
49
+ } rac_resource_type_t;
50
+
51
+ /**
52
+ * @brief Lifecycle metrics
53
+ *
54
+ * Mirrors Swift's ModelLifecycleMetrics struct.
55
+ */
56
+ typedef struct rac_lifecycle_metrics {
57
+ /** Total lifecycle events */
58
+ int32_t total_events;
59
+
60
+ /** Start time (ms since epoch) */
61
+ int64_t start_time_ms;
62
+
63
+ /** Last event time (ms since epoch, 0 if none) */
64
+ int64_t last_event_time_ms;
65
+
66
+ /** Total load attempts */
67
+ int32_t total_loads;
68
+
69
+ /** Successful loads */
70
+ int32_t successful_loads;
71
+
72
+ /** Failed loads */
73
+ int32_t failed_loads;
74
+
75
+ /** Average load time in milliseconds */
76
+ double average_load_time_ms;
77
+
78
+ /** Total unloads */
79
+ int32_t total_unloads;
80
+ } rac_lifecycle_metrics_t;
81
+
82
+ /**
83
+ * @brief Lifecycle configuration
84
+ */
85
+ typedef struct rac_lifecycle_config {
86
+ /** Resource type for event tracking */
87
+ rac_resource_type_t resource_type;
88
+
89
+ /** Logger category (can be NULL for default) */
90
+ const char* logger_category;
91
+
92
+ /** User data for callbacks */
93
+ void* user_data;
94
+ } rac_lifecycle_config_t;
95
+
96
+ /**
97
+ * @brief Service creation callback
98
+ *
99
+ * Called by the lifecycle manager to create a service for a given model ID.
100
+ *
101
+ * @param model_id The model ID to load
102
+ * @param user_data User-provided context
103
+ * @param out_service Output: Handle to the created service
104
+ * @return RAC_SUCCESS or error code
105
+ */
106
+ typedef rac_result_t (*rac_lifecycle_create_service_fn)(const char* model_id, void* user_data,
107
+ rac_handle_t* out_service);
108
+
109
+ /**
110
+ * @brief Service destroy callback
111
+ *
112
+ * Called by the lifecycle manager to destroy a service.
113
+ *
114
+ * @param service Handle to the service to destroy
115
+ * @param user_data User-provided context
116
+ */
117
+ typedef void (*rac_lifecycle_destroy_service_fn)(rac_handle_t service, void* user_data);
118
+
119
+ // =============================================================================
120
+ // LIFECYCLE API - Mirrors Swift's ManagedLifecycle
121
+ // =============================================================================
122
+
123
+ /**
124
+ * @brief Create a lifecycle manager
125
+ *
126
+ * @param config Lifecycle configuration
127
+ * @param create_fn Service creation callback
128
+ * @param destroy_fn Service destruction callback (can be NULL)
129
+ * @param out_handle Output: Handle to the lifecycle manager
130
+ * @return RAC_SUCCESS or error code
131
+ */
132
+ RAC_API rac_result_t rac_lifecycle_create(const rac_lifecycle_config_t* config,
133
+ rac_lifecycle_create_service_fn create_fn,
134
+ rac_lifecycle_destroy_service_fn destroy_fn,
135
+ rac_handle_t* out_handle);
136
+
137
+ /**
138
+ * @brief Load a model with automatic event tracking
139
+ *
140
+ * Mirrors Swift's ManagedLifecycle.load(_:)
141
+ * If already loaded with same ID, skips duplicate load.
142
+ *
143
+ * @param handle Lifecycle manager handle
144
+ * @param model_path File path to the model (used for loading) - REQUIRED
145
+ * @param model_id Model identifier for telemetry (e.g., "sherpa-onnx-whisper-tiny.en")
146
+ * Optional: if NULL, defaults to model_path
147
+ * @param model_name Human-readable model name (e.g., "Sherpa Whisper Tiny (ONNX)")
148
+ * Optional: if NULL, defaults to model_id
149
+ * @param out_service Output: Handle to the loaded service
150
+ * @return RAC_SUCCESS or error code
151
+ */
152
+ RAC_API rac_result_t rac_lifecycle_load(rac_handle_t handle, const char* model_path,
153
+ const char* model_id, const char* model_name,
154
+ rac_handle_t* out_service);
155
+
156
+ /**
157
+ * @brief Unload the currently loaded model
158
+ *
159
+ * Mirrors Swift's ManagedLifecycle.unload()
160
+ *
161
+ * @param handle Lifecycle manager handle
162
+ * @return RAC_SUCCESS or error code
163
+ */
164
+ RAC_API rac_result_t rac_lifecycle_unload(rac_handle_t handle);
165
+
166
+ /**
167
+ * @brief Reset all state
168
+ *
169
+ * Mirrors Swift's ManagedLifecycle.reset()
170
+ *
171
+ * @param handle Lifecycle manager handle
172
+ * @return RAC_SUCCESS or error code
173
+ */
174
+ RAC_API rac_result_t rac_lifecycle_reset(rac_handle_t handle);
175
+
176
+ /**
177
+ * @brief Get current lifecycle state
178
+ *
179
+ * Mirrors Swift's ManagedLifecycle.state
180
+ *
181
+ * @param handle Lifecycle manager handle
182
+ * @return Current state
183
+ */
184
+ RAC_API rac_lifecycle_state_t rac_lifecycle_get_state(rac_handle_t handle);
185
+
186
+ /**
187
+ * @brief Check if a model is loaded
188
+ *
189
+ * Mirrors Swift's ManagedLifecycle.isLoaded
190
+ *
191
+ * @param handle Lifecycle manager handle
192
+ * @return RAC_TRUE if loaded, RAC_FALSE otherwise
193
+ */
194
+ RAC_API rac_bool_t rac_lifecycle_is_loaded(rac_handle_t handle);
195
+
196
+ /**
197
+ * @brief Get current model ID
198
+ *
199
+ * Mirrors Swift's ManagedLifecycle.currentModelId
200
+ *
201
+ * @param handle Lifecycle manager handle
202
+ * @return Current model ID (may be NULL if not loaded)
203
+ */
204
+ RAC_API const char* rac_lifecycle_get_model_id(rac_handle_t handle);
205
+
206
+ /**
207
+ * @brief Get current model name (human-readable)
208
+ *
209
+ * @param handle Lifecycle manager handle
210
+ * @return Current model name (may be NULL if not loaded)
211
+ */
212
+ RAC_API const char* rac_lifecycle_get_model_name(rac_handle_t handle);
213
+
214
+ /**
215
+ * @brief Get current service handle
216
+ *
217
+ * Mirrors Swift's ManagedLifecycle.currentService
218
+ *
219
+ * @param handle Lifecycle manager handle
220
+ * @return Current service handle (may be NULL if not loaded)
221
+ */
222
+ RAC_API rac_handle_t rac_lifecycle_get_service(rac_handle_t handle);
223
+
224
+ /**
225
+ * @brief Require service or return error
226
+ *
227
+ * Mirrors Swift's ManagedLifecycle.requireService()
228
+ *
229
+ * @param handle Lifecycle manager handle
230
+ * @param out_service Output: Service handle
231
+ * @return RAC_SUCCESS or RAC_ERROR_NOT_INITIALIZED if not loaded
232
+ */
233
+ RAC_API rac_result_t rac_lifecycle_require_service(rac_handle_t handle, rac_handle_t* out_service);
234
+
235
+ /**
236
+ * @brief Track an operation error
237
+ *
238
+ * Mirrors Swift's ManagedLifecycle.trackOperationError(_:operation:)
239
+ *
240
+ * @param handle Lifecycle manager handle
241
+ * @param error_code Error code
242
+ * @param operation Operation name
243
+ */
244
+ RAC_API void rac_lifecycle_track_error(rac_handle_t handle, rac_result_t error_code,
245
+ const char* operation);
246
+
247
+ /**
248
+ * @brief Get lifecycle metrics
249
+ *
250
+ * Mirrors Swift's ManagedLifecycle.getLifecycleMetrics()
251
+ *
252
+ * @param handle Lifecycle manager handle
253
+ * @param out_metrics Output: Lifecycle metrics
254
+ * @return RAC_SUCCESS or error code
255
+ */
256
+ RAC_API rac_result_t rac_lifecycle_get_metrics(rac_handle_t handle,
257
+ rac_lifecycle_metrics_t* out_metrics);
258
+
259
+ /**
260
+ * @brief Destroy a lifecycle manager
261
+ *
262
+ * @param handle Lifecycle manager handle
263
+ */
264
+ RAC_API void rac_lifecycle_destroy(rac_handle_t handle);
265
+
266
+ // =============================================================================
267
+ // CONVENIENCE STATE HELPERS
268
+ // =============================================================================
269
+
270
+ /**
271
+ * @brief Get state name string
272
+ *
273
+ * @param state Lifecycle state
274
+ * @return Human-readable state name
275
+ */
276
+ RAC_API const char* rac_lifecycle_state_name(rac_lifecycle_state_t state);
277
+
278
+ /**
279
+ * @brief Get resource type name string
280
+ *
281
+ * @param type Resource type
282
+ * @return Human-readable resource type name
283
+ */
284
+ RAC_API const char* rac_resource_type_name(rac_resource_type_t type);
285
+
286
+ #ifdef __cplusplus
287
+ }
288
+ #endif
289
+
290
+ #endif /* RAC_LIFECYCLE_H */