@runanywhere/core 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/RunAnywhereCore.podspec +130 -0
  2. package/android/CMakeLists.txt +92 -0
  3. package/android/build.gradle +321 -0
  4. package/android/consumer-rules.pro +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/cpp/cpp-adapter.cpp +271 -0
  7. package/android/src/main/include/rac/backends/rac_llm_llamacpp.h +218 -0
  8. package/android/src/main/include/rac/backends/rac_stt_onnx.h +99 -0
  9. package/android/src/main/include/rac/backends/rac_stt_whispercpp.h +153 -0
  10. package/android/src/main/include/rac/backends/rac_tts_onnx.h +71 -0
  11. package/android/src/main/include/rac/backends/rac_vad_onnx.h +84 -0
  12. package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +290 -0
  13. package/android/src/main/include/rac/core/rac_analytics_events.h +610 -0
  14. package/android/src/main/include/rac/core/rac_audio_utils.h +88 -0
  15. package/android/src/main/include/rac/core/rac_component_types.h +160 -0
  16. package/android/src/main/include/rac/core/rac_core.h +331 -0
  17. package/android/src/main/include/rac/core/rac_error.h +469 -0
  18. package/android/src/main/include/rac/core/rac_events.h +334 -0
  19. package/android/src/main/include/rac/core/rac_logger.h +416 -0
  20. package/android/src/main/include/rac/core/rac_platform_adapter.h +340 -0
  21. package/android/src/main/include/rac/core/rac_sdk_state.h +292 -0
  22. package/android/src/main/include/rac/core/rac_structured_error.h +594 -0
  23. package/android/src/main/include/rac/core/rac_types.h +264 -0
  24. package/android/src/main/include/rac/features/llm/rac_llm.h +17 -0
  25. package/android/src/main/include/rac/features/llm/rac_llm_analytics.h +188 -0
  26. package/android/src/main/include/rac/features/llm/rac_llm_component.h +228 -0
  27. package/android/src/main/include/rac/features/llm/rac_llm_events.h +215 -0
  28. package/android/src/main/include/rac/features/llm/rac_llm_metrics.h +402 -0
  29. package/android/src/main/include/rac/features/llm/rac_llm_service.h +163 -0
  30. package/android/src/main/include/rac/features/llm/rac_llm_structured_output.h +141 -0
  31. package/android/src/main/include/rac/features/llm/rac_llm_types.h +384 -0
  32. package/android/src/main/include/rac/features/platform/rac_llm_platform.h +204 -0
  33. package/android/src/main/include/rac/features/platform/rac_tts_platform.h +197 -0
  34. package/android/src/main/include/rac/features/stt/rac_stt.h +17 -0
  35. package/android/src/main/include/rac/features/stt/rac_stt_analytics.h +204 -0
  36. package/android/src/main/include/rac/features/stt/rac_stt_component.h +162 -0
  37. package/android/src/main/include/rac/features/stt/rac_stt_events.h +62 -0
  38. package/android/src/main/include/rac/features/stt/rac_stt_service.h +154 -0
  39. package/android/src/main/include/rac/features/stt/rac_stt_types.h +389 -0
  40. package/android/src/main/include/rac/features/tts/rac_tts.h +17 -0
  41. package/android/src/main/include/rac/features/tts/rac_tts_analytics.h +181 -0
  42. package/android/src/main/include/rac/features/tts/rac_tts_component.h +158 -0
  43. package/android/src/main/include/rac/features/tts/rac_tts_events.h +54 -0
  44. package/android/src/main/include/rac/features/tts/rac_tts_service.h +162 -0
  45. package/android/src/main/include/rac/features/tts/rac_tts_types.h +374 -0
  46. package/android/src/main/include/rac/features/vad/rac_vad.h +17 -0
  47. package/android/src/main/include/rac/features/vad/rac_vad_analytics.h +236 -0
  48. package/android/src/main/include/rac/features/vad/rac_vad_component.h +185 -0
  49. package/android/src/main/include/rac/features/vad/rac_vad_energy.h +443 -0
  50. package/android/src/main/include/rac/features/vad/rac_vad_events.h +76 -0
  51. package/android/src/main/include/rac/features/vad/rac_vad_service.h +167 -0
  52. package/android/src/main/include/rac/features/vad/rac_vad_types.h +244 -0
  53. package/android/src/main/include/rac/features/voice_agent/rac_voice_agent.h +612 -0
  54. package/android/src/main/include/rac/infrastructure/device/rac_device_manager.h +176 -0
  55. package/android/src/main/include/rac/infrastructure/download/rac_download.h +418 -0
  56. package/android/src/main/include/rac/infrastructure/events/rac_events.h +177 -0
  57. package/android/src/main/include/rac/infrastructure/model_management/rac_model_assignment.h +169 -0
  58. package/android/src/main/include/rac/infrastructure/model_management/rac_model_paths.h +258 -0
  59. package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +357 -0
  60. package/android/src/main/include/rac/infrastructure/model_management/rac_model_strategy.h +374 -0
  61. package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +613 -0
  62. package/android/src/main/include/rac/infrastructure/network/rac_api_types.h +335 -0
  63. package/android/src/main/include/rac/infrastructure/network/rac_auth_manager.h +252 -0
  64. package/android/src/main/include/rac/infrastructure/network/rac_dev_config.h +85 -0
  65. package/android/src/main/include/rac/infrastructure/network/rac_endpoints.h +102 -0
  66. package/android/src/main/include/rac/infrastructure/network/rac_environment.h +220 -0
  67. package/android/src/main/include/rac/infrastructure/network/rac_http_client.h +233 -0
  68. package/android/src/main/include/rac/infrastructure/storage/rac_storage_analyzer.h +286 -0
  69. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_manager.h +206 -0
  70. package/android/src/main/include/rac/infrastructure/telemetry/rac_telemetry_types.h +234 -0
  71. package/android/src/main/java/com/margelo/nitro/runanywhere/ArchiveUtility.kt +308 -0
  72. package/android/src/main/java/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfo.kt +229 -0
  73. package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +392 -0
  74. package/android/src/main/java/com/margelo/nitro/runanywhere/RunAnywhereCorePackage.kt +28 -0
  75. package/android/src/main/java/com/margelo/nitro/runanywhere/SDKLogger.kt +357 -0
  76. package/android/src/main/java/com/margelo/nitro/runanywhere/SecureStorageManager.kt +147 -0
  77. package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
  78. package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
  79. package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
  80. package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
  81. package/cpp/HybridRunAnywhereCore.cpp +2505 -0
  82. package/cpp/HybridRunAnywhereCore.hpp +271 -0
  83. package/cpp/bridges/AuthBridge.cpp +209 -0
  84. package/cpp/bridges/AuthBridge.hpp +157 -0
  85. package/cpp/bridges/DeviceBridge.cpp +257 -0
  86. package/cpp/bridges/DeviceBridge.hpp +155 -0
  87. package/cpp/bridges/DownloadBridge.cpp +299 -0
  88. package/cpp/bridges/DownloadBridge.hpp +197 -0
  89. package/cpp/bridges/EventBridge.cpp +125 -0
  90. package/cpp/bridges/EventBridge.hpp +139 -0
  91. package/cpp/bridges/HTTPBridge.cpp +96 -0
  92. package/cpp/bridges/HTTPBridge.hpp +144 -0
  93. package/cpp/bridges/InitBridge.cpp +1273 -0
  94. package/cpp/bridges/InitBridge.hpp +306 -0
  95. package/cpp/bridges/ModelRegistryBridge.cpp +394 -0
  96. package/cpp/bridges/ModelRegistryBridge.hpp +177 -0
  97. package/cpp/bridges/StorageBridge.cpp +269 -0
  98. package/cpp/bridges/StorageBridge.hpp +172 -0
  99. package/cpp/bridges/TelemetryBridge.cpp +352 -0
  100. package/cpp/bridges/TelemetryBridge.hpp +126 -0
  101. package/ios/.testlocal +0 -0
  102. package/ios/ArchiveUtility.swift +526 -0
  103. package/ios/ArchiveUtilityBridge.m +52 -0
  104. package/ios/AudioDecoder.h +38 -0
  105. package/ios/AudioDecoder.m +162 -0
  106. package/ios/Binaries/RACommons.xcframework/Info.plist +44 -0
  107. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +67 -0
  108. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_analytics_events.h +610 -0
  109. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_api_types.h +335 -0
  110. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_audio_utils.h +88 -0
  111. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_auth_manager.h +252 -0
  112. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_component_types.h +160 -0
  113. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +331 -0
  114. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_dev_config.h +85 -0
  115. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_device_manager.h +176 -0
  116. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_download.h +418 -0
  117. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +102 -0
  118. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_environment.h +220 -0
  119. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_error.h +469 -0
  120. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_events.h +177 -0
  121. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_http_client.h +233 -0
  122. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +290 -0
  123. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm.h +17 -0
  124. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
  125. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_component.h +228 -0
  126. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_events.h +215 -0
  127. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
  128. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
  129. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_platform.h +204 -0
  130. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_service.h +163 -0
  131. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
  132. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_llm_types.h +384 -0
  133. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_logger.h +416 -0
  134. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +169 -0
  135. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_paths.h +258 -0
  136. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +357 -0
  137. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_strategy.h +374 -0
  138. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +613 -0
  139. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
  140. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_sdk_state.h +292 -0
  141. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
  142. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_structured_error.h +594 -0
  143. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt.h +17 -0
  144. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
  145. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_component.h +162 -0
  146. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_events.h +62 -0
  147. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
  148. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_service.h +154 -0
  149. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_types.h +389 -0
  150. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
  151. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
  152. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
  153. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts.h +17 -0
  154. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
  155. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_component.h +158 -0
  156. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_events.h +54 -0
  157. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
  158. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_platform.h +197 -0
  159. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_service.h +162 -0
  160. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tts_types.h +374 -0
  161. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +264 -0
  162. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad.h +17 -0
  163. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
  164. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_component.h +185 -0
  165. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +443 -0
  166. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_events.h +76 -0
  167. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
  168. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_service.h +167 -0
  169. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_types.h +244 -0
  170. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_voice_agent.h +612 -0
  171. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Info.plist +11 -0
  172. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Modules/module.modulemap +5 -0
  173. package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
  174. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +67 -0
  175. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_analytics_events.h +610 -0
  176. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_api_types.h +335 -0
  177. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_audio_utils.h +88 -0
  178. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_auth_manager.h +252 -0
  179. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_component_types.h +160 -0
  180. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +331 -0
  181. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_dev_config.h +85 -0
  182. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_device_manager.h +176 -0
  183. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_download.h +418 -0
  184. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +102 -0
  185. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_environment.h +220 -0
  186. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_error.h +469 -0
  187. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_events.h +177 -0
  188. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_http_client.h +233 -0
  189. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +290 -0
  190. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm.h +17 -0
  191. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_analytics.h +188 -0
  192. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_component.h +228 -0
  193. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_events.h +215 -0
  194. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_llamacpp.h +218 -0
  195. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_metrics.h +402 -0
  196. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_platform.h +204 -0
  197. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_service.h +163 -0
  198. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_structured_output.h +141 -0
  199. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_llm_types.h +384 -0
  200. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_logger.h +416 -0
  201. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +169 -0
  202. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_paths.h +258 -0
  203. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +357 -0
  204. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_strategy.h +374 -0
  205. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +613 -0
  206. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_platform_adapter.h +340 -0
  207. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_sdk_state.h +292 -0
  208. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_storage_analyzer.h +286 -0
  209. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_structured_error.h +594 -0
  210. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt.h +17 -0
  211. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_analytics.h +204 -0
  212. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_component.h +162 -0
  213. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_events.h +62 -0
  214. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_onnx.h +99 -0
  215. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_service.h +154 -0
  216. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_types.h +389 -0
  217. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_stt_whispercpp.h +153 -0
  218. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_manager.h +206 -0
  219. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_telemetry_types.h +234 -0
  220. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts.h +17 -0
  221. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_analytics.h +181 -0
  222. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_component.h +158 -0
  223. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_events.h +54 -0
  224. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_onnx.h +71 -0
  225. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_platform.h +197 -0
  226. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_service.h +162 -0
  227. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tts_types.h +374 -0
  228. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +264 -0
  229. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad.h +17 -0
  230. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_analytics.h +236 -0
  231. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_component.h +185 -0
  232. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +443 -0
  233. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_events.h +76 -0
  234. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_onnx.h +84 -0
  235. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_service.h +167 -0
  236. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_types.h +244 -0
  237. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_voice_agent.h +612 -0
  238. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Info.plist +11 -0
  239. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Modules/module.modulemap +5 -0
  240. package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
  241. package/ios/HybridRunAnywhereDeviceInfo.swift +214 -0
  242. package/ios/KeychainManager.swift +116 -0
  243. package/ios/PlatformAdapter.swift +100 -0
  244. package/ios/PlatformAdapterBridge.h +152 -0
  245. package/ios/PlatformAdapterBridge.m +570 -0
  246. package/ios/RNSDKLoggerBridge.h +41 -0
  247. package/ios/RNSDKLoggerBridge.m +66 -0
  248. package/ios/SDKLogger.swift +329 -0
  249. package/nitro.json +20 -0
  250. package/nitrogen/generated/.gitattributes +1 -0
  251. package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.cpp +257 -0
  252. package/nitrogen/generated/android/c++/JHybridRunAnywhereDeviceInfoSpec.hpp +77 -0
  253. package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/HybridRunAnywhereDeviceInfoSpec.kt +106 -0
  254. package/nitrogen/generated/android/kotlin/com/margelo/nitro/runanywhere/runanywherecoreOnLoad.kt +35 -0
  255. package/nitrogen/generated/android/runanywherecore+autolinking.cmake +82 -0
  256. package/nitrogen/generated/android/runanywherecore+autolinking.gradle +27 -0
  257. package/nitrogen/generated/android/runanywherecoreOnLoad.cpp +54 -0
  258. package/nitrogen/generated/android/runanywherecoreOnLoad.hpp +25 -0
  259. package/nitrogen/generated/ios/RunAnywhereCore+autolinking.rb +60 -0
  260. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.cpp +65 -0
  261. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Bridge.hpp +197 -0
  262. package/nitrogen/generated/ios/RunAnywhereCore-Swift-Cxx-Umbrella.hpp +45 -0
  263. package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.mm +43 -0
  264. package/nitrogen/generated/ios/RunAnywhereCoreAutolinking.swift +25 -0
  265. package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.cpp +11 -0
  266. package/nitrogen/generated/ios/c++/HybridRunAnywhereDeviceInfoSpecSwift.hpp +173 -0
  267. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  268. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  269. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  270. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  271. package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec.swift +68 -0
  272. package/nitrogen/generated/ios/swift/HybridRunAnywhereDeviceInfoSpec_cxx.swift +366 -0
  273. package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +92 -0
  274. package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +138 -0
  275. package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.cpp +33 -0
  276. package/nitrogen/generated/shared/c++/HybridRunAnywhereDeviceInfoSpec.hpp +75 -0
  277. package/package.json +76 -0
  278. package/react-native.config.js +14 -0
  279. package/src/Features/VoiceSession/AudioCaptureManager.ts +286 -0
  280. package/src/Features/VoiceSession/AudioPlaybackManager.ts +300 -0
  281. package/src/Features/VoiceSession/VoiceSessionHandle.ts +530 -0
  282. package/src/Features/VoiceSession/index.ts +20 -0
  283. package/src/Features/index.ts +7 -0
  284. package/src/Foundation/Constants/SDKConstants.ts +47 -0
  285. package/src/Foundation/Constants/index.ts +8 -0
  286. package/src/Foundation/DependencyInjection/ServiceContainer.ts +154 -0
  287. package/src/Foundation/DependencyInjection/ServiceRegistry.ts +51 -0
  288. package/src/Foundation/DependencyInjection/index.ts +6 -0
  289. package/src/Foundation/ErrorTypes/ErrorCategory.ts +184 -0
  290. package/src/Foundation/ErrorTypes/ErrorCodes.ts +151 -0
  291. package/src/Foundation/ErrorTypes/ErrorContext.ts +201 -0
  292. package/src/Foundation/ErrorTypes/SDKError.ts +507 -0
  293. package/src/Foundation/ErrorTypes/index.ts +57 -0
  294. package/src/Foundation/Initialization/InitializationPhase.ts +85 -0
  295. package/src/Foundation/Initialization/InitializationState.ts +168 -0
  296. package/src/Foundation/Initialization/index.ts +26 -0
  297. package/src/Foundation/Logging/Destinations/NativeLogBridge.ts +147 -0
  298. package/src/Foundation/Logging/Destinations/SentryDestination.ts +209 -0
  299. package/src/Foundation/Logging/Logger/SDKLogger.ts +232 -0
  300. package/src/Foundation/Logging/Models/LogLevel.ts +36 -0
  301. package/src/Foundation/Logging/Models/LoggingConfiguration.ts +117 -0
  302. package/src/Foundation/Logging/Services/LoggingManager.ts +407 -0
  303. package/src/Foundation/Logging/index.ts +59 -0
  304. package/src/Foundation/Security/DeviceIdentity.ts +92 -0
  305. package/src/Foundation/Security/SecureStorageError.ts +132 -0
  306. package/src/Foundation/Security/SecureStorageKeys.ts +35 -0
  307. package/src/Foundation/Security/SecureStorageService.ts +449 -0
  308. package/src/Foundation/Security/index.ts +17 -0
  309. package/src/Foundation/index.ts +26 -0
  310. package/src/Infrastructure/Events/EventPublisher.ts +165 -0
  311. package/src/Infrastructure/Events/SDKEvent.ts +214 -0
  312. package/src/Infrastructure/Events/index.ts +15 -0
  313. package/src/Infrastructure/index.ts +9 -0
  314. package/src/Public/Events/EventBus.ts +488 -0
  315. package/src/Public/Events/index.ts +8 -0
  316. package/src/Public/Extensions/RunAnywhere+Logging.ts +51 -0
  317. package/src/Public/Extensions/RunAnywhere+Models.ts +392 -0
  318. package/src/Public/Extensions/RunAnywhere+STT.ts +424 -0
  319. package/src/Public/Extensions/RunAnywhere+Storage.ts +151 -0
  320. package/src/Public/Extensions/RunAnywhere+StructuredOutput.ts +316 -0
  321. package/src/Public/Extensions/RunAnywhere+TTS.ts +430 -0
  322. package/src/Public/Extensions/RunAnywhere+TextGeneration.ts +320 -0
  323. package/src/Public/Extensions/RunAnywhere+VAD.ts +359 -0
  324. package/src/Public/Extensions/RunAnywhere+VoiceAgent.ts +225 -0
  325. package/src/Public/Extensions/RunAnywhere+VoiceSession.ts +155 -0
  326. package/src/Public/Extensions/index.ts +126 -0
  327. package/src/Public/RunAnywhere.ts +695 -0
  328. package/src/index.ts +238 -0
  329. package/src/native/NativeRunAnywhereCore.ts +291 -0
  330. package/src/native/NativeRunAnywhereModule.ts +32 -0
  331. package/src/native/index.ts +21 -0
  332. package/src/services/DownloadService.ts +282 -0
  333. package/src/services/FileSystem.ts +810 -0
  334. package/src/services/ModelRegistry.ts +246 -0
  335. package/src/services/Network/APIEndpoints.ts +84 -0
  336. package/src/services/Network/HTTPService.ts +479 -0
  337. package/src/services/Network/NetworkConfiguration.ts +130 -0
  338. package/src/services/Network/TelemetryService.ts +318 -0
  339. package/src/services/Network/index.ts +29 -0
  340. package/src/services/SystemTTSService.ts +130 -0
  341. package/src/services/index.ts +66 -0
  342. package/src/specs/RunAnywhereCore.nitro.ts +627 -0
  343. package/src/specs/RunAnywhereDeviceInfo.nitro.ts +73 -0
  344. package/src/types/LLMTypes.ts +127 -0
  345. package/src/types/STTTypes.ts +124 -0
  346. package/src/types/StructuredOutputTypes.ts +156 -0
  347. package/src/types/TTSTypes.ts +126 -0
  348. package/src/types/VADTypes.ts +70 -0
  349. package/src/types/VoiceAgentTypes.ts +182 -0
  350. package/src/types/enums.ts +258 -0
  351. package/src/types/events.ts +337 -0
  352. package/src/types/external.d.ts +142 -0
  353. package/src/types/index.ts +146 -0
  354. package/src/types/models.ts +579 -0
