@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,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 <RACommons/rac_error.h>
20
+ #include <RACommons/rac_types.h>
21
+ #include <RACommons/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 */
@@ -0,0 +1,357 @@
1
+ /**
2
+ * @file rac_model_registry.h
3
+ * @brief Model Information Registry - In-Memory Model Metadata Management
4
+ *
5
+ * C port of Swift's ModelInfoService and ModelInfo structures.
6
+ * Swift Source: Sources/RunAnywhere/Infrastructure/ModelManagement/Services/ModelInfoService.swift
7
+ * Swift Source: Sources/RunAnywhere/Infrastructure/ModelManagement/Models/Domain/ModelInfo.swift
8
+ *
9
+ * IMPORTANT: This is a direct translation of the Swift implementation.
10
+ * Do NOT add features not present in the Swift code.
11
+ */
12
+
13
+ #ifndef RAC_MODEL_REGISTRY_H
14
+ #define RAC_MODEL_REGISTRY_H
15
+
16
+ #include <RACommons/rac_error.h>
17
+ #include <RACommons/rac_types.h>
18
+ #include <RACommons/rac_model_types.h>
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ // =============================================================================
25
+ // TYPES - Uses types from rac_model_types.h
26
+ // =============================================================================
27
+
28
+ // NOTE: All model types (rac_model_category_t, rac_model_format_t,
29
+ // rac_inference_framework_t, rac_model_source_t, rac_artifact_type_kind_t,
30
+ // rac_model_info_t) are defined in rac_model_types.h
31
+
32
+ // =============================================================================
33
+ // OPAQUE HANDLE
34
+ // =============================================================================
35
+
36
+ /**
37
+ * @brief Opaque handle for model registry instance.
38
+ */
39
+ typedef struct rac_model_registry* rac_model_registry_handle_t;
40
+
41
+ // =============================================================================
42
+ // LIFECYCLE API
43
+ // =============================================================================
44
+
45
+ /**
46
+ * @brief Create a model registry instance.
47
+ *
48
+ * @param out_handle Output: Handle to the created registry
49
+ * @return RAC_SUCCESS or error code
50
+ */
51
+ RAC_API rac_result_t rac_model_registry_create(rac_model_registry_handle_t* out_handle);
52
+
53
+ /**
54
+ * @brief Destroy a model registry instance.
55
+ *
56
+ * @param handle Registry handle
57
+ */
58
+ RAC_API void rac_model_registry_destroy(rac_model_registry_handle_t handle);
59
+
60
+ // =============================================================================
61
+ // MODEL INFO API - Mirrors Swift's ModelInfoService
62
+ // =============================================================================
63
+
64
+ /**
65
+ * @brief Save model metadata.
66
+ *
67
+ * Mirrors Swift's ModelInfoService.saveModel(_:).
68
+ *
69
+ * @param handle Registry handle
70
+ * @param model Model info to save
71
+ * @return RAC_SUCCESS or error code
72
+ */
73
+ RAC_API rac_result_t rac_model_registry_save(rac_model_registry_handle_t handle,
74
+ const rac_model_info_t* model);
75
+
76
+ /**
77
+ * @brief Get model metadata by ID.
78
+ *
79
+ * Mirrors Swift's ModelInfoService.getModel(by:).
80
+ *
81
+ * @param handle Registry handle
82
+ * @param model_id Model identifier
83
+ * @param out_model Output: Model info (owned, must be freed with rac_model_info_free)
84
+ * @return RAC_SUCCESS, RAC_ERROR_NOT_FOUND, or other error code
85
+ */
86
+ RAC_API rac_result_t rac_model_registry_get(rac_model_registry_handle_t handle,
87
+ const char* model_id, rac_model_info_t** out_model);
88
+
89
+ /**
90
+ * @brief Load all stored models.
91
+ *
92
+ * Mirrors Swift's ModelInfoService.loadStoredModels().
93
+ *
94
+ * @param handle Registry handle
95
+ * @param out_models Output: Array of model info (owned, each must be freed)
96
+ * @param out_count Output: Number of models
97
+ * @return RAC_SUCCESS or error code
98
+ */
99
+ RAC_API rac_result_t rac_model_registry_get_all(rac_model_registry_handle_t handle,
100
+ rac_model_info_t*** out_models, size_t* out_count);
101
+
102
+ /**
103
+ * @brief Load models for specific frameworks.
104
+ *
105
+ * Mirrors Swift's ModelInfoService.loadModels(for:).
106
+ *
107
+ * @param handle Registry handle
108
+ * @param frameworks Array of frameworks to filter by
109
+ * @param framework_count Number of frameworks
110
+ * @param out_models Output: Array of model info (owned, each must be freed)
111
+ * @param out_count Output: Number of models
112
+ * @return RAC_SUCCESS or error code
113
+ */
114
+ RAC_API rac_result_t rac_model_registry_get_by_frameworks(
115
+ rac_model_registry_handle_t handle, const rac_inference_framework_t* frameworks,
116
+ size_t framework_count, rac_model_info_t*** out_models, size_t* out_count);
117
+
118
+ /**
119
+ * @brief Update model last used date.
120
+ *
121
+ * Mirrors Swift's ModelInfoService.updateLastUsed(for:).
122
+ * Also increments usage count.
123
+ *
124
+ * @param handle Registry handle
125
+ * @param model_id Model identifier
126
+ * @return RAC_SUCCESS or error code
127
+ */
128
+ RAC_API rac_result_t rac_model_registry_update_last_used(rac_model_registry_handle_t handle,
129
+ const char* model_id);
130
+
131
+ /**
132
+ * @brief Remove model metadata.
133
+ *
134
+ * Mirrors Swift's ModelInfoService.removeModel(_:).
135
+ *
136
+ * @param handle Registry handle
137
+ * @param model_id Model identifier
138
+ * @return RAC_SUCCESS or error code
139
+ */
140
+ RAC_API rac_result_t rac_model_registry_remove(rac_model_registry_handle_t handle,
141
+ const char* model_id);
142
+
143
+ /**
144
+ * @brief Get downloaded models.
145
+ *
146
+ * Mirrors Swift's ModelInfoService.getDownloadedModels().
147
+ *
148
+ * @param handle Registry handle
149
+ * @param out_models Output: Array of model info (owned, each must be freed)
150
+ * @param out_count Output: Number of models
151
+ * @return RAC_SUCCESS or error code
152
+ */
153
+ RAC_API rac_result_t rac_model_registry_get_downloaded(rac_model_registry_handle_t handle,
154
+ rac_model_info_t*** out_models,
155
+ size_t* out_count);
156
+
157
+ /**
158
+ * @brief Update download status for a model.
159
+ *
160
+ * Mirrors Swift's ModelInfoService.updateDownloadStatus(for:localPath:).
161
+ *
162
+ * @param handle Registry handle
163
+ * @param model_id Model identifier
164
+ * @param local_path Path to downloaded model (can be NULL to clear)
165
+ * @return RAC_SUCCESS or error code
166
+ */
167
+ RAC_API rac_result_t rac_model_registry_update_download_status(rac_model_registry_handle_t handle,
168
+ const char* model_id,
169
+ const char* local_path);
170
+
171
+ // =============================================================================
172
+ // QUERY HELPERS
173
+ // =============================================================================
174
+
175
+ /**
176
+ * @brief Check if a model is downloaded and available.
177
+ *
178
+ * Mirrors Swift's ModelInfo.isDownloaded computed property.
179
+ *
180
+ * @param model Model info
181
+ * @return RAC_TRUE if downloaded, RAC_FALSE otherwise
182
+ */
183
+ RAC_API rac_bool_t rac_model_info_is_downloaded(const rac_model_info_t* model);
184
+
185
+ /**
186
+ * @brief Check if model category requires context length.
187
+ *
188
+ * @param category Model category
189
+ * @return RAC_TRUE if requires context length
190
+ */
191
+ RAC_API rac_bool_t rac_model_category_requires_context_length(rac_model_category_t category);
192
+
193
+ /**
194
+ * @brief Check if model category supports thinking.
195
+ *
196
+ * @param category Model category
197
+ * @return RAC_TRUE if supports thinking
198
+ */
199
+ RAC_API rac_bool_t rac_model_category_supports_thinking(rac_model_category_t category);
200
+
201
+ /**
202
+ * @brief Infer artifact type from URL and format.
203
+ *
204
+ * Mirrors Swift's ModelArtifactType.infer(from:format:).
205
+ *
206
+ * @param url Download URL (can be NULL)
207
+ * @param format Model format
208
+ * @return Inferred artifact type kind
209
+ */
210
+ RAC_API rac_artifact_type_kind_t rac_model_infer_artifact_type(const char* url,
211
+ rac_model_format_t format);
212
+
213
+ // =============================================================================
214
+ // MEMORY MANAGEMENT
215
+ // =============================================================================
216
+
217
+ /**
218
+ * @brief Allocate a new model info struct.
219
+ *
220
+ * @return Allocated model info (must be freed with rac_model_info_free)
221
+ */
222
+ RAC_API rac_model_info_t* rac_model_info_alloc(void);
223
+
224
+ /**
225
+ * @brief Free a model info struct and its contents.
226
+ *
227
+ * @param model Model info to free
228
+ */
229
+ RAC_API void rac_model_info_free(rac_model_info_t* model);
230
+
231
+ /**
232
+ * @brief Free an array of model info structs.
233
+ *
234
+ * @param models Array of model info pointers
235
+ * @param count Number of models
236
+ */
237
+ RAC_API void rac_model_info_array_free(rac_model_info_t** models, size_t count);
238
+
239
+ /**
240
+ * @brief Copy a model info struct.
241
+ *
242
+ * @param model Model info to copy
243
+ * @return Deep copy (must be freed with rac_model_info_free)
244
+ */
245
+ RAC_API rac_model_info_t* rac_model_info_copy(const rac_model_info_t* model);
246
+
247
+ // =============================================================================
248
+ // MODEL DISCOVERY - Scan file system for downloaded models
249
+ // =============================================================================
250
+
251
+ /**
252
+ * @brief Callback to list directory contents
253
+ * @param path Directory path
254
+ * @param out_entries Output: Array of entry names (allocated by callback)
255
+ * @param out_count Output: Number of entries
256
+ * @param user_data User context
257
+ * @return RAC_SUCCESS or error code
258
+ */
259
+ typedef rac_result_t (*rac_list_directory_fn)(const char* path, char*** out_entries,
260
+ size_t* out_count, void* user_data);
261
+
262
+ /**
263
+ * @brief Callback to free directory entries
264
+ * @param entries Array of entry names
265
+ * @param count Number of entries
266
+ * @param user_data User context
267
+ */
268
+ typedef void (*rac_free_directory_entries_fn)(char** entries, size_t count, void* user_data);
269
+
270
+ /**
271
+ * @brief Callback to check if path is a directory
272
+ * @param path Path to check
273
+ * @param user_data User context
274
+ * @return RAC_TRUE if directory, RAC_FALSE otherwise
275
+ */
276
+ typedef rac_bool_t (*rac_is_directory_fn)(const char* path, void* user_data);
277
+
278
+ /**
279
+ * @brief Callback to check if path exists
280
+ * @param path Path to check
281
+ * @param user_data User context
282
+ * @return RAC_TRUE if exists
283
+ */
284
+ typedef rac_bool_t (*rac_path_exists_discovery_fn)(const char* path, void* user_data);
285
+
286
+ /**
287
+ * @brief Callback to check if file has model extension
288
+ * @param path File path
289
+ * @param framework Expected framework
290
+ * @param user_data User context
291
+ * @return RAC_TRUE if valid model file
292
+ */
293
+ typedef rac_bool_t (*rac_is_model_file_fn)(const char* path, rac_inference_framework_t framework,
294
+ void* user_data);
295
+
296
+ /**
297
+ * @brief Callbacks for model discovery file operations
298
+ */
299
+ typedef struct {
300
+ rac_list_directory_fn list_directory;
301
+ rac_free_directory_entries_fn free_entries;
302
+ rac_is_directory_fn is_directory;
303
+ rac_path_exists_discovery_fn path_exists;
304
+ rac_is_model_file_fn is_model_file;
305
+ void* user_data;
306
+ } rac_discovery_callbacks_t;
307
+
308
+ /**
309
+ * @brief Discovery result for a single model
310
+ */
311
+ typedef struct {
312
+ /** Model ID that was discovered */
313
+ const char* model_id;
314
+ /** Path where model was found */
315
+ const char* local_path;
316
+ /** Framework of the model */
317
+ rac_inference_framework_t framework;
318
+ } rac_discovered_model_t;
319
+
320
+ /**
321
+ * @brief Result of model discovery scan
322
+ */
323
+ typedef struct {
324
+ /** Number of models discovered as downloaded */
325
+ size_t discovered_count;
326
+ /** Array of discovered models */
327
+ rac_discovered_model_t* discovered_models;
328
+ /** Number of unregistered model folders found */
329
+ size_t unregistered_count;
330
+ } rac_discovery_result_t;
331
+
332
+ /**
333
+ * @brief Discover downloaded models on the file system.
334
+ *
335
+ * Scans the models directory for each framework, checks if folders
336
+ * contain valid model files, and updates the registry for registered models.
337
+ *
338
+ * @param handle Registry handle
339
+ * @param callbacks Platform file operation callbacks
340
+ * @param out_result Output: Discovery result (caller must call rac_discovery_result_free)
341
+ * @return RAC_SUCCESS or error code
342
+ */
343
+ RAC_API rac_result_t rac_model_registry_discover_downloaded(
344
+ rac_model_registry_handle_t handle, const rac_discovery_callbacks_t* callbacks,
345
+ rac_discovery_result_t* out_result);
346
+
347
+ /**
348
+ * @brief Free discovery result
349
+ * @param result Discovery result to free
350
+ */
351
+ RAC_API void rac_discovery_result_free(rac_discovery_result_t* result);
352
+
353
+ #ifdef __cplusplus
354
+ }
355
+ #endif
356
+
357
+ #endif /* RAC_MODEL_REGISTRY_H */