@runanywhere/core 0.17.7 → 0.18.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.
- package/README.md +218 -2
- package/RunAnywhereCore.podspec +1 -0
- package/android/CMakeLists.txt +24 -2
- package/android/build.gradle +61 -9
- package/android/src/main/cpp/cpp-adapter.cpp +51 -3
- package/android/src/main/include/rac/backends/rac_vlm_llamacpp.h +216 -0
- package/android/src/main/include/rac/core/capabilities/rac_lifecycle.h +3 -1
- package/android/src/main/include/rac/core/rac_core.h +11 -0
- package/android/src/main/include/rac/core/rac_types.h +8 -6
- package/android/src/main/include/rac/features/diffusion/rac_diffusion.h +22 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_component.h +263 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_model_registry.h +358 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_service.h +187 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_tokenizer.h +167 -0
- package/android/src/main/include/rac/features/diffusion/rac_diffusion_types.h +454 -0
- package/android/src/main/include/rac/features/llm/rac_tool_calling.h +373 -0
- package/android/src/main/include/rac/features/platform/rac_diffusion_platform.h +305 -0
- package/android/src/main/include/rac/features/vad/rac_vad_energy.h +1 -1
- package/android/src/main/include/rac/features/vlm/rac_vlm.h +16 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_component.h +168 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_service.h +206 -0
- package/android/src/main/include/rac/features/vlm/rac_vlm_types.h +417 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_registry.h +15 -0
- package/android/src/main/include/rac/infrastructure/model_management/rac_model_types.h +3 -0
- package/android/src/main/include/rac/utils/rac_image_utils.h +215 -0
- package/android/src/main/java/com/margelo/nitro/runanywhere/PlatformAdapterBridge.kt +201 -1
- package/android/src/main/jniLibs/arm64-v8a/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libomp.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librac_commons.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/librunanywhere_jni.so +0 -0
- package/android/src/main/jniLibs/x86_64/libc++_shared.so +0 -0
- package/android/src/main/jniLibs/x86_64/libomp.so +0 -0
- package/android/src/main/jniLibs/x86_64/librac_commons.so +0 -0
- package/android/src/main/jniLibs/x86_64/librunanywhere_jni.so +0 -0
- package/cpp/HybridRunAnywhereCore.cpp +259 -160
- package/cpp/HybridRunAnywhereCore.hpp +11 -0
- package/cpp/bridges/InitBridge.cpp +234 -3
- package/cpp/bridges/PlatformDownloadBridge.h +44 -0
- package/cpp/bridges/ToolCallingBridge.cpp +188 -0
- package/cpp/bridges/ToolCallingBridge.hpp +98 -0
- package/cpp/third_party/nlohmann/json.hpp +24765 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h +18 -4
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_core.h +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion.h +22 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_component.h +263 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_model_registry.h +358 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_platform.h +305 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_service.h +187 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_tokenizer.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion_types.h +454 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_endpoints.h +3 -17
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_image_utils.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_lifecycle.h +3 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_assignment.h +4 -20
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_registry.h +15 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_model_types.h +3 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_tool_calling.h +373 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_types.h +8 -6
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vad_energy.h +1 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm.h +16 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_component.h +168 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_llamacpp.h +216 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_service.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_vlm_types.h +417 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/RACommons +0 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/RACommons.h +18 -4
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_core.h +11 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion.h +22 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_component.h +263 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_model_registry.h +358 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_platform.h +305 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_service.h +187 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_tokenizer.h +167 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_diffusion_types.h +454 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_endpoints.h +3 -17
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_image_utils.h +215 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_lifecycle.h +3 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_assignment.h +4 -20
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_registry.h +15 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_model_types.h +3 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_tool_calling.h +373 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_types.h +8 -6
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vad_energy.h +1 -1
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm.h +16 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_component.h +168 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_llamacpp.h +216 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_service.h +206 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/Headers/rac_vlm_types.h +417 -0
- package/ios/Binaries/RACommons.xcframework/ios-arm64_x86_64-simulator/RACommons.framework/RACommons +0 -0
- package/ios/PlatformAdapterBridge.h +24 -1
- package/ios/PlatformAdapterBridge.m +243 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridRunAnywhereCoreSpec.hpp +4 -0
- package/package.json +8 -4
- package/src/Foundation/Security/SecureStorageService.ts +12 -6
- package/src/Public/Extensions/RunAnywhere+Models.ts +5 -3
- package/src/Public/Extensions/RunAnywhere+STT.ts +7 -2
- package/src/Public/Extensions/RunAnywhere+ToolCalling.ts +472 -0
- package/src/Public/Extensions/index.ts +16 -0
- package/src/Public/RunAnywhere.ts +18 -0
- package/src/index.ts +0 -1
- package/src/services/Network/index.ts +0 -1
- package/src/services/index.ts +0 -1
- package/src/specs/RunAnywhereCore.nitro.ts +72 -0
- package/src/types/ToolCallingTypes.ts +198 -0
- package/src/types/index.ts +13 -0
package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/RACommons.h
CHANGED
|
@@ -9,13 +9,22 @@
|
|
|
9
9
|
#include "rac_core.h"
|
|
10
10
|
#include "rac_dev_config.h"
|
|
11
11
|
#include "rac_device_manager.h"
|
|
12
|
+
#include "rac_diffusion.h"
|
|
13
|
+
#include "rac_diffusion_component.h"
|
|
14
|
+
#include "rac_diffusion_model_registry.h"
|
|
15
|
+
#include "rac_diffusion_platform.h"
|
|
16
|
+
#include "rac_diffusion_service.h"
|
|
17
|
+
#include "rac_diffusion_tokenizer.h"
|
|
18
|
+
#include "rac_diffusion_types.h"
|
|
12
19
|
#include "rac_download.h"
|
|
13
20
|
#include "rac_endpoints.h"
|
|
14
21
|
#include "rac_environment.h"
|
|
15
22
|
#include "rac_error.h"
|
|
16
23
|
#include "rac_events.h"
|
|
17
24
|
#include "rac_http_client.h"
|
|
25
|
+
#include "rac_image_utils.h"
|
|
18
26
|
#include "rac_lifecycle.h"
|
|
27
|
+
#include "rac_llm.h"
|
|
19
28
|
#include "rac_llm_analytics.h"
|
|
20
29
|
#include "rac_llm_component.h"
|
|
21
30
|
#include "rac_llm_events.h"
|
|
@@ -25,7 +34,6 @@
|
|
|
25
34
|
#include "rac_llm_service.h"
|
|
26
35
|
#include "rac_llm_structured_output.h"
|
|
27
36
|
#include "rac_llm_types.h"
|
|
28
|
-
#include "rac_llm.h"
|
|
29
37
|
#include "rac_logger.h"
|
|
30
38
|
#include "rac_model_assignment.h"
|
|
31
39
|
#include "rac_model_paths.h"
|
|
@@ -36,6 +44,7 @@
|
|
|
36
44
|
#include "rac_sdk_state.h"
|
|
37
45
|
#include "rac_storage_analyzer.h"
|
|
38
46
|
#include "rac_structured_error.h"
|
|
47
|
+
#include "rac_stt.h"
|
|
39
48
|
#include "rac_stt_analytics.h"
|
|
40
49
|
#include "rac_stt_component.h"
|
|
41
50
|
#include "rac_stt_events.h"
|
|
@@ -43,9 +52,10 @@
|
|
|
43
52
|
#include "rac_stt_service.h"
|
|
44
53
|
#include "rac_stt_types.h"
|
|
45
54
|
#include "rac_stt_whispercpp.h"
|
|
46
|
-
#include "rac_stt.h"
|
|
47
55
|
#include "rac_telemetry_manager.h"
|
|
48
56
|
#include "rac_telemetry_types.h"
|
|
57
|
+
#include "rac_tool_calling.h"
|
|
58
|
+
#include "rac_tts.h"
|
|
49
59
|
#include "rac_tts_analytics.h"
|
|
50
60
|
#include "rac_tts_component.h"
|
|
51
61
|
#include "rac_tts_events.h"
|
|
@@ -53,8 +63,8 @@
|
|
|
53
63
|
#include "rac_tts_platform.h"
|
|
54
64
|
#include "rac_tts_service.h"
|
|
55
65
|
#include "rac_tts_types.h"
|
|
56
|
-
#include "rac_tts.h"
|
|
57
66
|
#include "rac_types.h"
|
|
67
|
+
#include "rac_vad.h"
|
|
58
68
|
#include "rac_vad_analytics.h"
|
|
59
69
|
#include "rac_vad_component.h"
|
|
60
70
|
#include "rac_vad_energy.h"
|
|
@@ -62,6 +72,10 @@
|
|
|
62
72
|
#include "rac_vad_onnx.h"
|
|
63
73
|
#include "rac_vad_service.h"
|
|
64
74
|
#include "rac_vad_types.h"
|
|
65
|
-
#include "
|
|
75
|
+
#include "rac_vlm.h"
|
|
76
|
+
#include "rac_vlm_component.h"
|
|
77
|
+
#include "rac_vlm_llamacpp.h"
|
|
78
|
+
#include "rac_vlm_service.h"
|
|
79
|
+
#include "rac_vlm_types.h"
|
|
66
80
|
#include "rac_voice_agent.h"
|
|
67
81
|
#endif
|
|
@@ -324,6 +324,17 @@ RAC_API rac_result_t rac_register_model(const struct rac_model_info* model);
|
|
|
324
324
|
*/
|
|
325
325
|
RAC_API rac_result_t rac_get_model(const char* model_id, struct rac_model_info** out_model);
|
|
326
326
|
|
|
327
|
+
/**
|
|
328
|
+
* Gets model info from the global registry by local path.
|
|
329
|
+
* Convenience function that calls rac_model_registry_get_by_path on the global registry.
|
|
330
|
+
* Useful when loading models by path instead of model_id.
|
|
331
|
+
*
|
|
332
|
+
* @param local_path Local path to search for
|
|
333
|
+
* @param out_model Output: Model info (owned, must be freed with rac_model_info_free)
|
|
334
|
+
* @return RAC_SUCCESS on success, RAC_ERROR_NOT_FOUND if not registered
|
|
335
|
+
*/
|
|
336
|
+
RAC_API rac_result_t rac_get_model_by_path(const char* local_path, struct rac_model_info** out_model);
|
|
337
|
+
|
|
327
338
|
#ifdef __cplusplus
|
|
328
339
|
}
|
|
329
340
|
#endif
|
package/ios/Binaries/RACommons.xcframework/ios-arm64/RACommons.framework/Headers/rac_diffusion.h
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_diffusion.h
|
|
3
|
+
* @brief RunAnywhere Commons - Diffusion Feature Umbrella Header
|
|
4
|
+
*
|
|
5
|
+
* Include this header to use diffusion (image generation) capabilities.
|
|
6
|
+
* This provides text-to-image, image-to-image, and inpainting using
|
|
7
|
+
* Stable Diffusion models.
|
|
8
|
+
*
|
|
9
|
+
* Supported backends:
|
|
10
|
+
* - CoreML (Apple platforms) - via Platform backend
|
|
11
|
+
* - ONNX Runtime (cross-platform) - via ONNX backend
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef RAC_DIFFUSION_H
|
|
15
|
+
#define RAC_DIFFUSION_H
|
|
16
|
+
|
|
17
|
+
#include <RACommons/rac_diffusion_component.h>
|
|
18
|
+
#include <RACommons/rac_diffusion_service.h>
|
|
19
|
+
#include <RACommons/rac_diffusion_tokenizer.h>
|
|
20
|
+
#include <RACommons/rac_diffusion_types.h>
|
|
21
|
+
|
|
22
|
+
#endif /* RAC_DIFFUSION_H */
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file rac_diffusion_component.h
|
|
3
|
+
* @brief RunAnywhere Commons - Diffusion Capability Component
|
|
4
|
+
*
|
|
5
|
+
* Actor-based diffusion capability that owns model lifecycle and generation.
|
|
6
|
+
* Uses lifecycle manager for unified lifecycle + analytics handling.
|
|
7
|
+
*
|
|
8
|
+
* Supports:
|
|
9
|
+
* - Text-to-image generation
|
|
10
|
+
* - Image-to-image transformation
|
|
11
|
+
* - Inpainting with mask
|
|
12
|
+
* - Progress reporting with optional intermediate images
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
#ifndef RAC_DIFFUSION_COMPONENT_H
|
|
16
|
+
#define RAC_DIFFUSION_COMPONENT_H
|
|
17
|
+
|
|
18
|
+
#include <RACommons/rac_lifecycle.h>
|
|
19
|
+
#include <RACommons/rac_error.h>
|
|
20
|
+
#include <RACommons/rac_diffusion_types.h>
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// DIFFUSION COMPONENT API - Component lifecycle and generation
|
|
28
|
+
// =============================================================================
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @brief Create a diffusion capability component
|
|
32
|
+
*
|
|
33
|
+
* @param out_handle Output: Handle to the component
|
|
34
|
+
* @return RAC_SUCCESS or error code
|
|
35
|
+
*/
|
|
36
|
+
RAC_API rac_result_t rac_diffusion_component_create(rac_handle_t* out_handle);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @brief Configure the diffusion component
|
|
40
|
+
*
|
|
41
|
+
* @param handle Component handle
|
|
42
|
+
* @param config Configuration
|
|
43
|
+
* @return RAC_SUCCESS or error code
|
|
44
|
+
*/
|
|
45
|
+
RAC_API rac_result_t rac_diffusion_component_configure(rac_handle_t handle,
|
|
46
|
+
const rac_diffusion_config_t* config);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @brief Check if model is loaded
|
|
50
|
+
*
|
|
51
|
+
* @param handle Component handle
|
|
52
|
+
* @return RAC_TRUE if loaded, RAC_FALSE otherwise
|
|
53
|
+
*/
|
|
54
|
+
RAC_API rac_bool_t rac_diffusion_component_is_loaded(rac_handle_t handle);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @brief Get current model ID
|
|
58
|
+
*
|
|
59
|
+
* @param handle Component handle
|
|
60
|
+
* @return Current model ID (NULL if not loaded)
|
|
61
|
+
*/
|
|
62
|
+
RAC_API const char* rac_diffusion_component_get_model_id(rac_handle_t handle);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @brief Load a diffusion model
|
|
66
|
+
*
|
|
67
|
+
* @param handle Component handle
|
|
68
|
+
* @param model_path Path to the model directory
|
|
69
|
+
* @param model_id Model identifier for telemetry
|
|
70
|
+
* @param model_name Human-readable model name
|
|
71
|
+
* @return RAC_SUCCESS or error code
|
|
72
|
+
*/
|
|
73
|
+
RAC_API rac_result_t rac_diffusion_component_load_model(rac_handle_t handle, const char* model_path,
|
|
74
|
+
const char* model_id,
|
|
75
|
+
const char* model_name);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @brief Unload the current model
|
|
79
|
+
*
|
|
80
|
+
* @param handle Component handle
|
|
81
|
+
* @return RAC_SUCCESS or error code
|
|
82
|
+
*/
|
|
83
|
+
RAC_API rac_result_t rac_diffusion_component_unload(rac_handle_t handle);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @brief Cleanup and reset the component
|
|
87
|
+
*
|
|
88
|
+
* @param handle Component handle
|
|
89
|
+
* @return RAC_SUCCESS or error code
|
|
90
|
+
*/
|
|
91
|
+
RAC_API rac_result_t rac_diffusion_component_cleanup(rac_handle_t handle);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @brief Cancel ongoing generation
|
|
95
|
+
*
|
|
96
|
+
* Best-effort cancellation.
|
|
97
|
+
*
|
|
98
|
+
* @param handle Component handle
|
|
99
|
+
* @return RAC_SUCCESS or error code
|
|
100
|
+
*/
|
|
101
|
+
RAC_API rac_result_t rac_diffusion_component_cancel(rac_handle_t handle);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @brief Generate an image (non-streaming)
|
|
105
|
+
*
|
|
106
|
+
* Blocking call that generates an image from the prompt.
|
|
107
|
+
*
|
|
108
|
+
* @param handle Component handle
|
|
109
|
+
* @param options Generation options
|
|
110
|
+
* @param out_result Output: Generation result
|
|
111
|
+
* @return RAC_SUCCESS or error code
|
|
112
|
+
*/
|
|
113
|
+
RAC_API rac_result_t rac_diffusion_component_generate(rac_handle_t handle,
|
|
114
|
+
const rac_diffusion_options_t* options,
|
|
115
|
+
rac_diffusion_result_t* out_result);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @brief Generate an image with progress callbacks
|
|
119
|
+
*
|
|
120
|
+
* Non-blocking call with progress reporting via callbacks.
|
|
121
|
+
*
|
|
122
|
+
* @param handle Component handle
|
|
123
|
+
* @param options Generation options
|
|
124
|
+
* @param progress_callback Called for each progress update
|
|
125
|
+
* @param complete_callback Called when generation completes
|
|
126
|
+
* @param error_callback Called on error
|
|
127
|
+
* @param user_data User context passed to callbacks
|
|
128
|
+
* @return RAC_SUCCESS or error code
|
|
129
|
+
*/
|
|
130
|
+
RAC_API rac_result_t rac_diffusion_component_generate_with_callbacks(
|
|
131
|
+
rac_handle_t handle, const rac_diffusion_options_t* options,
|
|
132
|
+
rac_diffusion_progress_callback_fn progress_callback,
|
|
133
|
+
rac_diffusion_complete_callback_fn complete_callback,
|
|
134
|
+
rac_diffusion_error_callback_fn error_callback, void* user_data);
|
|
135
|
+
|
|
136
|
+
// =============================================================================
|
|
137
|
+
// JSON CONVENIENCE HELPERS
|
|
138
|
+
// =============================================================================
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @brief Configure diffusion component from JSON
|
|
142
|
+
*
|
|
143
|
+
* JSON schema (flat object):
|
|
144
|
+
* {
|
|
145
|
+
* "model_id": "optional-model-id",
|
|
146
|
+
* "model_variant": 0 | "sd15" | "sd21" | "sdxl" | "sdxl_turbo" | "sdxs" | "lcm",
|
|
147
|
+
* "enable_safety_checker": true/false,
|
|
148
|
+
* "reduce_memory": true/false,
|
|
149
|
+
* "tokenizer_source": 0 | 1 | 2 | 99,
|
|
150
|
+
* "tokenizer_custom_url": "https://..."
|
|
151
|
+
* }
|
|
152
|
+
*
|
|
153
|
+
* @param handle Component handle
|
|
154
|
+
* @param config_json JSON string
|
|
155
|
+
* @return RAC_SUCCESS or error code
|
|
156
|
+
*/
|
|
157
|
+
RAC_API rac_result_t rac_diffusion_component_configure_json(rac_handle_t handle,
|
|
158
|
+
const char* config_json);
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @brief Generate image from JSON options
|
|
162
|
+
*
|
|
163
|
+
* JSON schema (flat object):
|
|
164
|
+
* {
|
|
165
|
+
* "prompt": "text prompt",
|
|
166
|
+
* "negative_prompt": "optional",
|
|
167
|
+
* "width": 512,
|
|
168
|
+
* "height": 512,
|
|
169
|
+
* "steps": 28,
|
|
170
|
+
* "guidance_scale": 7.5,
|
|
171
|
+
* "seed": -1,
|
|
172
|
+
* "scheduler": 0 | "dpm++_2m_karras" | "dpm++_2m" | "dpm++_2m_sde" | "ddim" | "euler" | "euler_a" | "pndm" | "lms",
|
|
173
|
+
* "mode": 0 | "txt2img" | "img2img" | "inpainting",
|
|
174
|
+
* "denoise_strength": 0.75,
|
|
175
|
+
* "report_intermediate_images": false,
|
|
176
|
+
* "progress_stride": 1
|
|
177
|
+
* }
|
|
178
|
+
*
|
|
179
|
+
* @param handle Component handle
|
|
180
|
+
* @param options_json JSON string
|
|
181
|
+
* @param input_image_data Optional input image bytes (PNG/JPEG or RGBA)
|
|
182
|
+
* @param input_image_size Size of input image bytes
|
|
183
|
+
* @param mask_data Optional mask image bytes (PNG/JPEG or grayscale)
|
|
184
|
+
* @param mask_size Size of mask bytes
|
|
185
|
+
* @param out_json Output JSON (caller must free with rac_free)
|
|
186
|
+
* @return RAC_SUCCESS or error code
|
|
187
|
+
*/
|
|
188
|
+
RAC_API rac_result_t rac_diffusion_component_generate_json(
|
|
189
|
+
rac_handle_t handle, const char* options_json, const uint8_t* input_image_data,
|
|
190
|
+
size_t input_image_size, const uint8_t* mask_data, size_t mask_size, char** out_json);
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @brief Get diffusion info as JSON
|
|
194
|
+
*
|
|
195
|
+
* Output schema:
|
|
196
|
+
* {
|
|
197
|
+
* "is_ready": true/false,
|
|
198
|
+
* "current_model": "id",
|
|
199
|
+
* "model_variant": 0,
|
|
200
|
+
* "supports_text_to_image": true/false,
|
|
201
|
+
* "supports_image_to_image": true/false,
|
|
202
|
+
* "supports_inpainting": true/false,
|
|
203
|
+
* "safety_checker_enabled": true/false,
|
|
204
|
+
* "max_width": 512,
|
|
205
|
+
* "max_height": 512
|
|
206
|
+
* }
|
|
207
|
+
*
|
|
208
|
+
* @param handle Component handle
|
|
209
|
+
* @param out_json Output JSON (caller must free with rac_free)
|
|
210
|
+
* @return RAC_SUCCESS or error code
|
|
211
|
+
*/
|
|
212
|
+
RAC_API rac_result_t rac_diffusion_component_get_info_json(rac_handle_t handle, char** out_json);
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @brief Get supported capabilities
|
|
216
|
+
*
|
|
217
|
+
* Returns a bitmask of supported capabilities.
|
|
218
|
+
*
|
|
219
|
+
* @param handle Component handle
|
|
220
|
+
* @return Capability bitmask (RAC_DIFFUSION_CAP_* flags)
|
|
221
|
+
*/
|
|
222
|
+
RAC_API uint32_t rac_diffusion_component_get_capabilities(rac_handle_t handle);
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @brief Get service information
|
|
226
|
+
*
|
|
227
|
+
* @param handle Component handle
|
|
228
|
+
* @param out_info Output: Service information
|
|
229
|
+
* @return RAC_SUCCESS or error code
|
|
230
|
+
*/
|
|
231
|
+
RAC_API rac_result_t rac_diffusion_component_get_info(rac_handle_t handle,
|
|
232
|
+
rac_diffusion_info_t* out_info);
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @brief Get lifecycle state
|
|
236
|
+
*
|
|
237
|
+
* @param handle Component handle
|
|
238
|
+
* @return Current lifecycle state
|
|
239
|
+
*/
|
|
240
|
+
RAC_API rac_lifecycle_state_t rac_diffusion_component_get_state(rac_handle_t handle);
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @brief Get lifecycle metrics
|
|
244
|
+
*
|
|
245
|
+
* @param handle Component handle
|
|
246
|
+
* @param out_metrics Output: Lifecycle metrics
|
|
247
|
+
* @return RAC_SUCCESS or error code
|
|
248
|
+
*/
|
|
249
|
+
RAC_API rac_result_t rac_diffusion_component_get_metrics(rac_handle_t handle,
|
|
250
|
+
rac_lifecycle_metrics_t* out_metrics);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* @brief Destroy the diffusion component
|
|
254
|
+
*
|
|
255
|
+
* @param handle Component handle
|
|
256
|
+
*/
|
|
257
|
+
RAC_API void rac_diffusion_component_destroy(rac_handle_t handle);
|
|
258
|
+
|
|
259
|
+
#ifdef __cplusplus
|
|
260
|
+
}
|
|
261
|
+
#endif
|
|
262
|
+
|
|
263
|
+
#endif /* RAC_DIFFUSION_COMPONENT_H */
|