cactus-react-native 1.4.0 → 1.7.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/Cactus.podspec +1 -1
- package/README.md +465 -174
- package/android/CMakeLists.txt +24 -5
- package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcurl.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedcrypto.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedtls.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedx509.a +0 -0
- package/cpp/HybridCactus.cpp +157 -6
- package/cpp/HybridCactus.hpp +20 -3
- package/cpp/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +357 -122
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +184 -63
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gemma_tools.h +549 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +153 -27
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +90 -178
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +276 -151
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +357 -122
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +184 -63
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/gemma_tools.h +549 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +153 -27
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +90 -178
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +276 -151
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/lib/module/classes/CactusLM.js +43 -58
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +64 -38
- package/lib/module/classes/CactusSTT.js.map +1 -1
- package/lib/module/classes/CactusVAD.js +95 -0
- package/lib/module/classes/CactusVAD.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +23 -15
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +85 -28
- package/lib/module/hooks/useCactusSTT.js.map +1 -1
- package/lib/module/hooks/useCactusVAD.js +171 -0
- package/lib/module/hooks/useCactusVAD.js.map +1 -0
- package/lib/module/index.js +2 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/modelRegistry.js +52 -0
- package/lib/module/modelRegistry.js.map +1 -0
- package/lib/module/native/Cactus.js +107 -8
- package/lib/module/native/Cactus.js.map +1 -1
- package/lib/module/native/CactusIndex.js.map +1 -1
- package/lib/module/native/index.js +0 -3
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/types/CactusLM.js +2 -0
- package/lib/module/types/CactusSTT.js +2 -0
- package/lib/module/types/CactusVAD.js +4 -0
- package/lib/module/types/{CactusModel.js.map → CactusVAD.js.map} +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/{CactusSTTModel.js.map → common.js.map} +1 -1
- package/lib/typescript/src/classes/CactusLM.d.ts +8 -6
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +11 -6
- package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusVAD.d.ts +20 -0
- package/lib/typescript/src/classes/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +3 -3
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +11 -5
- package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusVAD.d.ts +15 -0
- package/lib/typescript/src/hooks/useCactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modelRegistry.d.ts +5 -0
- package/lib/typescript/src/modelRegistry.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +12 -6
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +0 -3
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +6 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusLM.d.ts +19 -9
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +45 -4
- package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusVAD.d.ts +34 -0
- package/lib/typescript/src/types/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/types/common.d.ts +23 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/nitro.json +0 -11
- package/nitrogen/generated/android/cactus+autolinking.cmake +0 -5
- package/nitrogen/generated/android/cactusOnLoad.cpp +0 -30
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +0 -50
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +9 -147
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +0 -13
- package/nitrogen/generated/ios/CactusAutolinking.mm +0 -26
- package/nitrogen/generated/ios/CactusAutolinking.swift +0 -30
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +5 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +6 -1
- package/package.json +3 -3
- package/src/classes/CactusLM.ts +59 -74
- package/src/classes/CactusSTT.ts +92 -49
- package/src/classes/CactusVAD.ts +129 -0
- package/src/hooks/useCactusLM.ts +26 -9
- package/src/hooks/useCactusSTT.ts +105 -44
- package/src/hooks/useCactusVAD.ts +215 -0
- package/src/index.tsx +20 -10
- package/src/modelRegistry.ts +65 -0
- package/src/native/Cactus.ts +130 -14
- package/src/native/CactusIndex.ts +2 -2
- package/src/native/index.ts +0 -3
- package/src/specs/Cactus.nitro.ts +11 -2
- package/src/types/CactusIndex.ts +2 -2
- package/src/types/CactusLM.ts +20 -9
- package/src/types/CactusSTT.ts +50 -4
- package/src/types/CactusVAD.ts +39 -0
- package/src/types/common.ts +23 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +0 -46
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +0 -27
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
- package/cpp/HybridCactusUtil.cpp +0 -47
- package/cpp/HybridCactusUtil.hpp +0 -27
- package/cpp/cactus_util.h +0 -25
- package/ios/HybridCactusCrypto.swift +0 -37
- package/ios/HybridCactusDeviceInfo.swift +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus_util.xcframework/Info.plist +0 -39
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +0 -135
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +0 -137
- package/lib/module/api/Database.js.map +0 -1
- package/lib/module/api/RemoteLM.js +0 -201
- package/lib/module/api/RemoteLM.js.map +0 -1
- package/lib/module/config/CactusConfig.js +0 -12
- package/lib/module/config/CactusConfig.js.map +0 -1
- package/lib/module/native/CactusCrypto.js +0 -10
- package/lib/module/native/CactusCrypto.js.map +0 -1
- package/lib/module/native/CactusDeviceInfo.js +0 -13
- package/lib/module/native/CactusDeviceInfo.js.map +0 -1
- package/lib/module/native/CactusUtil.js +0 -36
- package/lib/module/native/CactusUtil.js.map +0 -1
- package/lib/module/specs/CactusCrypto.nitro.js +0 -4
- package/lib/module/specs/CactusCrypto.nitro.js.map +0 -1
- package/lib/module/specs/CactusDeviceInfo.nitro.js +0 -4
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +0 -1
- package/lib/module/specs/CactusUtil.nitro.js +0 -4
- package/lib/module/specs/CactusUtil.nitro.js.map +0 -1
- package/lib/module/telemetry/Telemetry.js +0 -154
- package/lib/module/telemetry/Telemetry.js.map +0 -1
- package/lib/module/types/CactusModel.js +0 -2
- package/lib/module/types/CactusSTTModel.js +0 -2
- package/lib/typescript/src/api/Database.d.ts +0 -18
- package/lib/typescript/src/api/Database.d.ts.map +0 -1
- package/lib/typescript/src/api/RemoteLM.d.ts +0 -14
- package/lib/typescript/src/api/RemoteLM.d.ts.map +0 -1
- package/lib/typescript/src/config/CactusConfig.d.ts +0 -7
- package/lib/typescript/src/config/CactusConfig.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusCrypto.d.ts +0 -5
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +0 -7
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusUtil.d.ts +0 -6
- package/lib/typescript/src/native/CactusUtil.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +0 -8
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +0 -16
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +0 -10
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +0 -1
- package/lib/typescript/src/telemetry/Telemetry.d.ts +0 -34
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +0 -1
- package/lib/typescript/src/types/CactusModel.d.ts +0 -13
- package/lib/typescript/src/types/CactusModel.d.ts.map +0 -1
- package/lib/typescript/src/types/CactusSTTModel.d.ts +0 -8
- package/lib/typescript/src/types/CactusSTTModel.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +0 -74
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +0 -85
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +0 -66
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +0 -58
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +0 -62
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +0 -77
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +0 -88
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +0 -98
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -54
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +0 -57
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +0 -139
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +0 -164
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +0 -92
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +0 -21
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +0 -63
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +0 -22
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +0 -67
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +0 -66
- package/src/api/Database.ts +0 -188
- package/src/api/RemoteLM.ts +0 -273
- package/src/config/CactusConfig.ts +0 -11
- package/src/native/CactusCrypto.ts +0 -11
- package/src/native/CactusDeviceInfo.ts +0 -18
- package/src/native/CactusUtil.ts +0 -43
- package/src/specs/CactusCrypto.nitro.ts +0 -6
- package/src/specs/CactusDeviceInfo.nitro.ts +0 -15
- package/src/specs/CactusUtil.nitro.ts +0 -8
- package/src/telemetry/Telemetry.ts +0 -236
- package/src/types/CactusModel.ts +0 -15
- package/src/types/CactusSTTModel.ts +0 -10
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// DeviceInfo.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
-
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
-
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
-
#else
|
|
18
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
-
#endif
|
|
20
|
-
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
-
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
-
#else
|
|
23
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
-
#endif
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
#include <string>
|
|
29
|
-
#include <optional>
|
|
30
|
-
|
|
31
|
-
namespace margelo::nitro::cactus {
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A struct which can be represented as a JavaScript object (DeviceInfo).
|
|
35
|
-
*/
|
|
36
|
-
struct DeviceInfo {
|
|
37
|
-
public:
|
|
38
|
-
std::string brand SWIFT_PRIVATE;
|
|
39
|
-
std::string model SWIFT_PRIVATE;
|
|
40
|
-
std::optional<std::string> device_id SWIFT_PRIVATE;
|
|
41
|
-
std::string os SWIFT_PRIVATE;
|
|
42
|
-
std::string os_version SWIFT_PRIVATE;
|
|
43
|
-
|
|
44
|
-
public:
|
|
45
|
-
DeviceInfo() = default;
|
|
46
|
-
explicit DeviceInfo(std::string brand, std::string model, std::optional<std::string> device_id, std::string os, std::string os_version): brand(brand), model(model), device_id(device_id), os(os), os_version(os_version) {}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
} // namespace margelo::nitro::cactus
|
|
50
|
-
|
|
51
|
-
namespace margelo::nitro {
|
|
52
|
-
|
|
53
|
-
// C++ DeviceInfo <> JS DeviceInfo (object)
|
|
54
|
-
template <>
|
|
55
|
-
struct JSIConverter<margelo::nitro::cactus::DeviceInfo> final {
|
|
56
|
-
static inline margelo::nitro::cactus::DeviceInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
57
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
58
|
-
return margelo::nitro::cactus::DeviceInfo(
|
|
59
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "brand")),
|
|
60
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "model")),
|
|
61
|
-
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "device_id")),
|
|
62
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "os")),
|
|
63
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "os_version"))
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::cactus::DeviceInfo& arg) {
|
|
67
|
-
jsi::Object obj(runtime);
|
|
68
|
-
obj.setProperty(runtime, "brand", JSIConverter<std::string>::toJSI(runtime, arg.brand));
|
|
69
|
-
obj.setProperty(runtime, "model", JSIConverter<std::string>::toJSI(runtime, arg.model));
|
|
70
|
-
obj.setProperty(runtime, "device_id", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.device_id));
|
|
71
|
-
obj.setProperty(runtime, "os", JSIConverter<std::string>::toJSI(runtime, arg.os));
|
|
72
|
-
obj.setProperty(runtime, "os_version", JSIConverter<std::string>::toJSI(runtime, arg.os_version));
|
|
73
|
-
return obj;
|
|
74
|
-
}
|
|
75
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
76
|
-
if (!value.isObject()) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
jsi::Object obj = value.getObject(runtime);
|
|
80
|
-
if (!nitro::isPlainObject(runtime, obj)) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "brand"))) return false;
|
|
84
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "model"))) return false;
|
|
85
|
-
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "device_id"))) return false;
|
|
86
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "os"))) return false;
|
|
87
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "os_version"))) return false;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
} // namespace margelo::nitro
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridCactusCryptoSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::cactus {
|
|
11
|
-
|
|
12
|
-
void HybridCactusCryptoSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("uuidv5", &HybridCactusCryptoSpec::uuidv5);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
-
#include <NitroModules/HybridObject.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#include <string>
|
|
19
|
-
#include <NitroModules/Promise.hpp>
|
|
20
|
-
|
|
21
|
-
namespace margelo::nitro::cactus {
|
|
22
|
-
|
|
23
|
-
using namespace margelo::nitro;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* An abstract base class for `CactusCrypto`
|
|
27
|
-
* Inherit this class to create instances of `HybridCactusCryptoSpec` in C++.
|
|
28
|
-
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
29
|
-
* @example
|
|
30
|
-
* ```cpp
|
|
31
|
-
* class HybridCactusCrypto: public HybridCactusCryptoSpec {
|
|
32
|
-
* public:
|
|
33
|
-
* HybridCactusCrypto(...): HybridObject(TAG) { ... }
|
|
34
|
-
* // ...
|
|
35
|
-
* };
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
class HybridCactusCryptoSpec: public virtual HybridObject {
|
|
39
|
-
public:
|
|
40
|
-
// Constructor
|
|
41
|
-
explicit HybridCactusCryptoSpec(): HybridObject(TAG) { }
|
|
42
|
-
|
|
43
|
-
// Destructor
|
|
44
|
-
~HybridCactusCryptoSpec() override = default;
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
// Properties
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
public:
|
|
51
|
-
// Methods
|
|
52
|
-
virtual std::shared_ptr<Promise<std::string>> uuidv5(const std::string& namespaceUuid, const std::string& name) = 0;
|
|
53
|
-
|
|
54
|
-
protected:
|
|
55
|
-
// Hybrid Setup
|
|
56
|
-
void loadHybridMethods() override;
|
|
57
|
-
|
|
58
|
-
protected:
|
|
59
|
-
// Tag for logging
|
|
60
|
-
static constexpr auto TAG = "CactusCrypto";
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridCactusDeviceInfoSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::cactus {
|
|
11
|
-
|
|
12
|
-
void HybridCactusDeviceInfoSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("getAppIdentifier", &HybridCactusDeviceInfoSpec::getAppIdentifier);
|
|
18
|
-
prototype.registerHybridMethod("getDeviceInfo", &HybridCactusDeviceInfoSpec::getDeviceInfo);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
-
#include <NitroModules/HybridObject.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
// Forward declaration of `DeviceInfo` to properly resolve imports.
|
|
17
|
-
namespace margelo::nitro::cactus { struct DeviceInfo; }
|
|
18
|
-
|
|
19
|
-
#include <string>
|
|
20
|
-
#include <optional>
|
|
21
|
-
#include <NitroModules/Promise.hpp>
|
|
22
|
-
#include "DeviceInfo.hpp"
|
|
23
|
-
|
|
24
|
-
namespace margelo::nitro::cactus {
|
|
25
|
-
|
|
26
|
-
using namespace margelo::nitro;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* An abstract base class for `CactusDeviceInfo`
|
|
30
|
-
* Inherit this class to create instances of `HybridCactusDeviceInfoSpec` in C++.
|
|
31
|
-
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
32
|
-
* @example
|
|
33
|
-
* ```cpp
|
|
34
|
-
* class HybridCactusDeviceInfo: public HybridCactusDeviceInfoSpec {
|
|
35
|
-
* public:
|
|
36
|
-
* HybridCactusDeviceInfo(...): HybridObject(TAG) { ... }
|
|
37
|
-
* // ...
|
|
38
|
-
* };
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
class HybridCactusDeviceInfoSpec: public virtual HybridObject {
|
|
42
|
-
public:
|
|
43
|
-
// Constructor
|
|
44
|
-
explicit HybridCactusDeviceInfoSpec(): HybridObject(TAG) { }
|
|
45
|
-
|
|
46
|
-
// Destructor
|
|
47
|
-
~HybridCactusDeviceInfoSpec() override = default;
|
|
48
|
-
|
|
49
|
-
public:
|
|
50
|
-
// Properties
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
public:
|
|
54
|
-
// Methods
|
|
55
|
-
virtual std::shared_ptr<Promise<std::optional<std::string>>> getAppIdentifier() = 0;
|
|
56
|
-
virtual std::shared_ptr<Promise<DeviceInfo>> getDeviceInfo() = 0;
|
|
57
|
-
|
|
58
|
-
protected:
|
|
59
|
-
// Hybrid Setup
|
|
60
|
-
void loadHybridMethods() override;
|
|
61
|
-
|
|
62
|
-
protected:
|
|
63
|
-
// Tag for logging
|
|
64
|
-
static constexpr auto TAG = "CactusDeviceInfo";
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusUtilSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridCactusUtilSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::cactus {
|
|
11
|
-
|
|
12
|
-
void HybridCactusUtilSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("registerApp", &HybridCactusUtilSpec::registerApp);
|
|
18
|
-
prototype.registerHybridMethod("getDeviceId", &HybridCactusUtilSpec::getDeviceId);
|
|
19
|
-
prototype.registerHybridMethod("setAndroidDataDirectory", &HybridCactusUtilSpec::setAndroidDataDirectory);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusUtilSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
-
#include <NitroModules/HybridObject.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
#include <string>
|
|
19
|
-
#include <NitroModules/Promise.hpp>
|
|
20
|
-
#include <optional>
|
|
21
|
-
|
|
22
|
-
namespace margelo::nitro::cactus {
|
|
23
|
-
|
|
24
|
-
using namespace margelo::nitro;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* An abstract base class for `CactusUtil`
|
|
28
|
-
* Inherit this class to create instances of `HybridCactusUtilSpec` in C++.
|
|
29
|
-
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
30
|
-
* @example
|
|
31
|
-
* ```cpp
|
|
32
|
-
* class HybridCactusUtil: public HybridCactusUtilSpec {
|
|
33
|
-
* public:
|
|
34
|
-
* HybridCactusUtil(...): HybridObject(TAG) { ... }
|
|
35
|
-
* // ...
|
|
36
|
-
* };
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
class HybridCactusUtilSpec: public virtual HybridObject {
|
|
40
|
-
public:
|
|
41
|
-
// Constructor
|
|
42
|
-
explicit HybridCactusUtilSpec(): HybridObject(TAG) { }
|
|
43
|
-
|
|
44
|
-
// Destructor
|
|
45
|
-
~HybridCactusUtilSpec() override = default;
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
// Properties
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
// Methods
|
|
53
|
-
virtual std::shared_ptr<Promise<std::string>> registerApp(const std::string& encryptedData) = 0;
|
|
54
|
-
virtual std::shared_ptr<Promise<std::optional<std::string>>> getDeviceId(const std::optional<std::string>& token) = 0;
|
|
55
|
-
virtual std::shared_ptr<Promise<void>> setAndroidDataDirectory(const std::string& dataDir) = 0;
|
|
56
|
-
|
|
57
|
-
protected:
|
|
58
|
-
// Hybrid Setup
|
|
59
|
-
void loadHybridMethods() override;
|
|
60
|
-
|
|
61
|
-
protected:
|
|
62
|
-
// Tag for logging
|
|
63
|
-
static constexpr auto TAG = "CactusUtil";
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
} // namespace margelo::nitro::cactus
|
package/src/api/Database.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { CactusUtil } from '../native';
|
|
2
|
-
import type { DeviceInfo } from '../specs/CactusDeviceInfo.nitro';
|
|
3
|
-
import type { LogRecord } from '../telemetry/Telemetry';
|
|
4
|
-
import { packageVersion } from '../constants/packageVersion';
|
|
5
|
-
import type { CactusModel } from '../types/CactusModel';
|
|
6
|
-
import type { CactusSTTModel } from '../types/CactusSTTModel';
|
|
7
|
-
import { CactusConfig } from '../config/CactusConfig';
|
|
8
|
-
|
|
9
|
-
interface CactusModelResponse {
|
|
10
|
-
name: string;
|
|
11
|
-
slug: string;
|
|
12
|
-
quantization: number;
|
|
13
|
-
size_mb: number;
|
|
14
|
-
download_url: string;
|
|
15
|
-
supports_tool_calling: boolean;
|
|
16
|
-
supports_vision: boolean;
|
|
17
|
-
supports_completion: boolean;
|
|
18
|
-
created_at: Date;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface CactusSTTModelResponse {
|
|
22
|
-
slug: string;
|
|
23
|
-
download_url: string;
|
|
24
|
-
size_mb: number;
|
|
25
|
-
created_at: Date;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export class Database {
|
|
29
|
-
private static readonly url = 'https://vlqqczxwyaodtcdmdmlw.supabase.co';
|
|
30
|
-
private static readonly key =
|
|
31
|
-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZscXFjenh3eWFvZHRjZG1kbWx3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTE1MTg2MzIsImV4cCI6MjA2NzA5NDYzMn0.nBzqGuK9j6RZ6mOPWU2boAC_5H9XDs-fPpo5P3WZYbI';
|
|
32
|
-
|
|
33
|
-
public static async sendLogRecords(records: LogRecord[]): Promise<void> {
|
|
34
|
-
const response = await fetch(`${this.url}/rest/v1/logs`, {
|
|
35
|
-
method: 'POST',
|
|
36
|
-
headers: {
|
|
37
|
-
'apikey': this.key,
|
|
38
|
-
'Authorization': `Bearer ${this.key}`,
|
|
39
|
-
'Content-Type': 'application/json',
|
|
40
|
-
'Content-Profile': 'cactus',
|
|
41
|
-
'Prefer': 'return=minimal',
|
|
42
|
-
},
|
|
43
|
-
body: JSON.stringify(records),
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (!response.ok) {
|
|
47
|
-
throw new Error('Sending logs failed');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public static async registerDevice({
|
|
52
|
-
deviceData,
|
|
53
|
-
deviceId,
|
|
54
|
-
}: {
|
|
55
|
-
deviceData?: DeviceInfo;
|
|
56
|
-
deviceId?: string;
|
|
57
|
-
}): Promise<string> {
|
|
58
|
-
const response = await fetch(
|
|
59
|
-
`${this.url}/functions/v1/device-registration`,
|
|
60
|
-
{
|
|
61
|
-
method: 'POST',
|
|
62
|
-
body: JSON.stringify({
|
|
63
|
-
device_data: deviceData,
|
|
64
|
-
device_id: deviceId,
|
|
65
|
-
cactus_pro_key: CactusConfig.cactusProKey,
|
|
66
|
-
}),
|
|
67
|
-
headers: { 'Content-Type': 'application/json' },
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
if (!response.ok) {
|
|
72
|
-
throw new Error('Registering device failed');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return await CactusUtil.registerApp(await response.text());
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public static async getModel(slug: string): Promise<CactusModel> {
|
|
79
|
-
const response = await fetch(
|
|
80
|
-
`${this.url}/functions/v1/get-models?slug=${slug}&sdk_name=react&sdk_version=${packageVersion}`,
|
|
81
|
-
{
|
|
82
|
-
headers: { apikey: this.key, Authorization: `Bearer ${this.key}` },
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
throw new Error('Getting model failed');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const model = (await response.json()) as CactusModelResponse;
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
name: model.name,
|
|
94
|
-
slug: model.slug,
|
|
95
|
-
quantization: model.quantization,
|
|
96
|
-
sizeMb: model.size_mb,
|
|
97
|
-
downloadUrl: model.download_url,
|
|
98
|
-
supportsToolCalling: model.supports_tool_calling,
|
|
99
|
-
supportsVision: model.supports_vision,
|
|
100
|
-
supportsCompletion: model.supports_completion,
|
|
101
|
-
createdAt: model.created_at,
|
|
102
|
-
isDownloaded: false,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public static async getSTTModel(slug: string): Promise<CactusSTTModel> {
|
|
107
|
-
const response = await fetch(
|
|
108
|
-
`${this.url}/rest/v1/whisper?slug=eq.${slug}&select=*`,
|
|
109
|
-
{
|
|
110
|
-
headers: {
|
|
111
|
-
'apikey': this.key,
|
|
112
|
-
'Authorization': `Bearer ${this.key}`,
|
|
113
|
-
'Accept-Profile': 'cactus',
|
|
114
|
-
},
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
if (!response.ok) {
|
|
119
|
-
throw new Error('Getting STT model failed');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const [model] = (await response.json()) as CactusSTTModelResponse[];
|
|
123
|
-
|
|
124
|
-
if (!model) {
|
|
125
|
-
throw new Error(`STT model with slug "${slug}" not found`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
slug: model.slug,
|
|
130
|
-
downloadUrl: model.download_url,
|
|
131
|
-
sizeMb: model.size_mb,
|
|
132
|
-
createdAt: model.created_at,
|
|
133
|
-
isDownloaded: false,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
public static async getModels(): Promise<CactusModel[]> {
|
|
138
|
-
const response = await fetch(
|
|
139
|
-
`${this.url}/functions/v1/get-models?sdk_name=react&sdk_version=${packageVersion}`,
|
|
140
|
-
{
|
|
141
|
-
headers: { apikey: this.key, Authorization: `Bearer ${this.key}` },
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
if (!response.ok) {
|
|
146
|
-
throw new Error('Getting models failed');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const models = (await response.json()) as CactusModelResponse[];
|
|
150
|
-
|
|
151
|
-
return models.map((model) => ({
|
|
152
|
-
name: model.name,
|
|
153
|
-
slug: model.slug,
|
|
154
|
-
quantization: model.quantization,
|
|
155
|
-
sizeMb: model.size_mb,
|
|
156
|
-
downloadUrl: model.download_url,
|
|
157
|
-
supportsToolCalling: model.supports_tool_calling,
|
|
158
|
-
supportsVision: model.supports_vision,
|
|
159
|
-
supportsCompletion: model.supports_completion,
|
|
160
|
-
createdAt: model.created_at,
|
|
161
|
-
isDownloaded: false,
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public static async getSTTModels(): Promise<CactusSTTModel[]> {
|
|
166
|
-
const response = await fetch(`${this.url}/rest/v1/whisper?select=*`, {
|
|
167
|
-
headers: {
|
|
168
|
-
'apikey': this.key,
|
|
169
|
-
'Authorization': `Bearer ${this.key}`,
|
|
170
|
-
'Accept-Profile': 'cactus',
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
if (!response.ok) {
|
|
175
|
-
throw new Error('Getting STT models failed');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const models = (await response.json()) as CactusSTTModelResponse[];
|
|
179
|
-
|
|
180
|
-
return models.map((model) => ({
|
|
181
|
-
slug: model.slug,
|
|
182
|
-
downloadUrl: model.download_url,
|
|
183
|
-
sizeMb: model.size_mb,
|
|
184
|
-
createdAt: model.created_at,
|
|
185
|
-
isDownloaded: false,
|
|
186
|
-
}));
|
|
187
|
-
}
|
|
188
|
-
}
|