@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,610 @@
1
+ /**
2
+ * @file rac_events.h
3
+ * @brief RunAnywhere Commons - Cross-Platform Event System
4
+ *
5
+ * C++ is the canonical source of truth for all analytics events.
6
+ * Platform SDKs (Swift, Kotlin, Flutter) register callbacks to receive
7
+ * these events and forward them to their native event systems.
8
+ *
9
+ * Usage:
10
+ * 1. Platform SDK registers callback via rac_events_set_callback()
11
+ * 2. C++ components emit events via rac_event_emit()
12
+ * 3. Platform SDK receives events in callback and converts to native events
13
+ */
14
+
15
+ #ifndef RAC_ANALYTICS_EVENTS_H
16
+ #define RAC_ANALYTICS_EVENTS_H
17
+
18
+ #include "rac/core/rac_types.h"
19
+ #include "rac/infrastructure/model_management/rac_model_types.h"
20
+
21
+ #ifdef __cplusplus
22
+ extern "C" {
23
+ #endif
24
+
25
+ // =============================================================================
26
+ // EVENT DESTINATION
27
+ // =============================================================================
28
+
29
+ // Include the event publishing header for destination types
30
+ #include "rac/infrastructure/events/rac_events.h"
31
+
32
+ // Alias the existing enum values for convenience in analytics context
33
+ #define RAC_EVENT_DEST_PUBLIC_ONLY RAC_EVENT_DESTINATION_PUBLIC_ONLY
34
+ #define RAC_EVENT_DEST_TELEMETRY_ONLY RAC_EVENT_DESTINATION_ANALYTICS_ONLY
35
+ #define RAC_EVENT_DEST_ALL RAC_EVENT_DESTINATION_ALL
36
+
37
+ // =============================================================================
38
+ // EVENT TYPES
39
+ // =============================================================================
40
+
41
+ /**
42
+ * @brief Event type enumeration
43
+ */
44
+ typedef enum rac_event_type {
45
+ // LLM Events (100-199)
46
+ RAC_EVENT_LLM_MODEL_LOAD_STARTED = 100,
47
+ RAC_EVENT_LLM_MODEL_LOAD_COMPLETED = 101,
48
+ RAC_EVENT_LLM_MODEL_LOAD_FAILED = 102,
49
+ RAC_EVENT_LLM_MODEL_UNLOADED = 103,
50
+ RAC_EVENT_LLM_GENERATION_STARTED = 110,
51
+ RAC_EVENT_LLM_GENERATION_COMPLETED = 111,
52
+ RAC_EVENT_LLM_GENERATION_FAILED = 112,
53
+ RAC_EVENT_LLM_FIRST_TOKEN = 113,
54
+ RAC_EVENT_LLM_STREAMING_UPDATE = 114,
55
+
56
+ // STT Events (200-299)
57
+ RAC_EVENT_STT_MODEL_LOAD_STARTED = 200,
58
+ RAC_EVENT_STT_MODEL_LOAD_COMPLETED = 201,
59
+ RAC_EVENT_STT_MODEL_LOAD_FAILED = 202,
60
+ RAC_EVENT_STT_MODEL_UNLOADED = 203,
61
+ RAC_EVENT_STT_TRANSCRIPTION_STARTED = 210,
62
+ RAC_EVENT_STT_TRANSCRIPTION_COMPLETED = 211,
63
+ RAC_EVENT_STT_TRANSCRIPTION_FAILED = 212,
64
+ RAC_EVENT_STT_PARTIAL_TRANSCRIPT = 213,
65
+
66
+ // TTS Events (300-399)
67
+ RAC_EVENT_TTS_VOICE_LOAD_STARTED = 300,
68
+ RAC_EVENT_TTS_VOICE_LOAD_COMPLETED = 301,
69
+ RAC_EVENT_TTS_VOICE_LOAD_FAILED = 302,
70
+ RAC_EVENT_TTS_VOICE_UNLOADED = 303,
71
+ RAC_EVENT_TTS_SYNTHESIS_STARTED = 310,
72
+ RAC_EVENT_TTS_SYNTHESIS_COMPLETED = 311,
73
+ RAC_EVENT_TTS_SYNTHESIS_FAILED = 312,
74
+ RAC_EVENT_TTS_SYNTHESIS_CHUNK = 313,
75
+
76
+ // VAD Events (400-499)
77
+ RAC_EVENT_VAD_STARTED = 400,
78
+ RAC_EVENT_VAD_STOPPED = 401,
79
+ RAC_EVENT_VAD_SPEECH_STARTED = 402,
80
+ RAC_EVENT_VAD_SPEECH_ENDED = 403,
81
+ RAC_EVENT_VAD_PAUSED = 404,
82
+ RAC_EVENT_VAD_RESUMED = 405,
83
+
84
+ // VoiceAgent Events (500-599)
85
+ RAC_EVENT_VOICE_AGENT_TURN_STARTED = 500,
86
+ RAC_EVENT_VOICE_AGENT_TURN_COMPLETED = 501,
87
+ RAC_EVENT_VOICE_AGENT_TURN_FAILED = 502,
88
+ // Voice Agent Component State Events
89
+ RAC_EVENT_VOICE_AGENT_STT_STATE_CHANGED = 510,
90
+ RAC_EVENT_VOICE_AGENT_LLM_STATE_CHANGED = 511,
91
+ RAC_EVENT_VOICE_AGENT_TTS_STATE_CHANGED = 512,
92
+ RAC_EVENT_VOICE_AGENT_ALL_READY = 513,
93
+
94
+ // SDK Lifecycle Events (600-699)
95
+ RAC_EVENT_SDK_INIT_STARTED = 600,
96
+ RAC_EVENT_SDK_INIT_COMPLETED = 601,
97
+ RAC_EVENT_SDK_INIT_FAILED = 602,
98
+ RAC_EVENT_SDK_MODELS_LOADED = 603,
99
+
100
+ // Model Download Events (700-719)
101
+ RAC_EVENT_MODEL_DOWNLOAD_STARTED = 700,
102
+ RAC_EVENT_MODEL_DOWNLOAD_PROGRESS = 701,
103
+ RAC_EVENT_MODEL_DOWNLOAD_COMPLETED = 702,
104
+ RAC_EVENT_MODEL_DOWNLOAD_FAILED = 703,
105
+ RAC_EVENT_MODEL_DOWNLOAD_CANCELLED = 704,
106
+
107
+ // Model Extraction Events (710-719)
108
+ RAC_EVENT_MODEL_EXTRACTION_STARTED = 710,
109
+ RAC_EVENT_MODEL_EXTRACTION_PROGRESS = 711,
110
+ RAC_EVENT_MODEL_EXTRACTION_COMPLETED = 712,
111
+ RAC_EVENT_MODEL_EXTRACTION_FAILED = 713,
112
+
113
+ // Model Deletion Events (720-729)
114
+ RAC_EVENT_MODEL_DELETED = 720,
115
+
116
+ // Storage Events (800-899)
117
+ RAC_EVENT_STORAGE_CACHE_CLEARED = 800,
118
+ RAC_EVENT_STORAGE_CACHE_CLEAR_FAILED = 801,
119
+ RAC_EVENT_STORAGE_TEMP_CLEANED = 802,
120
+
121
+ // Device Events (900-999)
122
+ RAC_EVENT_DEVICE_REGISTERED = 900,
123
+ RAC_EVENT_DEVICE_REGISTRATION_FAILED = 901,
124
+
125
+ // Network Events (1000-1099)
126
+ RAC_EVENT_NETWORK_CONNECTIVITY_CHANGED = 1000,
127
+
128
+ // Error Events (1100-1199)
129
+ RAC_EVENT_SDK_ERROR = 1100,
130
+
131
+ // Framework Events (1200-1299)
132
+ RAC_EVENT_FRAMEWORK_MODELS_REQUESTED = 1200,
133
+ RAC_EVENT_FRAMEWORK_MODELS_RETRIEVED = 1201,
134
+ } rac_event_type_t;
135
+
136
+ /**
137
+ * @brief Get the destination for an event type
138
+ *
139
+ * @param type Event type
140
+ * @return Event destination
141
+ */
142
+ RAC_API rac_event_destination_t rac_event_get_destination(rac_event_type_t type);
143
+
144
+ // =============================================================================
145
+ // EVENT DATA STRUCTURES
146
+ // =============================================================================
147
+
148
+ /**
149
+ * @brief LLM generation analytics event data
150
+ * Used for: GENERATION_STARTED, GENERATION_COMPLETED, GENERATION_FAILED
151
+ */
152
+ typedef struct rac_analytics_llm_generation {
153
+ /** Unique generation identifier */
154
+ const char* generation_id;
155
+ /** Model ID used for generation */
156
+ const char* model_id;
157
+ /** Human-readable model name */
158
+ const char* model_name;
159
+ /** Number of input/prompt tokens */
160
+ int32_t input_tokens;
161
+ /** Number of output/completion tokens */
162
+ int32_t output_tokens;
163
+ /** Total duration in milliseconds */
164
+ double duration_ms;
165
+ /** Tokens generated per second */
166
+ double tokens_per_second;
167
+ /** Whether this was a streaming generation */
168
+ rac_bool_t is_streaming;
169
+ /** Time to first token in ms (0 if not streaming or not yet received) */
170
+ double time_to_first_token_ms;
171
+ /** Inference framework used */
172
+ rac_inference_framework_t framework;
173
+ /** Generation temperature (0 if not set) */
174
+ float temperature;
175
+ /** Max tokens setting (0 if not set) */
176
+ int32_t max_tokens;
177
+ /** Context length (0 if not set) */
178
+ int32_t context_length;
179
+ /** Error code (RAC_SUCCESS if no error) */
180
+ rac_result_t error_code;
181
+ /** Error message (NULL if no error) */
182
+ const char* error_message;
183
+ } rac_analytics_llm_generation_t;
184
+
185
+ /**
186
+ * @brief LLM model load analytics event data
187
+ * Used for: MODEL_LOAD_STARTED, MODEL_LOAD_COMPLETED, MODEL_LOAD_FAILED
188
+ */
189
+ typedef struct rac_analytics_llm_model {
190
+ /** Model ID */
191
+ const char* model_id;
192
+ /** Human-readable model name */
193
+ const char* model_name;
194
+ /** Model size in bytes (0 if unknown) */
195
+ int64_t model_size_bytes;
196
+ /** Load duration in milliseconds (for completed event) */
197
+ double duration_ms;
198
+ /** Inference framework */
199
+ rac_inference_framework_t framework;
200
+ /** Error code (RAC_SUCCESS if no error) */
201
+ rac_result_t error_code;
202
+ /** Error message (NULL if no error) */
203
+ const char* error_message;
204
+ } rac_analytics_llm_model_t;
205
+
206
+ /**
207
+ * @brief STT transcription event data
208
+ * Used for: TRANSCRIPTION_STARTED, TRANSCRIPTION_COMPLETED, TRANSCRIPTION_FAILED
209
+ */
210
+ typedef struct rac_analytics_stt_transcription {
211
+ /** Unique transcription identifier */
212
+ const char* transcription_id;
213
+ /** Model ID used */
214
+ const char* model_id;
215
+ /** Human-readable model name */
216
+ const char* model_name;
217
+ /** Transcribed text (for completed event) */
218
+ const char* text;
219
+ /** Confidence score (0.0 - 1.0) */
220
+ float confidence;
221
+ /** Processing duration in milliseconds */
222
+ double duration_ms;
223
+ /** Audio length in milliseconds */
224
+ double audio_length_ms;
225
+ /** Audio size in bytes */
226
+ int32_t audio_size_bytes;
227
+ /** Word count in result */
228
+ int32_t word_count;
229
+ /** Real-time factor (audio_length / processing_time) */
230
+ double real_time_factor;
231
+ /** Language code */
232
+ const char* language;
233
+ /** Sample rate */
234
+ int32_t sample_rate;
235
+ /** Whether streaming transcription */
236
+ rac_bool_t is_streaming;
237
+ /** Inference framework */
238
+ rac_inference_framework_t framework;
239
+ /** Error code (RAC_SUCCESS if no error) */
240
+ rac_result_t error_code;
241
+ /** Error message (NULL if no error) */
242
+ const char* error_message;
243
+ } rac_analytics_stt_transcription_t;
244
+
245
+ /**
246
+ * @brief TTS synthesis event data
247
+ * Used for: SYNTHESIS_STARTED, SYNTHESIS_COMPLETED, SYNTHESIS_FAILED
248
+ */
249
+ typedef struct rac_analytics_tts_synthesis {
250
+ /** Unique synthesis identifier */
251
+ const char* synthesis_id;
252
+ /** Voice/Model ID used */
253
+ const char* model_id;
254
+ /** Human-readable voice/model name */
255
+ const char* model_name;
256
+ /** Character count of input text */
257
+ int32_t character_count;
258
+ /** Audio duration in milliseconds */
259
+ double audio_duration_ms;
260
+ /** Audio size in bytes */
261
+ int32_t audio_size_bytes;
262
+ /** Processing duration in milliseconds */
263
+ double processing_duration_ms;
264
+ /** Characters processed per second */
265
+ double characters_per_second;
266
+ /** Sample rate */
267
+ int32_t sample_rate;
268
+ /** Inference framework */
269
+ rac_inference_framework_t framework;
270
+ /** Error code (RAC_SUCCESS if no error) */
271
+ rac_result_t error_code;
272
+ /** Error message (NULL if no error) */
273
+ const char* error_message;
274
+ } rac_analytics_tts_synthesis_t;
275
+
276
+ /**
277
+ * @brief VAD event data
278
+ * Used for: VAD_STARTED, VAD_STOPPED, VAD_SPEECH_STARTED, VAD_SPEECH_ENDED
279
+ */
280
+ typedef struct rac_analytics_vad {
281
+ /** Speech duration in milliseconds (for SPEECH_ENDED) */
282
+ double speech_duration_ms;
283
+ /** Energy level (for speech events) */
284
+ float energy_level;
285
+ } rac_analytics_vad_t;
286
+
287
+ /**
288
+ * @brief Model download event data
289
+ * Used for: MODEL_DOWNLOAD_*, MODEL_EXTRACTION_*, MODEL_DELETED
290
+ */
291
+ typedef struct rac_analytics_model_download {
292
+ /** Model identifier */
293
+ const char* model_id;
294
+ /** Download progress (0.0 - 100.0) */
295
+ double progress;
296
+ /** Bytes downloaded so far */
297
+ int64_t bytes_downloaded;
298
+ /** Total bytes to download */
299
+ int64_t total_bytes;
300
+ /** Duration in milliseconds */
301
+ double duration_ms;
302
+ /** Final size in bytes (for completed event) */
303
+ int64_t size_bytes;
304
+ /** Archive type (e.g., "zip", "tar.gz", "none") */
305
+ const char* archive_type;
306
+ /** Error code (RAC_SUCCESS if no error) */
307
+ rac_result_t error_code;
308
+ /** Error message (NULL if no error) */
309
+ const char* error_message;
310
+ } rac_analytics_model_download_t;
311
+
312
+ /**
313
+ * @brief SDK lifecycle event data
314
+ * Used for: SDK_INIT_*, SDK_MODELS_LOADED
315
+ */
316
+ typedef struct rac_analytics_sdk_lifecycle {
317
+ /** Duration in milliseconds */
318
+ double duration_ms;
319
+ /** Count (e.g., number of models loaded) */
320
+ int32_t count;
321
+ /** Error code (RAC_SUCCESS if no error) */
322
+ rac_result_t error_code;
323
+ /** Error message (NULL if no error) */
324
+ const char* error_message;
325
+ } rac_analytics_sdk_lifecycle_t;
326
+
327
+ /**
328
+ * @brief Storage event data
329
+ * Used for: STORAGE_CACHE_CLEARED, STORAGE_TEMP_CLEANED
330
+ */
331
+ typedef struct rac_analytics_storage {
332
+ /** Bytes freed */
333
+ int64_t freed_bytes;
334
+ /** Error code (RAC_SUCCESS if no error) */
335
+ rac_result_t error_code;
336
+ /** Error message (NULL if no error) */
337
+ const char* error_message;
338
+ } rac_analytics_storage_t;
339
+
340
+ /**
341
+ * @brief Device event data
342
+ * Used for: DEVICE_REGISTERED, DEVICE_REGISTRATION_FAILED
343
+ */
344
+ typedef struct rac_analytics_device {
345
+ /** Device identifier */
346
+ const char* device_id;
347
+ /** Error code (RAC_SUCCESS if no error) */
348
+ rac_result_t error_code;
349
+ /** Error message (NULL if no error) */
350
+ const char* error_message;
351
+ } rac_analytics_device_t;
352
+
353
+ /**
354
+ * @brief Network event data
355
+ * Used for: NETWORK_CONNECTIVITY_CHANGED
356
+ */
357
+ typedef struct rac_analytics_network {
358
+ /** Whether the device is online */
359
+ rac_bool_t is_online;
360
+ } rac_analytics_network_t;
361
+
362
+ /**
363
+ * @brief SDK error event data
364
+ * Used for: SDK_ERROR
365
+ */
366
+ typedef struct rac_analytics_sdk_error {
367
+ /** Error code */
368
+ rac_result_t error_code;
369
+ /** Error message */
370
+ const char* error_message;
371
+ /** Operation that failed */
372
+ const char* operation;
373
+ /** Additional context */
374
+ const char* context;
375
+ } rac_analytics_sdk_error_t;
376
+
377
+ /**
378
+ * @brief Voice agent component state
379
+ * Used for: VOICE_AGENT_*_STATE_CHANGED events
380
+ */
381
+ typedef enum rac_voice_agent_component_state {
382
+ RAC_VOICE_AGENT_STATE_NOT_LOADED = 0,
383
+ RAC_VOICE_AGENT_STATE_LOADING = 1,
384
+ RAC_VOICE_AGENT_STATE_LOADED = 2,
385
+ RAC_VOICE_AGENT_STATE_ERROR = 3,
386
+ } rac_voice_agent_component_state_t;
387
+
388
+ /**
389
+ * @brief Voice agent state change event data
390
+ * Used for: VOICE_AGENT_STT_STATE_CHANGED, VOICE_AGENT_LLM_STATE_CHANGED,
391
+ * VOICE_AGENT_TTS_STATE_CHANGED, VOICE_AGENT_ALL_READY
392
+ */
393
+ typedef struct rac_analytics_voice_agent_state {
394
+ /** Component name: "stt", "llm", "tts", or "all" */
395
+ const char* component;
396
+ /** New state */
397
+ rac_voice_agent_component_state_t state;
398
+ /** Model ID (if loaded) */
399
+ const char* model_id;
400
+ /** Error message (if state is ERROR) */
401
+ const char* error_message;
402
+ } rac_analytics_voice_agent_state_t;
403
+
404
+ /**
405
+ * @brief Union of all event data types
406
+ */
407
+ typedef struct rac_analytics_event_data {
408
+ rac_event_type_t type;
409
+ union {
410
+ rac_analytics_llm_generation_t llm_generation;
411
+ rac_analytics_llm_model_t llm_model;
412
+ rac_analytics_stt_transcription_t stt_transcription;
413
+ rac_analytics_tts_synthesis_t tts_synthesis;
414
+ rac_analytics_vad_t vad;
415
+ rac_analytics_model_download_t model_download;
416
+ rac_analytics_sdk_lifecycle_t sdk_lifecycle;
417
+ rac_analytics_storage_t storage;
418
+ rac_analytics_device_t device;
419
+ rac_analytics_network_t network;
420
+ rac_analytics_sdk_error_t sdk_error;
421
+ rac_analytics_voice_agent_state_t voice_agent_state;
422
+ } data;
423
+ } rac_analytics_event_data_t;
424
+
425
+ // =============================================================================
426
+ // EVENT CALLBACK API
427
+ // =============================================================================
428
+
429
+ /**
430
+ * @brief Event callback function type
431
+ *
432
+ * Platform SDKs implement this callback to receive events from C++.
433
+ *
434
+ * @param type Event type
435
+ * @param data Event data (lifetime: only valid during callback)
436
+ * @param user_data User data provided during registration
437
+ */
438
+ typedef void (*rac_analytics_callback_fn)(rac_event_type_t type,
439
+ const rac_analytics_event_data_t* data, void* user_data);
440
+
441
+ /**
442
+ * @brief Register analytics event callback
443
+ *
444
+ * Called by platform SDKs at initialization to receive analytics events.
445
+ * Only one callback can be registered at a time.
446
+ *
447
+ * @param callback Callback function (NULL to unregister)
448
+ * @param user_data User data passed to callback
449
+ * @return RAC_SUCCESS or error code
450
+ */
451
+ RAC_API rac_result_t rac_analytics_events_set_callback(rac_analytics_callback_fn callback,
452
+ void* user_data);
453
+
454
+ /**
455
+ * @brief Emit an analytics event
456
+ *
457
+ * Called internally by C++ components to emit analytics events.
458
+ * If no callback is registered, event is silently discarded.
459
+ *
460
+ * @param type Event type
461
+ * @param data Event data
462
+ */
463
+ RAC_API void rac_analytics_event_emit(rac_event_type_t type,
464
+ const rac_analytics_event_data_t* data);
465
+
466
+ /**
467
+ * @brief Check if analytics event callback is registered
468
+ *
469
+ * @return RAC_TRUE if callback is registered, RAC_FALSE otherwise
470
+ */
471
+ RAC_API rac_bool_t rac_analytics_events_has_callback(void);
472
+
473
+ // =============================================================================
474
+ // PUBLIC EVENT CALLBACK API
475
+ // =============================================================================
476
+
477
+ /**
478
+ * @brief Public event callback function type
479
+ *
480
+ * Platform SDKs implement this callback to receive public events from C++.
481
+ * Public events are intended for app developers (UI updates, user feedback).
482
+ *
483
+ * @param type Event type
484
+ * @param data Event data (lifetime: only valid during callback)
485
+ * @param user_data User data provided during registration
486
+ */
487
+ typedef void (*rac_public_event_callback_fn)(rac_event_type_t type,
488
+ const rac_analytics_event_data_t* data,
489
+ void* user_data);
490
+
491
+ /**
492
+ * @brief Register public event callback
493
+ *
494
+ * Called by platform SDKs to receive public events (for app developers).
495
+ * Events are routed based on their destination:
496
+ * - PUBLIC_ONLY: Only sent to this callback
497
+ * - ALL: Sent to both this callback and telemetry
498
+ *
499
+ * @param callback Callback function (NULL to unregister)
500
+ * @param user_data User data passed to callback
501
+ * @return RAC_SUCCESS or error code
502
+ */
503
+ RAC_API rac_result_t rac_analytics_events_set_public_callback(rac_public_event_callback_fn callback,
504
+ void* user_data);
505
+
506
+ /**
507
+ * @brief Check if public event callback is registered
508
+ *
509
+ * @return RAC_TRUE if callback is registered, RAC_FALSE otherwise
510
+ */
511
+ RAC_API rac_bool_t rac_analytics_events_has_public_callback(void);
512
+
513
+ // =============================================================================
514
+ // DEFAULT EVENT DATA
515
+ // =============================================================================
516
+
517
+ /** Default LLM generation event */
518
+ static const rac_analytics_llm_generation_t RAC_ANALYTICS_LLM_GENERATION_DEFAULT = {
519
+ .generation_id = RAC_NULL,
520
+ .model_id = RAC_NULL,
521
+ .model_name = RAC_NULL,
522
+ .input_tokens = 0,
523
+ .output_tokens = 0,
524
+ .duration_ms = 0.0,
525
+ .tokens_per_second = 0.0,
526
+ .is_streaming = RAC_FALSE,
527
+ .time_to_first_token_ms = 0.0,
528
+ .framework = RAC_FRAMEWORK_UNKNOWN,
529
+ .temperature = 0.0f,
530
+ .max_tokens = 0,
531
+ .context_length = 0,
532
+ .error_code = RAC_SUCCESS,
533
+ .error_message = RAC_NULL};
534
+
535
+ /** Default STT transcription event */
536
+ static const rac_analytics_stt_transcription_t RAC_ANALYTICS_STT_TRANSCRIPTION_DEFAULT = {
537
+ .transcription_id = RAC_NULL,
538
+ .model_id = RAC_NULL,
539
+ .model_name = RAC_NULL,
540
+ .text = RAC_NULL,
541
+ .confidence = 0.0f,
542
+ .duration_ms = 0.0,
543
+ .audio_length_ms = 0.0,
544
+ .audio_size_bytes = 0,
545
+ .word_count = 0,
546
+ .real_time_factor = 0.0,
547
+ .language = RAC_NULL,
548
+ .sample_rate = 0,
549
+ .is_streaming = RAC_FALSE,
550
+ .framework = RAC_FRAMEWORK_UNKNOWN,
551
+ .error_code = RAC_SUCCESS,
552
+ .error_message = RAC_NULL};
553
+
554
+ /** Default TTS synthesis event */
555
+ static const rac_analytics_tts_synthesis_t RAC_ANALYTICS_TTS_SYNTHESIS_DEFAULT = {
556
+ .synthesis_id = RAC_NULL,
557
+ .model_id = RAC_NULL,
558
+ .model_name = RAC_NULL,
559
+ .character_count = 0,
560
+ .audio_duration_ms = 0.0,
561
+ .audio_size_bytes = 0,
562
+ .processing_duration_ms = 0.0,
563
+ .characters_per_second = 0.0,
564
+ .sample_rate = 0,
565
+ .framework = RAC_FRAMEWORK_UNKNOWN,
566
+ .error_code = RAC_SUCCESS,
567
+ .error_message = RAC_NULL};
568
+
569
+ /** Default VAD event */
570
+ static const rac_analytics_vad_t RAC_ANALYTICS_VAD_DEFAULT = {.speech_duration_ms = 0.0,
571
+ .energy_level = 0.0f};
572
+
573
+ /** Default model download event */
574
+ static const rac_analytics_model_download_t RAC_ANALYTICS_MODEL_DOWNLOAD_DEFAULT = {
575
+ .model_id = RAC_NULL,
576
+ .progress = 0.0,
577
+ .bytes_downloaded = 0,
578
+ .total_bytes = 0,
579
+ .duration_ms = 0.0,
580
+ .size_bytes = 0,
581
+ .archive_type = RAC_NULL,
582
+ .error_code = RAC_SUCCESS,
583
+ .error_message = RAC_NULL};
584
+
585
+ /** Default SDK lifecycle event */
586
+ static const rac_analytics_sdk_lifecycle_t RAC_ANALYTICS_SDK_LIFECYCLE_DEFAULT = {
587
+ .duration_ms = 0.0, .count = 0, .error_code = RAC_SUCCESS, .error_message = RAC_NULL};
588
+
589
+ /** Default storage event */
590
+ static const rac_analytics_storage_t RAC_ANALYTICS_STORAGE_DEFAULT = {
591
+ .freed_bytes = 0, .error_code = RAC_SUCCESS, .error_message = RAC_NULL};
592
+
593
+ /** Default device event */
594
+ static const rac_analytics_device_t RAC_ANALYTICS_DEVICE_DEFAULT = {
595
+ .device_id = RAC_NULL, .error_code = RAC_SUCCESS, .error_message = RAC_NULL};
596
+
597
+ /** Default network event */
598
+ static const rac_analytics_network_t RAC_ANALYTICS_NETWORK_DEFAULT = {.is_online = RAC_FALSE};
599
+
600
+ /** Default SDK error event */
601
+ static const rac_analytics_sdk_error_t RAC_ANALYTICS_SDK_ERROR_DEFAULT = {.error_code = RAC_SUCCESS,
602
+ .error_message = RAC_NULL,
603
+ .operation = RAC_NULL,
604
+ .context = RAC_NULL};
605
+
606
+ #ifdef __cplusplus
607
+ }
608
+ #endif
609
+
610
+ #endif /* RAC_ANALYTICS_EVENTS_H */
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @file rac_audio_utils.h
3
+ * @brief RunAnywhere Commons - Audio Utility Functions
4
+ *
5
+ * Provides audio format conversion utilities used across the SDK.
6
+ * This centralizes audio processing logic that was previously duplicated
7
+ * in Swift/Kotlin SDKs.
8
+ */
9
+
10
+ #ifndef RAC_AUDIO_UTILS_H
11
+ #define RAC_AUDIO_UTILS_H
12
+
13
+ #include "rac/core/rac_types.h"
14
+ #include "rac/features/tts/rac_tts_types.h"
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ // =============================================================================
21
+ // AUDIO CONVERSION API
22
+ // =============================================================================
23
+
24
+ /**
25
+ * @brief Convert Float32 PCM samples to WAV format (Int16 PCM with header)
26
+ *
27
+ * TTS backends typically output raw Float32 PCM samples in range [-1.0, 1.0].
28
+ * This function converts them to a complete WAV file that can be played by
29
+ * standard audio players (AVAudioPlayer on iOS, MediaPlayer on Android, etc.).
30
+ *
31
+ * WAV format details:
32
+ * - RIFF header with WAVE format
33
+ * - fmt chunk: PCM format (1), mono (1 channel), Int16 samples
34
+ * - data chunk: Int16 samples (scaled from Float32)
35
+ *
36
+ * @param pcm_data Input Float32 PCM samples
37
+ * @param pcm_size Size of pcm_data in bytes (must be multiple of 4)
38
+ * @param sample_rate Sample rate in Hz (e.g., 22050 for Piper TTS)
39
+ * @param out_wav_data Output: WAV file data (owned, must be freed with rac_free)
40
+ * @param out_wav_size Output: Size of WAV data in bytes
41
+ * @return RAC_SUCCESS or error code
42
+ *
43
+ * @note The caller owns the returned wav_data and must free it with rac_free()
44
+ *
45
+ * Example usage:
46
+ * @code
47
+ * void* wav_data = NULL;
48
+ * size_t wav_size = 0;
49
+ * rac_result_t result = rac_audio_float32_to_wav(
50
+ * pcm_samples, pcm_size, RAC_TTS_DEFAULT_SAMPLE_RATE, &wav_data, &wav_size);
51
+ * if (result == RAC_SUCCESS) {
52
+ * // Use wav_data...
53
+ * rac_free(wav_data);
54
+ * }
55
+ * @endcode
56
+ */
57
+ RAC_API rac_result_t rac_audio_float32_to_wav(const void* pcm_data, size_t pcm_size,
58
+ int32_t sample_rate, void** out_wav_data,
59
+ size_t* out_wav_size);
60
+
61
+ /**
62
+ * @brief Convert Int16 PCM samples to WAV format
63
+ *
64
+ * Similar to rac_audio_float32_to_wav but for Int16 input samples.
65
+ *
66
+ * @param pcm_data Input Int16 PCM samples
67
+ * @param pcm_size Size of pcm_data in bytes (must be multiple of 2)
68
+ * @param sample_rate Sample rate in Hz
69
+ * @param out_wav_data Output: WAV file data (owned, must be freed with rac_free)
70
+ * @param out_wav_size Output: Size of WAV data in bytes
71
+ * @return RAC_SUCCESS or error code
72
+ */
73
+ RAC_API rac_result_t rac_audio_int16_to_wav(const void* pcm_data, size_t pcm_size,
74
+ int32_t sample_rate, void** out_wav_data,
75
+ size_t* out_wav_size);
76
+
77
+ /**
78
+ * @brief Get WAV header size in bytes
79
+ *
80
+ * @return WAV header size (always 44 bytes for standard PCM WAV)
81
+ */
82
+ RAC_API size_t rac_audio_wav_header_size(void);
83
+
84
+ #ifdef __cplusplus
85
+ }
86
+ #endif
87
+
88
+ #endif /* RAC_AUDIO_UTILS_H */