@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,158 @@
1
+ /**
2
+ * @file rac_tts_component.h
3
+ * @brief RunAnywhere Commons - TTS Capability Component
4
+ *
5
+ * C port of Swift's TTSCapability.swift from:
6
+ * Sources/RunAnywhere/Features/TTS/TTSCapability.swift
7
+ *
8
+ * Actor-based TTS capability that owns voice lifecycle and synthesis.
9
+ * Uses lifecycle manager for unified lifecycle + analytics handling.
10
+ */
11
+
12
+ #ifndef RAC_TTS_COMPONENT_H
13
+ #define RAC_TTS_COMPONENT_H
14
+
15
+ #include <RACommons/rac_lifecycle.h>
16
+ #include <RACommons/rac_error.h>
17
+ #include <RACommons/rac_tts_types.h>
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ // NOTE: rac_tts_config_t is defined in rac_tts_types.h (included above)
24
+
25
+ // =============================================================================
26
+ // TTS COMPONENT API - Mirrors Swift's TTSCapability
27
+ // =============================================================================
28
+
29
+ /**
30
+ * @brief Create a TTS capability component
31
+ *
32
+ * @param out_handle Output: Handle to the component
33
+ * @return RAC_SUCCESS or error code
34
+ */
35
+ RAC_API rac_result_t rac_tts_component_create(rac_handle_t* out_handle);
36
+
37
+ /**
38
+ * @brief Configure the TTS component
39
+ *
40
+ * @param handle Component handle
41
+ * @param config Configuration
42
+ * @return RAC_SUCCESS or error code
43
+ */
44
+ RAC_API rac_result_t rac_tts_component_configure(rac_handle_t handle,
45
+ const rac_tts_config_t* config);
46
+
47
+ /**
48
+ * @brief Check if voice is loaded
49
+ *
50
+ * @param handle Component handle
51
+ * @return RAC_TRUE if loaded, RAC_FALSE otherwise
52
+ */
53
+ RAC_API rac_bool_t rac_tts_component_is_loaded(rac_handle_t handle);
54
+
55
+ /**
56
+ * @brief Get current voice ID
57
+ *
58
+ * @param handle Component handle
59
+ * @return Current voice ID (NULL if not loaded)
60
+ */
61
+ RAC_API const char* rac_tts_component_get_voice_id(rac_handle_t handle);
62
+
63
+ /**
64
+ * @brief Load a voice
65
+ *
66
+ * @param handle Component handle
67
+ * @param voice_path File path to the voice (used for loading) - REQUIRED
68
+ * @param voice_id Voice identifier for telemetry (e.g., "vits-piper-en_GB-alba-medium")
69
+ * Optional: if NULL, defaults to voice_path
70
+ * @param voice_name Human-readable voice name (e.g., "Piper TTS (British English)")
71
+ * Optional: if NULL, defaults to voice_id
72
+ * @return RAC_SUCCESS or error code
73
+ */
74
+ RAC_API rac_result_t rac_tts_component_load_voice(rac_handle_t handle, const char* voice_path,
75
+ const char* voice_id, const char* voice_name);
76
+
77
+ /**
78
+ * @brief Unload the current voice
79
+ *
80
+ * @param handle Component handle
81
+ * @return RAC_SUCCESS or error code
82
+ */
83
+ RAC_API rac_result_t rac_tts_component_unload(rac_handle_t handle);
84
+
85
+ /**
86
+ * @brief Cleanup and reset the component
87
+ *
88
+ * @param handle Component handle
89
+ * @return RAC_SUCCESS or error code
90
+ */
91
+ RAC_API rac_result_t rac_tts_component_cleanup(rac_handle_t handle);
92
+
93
+ /**
94
+ * @brief Stop current synthesis
95
+ *
96
+ * @param handle Component handle
97
+ * @return RAC_SUCCESS or error code
98
+ */
99
+ RAC_API rac_result_t rac_tts_component_stop(rac_handle_t handle);
100
+
101
+ /**
102
+ * @brief Synthesize text to audio
103
+ *
104
+ * @param handle Component handle
105
+ * @param text Text to synthesize
106
+ * @param options Synthesis options (can be NULL for defaults)
107
+ * @param out_result Output: Synthesis result
108
+ * @return RAC_SUCCESS or error code
109
+ */
110
+ RAC_API rac_result_t rac_tts_component_synthesize(rac_handle_t handle, const char* text,
111
+ const rac_tts_options_t* options,
112
+ rac_tts_result_t* out_result);
113
+
114
+ /**
115
+ * @brief Synthesize text with streaming
116
+ *
117
+ * @param handle Component handle
118
+ * @param text Text to synthesize
119
+ * @param options Synthesis options
120
+ * @param callback Callback for audio chunks
121
+ * @param user_data User context passed to callback
122
+ * @return RAC_SUCCESS or error code
123
+ */
124
+ RAC_API rac_result_t rac_tts_component_synthesize_stream(rac_handle_t handle, const char* text,
125
+ const rac_tts_options_t* options,
126
+ rac_tts_stream_callback_t callback,
127
+ void* user_data);
128
+
129
+ /**
130
+ * @brief Get lifecycle state
131
+ *
132
+ * @param handle Component handle
133
+ * @return Current lifecycle state
134
+ */
135
+ RAC_API rac_lifecycle_state_t rac_tts_component_get_state(rac_handle_t handle);
136
+
137
+ /**
138
+ * @brief Get lifecycle metrics
139
+ *
140
+ * @param handle Component handle
141
+ * @param out_metrics Output: Lifecycle metrics
142
+ * @return RAC_SUCCESS or error code
143
+ */
144
+ RAC_API rac_result_t rac_tts_component_get_metrics(rac_handle_t handle,
145
+ rac_lifecycle_metrics_t* out_metrics);
146
+
147
+ /**
148
+ * @brief Destroy the TTS component
149
+ *
150
+ * @param handle Component handle
151
+ */
152
+ RAC_API void rac_tts_component_destroy(rac_handle_t handle);
153
+
154
+ #ifdef __cplusplus
155
+ }
156
+ #endif
157
+
158
+ #endif /* RAC_TTS_COMPONENT_H */
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @file rac_tts_events.h
3
+ * @brief TTS-specific event types - 1:1 port of TTSEvent.swift
4
+ *
5
+ * Swift Source: Sources/RunAnywhere/Features/TTS/Analytics/TTSEvent.swift
6
+ */
7
+
8
+ #ifndef RAC_TTS_EVENTS_H
9
+ #define RAC_TTS_EVENTS_H
10
+
11
+ #include <RACommons/rac_types.h>
12
+ #include <RACommons/rac_events.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ // =============================================================================
19
+ // TTS EVENT TYPES
20
+ // =============================================================================
21
+
22
+ typedef enum rac_tts_event_type {
23
+ RAC_TTS_EVENT_SYNTHESIS_STARTED = 0,
24
+ RAC_TTS_EVENT_SYNTHESIS_CHUNK,
25
+ RAC_TTS_EVENT_SYNTHESIS_COMPLETED,
26
+ RAC_TTS_EVENT_SYNTHESIS_FAILED,
27
+ } rac_tts_event_type_t;
28
+
29
+ // =============================================================================
30
+ // EVENT PUBLISHING FUNCTIONS
31
+ // =============================================================================
32
+
33
+ RAC_API rac_result_t rac_tts_event_synthesis_started(const char* synthesis_id, const char* model_id,
34
+ int32_t character_count, int32_t sample_rate,
35
+ rac_inference_framework_t framework);
36
+
37
+ RAC_API rac_result_t rac_tts_event_synthesis_chunk(const char* synthesis_id, int32_t chunk_size);
38
+
39
+ RAC_API rac_result_t rac_tts_event_synthesis_completed(
40
+ const char* synthesis_id, const char* model_id, int32_t character_count,
41
+ double audio_duration_ms, int32_t audio_size_bytes, double processing_duration_ms,
42
+ double characters_per_second, int32_t sample_rate, rac_inference_framework_t framework);
43
+
44
+ RAC_API rac_result_t rac_tts_event_synthesis_failed(const char* synthesis_id, const char* model_id,
45
+ rac_result_t error_code,
46
+ const char* error_message);
47
+
48
+ RAC_API const char* rac_tts_event_type_string(rac_tts_event_type_t event_type);
49
+
50
+ #ifdef __cplusplus
51
+ }
52
+ #endif
53
+
54
+ #endif /* RAC_TTS_EVENTS_H */
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @file rac_tts_onnx.h
3
+ * @brief RunAnywhere Core - ONNX Backend RAC API for TTS
4
+ *
5
+ * Direct RAC API export from runanywhere-core's ONNX TTS backend.
6
+ */
7
+
8
+ #ifndef RAC_TTS_ONNX_H
9
+ #define RAC_TTS_ONNX_H
10
+
11
+ #include <RACommons/rac_error.h>
12
+ #include <RACommons/rac_types.h>
13
+ #include <RACommons/rac_tts.h>
14
+
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif
18
+
19
+ // =============================================================================
20
+ // EXPORT MACRO
21
+ // =============================================================================
22
+
23
+ #if defined(RAC_ONNX_BUILDING)
24
+ #if defined(_WIN32)
25
+ #define RAC_ONNX_API __declspec(dllexport)
26
+ #elif defined(__GNUC__) || defined(__clang__)
27
+ #define RAC_ONNX_API __attribute__((visibility("default")))
28
+ #else
29
+ #define RAC_ONNX_API
30
+ #endif
31
+ #else
32
+ #define RAC_ONNX_API
33
+ #endif
34
+
35
+ // =============================================================================
36
+ // CONFIGURATION
37
+ // =============================================================================
38
+
39
+ typedef struct rac_tts_onnx_config {
40
+ int32_t num_threads;
41
+ rac_bool_t use_coreml;
42
+ int32_t sample_rate;
43
+ } rac_tts_onnx_config_t;
44
+
45
+ static const rac_tts_onnx_config_t RAC_TTS_ONNX_CONFIG_DEFAULT = {
46
+ .num_threads = 0, .use_coreml = RAC_TRUE, .sample_rate = 22050};
47
+
48
+ // =============================================================================
49
+ // ONNX TTS API
50
+ // =============================================================================
51
+
52
+ RAC_ONNX_API rac_result_t rac_tts_onnx_create(const char* model_path,
53
+ const rac_tts_onnx_config_t* config,
54
+ rac_handle_t* out_handle);
55
+
56
+ RAC_ONNX_API rac_result_t rac_tts_onnx_synthesize(rac_handle_t handle, const char* text,
57
+ const rac_tts_options_t* options,
58
+ rac_tts_result_t* out_result);
59
+
60
+ RAC_ONNX_API rac_result_t rac_tts_onnx_get_voices(rac_handle_t handle, char*** out_voices,
61
+ size_t* out_count);
62
+
63
+ RAC_ONNX_API void rac_tts_onnx_stop(rac_handle_t handle);
64
+
65
+ RAC_ONNX_API void rac_tts_onnx_destroy(rac_handle_t handle);
66
+
67
+ #ifdef __cplusplus
68
+ }
69
+ #endif
70
+
71
+ #endif /* RAC_TTS_ONNX_H */
@@ -0,0 +1,197 @@
1
+ /**
2
+ * @file rac_tts_platform.h
3
+ * @brief RunAnywhere Commons - Platform TTS Backend (System TTS)
4
+ *
5
+ * C API for platform-native TTS services. On Apple platforms, this uses
6
+ * AVSpeechSynthesizer. The actual implementation is in Swift, with C++
7
+ * providing the registration and callback infrastructure.
8
+ *
9
+ * This backend follows the same pattern as ONNX TTS backend, but delegates
10
+ * to Swift via function pointer callbacks since AVSpeechSynthesizer is
11
+ * an Apple-only framework.
12
+ */
13
+
14
+ #ifndef RAC_TTS_PLATFORM_H
15
+ #define RAC_TTS_PLATFORM_H
16
+
17
+ #include <RACommons/rac_types.h>
18
+
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ // =============================================================================
24
+ // TYPES
25
+ // =============================================================================
26
+
27
+ /** Opaque handle to platform TTS service */
28
+ typedef struct rac_tts_platform* rac_tts_platform_handle_t;
29
+
30
+ /**
31
+ * Platform TTS configuration.
32
+ */
33
+ typedef struct rac_tts_platform_config {
34
+ /** Voice identifier (can be NULL for default) */
35
+ const char* voice_id;
36
+ /** Language code (e.g., "en-US") */
37
+ const char* language;
38
+ /** Reserved for future use */
39
+ void* reserved;
40
+ } rac_tts_platform_config_t;
41
+
42
+ /**
43
+ * Synthesis options for platform TTS.
44
+ */
45
+ typedef struct rac_tts_platform_options {
46
+ /** Speech rate (0.5 = half speed, 1.0 = normal, 2.0 = double) */
47
+ float rate;
48
+ /** Pitch multiplier (0.5 = low, 1.0 = normal, 2.0 = high) */
49
+ float pitch;
50
+ /** Volume (0.0 = silent, 1.0 = full) */
51
+ float volume;
52
+ /** Voice identifier override (can be NULL) */
53
+ const char* voice_id;
54
+ /** Reserved for future options */
55
+ void* reserved;
56
+ } rac_tts_platform_options_t;
57
+
58
+ // =============================================================================
59
+ // SWIFT CALLBACK TYPES
60
+ // =============================================================================
61
+
62
+ /**
63
+ * Callback to check if platform TTS can handle a voice ID.
64
+ * Implemented in Swift.
65
+ *
66
+ * @param voice_id Voice identifier to check (can be NULL)
67
+ * @param user_data User-provided context
68
+ * @return RAC_TRUE if this backend can handle the voice
69
+ */
70
+ typedef rac_bool_t (*rac_platform_tts_can_handle_fn)(const char* voice_id, void* user_data);
71
+
72
+ /**
73
+ * Callback to create platform TTS service.
74
+ * Implemented in Swift.
75
+ *
76
+ * @param config Configuration options
77
+ * @param user_data User-provided context
78
+ * @return Handle to created service (Swift object pointer), or NULL on failure
79
+ */
80
+ typedef rac_handle_t (*rac_platform_tts_create_fn)(const rac_tts_platform_config_t* config,
81
+ void* user_data);
82
+
83
+ /**
84
+ * Callback to synthesize speech.
85
+ * Implemented in Swift.
86
+ *
87
+ * @param handle Service handle from create
88
+ * @param text Text to synthesize
89
+ * @param options Synthesis options
90
+ * @param user_data User-provided context
91
+ * @return RAC_SUCCESS or error code
92
+ */
93
+ typedef rac_result_t (*rac_platform_tts_synthesize_fn)(rac_handle_t handle, const char* text,
94
+ const rac_tts_platform_options_t* options,
95
+ void* user_data);
96
+
97
+ /**
98
+ * Callback to stop speech.
99
+ * Implemented in Swift.
100
+ *
101
+ * @param handle Service handle
102
+ * @param user_data User-provided context
103
+ */
104
+ typedef void (*rac_platform_tts_stop_fn)(rac_handle_t handle, void* user_data);
105
+
106
+ /**
107
+ * Callback to destroy platform TTS service.
108
+ * Implemented in Swift.
109
+ *
110
+ * @param handle Service handle to destroy
111
+ * @param user_data User-provided context
112
+ */
113
+ typedef void (*rac_platform_tts_destroy_fn)(rac_handle_t handle, void* user_data);
114
+
115
+ /**
116
+ * Swift callbacks for platform TTS operations.
117
+ */
118
+ typedef struct rac_platform_tts_callbacks {
119
+ rac_platform_tts_can_handle_fn can_handle;
120
+ rac_platform_tts_create_fn create;
121
+ rac_platform_tts_synthesize_fn synthesize;
122
+ rac_platform_tts_stop_fn stop;
123
+ rac_platform_tts_destroy_fn destroy;
124
+ void* user_data;
125
+ } rac_platform_tts_callbacks_t;
126
+
127
+ // =============================================================================
128
+ // CALLBACK REGISTRATION
129
+ // =============================================================================
130
+
131
+ /**
132
+ * Sets the Swift callbacks for platform TTS operations.
133
+ * Must be called before using platform TTS services.
134
+ *
135
+ * @param callbacks Callback functions (copied internally)
136
+ * @return RAC_SUCCESS on success
137
+ */
138
+ RAC_API rac_result_t rac_platform_tts_set_callbacks(const rac_platform_tts_callbacks_t* callbacks);
139
+
140
+ /**
141
+ * Gets the current Swift callbacks.
142
+ *
143
+ * @return Pointer to callbacks, or NULL if not set
144
+ */
145
+ RAC_API const rac_platform_tts_callbacks_t* rac_platform_tts_get_callbacks(void);
146
+
147
+ /**
148
+ * Checks if Swift callbacks are registered.
149
+ *
150
+ * @return RAC_TRUE if callbacks are available
151
+ */
152
+ RAC_API rac_bool_t rac_platform_tts_is_available(void);
153
+
154
+ // =============================================================================
155
+ // SERVICE API
156
+ // =============================================================================
157
+
158
+ /**
159
+ * Creates a platform TTS service.
160
+ *
161
+ * @param config Configuration options (can be NULL for defaults)
162
+ * @param out_handle Output: Service handle
163
+ * @return RAC_SUCCESS on success, or error code
164
+ */
165
+ RAC_API rac_result_t rac_tts_platform_create(const rac_tts_platform_config_t* config,
166
+ rac_tts_platform_handle_t* out_handle);
167
+
168
+ /**
169
+ * Destroys a platform TTS service.
170
+ *
171
+ * @param handle Service handle to destroy
172
+ */
173
+ RAC_API void rac_tts_platform_destroy(rac_tts_platform_handle_t handle);
174
+
175
+ /**
176
+ * Synthesizes speech using platform TTS.
177
+ *
178
+ * @param handle Service handle
179
+ * @param text Text to synthesize
180
+ * @param options Synthesis options (can be NULL for defaults)
181
+ * @return RAC_SUCCESS on success, or error code
182
+ */
183
+ RAC_API rac_result_t rac_tts_platform_synthesize(rac_tts_platform_handle_t handle, const char* text,
184
+ const rac_tts_platform_options_t* options);
185
+
186
+ /**
187
+ * Stops current speech synthesis.
188
+ *
189
+ * @param handle Service handle
190
+ */
191
+ RAC_API void rac_tts_platform_stop(rac_tts_platform_handle_t handle);
192
+
193
+ #ifdef __cplusplus
194
+ }
195
+ #endif
196
+
197
+ #endif /* RAC_TTS_PLATFORM_H */
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @file rac_tts_service.h
3
+ * @brief RunAnywhere Commons - TTS Service Interface
4
+ *
5
+ * Defines the generic TTS service API and vtable for multi-backend dispatch.
6
+ * Backends (ONNX, Platform/System TTS, etc.) implement the vtable and register
7
+ * with the service registry.
8
+ */
9
+
10
+ #ifndef RAC_TTS_SERVICE_H
11
+ #define RAC_TTS_SERVICE_H
12
+
13
+ #include <RACommons/rac_error.h>
14
+ #include <RACommons/rac_tts_types.h>
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ // =============================================================================
21
+ // SERVICE VTABLE - Backend implementations provide this
22
+ // =============================================================================
23
+
24
+ /**
25
+ * TTS Service operations vtable.
26
+ * Each backend implements these functions and provides a static vtable.
27
+ */
28
+ typedef struct rac_tts_service_ops {
29
+ /** Initialize the service */
30
+ rac_result_t (*initialize)(void* impl);
31
+
32
+ /** Synthesize text to audio (blocking) */
33
+ rac_result_t (*synthesize)(void* impl, const char* text, const rac_tts_options_t* options,
34
+ rac_tts_result_t* out_result);
35
+
36
+ /** Stream synthesis for long text */
37
+ rac_result_t (*synthesize_stream)(void* impl, const char* text,
38
+ const rac_tts_options_t* options,
39
+ rac_tts_stream_callback_t callback, void* user_data);
40
+
41
+ /** Stop current synthesis */
42
+ rac_result_t (*stop)(void* impl);
43
+
44
+ /** Get service info */
45
+ rac_result_t (*get_info)(void* impl, rac_tts_info_t* out_info);
46
+
47
+ /** Cleanup/release resources (keeps service alive) */
48
+ rac_result_t (*cleanup)(void* impl);
49
+
50
+ /** Destroy the service */
51
+ void (*destroy)(void* impl);
52
+ } rac_tts_service_ops_t;
53
+
54
+ /**
55
+ * TTS Service instance.
56
+ * Contains vtable pointer and backend-specific implementation.
57
+ */
58
+ typedef struct rac_tts_service {
59
+ /** Vtable with backend operations */
60
+ const rac_tts_service_ops_t* ops;
61
+
62
+ /** Backend-specific implementation handle */
63
+ void* impl;
64
+
65
+ /** Model/voice ID for reference */
66
+ const char* model_id;
67
+ } rac_tts_service_t;
68
+
69
+ // =============================================================================
70
+ // PUBLIC API - Generic service functions
71
+ // =============================================================================
72
+
73
+ /**
74
+ * @brief Create a TTS service
75
+ *
76
+ * Routes through service registry to find appropriate backend.
77
+ *
78
+ * @param voice_id Voice/model identifier (registry ID or path)
79
+ * @param out_handle Output: Handle to the created service
80
+ * @return RAC_SUCCESS or error code
81
+ */
82
+ RAC_API rac_result_t rac_tts_create(const char* voice_id, rac_handle_t* out_handle);
83
+
84
+ /**
85
+ * @brief Initialize a TTS service
86
+ *
87
+ * @param handle Service handle
88
+ * @return RAC_SUCCESS or error code
89
+ */
90
+ RAC_API rac_result_t rac_tts_initialize(rac_handle_t handle);
91
+
92
+ /**
93
+ * @brief Synthesize text to audio
94
+ *
95
+ * @param handle Service handle
96
+ * @param text Text to synthesize
97
+ * @param options Synthesis options (can be NULL for defaults)
98
+ * @param out_result Output: Synthesis result (caller must free with rac_tts_result_free)
99
+ * @return RAC_SUCCESS or error code
100
+ */
101
+ RAC_API rac_result_t rac_tts_synthesize(rac_handle_t handle, const char* text,
102
+ const rac_tts_options_t* options,
103
+ rac_tts_result_t* out_result);
104
+
105
+ /**
106
+ * @brief Stream synthesis for long text
107
+ *
108
+ * @param handle Service handle
109
+ * @param text Text to synthesize
110
+ * @param options Synthesis options
111
+ * @param callback Callback for each audio chunk
112
+ * @param user_data User context passed to callback
113
+ * @return RAC_SUCCESS or error code
114
+ */
115
+ RAC_API rac_result_t rac_tts_synthesize_stream(rac_handle_t handle, const char* text,
116
+ const rac_tts_options_t* options,
117
+ rac_tts_stream_callback_t callback, void* user_data);
118
+
119
+ /**
120
+ * @brief Stop current synthesis
121
+ *
122
+ * @param handle Service handle
123
+ * @return RAC_SUCCESS or error code
124
+ */
125
+ RAC_API rac_result_t rac_tts_stop(rac_handle_t handle);
126
+
127
+ /**
128
+ * @brief Get service information
129
+ *
130
+ * @param handle Service handle
131
+ * @param out_info Output: Service information
132
+ * @return RAC_SUCCESS or error code
133
+ */
134
+ RAC_API rac_result_t rac_tts_get_info(rac_handle_t handle, rac_tts_info_t* out_info);
135
+
136
+ /**
137
+ * @brief Cleanup and release resources
138
+ *
139
+ * @param handle Service handle
140
+ * @return RAC_SUCCESS or error code
141
+ */
142
+ RAC_API rac_result_t rac_tts_cleanup(rac_handle_t handle);
143
+
144
+ /**
145
+ * @brief Destroy a TTS service instance
146
+ *
147
+ * @param handle Service handle to destroy
148
+ */
149
+ RAC_API void rac_tts_destroy(rac_handle_t handle);
150
+
151
+ /**
152
+ * @brief Free a TTS result
153
+ *
154
+ * @param result Result to free
155
+ */
156
+ RAC_API void rac_tts_result_free(rac_tts_result_t* result);
157
+
158
+ #ifdef __cplusplus
159
+ }
160
+ #endif
161
+
162
+ #endif /* RAC_TTS_SERVICE_H */