@@ -0,0 +1,177 @@
1
+ /**
2
+ * @file rac_events.h
3
+ * @brief RunAnywhere Commons - Event Publishing and Subscription
4
+ *
5
+ * C port of Swift's SDKEvent protocol and EventPublisher from:
6
+ * Sources/RunAnywhere/Infrastructure/Events/SDKEvent.swift
7
+ * Sources/RunAnywhere/Infrastructure/Events/EventPublisher.swift
8
+ *
9
+ * Events are categorized and can be routed to different destinations
10
+ * (public EventBus or analytics).
11
+ */
12
+
13
+ #ifndef RAC_EVENTS_H
14
+ #define RAC_EVENTS_H
15
+
16
+ #include "rac/core/rac_types.h"
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // EVENT DESTINATION - Mirrors Swift's EventDestination
24
+ // =============================================================================
25
+
26
+ /**
27
+ * Where an event should be routed.
28
+ * Mirrors Swift's EventDestination enum.
29
+ */
30
+ typedef enum rac_event_destination {
31
+ /** Only to public EventBus (app developers) */
32
+ RAC_EVENT_DESTINATION_PUBLIC_ONLY = 0,
33
+ /** Only to analytics/telemetry (backend) */
34
+ RAC_EVENT_DESTINATION_ANALYTICS_ONLY = 1,
35
+ /** Both destinations (default) */
36
+ RAC_EVENT_DESTINATION_ALL = 2,
37
+ } rac_event_destination_t;
38
+
39
+ // =============================================================================
40
+ // EVENT CATEGORY - Mirrors Swift's EventCategory
41
+ // =============================================================================
42
+
43
+ /**
44
+ * Event categories for filtering/grouping.
45
+ * Mirrors Swift's EventCategory enum.
46
+ */
47
+ typedef enum rac_event_category {
48
+ RAC_EVENT_CATEGORY_SDK = 0,
49
+ RAC_EVENT_CATEGORY_MODEL = 1,
50
+ RAC_EVENT_CATEGORY_LLM = 2,
51
+ RAC_EVENT_CATEGORY_STT = 3,
52
+ RAC_EVENT_CATEGORY_TTS = 4,
53
+ RAC_EVENT_CATEGORY_VOICE = 5,
54
+ RAC_EVENT_CATEGORY_STORAGE = 6,
55
+ RAC_EVENT_CATEGORY_DEVICE = 7,
56
+ RAC_EVENT_CATEGORY_NETWORK = 8,
57
+ RAC_EVENT_CATEGORY_ERROR = 9,
58
+ } rac_event_category_t;
59
+
60
+ // =============================================================================
61
+ // EVENT STRUCTURE - Mirrors Swift's SDKEvent protocol
62
+ // =============================================================================
63
+
64
+ /**
65
+ * Event data structure.
66
+ * Mirrors Swift's SDKEvent protocol properties.
67
+ */
68
+ typedef struct rac_event {
69
+ /** Unique identifier for this event instance */
70
+ const char* id;
71
+
72
+ /** Event type string (used for analytics categorization) */
73
+ const char* type;
74
+
75
+ /** Category for filtering/routing */
76
+ rac_event_category_t category;
77
+
78
+ /** Timestamp in milliseconds since epoch */
79
+ int64_t timestamp_ms;
80
+
81
+ /** Optional session ID for grouping related events (can be NULL) */
82
+ const char* session_id;
83
+
84
+ /** Where to route this event */
85
+ rac_event_destination_t destination;
86
+
87
+ /** Event properties as JSON string (can be NULL) */
88
+ const char* properties_json;
89
+ } rac_event_t;
90
+
91
+ // =============================================================================
92
+ // EVENT CALLBACK
93
+ // =============================================================================
94
+
95
+ /**
96
+ * Event callback function type.
97
+ *
98
+ * @param event The event data (valid only during the callback)
99
+ * @param user_data User-provided context data
100
+ */
101
+ typedef void (*rac_event_callback_fn)(const rac_event_t* event, void* user_data);
102
+
103
+ // =============================================================================
104
+ // EVENT API
105
+ // =============================================================================
106
+
107
+ /**
108
+ * Subscribes to events of a specific category.
109
+ *
110
+ * @param category The category to subscribe to
111
+ * @param callback The callback function to invoke
112
+ * @param user_data User data passed to the callback
113
+ * @return Subscription ID (0 on failure), use with rac_event_unsubscribe
114
+ *
115
+ * @note The callback is invoked on the thread that publishes the event.
116
+ * Keep callback execution fast to avoid blocking.
117
+ */
118
+ RAC_API uint64_t rac_event_subscribe(rac_event_category_t category, rac_event_callback_fn callback,
119
+ void* user_data);
120
+
121
+ /**
122
+ * Subscribes to all events regardless of category.
123
+ *
124
+ * @param callback The callback function to invoke
125
+ * @param user_data User data passed to the callback
126
+ * @return Subscription ID (0 on failure)
127
+ */
128
+ RAC_API uint64_t rac_event_subscribe_all(rac_event_callback_fn callback, void* user_data);
129
+
130
+ /**
131
+ * Unsubscribes from events.
132
+ *
133
+ * @param subscription_id The subscription ID returned from subscribe
134
+ */
135
+ RAC_API void rac_event_unsubscribe(uint64_t subscription_id);
136
+
137
+ /**
138
+ * Publishes an event to all subscribers.
139
+ *
140
+ * This is called by the commons library to publish events.
141
+ * Swift's EventBridge subscribes to receive and re-publish to Swift consumers.
142
+ *
143
+ * @param event The event to publish
144
+ * @return RAC_SUCCESS on success, or an error code on failure
145
+ */
146
+ RAC_API rac_result_t rac_event_publish(const rac_event_t* event);
147
+
148
+ /**
149
+ * Track an event (convenience function matching Swift's EventPublisher.track).
150
+ *
151
+ * @param type Event type string
152
+ * @param category Event category
153
+ * @param destination Where to route this event
154
+ * @param properties_json Event properties as JSON (can be NULL)
155
+ * @return RAC_SUCCESS on success, or an error code on failure
156
+ */
157
+ RAC_API rac_result_t rac_event_track(const char* type, rac_event_category_t category,
158
+ rac_event_destination_t destination,
159
+ const char* properties_json);
160
+
161
+ // =============================================================================
162
+ // UTILITY FUNCTIONS
163
+ // =============================================================================
164
+
165
+ /**
166
+ * Gets a string name for an event category.
167
+ *
168
+ * @param category The event category
169
+ * @return A string name (never NULL)
170
+ */
171
+ RAC_API const char* rac_event_category_name(rac_event_category_t category);
172
+
173
+ #ifdef __cplusplus
174
+ }
175
+ #endif
176
+
177
+ #endif /* RAC_EVENTS_H */
@@ -0,0 +1,169 @@
1
+ /**
2
+ * @file rac_model_assignment.h
3
+ * @brief Model Assignment Manager - Fetches models assigned to device from backend
4
+ *
5
+ * Handles fetching model assignments from the backend API.
6
+ * Business logic (caching, JSON parsing, registry saving) is in C++.
7
+ * Platform SDKs provide HTTP GET callback for network transport.
8
+ *
9
+ * Events are emitted via rac_analytics_event_emit().
10
+ */
11
+
12
+ #ifndef RAC_MODEL_ASSIGNMENT_H
13
+ #define RAC_MODEL_ASSIGNMENT_H
14
+
15
+ #include "rac/core/rac_types.h"
16
+ #include "rac/infrastructure/model_management/rac_model_types.h"
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ // =============================================================================
23
+ // CALLBACK TYPES
24
+ // =============================================================================
25
+
26
+ /**
27
+ * @brief HTTP response for model assignment fetch
28
+ */
29
+ typedef struct rac_assignment_http_response {
30
+ rac_result_t result; // RAC_SUCCESS on success
31
+ int32_t status_code; // HTTP status code (200, 400, etc.)
32
+ const char* response_body; // Response JSON (must remain valid during processing)
33
+ size_t response_length; // Length of response body
34
+ const char* error_message; // Error message (can be NULL)
35
+ } rac_assignment_http_response_t;
36
+
37
+ /**
38
+ * @brief Device info for model assignment request
39
+ */
40
+ typedef struct rac_assignment_device_info {
41
+ const char* device_type; // e.g., "iPhone15,2"
42
+ const char* platform; // e.g., "iOS"
43
+ } rac_assignment_device_info_t;
44
+
45
+ /**
46
+ * Make HTTP GET request for model assignments
47
+ * @param endpoint Full endpoint URL with query params
48
+ * @param requires_auth Whether authentication header is required
49
+ * @param out_response Output parameter for response
50
+ * @param user_data User-provided context
51
+ * @return RAC_SUCCESS on success, error code otherwise
52
+ */
53
+ typedef rac_result_t (*rac_assignment_http_get_fn)(const char* endpoint, rac_bool_t requires_auth,
54
+ rac_assignment_http_response_t* out_response,
55
+ void* user_data);
56
+
57
+ /**
58
+ * Get device info for model assignment request
59
+ * @param out_info Output parameter for device info
60
+ * @param user_data User-provided context
61
+ */
62
+ typedef void (*rac_assignment_get_device_info_fn)(rac_assignment_device_info_t* out_info,
63
+ void* user_data);
64
+
65
+ /**
66
+ * @brief Callback structure for model assignment operations
67
+ */
68
+ typedef struct rac_assignment_callbacks {
69
+ /** Make HTTP GET request */
70
+ rac_assignment_http_get_fn http_get;
71
+
72
+ /** Get device info for request */
73
+ rac_assignment_get_device_info_fn get_device_info;
74
+
75
+ /** User data passed to all callbacks */
76
+ void* user_data;
77
+ } rac_assignment_callbacks_t;
78
+
79
+ // =============================================================================
80
+ // MODEL ASSIGNMENT API
81
+ // =============================================================================
82
+
83
+ /**
84
+ * @brief Set callbacks for model assignment operations
85
+ *
86
+ * Must be called before any other model assignment functions.
87
+ * Typically called during SDK initialization.
88
+ *
89
+ * @param callbacks Callback structure (copied internally)
90
+ * @return RAC_SUCCESS or error code
91
+ */
92
+ RAC_API rac_result_t
93
+ rac_model_assignment_set_callbacks(const rac_assignment_callbacks_t* callbacks);
94
+
95
+ /**
96
+ * @brief Fetch model assignments from backend
97
+ *
98
+ * Fetches models assigned to this device from the backend API.
99
+ * Results are cached for cache_timeout_seconds.
100
+ *
101
+ * Business logic:
102
+ * 1. Check cache if not force_refresh
103
+ * 2. Get device info (via callback)
104
+ * 3. Build endpoint URL
105
+ * 4. Make HTTP GET (via callback)
106
+ * 5. Parse JSON response
107
+ * 6. Save models to registry
108
+ * 7. Update cache
109
+ * 8. Emit analytics event
110
+ *
111
+ * @param force_refresh If true, bypass cache
112
+ * @param out_models Output array of model infos (caller must free with rac_model_info_array_free)
113
+ * @param out_count Number of models returned
114
+ * @return RAC_SUCCESS on success, error code otherwise
115
+ */
116
+ RAC_API rac_result_t rac_model_assignment_fetch(rac_bool_t force_refresh,
117
+ rac_model_info_t*** out_models, size_t* out_count);
118
+
119
+ /**
120
+ * @brief Get cached model assignments for a specific framework
121
+ *
122
+ * Filters cached models by framework. Does not make network request.
123
+ * Call rac_model_assignment_fetch first to populate cache.
124
+ *
125
+ * @param framework Framework to filter by
126
+ * @param out_models Output array of model infos (caller must free)
127
+ * @param out_count Number of models returned
128
+ * @return RAC_SUCCESS on success, error code otherwise
129
+ */
130
+ RAC_API rac_result_t rac_model_assignment_get_by_framework(rac_inference_framework_t framework,
131
+ rac_model_info_t*** out_models,
132
+ size_t* out_count);
133
+
134
+ /**
135
+ * @brief Get cached model assignments for a specific category
136
+ *
137
+ * Filters cached models by category. Does not make network request.
138
+ * Call rac_model_assignment_fetch first to populate cache.
139
+ *
140
+ * @param category Category to filter by
141
+ * @param out_models Output array of model infos (caller must free)
142
+ * @param out_count Number of models returned
143
+ * @return RAC_SUCCESS on success, error code otherwise
144
+ */
145
+ RAC_API rac_result_t rac_model_assignment_get_by_category(rac_model_category_t category,
146
+ rac_model_info_t*** out_models,
147
+ size_t* out_count);
148
+
149
+ /**
150
+ * @brief Clear model assignment cache
151
+ *
152
+ * Clears the in-memory cache. Next fetch will make network request.
153
+ */
154
+ RAC_API void rac_model_assignment_clear_cache(void);
155
+
156
+ /**
157
+ * @brief Set cache timeout in seconds
158
+ *
159
+ * Default is 3600 (1 hour).
160
+ *
161
+ * @param timeout_seconds Cache timeout in seconds
162
+ */
163
+ RAC_API void rac_model_assignment_set_cache_timeout(uint32_t timeout_seconds);
164
+
165
+ #ifdef __cplusplus
166
+ }
167
+ #endif
168
+
169
+ #endif /* RAC_MODEL_ASSIGNMENT_H */
@@ -0,0 +1,258 @@
1
+ /**
2
+ * @file rac_model_paths.h
3
+ * @brief Model Path Utilities - Centralized Path Calculation
4
+ *
5
+ * C port of Swift's ModelPathUtils from:
6
+ * Sources/RunAnywhere/Infrastructure/ModelManagement/Utilities/ModelPathUtils.swift
7
+ *
8
+ * Path structure: `{base_dir}/RunAnywhere/Models/{framework}/{modelId}/`
9
+ *
10
+ * IMPORTANT: This is a direct translation of the Swift implementation.
11
+ * Do NOT add features not present in the Swift code.
12
+ */
13
+
14
+ #ifndef RAC_MODEL_PATHS_H
15
+ #define RAC_MODEL_PATHS_H
16
+
17
+ #include <stddef.h>
18
+
19
+ #include "rac/core/rac_error.h"
20
+ #include "rac/core/rac_types.h"
21
+ #include "rac/infrastructure/model_management/rac_model_types.h"
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ // =============================================================================
28
+ // CONFIGURATION
29
+ // =============================================================================
30
+
31
+ /**
32
+ * @brief Set the base directory for model storage.
33
+ *
34
+ * This must be called before using any path utilities.
35
+ * On iOS, this would typically be the Documents directory.
36
+ * The Swift platform adapter should call this during initialization.
37
+ *
38
+ * @param base_dir Base directory path (e.g.,
39
+ * "/var/mobile/Containers/Data/Application/.../Documents")
40
+ * @return RAC_SUCCESS or error code
41
+ */
42
+ RAC_API rac_result_t rac_model_paths_set_base_dir(const char* base_dir);
43
+
44
+ /**
45
+ * @brief Get the configured base directory.
46
+ *
47
+ * @return Base directory path, or NULL if not configured
48
+ */
49
+ RAC_API const char* rac_model_paths_get_base_dir(void);
50
+
51
+ // =============================================================================
52
+ // BASE DIRECTORIES - Mirrors ModelPathUtils base directory methods
53
+ // =============================================================================
54
+
55
+ /**
56
+ * @brief Get the base RunAnywhere directory.
57
+ * Mirrors Swift's ModelPathUtils.getBaseDirectory().
58
+ *
59
+ * @param out_path Output buffer for path
60
+ * @param path_size Size of output buffer
61
+ * @return RAC_SUCCESS or error code
62
+ */
63
+ RAC_API rac_result_t rac_model_paths_get_base_directory(char* out_path, size_t path_size);
64
+
65
+ /**
66
+ * @brief Get the models directory.
67
+ * Mirrors Swift's ModelPathUtils.getModelsDirectory().
68
+ *
69
+ * Returns: `{base_dir}/RunAnywhere/Models/`
70
+ *
71
+ * @param out_path Output buffer for path
72
+ * @param path_size Size of output buffer
73
+ * @return RAC_SUCCESS or error code
74
+ */
75
+ RAC_API rac_result_t rac_model_paths_get_models_directory(char* out_path, size_t path_size);
76
+
77
+ // =============================================================================
78
+ // FRAMEWORK-SPECIFIC PATHS - Mirrors ModelPathUtils framework methods
79
+ // =============================================================================
80
+
81
+ /**
82
+ * @brief Get the directory for a specific framework.
83
+ * Mirrors Swift's ModelPathUtils.getFrameworkDirectory(framework:).
84
+ *
85
+ * Returns: `{base_dir}/RunAnywhere/Models/{framework}/`
86
+ *
87
+ * @param framework Inference framework
88
+ * @param out_path Output buffer for path
89
+ * @param path_size Size of output buffer
90
+ * @return RAC_SUCCESS or error code
91
+ */
92
+ RAC_API rac_result_t rac_model_paths_get_framework_directory(rac_inference_framework_t framework,
93
+ char* out_path, size_t path_size);
94
+
95
+ /**
96
+ * @brief Get the folder for a specific model.
97
+ * Mirrors Swift's ModelPathUtils.getModelFolder(modelId:framework:).
98
+ *
99
+ * Returns: `{base_dir}/RunAnywhere/Models/{framework}/{modelId}/`
100
+ *
101
+ * @param model_id Model identifier
102
+ * @param framework Inference framework
103
+ * @param out_path Output buffer for path
104
+ * @param path_size Size of output buffer
105
+ * @return RAC_SUCCESS or error code
106
+ */
107
+ RAC_API rac_result_t rac_model_paths_get_model_folder(const char* model_id,
108
+ rac_inference_framework_t framework,
109
+ char* out_path, size_t path_size);
110
+
111
+ // =============================================================================
112
+ // MODEL FILE PATHS - Mirrors ModelPathUtils file path methods
113
+ // =============================================================================
114
+
115
+ /**
116
+ * @brief Get the full path to a model file.
117
+ * Mirrors Swift's ModelPathUtils.getModelFilePath(modelId:framework:format:).
118
+ *
119
+ * Returns: `{base_dir}/RunAnywhere/Models/{framework}/{modelId}/{modelId}.{format}`
120
+ *
121
+ * @param model_id Model identifier
122
+ * @param framework Inference framework
123
+ * @param format Model format
124
+ * @param out_path Output buffer for path
125
+ * @param path_size Size of output buffer
126
+ * @return RAC_SUCCESS or error code
127
+ */
128
+ RAC_API rac_result_t rac_model_paths_get_model_file_path(const char* model_id,
129
+ rac_inference_framework_t framework,
130
+ rac_model_format_t format, char* out_path,
131
+ size_t path_size);
132
+
133
+ /**
134
+ * @brief Get the expected model path for a model.
135
+ * Mirrors Swift's ModelPathUtils.getExpectedModelPath(modelId:framework:format:).
136
+ *
137
+ * For directory-based frameworks (e.g., ONNX), returns the model folder.
138
+ * For single-file frameworks (e.g., LlamaCpp), returns the model file path.
139
+ *
140
+ * @param model_id Model identifier
141
+ * @param framework Inference framework
142
+ * @param format Model format
143
+ * @param out_path Output buffer for path
144
+ * @param path_size Size of output buffer
145
+ * @return RAC_SUCCESS or error code
146
+ */
147
+ RAC_API rac_result_t rac_model_paths_get_expected_model_path(const char* model_id,
148
+ rac_inference_framework_t framework,
149
+ rac_model_format_t format,
150
+ char* out_path, size_t path_size);
151
+
152
+ /**
153
+ * @brief Get the model path from model info.
154
+ * Mirrors Swift's ModelPathUtils.getModelPath(modelInfo:).
155
+ *
156
+ * @param model_info Model information
157
+ * @param out_path Output buffer for path
158
+ * @param path_size Size of output buffer
159
+ * @return RAC_SUCCESS or error code
160
+ */
161
+ RAC_API rac_result_t rac_model_paths_get_model_path(const rac_model_info_t* model_info,
162
+ char* out_path, size_t path_size);
163
+
164
+ // =============================================================================
165
+ // OTHER DIRECTORIES - Mirrors ModelPathUtils other directory methods
166
+ // =============================================================================
167
+
168
+ /**
169
+ * @brief Get the cache directory.
170
+ * Mirrors Swift's ModelPathUtils.getCacheDirectory().
171
+ *
172
+ * Returns: `{base_dir}/RunAnywhere/Cache/`
173
+ *
174
+ * @param out_path Output buffer for path
175
+ * @param path_size Size of output buffer
176
+ * @return RAC_SUCCESS or error code
177
+ */
178
+ RAC_API rac_result_t rac_model_paths_get_cache_directory(char* out_path, size_t path_size);
179
+
180
+ /**
181
+ * @brief Get the temporary files directory.
182
+ * Mirrors Swift's ModelPathUtils.getTempDirectory().
183
+ *
184
+ * Returns: `{base_dir}/RunAnywhere/Temp/`
185
+ *
186
+ * @param out_path Output buffer for path
187
+ * @param path_size Size of output buffer
188
+ * @return RAC_SUCCESS or error code
189
+ */
190
+ RAC_API rac_result_t rac_model_paths_get_temp_directory(char* out_path, size_t path_size);
191
+
192
+ /**
193
+ * @brief Get the downloads directory.
194
+ * Mirrors Swift's ModelPathUtils.getDownloadsDirectory().
195
+ *
196
+ * Returns: `{base_dir}/RunAnywhere/Downloads/`
197
+ *
198
+ * @param out_path Output buffer for path
199
+ * @param path_size Size of output buffer
200
+ * @return RAC_SUCCESS or error code
201
+ */
202
+ RAC_API rac_result_t rac_model_paths_get_downloads_directory(char* out_path, size_t path_size);
203
+
204
+ // =============================================================================
205
+ // PATH ANALYSIS - Mirrors ModelPathUtils analysis methods
206
+ // =============================================================================
207
+
208
+ /**
209
+ * @brief Extract model ID from a file path.
210
+ * Mirrors Swift's ModelPathUtils.extractModelId(from:).
211
+ *
212
+ * @param path File path
213
+ * @param out_model_id Output buffer for model ID (can be NULL to just check if valid)
214
+ * @param model_id_size Size of output buffer
215
+ * @return RAC_SUCCESS if model ID found, RAC_ERROR_NOT_FOUND otherwise
216
+ */
217
+ RAC_API rac_result_t rac_model_paths_extract_model_id(const char* path, char* out_model_id,
218
+ size_t model_id_size);
219
+
220
+ /**
221
+ * @brief Extract framework from a file path.
222
+ * Mirrors Swift's ModelPathUtils.extractFramework(from:).
223
+ *
224
+ * @param path File path
225
+ * @param out_framework Output: The framework if found
226
+ * @return RAC_SUCCESS if framework found, RAC_ERROR_NOT_FOUND otherwise
227
+ */
228
+ RAC_API rac_result_t rac_model_paths_extract_framework(const char* path,
229
+ rac_inference_framework_t* out_framework);
230
+
231
+ /**
232
+ * @brief Check if a path is within the models directory.
233
+ * Mirrors Swift's ModelPathUtils.isModelPath(_:).
234
+ *
235
+ * @param path File path to check
236
+ * @return RAC_TRUE if path is within models directory, RAC_FALSE otherwise
237
+ */
238
+ RAC_API rac_bool_t rac_model_paths_is_model_path(const char* path);
239
+
240
+ // =============================================================================
241
+ // PATH UTILITIES
242
+ // =============================================================================
243
+
244
+ // NOTE: rac_model_format_extension is declared in rac_model_types.h
245
+
246
+ /**
247
+ * @brief Get raw value string for a framework.
248
+ *
249
+ * @param framework Inference framework
250
+ * @return Raw value string (e.g., "LlamaCpp", "ONNX")
251
+ */
252
+ RAC_API const char* rac_framework_raw_value(rac_inference_framework_t framework);
253
+
254
+ #ifdef __cplusplus
255
+ }
256
+ #endif
257
+
258
+ #endif /* RAC_MODEL_PATHS_H */