cactus-react-native 0.2.11 → 1.0.1
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 +34 -0
- package/LICENSE +38 -0
- package/README.md +354 -69
- package/android/CMakeLists.txt +40 -0
- package/android/build.gradle +68 -44
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/cactus/CactusPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +24 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +227 -0
- package/android/src/main/jniLibs/arm64-v8a/{libcactus_v8_2_dotprod.so → libcactus.a} +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.so +0 -0
- package/cpp/HybridCactus.cpp +123 -0
- package/cpp/HybridCactus.hpp +35 -0
- package/cpp/HybridCactusUtil.cpp +45 -0
- package/cpp/HybridCactusUtil.hpp +26 -0
- package/cpp/cactus_ffi.h +55 -0
- package/cpp/cactus_util.h +25 -0
- package/ios/HybridCactusCrypto.swift +37 -0
- package/ios/HybridCactusDeviceInfo.swift +32 -0
- package/ios/HybridCactusFileSystem.swift +234 -0
- package/ios/cactus.xcframework/{info.plist → Info.plist} +2 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +8 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +28 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +11 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +55 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/{tvos-arm64_x86_64-simulator → ios-arm64-simulator}/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus_util.xcframework/Info.plist +39 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +25 -0
- 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 +25 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +25 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/Info.plist +0 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/_CodeSignature/CodeResources +36 -2
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +60 -0
- package/lib/module/api/Database.js.map +1 -0
- package/lib/module/classes/CactusLM.js +149 -0
- package/lib/module/classes/CactusLM.js.map +1 -0
- package/lib/module/config/CactusConfig.js +6 -0
- package/lib/module/config/CactusConfig.js.map +1 -0
- package/lib/module/constants/packageVersion.js +4 -0
- package/lib/module/constants/packageVersion.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +233 -0
- package/lib/module/hooks/useCactusLM.js.map +1 -0
- package/lib/module/index.js +9 -409
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Cactus.js +50 -0
- package/lib/module/native/Cactus.js.map +1 -0
- package/lib/module/native/CactusCrypto.js +10 -0
- package/lib/module/native/CactusCrypto.js.map +1 -0
- package/lib/module/native/CactusDeviceInfo.js +13 -0
- package/lib/module/native/CactusDeviceInfo.js.map +1 -0
- package/lib/module/native/CactusFileSystem.js +35 -0
- package/lib/module/native/CactusFileSystem.js.map +1 -0
- package/lib/module/native/CactusUtil.js +23 -0
- package/lib/module/native/CactusUtil.js.map +1 -0
- package/lib/module/native/index.js +8 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/specs/Cactus.nitro.js +4 -0
- package/lib/module/specs/Cactus.nitro.js.map +1 -0
- package/lib/module/specs/CactusCrypto.nitro.js +4 -0
- package/lib/module/specs/CactusCrypto.nitro.js.map +1 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js +4 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +1 -0
- package/lib/module/specs/CactusFileSystem.nitro.js +4 -0
- package/lib/module/specs/CactusFileSystem.nitro.js.map +1 -0
- package/lib/module/specs/CactusUtil.nitro.js +4 -0
- package/lib/module/specs/CactusUtil.nitro.js.map +1 -0
- package/lib/module/telemetry/Telemetry.js +100 -0
- package/lib/module/telemetry/Telemetry.js.map +1 -0
- package/lib/module/types/CactusLM.js +2 -0
- package/lib/module/types/CactusLM.js.map +1 -0
- package/lib/module/types/CactusModel.js +2 -0
- package/lib/module/types/CactusModel.js.map +1 -0
- package/lib/module/utils/error.js +4 -0
- package/lib/module/utils/error.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/api/Database.d.ts +11 -0
- package/lib/typescript/src/api/Database.d.ts.map +1 -0
- package/lib/typescript/src/classes/CactusLM.d.ts +25 -0
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts +5 -0
- package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -0
- package/lib/typescript/src/constants/packageVersion.d.ts +2 -0
- package/lib/typescript/src/constants/packageVersion.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +20 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +11 -0
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts +5 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +7 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts +13 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusUtil.d.ts +6 -0
- package/lib/typescript/src/native/CactusUtil.d.ts.map +1 -0
- package/lib/typescript/src/native/index.d.ts +6 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +13 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +8 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +1 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts +30 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusLM.d.ts +65 -0
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusModel.d.ts +12 -0
- package/lib/typescript/src/types/CactusModel.d.ts.map +1 -0
- package/lib/typescript/src/utils/error.d.ts +2 -0
- package/lib/typescript/src/utils/error.d.ts.map +1 -0
- package/nitro.json +31 -0
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +74 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +85 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.cpp +192 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/android/cactus+autolinking.cmake +87 -0
- package/nitrogen/generated/android/cactus+autolinking.gradle +27 -0
- package/nitrogen/generated/android/cactusOnLoad.cpp +86 -0
- package/nitrogen/generated/android/cactusOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt +95 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/cactusOnLoad.kt +35 -0
- package/nitrogen/generated/ios/Cactus+autolinking.rb +60 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +122 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +373 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/CactusAutolinking.mm +69 -0
- package/nitrogen/generated/ios/CactusAutolinking.swift +55 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +77 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +88 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.hpp +143 -0
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +98 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +139 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec_cxx.swift +303 -0
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +92 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +66 -0
- package/package.json +84 -143
- package/src/api/Database.ts +83 -0
- package/src/classes/CactusLM.ts +203 -0
- package/src/config/CactusConfig.ts +4 -0
- package/src/constants/packageVersion.ts +1 -0
- package/src/hooks/useCactusLM.ts +282 -0
- package/src/index.tsx +23 -0
- package/src/native/Cactus.ts +79 -0
- package/src/native/CactusCrypto.ts +11 -0
- package/src/native/CactusDeviceInfo.ts +18 -0
- package/src/native/CactusFileSystem.ts +47 -0
- package/src/native/CactusUtil.ts +27 -0
- package/src/native/index.ts +5 -0
- package/src/specs/Cactus.nitro.ts +16 -0
- package/src/specs/CactusCrypto.nitro.ts +6 -0
- package/src/specs/CactusDeviceInfo.nitro.ts +15 -0
- package/src/specs/CactusFileSystem.nitro.ts +21 -0
- package/src/specs/CactusUtil.nitro.ts +8 -0
- package/src/telemetry/Telemetry.ts +159 -0
- package/src/types/CactusLM.ts +71 -0
- package/src/types/CactusModel.ts +14 -0
- package/src/utils/error.ts +2 -0
- package/LICENSE.txt +0 -20
- package/android/src/main/CMakeLists.txt +0 -140
- package/android/src/main/java/com/cactus/Cactus.java +0 -1190
- package/android/src/main/java/com/cactus/CactusPackage.java +0 -48
- package/android/src/main/java/com/cactus/LlamaContext.java +0 -748
- package/android/src/main/jni-utils.h +0 -100
- package/android/src/main/jni.cpp +0 -1605
- package/android/src/main/jniLibs/arm64-v8a/libcactus.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_dotprod_i8mm.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_i8mm.so +0 -0
- package/android/src/newarch/java/com/cactus/CactusModule.java +0 -204
- package/android/src/oldarch/java/com/cactus/CactusModule.java +0 -205
- package/cactus-react-native.podspec +0 -42
- package/ios/CMakeLists.txt +0 -131
- package/ios/Cactus.h +0 -6
- package/ios/Cactus.mm +0 -681
- package/ios/CactusContext.h +0 -81
- package/ios/CactusContext.mm +0 -1032
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/lib/commonjs/NativeCactus.js +0 -9
- package/lib/commonjs/NativeCactus.js.map +0 -1
- package/lib/commonjs/agent.js +0 -73
- package/lib/commonjs/agent.js.map +0 -1
- package/lib/commonjs/chat.js +0 -73
- package/lib/commonjs/chat.js.map +0 -1
- package/lib/commonjs/index.js +0 -523
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/lm.js +0 -272
- package/lib/commonjs/lm.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/projectId.js +0 -9
- package/lib/commonjs/projectId.js.map +0 -1
- package/lib/commonjs/remote.js +0 -100
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/telemetry.js +0 -102
- package/lib/commonjs/telemetry.js.map +0 -1
- package/lib/commonjs/tools.js +0 -72
- package/lib/commonjs/tools.js.map +0 -1
- package/lib/commonjs/tts.js +0 -141
- package/lib/commonjs/tts.js.map +0 -1
- package/lib/commonjs/vlm.js +0 -221
- package/lib/commonjs/vlm.js.map +0 -1
- package/lib/module/NativeCactus.js +0 -5
- package/lib/module/NativeCactus.js.map +0 -1
- package/lib/module/agent.js +0 -68
- package/lib/module/agent.js.map +0 -1
- package/lib/module/chat.js +0 -67
- package/lib/module/chat.js.map +0 -1
- package/lib/module/lm.js +0 -267
- package/lib/module/lm.js.map +0 -1
- package/lib/module/projectId.js +0 -5
- package/lib/module/projectId.js.map +0 -1
- package/lib/module/remote.js +0 -91
- package/lib/module/remote.js.map +0 -1
- package/lib/module/telemetry.js +0 -97
- package/lib/module/telemetry.js.map +0 -1
- package/lib/module/tools.js +0 -66
- package/lib/module/tools.js.map +0 -1
- package/lib/module/tts.js +0 -135
- package/lib/module/tts.js.map +0 -1
- package/lib/module/vlm.js +0 -216
- package/lib/module/vlm.js.map +0 -1
- package/lib/typescript/NativeCactus.d.ts +0 -252
- package/lib/typescript/NativeCactus.d.ts.map +0 -1
- package/lib/typescript/agent.d.ts +0 -31
- package/lib/typescript/agent.d.ts.map +0 -1
- package/lib/typescript/chat.d.ts +0 -23
- package/lib/typescript/chat.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -114
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/lm.d.ts +0 -36
- package/lib/typescript/lm.d.ts.map +0 -1
- package/lib/typescript/projectId.d.ts +0 -2
- package/lib/typescript/projectId.d.ts.map +0 -1
- package/lib/typescript/remote.d.ts +0 -8
- package/lib/typescript/remote.d.ts.map +0 -1
- package/lib/typescript/telemetry.d.ts +0 -25
- package/lib/typescript/telemetry.d.ts.map +0 -1
- package/lib/typescript/tools.d.ts +0 -36
- package/lib/typescript/tools.d.ts.map +0 -1
- package/lib/typescript/tts.d.ts +0 -54
- package/lib/typescript/tts.d.ts.map +0 -1
- package/lib/typescript/vlm.d.ts +0 -33
- package/lib/typescript/vlm.d.ts.map +0 -1
- package/scripts/postInstall.js +0 -33
- package/src/NativeCactus.ts +0 -317
- package/src/agent.ts +0 -112
- package/src/chat.ts +0 -91
- package/src/index.ts +0 -663
- package/src/lm.ts +0 -324
- package/src/projectId.ts +0 -1
- package/src/remote.ts +0 -113
- package/src/telemetry.ts +0 -137
- package/src/tools.ts +0 -94
- package/src/tts.ts +0 -236
- package/src/vlm.ts +0 -276
package/lib/module/index.js
CHANGED
|
@@ -1,413 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { formatChat } from './chat';
|
|
6
|
-
import { parseAndExecuteTool } from './tools';
|
|
7
|
-
import { Telemetry } from './telemetry';
|
|
8
|
-
export * from './remote';
|
|
9
|
-
export { Tools, parseAndExecuteTool } from './tools';
|
|
10
|
-
const EVENT_ON_INIT_CONTEXT_PROGRESS = '@Cactus_onInitContextProgress';
|
|
11
|
-
const EVENT_ON_TOKEN = '@Cactus_onToken';
|
|
12
|
-
const EVENT_ON_NATIVE_LOG = '@Cactus_onNativeLog';
|
|
13
|
-
let EventEmitter;
|
|
14
|
-
if (Platform.OS === 'ios') {
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
EventEmitter = new NativeEventEmitter(Cactus);
|
|
17
|
-
}
|
|
18
|
-
if (Platform.OS === 'android') {
|
|
19
|
-
EventEmitter = DeviceEventEmitter;
|
|
20
|
-
}
|
|
21
|
-
const logListeners = [];
|
|
3
|
+
// Classes
|
|
4
|
+
export { CactusLM } from "./classes/CactusLM.js";
|
|
22
5
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
const getJsonSchema = responseFormat => {
|
|
31
|
-
if (responseFormat?.type === 'json_schema') {
|
|
32
|
-
return responseFormat.json_schema?.schema;
|
|
33
|
-
}
|
|
34
|
-
if (responseFormat?.type === 'json_object') {
|
|
35
|
-
return responseFormat.schema || {};
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
|
-
const telemetryParams = {
|
|
40
|
-
n_gpu_layers: null,
|
|
41
|
-
n_ctx: null,
|
|
42
|
-
model: null
|
|
43
|
-
};
|
|
44
|
-
export class LlamaContext {
|
|
45
|
-
gpu = false;
|
|
46
|
-
reasonNoGPU = '';
|
|
47
|
-
constructor({
|
|
48
|
-
contextId,
|
|
49
|
-
gpu,
|
|
50
|
-
reasonNoGPU,
|
|
51
|
-
model
|
|
52
|
-
}) {
|
|
53
|
-
this.id = contextId;
|
|
54
|
-
this.gpu = gpu;
|
|
55
|
-
this.reasonNoGPU = reasonNoGPU;
|
|
56
|
-
this.model = model;
|
|
57
|
-
}
|
|
58
|
-
async loadSession(filepath) {
|
|
59
|
-
let path = filepath;
|
|
60
|
-
if (path.startsWith('file://')) path = path.slice(7);
|
|
61
|
-
return Cactus.loadSession(this.id, path);
|
|
62
|
-
}
|
|
63
|
-
async saveSession(filepath, options) {
|
|
64
|
-
return Cactus.saveSession(this.id, filepath, options?.tokenSize || -1);
|
|
65
|
-
}
|
|
66
|
-
isLlamaChatSupported() {
|
|
67
|
-
return !!this.model.chatTemplates.llamaChat;
|
|
68
|
-
}
|
|
69
|
-
isJinjaSupported() {
|
|
70
|
-
const {
|
|
71
|
-
minja
|
|
72
|
-
} = this.model.chatTemplates;
|
|
73
|
-
return !!minja?.toolUse || !!minja?.default;
|
|
74
|
-
}
|
|
75
|
-
async getFormattedChat(messages, template, params) {
|
|
76
|
-
const chat = formatChat(messages);
|
|
77
|
-
const useJinja = this.isJinjaSupported() && params?.jinja;
|
|
78
|
-
let tmpl = this.isLlamaChatSupported() || useJinja ? undefined : 'chatml';
|
|
79
|
-
if (template) tmpl = template; // Force replace if provided
|
|
80
|
-
const jsonSchema = getJsonSchema(params?.response_format);
|
|
81
|
-
return Cactus.getFormattedChat(this.id, JSON.stringify(chat), tmpl, {
|
|
82
|
-
jinja: useJinja,
|
|
83
|
-
json_schema: jsonSchema ? JSON.stringify(jsonSchema) : undefined,
|
|
84
|
-
tools: params?.tools ? JSON.stringify(params.tools) : undefined,
|
|
85
|
-
parallel_tool_calls: params?.parallel_tool_calls ? JSON.stringify(params.parallel_tool_calls) : undefined,
|
|
86
|
-
tool_choice: params?.tool_choice
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
async completionWithTools(params, callback, recursionCount = 0, recursionLimit = 3) {
|
|
90
|
-
if (!params.messages) {
|
|
91
|
-
return this.completion(params, callback);
|
|
92
|
-
}
|
|
93
|
-
if (!params.tools) {
|
|
94
|
-
return this.completion(params, callback);
|
|
95
|
-
}
|
|
96
|
-
if (recursionCount >= recursionLimit) {
|
|
97
|
-
return this.completion({
|
|
98
|
-
...params,
|
|
99
|
-
jinja: true,
|
|
100
|
-
tools: params.tools.getSchemas()
|
|
101
|
-
}, callback);
|
|
102
|
-
}
|
|
103
|
-
const messages = [...params.messages];
|
|
104
|
-
const result = await this.completion({
|
|
105
|
-
...params,
|
|
106
|
-
messages: messages,
|
|
107
|
-
jinja: true,
|
|
108
|
-
tools: params.tools.getSchemas()
|
|
109
|
-
}, callback);
|
|
110
|
-
const {
|
|
111
|
-
toolCalled,
|
|
112
|
-
toolName,
|
|
113
|
-
toolInput,
|
|
114
|
-
toolOutput
|
|
115
|
-
} = await parseAndExecuteTool(result, params.tools);
|
|
116
|
-
if (toolCalled && toolName && toolInput) {
|
|
117
|
-
const assistantMessage = {
|
|
118
|
-
role: 'assistant',
|
|
119
|
-
content: result.content,
|
|
120
|
-
tool_calls: result.tool_calls
|
|
121
|
-
};
|
|
122
|
-
messages.push(assistantMessage);
|
|
123
|
-
const toolCallId = result.tool_calls?.[0]?.id;
|
|
124
|
-
const toolMessage = {
|
|
125
|
-
role: 'tool',
|
|
126
|
-
content: JSON.stringify(toolOutput),
|
|
127
|
-
tool_call_id: toolCallId
|
|
128
|
-
};
|
|
129
|
-
messages.push(toolMessage);
|
|
130
|
-
return await this.completionWithTools({
|
|
131
|
-
...params,
|
|
132
|
-
messages: messages
|
|
133
|
-
}, callback, recursionCount + 1, recursionLimit);
|
|
134
|
-
}
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
async completion(params, callback) {
|
|
138
|
-
const nativeParams = {
|
|
139
|
-
...params,
|
|
140
|
-
prompt: params.prompt || '',
|
|
141
|
-
emit_partial_completion: !!callback
|
|
142
|
-
};
|
|
143
|
-
if (params.messages) {
|
|
144
|
-
const formattedResult = await this.getFormattedChat(params.messages, params.chat_template || params.chatTemplate, {
|
|
145
|
-
jinja: params.jinja,
|
|
146
|
-
tools: params.tools,
|
|
147
|
-
parallel_tool_calls: params.parallel_tool_calls,
|
|
148
|
-
tool_choice: params.tool_choice
|
|
149
|
-
});
|
|
150
|
-
if (typeof formattedResult === 'string') {
|
|
151
|
-
nativeParams.prompt = formattedResult || '';
|
|
152
|
-
} else {
|
|
153
|
-
nativeParams.prompt = formattedResult.prompt || '';
|
|
154
|
-
if (typeof formattedResult.chat_format === 'number') nativeParams.chat_format = formattedResult.chat_format;
|
|
155
|
-
if (formattedResult.grammar) nativeParams.grammar = formattedResult.grammar;
|
|
156
|
-
if (typeof formattedResult.grammar_lazy === 'boolean') nativeParams.grammar_lazy = formattedResult.grammar_lazy;
|
|
157
|
-
if (formattedResult.grammar_triggers) nativeParams.grammar_triggers = formattedResult.grammar_triggers;
|
|
158
|
-
if (formattedResult.preserved_tokens) nativeParams.preserved_tokens = formattedResult.preserved_tokens;
|
|
159
|
-
if (formattedResult.additional_stops) {
|
|
160
|
-
if (!nativeParams.stop) nativeParams.stop = [];
|
|
161
|
-
nativeParams.stop.push(...formattedResult.additional_stops);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
nativeParams.prompt = params.prompt || '';
|
|
166
|
-
}
|
|
167
|
-
if (nativeParams.response_format && !nativeParams.grammar) {
|
|
168
|
-
const jsonSchema = getJsonSchema(params.response_format);
|
|
169
|
-
if (jsonSchema) nativeParams.json_schema = JSON.stringify(jsonSchema);
|
|
170
|
-
}
|
|
171
|
-
const startTime = Date.now();
|
|
172
|
-
let firstTokenTime = null;
|
|
173
|
-
const deviceInfo = await getDeviceInfo(this.id);
|
|
174
|
-
const wrappedCallback = callback ? data => {
|
|
175
|
-
if (firstTokenTime === null) firstTokenTime = Date.now();
|
|
176
|
-
callback(data);
|
|
177
|
-
} : undefined;
|
|
178
|
-
let tokenListener = wrappedCallback && EventEmitter.addListener(EVENT_ON_TOKEN, evt => {
|
|
179
|
-
const {
|
|
180
|
-
contextId,
|
|
181
|
-
tokenResult
|
|
182
|
-
} = evt;
|
|
183
|
-
if (contextId !== this.id) return;
|
|
184
|
-
wrappedCallback(tokenResult);
|
|
185
|
-
});
|
|
186
|
-
if (!nativeParams.prompt) throw new Error('Prompt is required');
|
|
187
|
-
const promise = Cactus.completion(this.id, nativeParams);
|
|
188
|
-
return promise.then(completionResult => {
|
|
189
|
-
Telemetry.track({
|
|
190
|
-
event: 'completion',
|
|
191
|
-
tok_per_sec: completionResult.timings?.predicted_per_second,
|
|
192
|
-
toks_generated: completionResult.timings?.predicted_n,
|
|
193
|
-
ttft: firstTokenTime ? firstTokenTime - startTime : null
|
|
194
|
-
}, telemetryParams, deviceInfo);
|
|
195
|
-
tokenListener?.remove();
|
|
196
|
-
tokenListener = null;
|
|
197
|
-
return completionResult;
|
|
198
|
-
}).catch(err => {
|
|
199
|
-
tokenListener?.remove();
|
|
200
|
-
tokenListener = null;
|
|
201
|
-
throw err;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
stopCompletion() {
|
|
205
|
-
return Cactus.stopCompletion(this.id);
|
|
206
|
-
}
|
|
207
|
-
tokenize(text) {
|
|
208
|
-
return Cactus.tokenize(this.id, text);
|
|
209
|
-
}
|
|
210
|
-
detokenize(tokens) {
|
|
211
|
-
return Cactus.detokenize(this.id, tokens);
|
|
212
|
-
}
|
|
213
|
-
async embedding(text, params) {
|
|
214
|
-
const startTime = Date.now();
|
|
215
|
-
const embeddingResult = await Cactus.embedding(this.id, text, params || {});
|
|
216
|
-
const totalTime = Date.now() - startTime;
|
|
217
|
-
const deviceInfo = await getDeviceInfo(this.id);
|
|
218
|
-
Telemetry.track({
|
|
219
|
-
event: 'embedding',
|
|
220
|
-
mode: 'local',
|
|
221
|
-
embedding_time: totalTime
|
|
222
|
-
}, telemetryParams, deviceInfo);
|
|
223
|
-
return embeddingResult;
|
|
224
|
-
}
|
|
225
|
-
async bench(pp, tg, pl, nr) {
|
|
226
|
-
const result = await Cactus.bench(this.id, pp, tg, pl, nr);
|
|
227
|
-
const [modelDesc, modelSize, modelNParams, ppAvg, ppStd, tgAvg, tgStd] = JSON.parse(result);
|
|
228
|
-
return {
|
|
229
|
-
modelDesc,
|
|
230
|
-
modelSize,
|
|
231
|
-
modelNParams,
|
|
232
|
-
ppAvg,
|
|
233
|
-
ppStd,
|
|
234
|
-
tgAvg,
|
|
235
|
-
tgStd
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
async applyLoraAdapters(loraList) {
|
|
239
|
-
let loraAdapters = [];
|
|
240
|
-
if (loraList) loraAdapters = loraList.map(l => ({
|
|
241
|
-
path: l.path.replace(/file:\/\//, ''),
|
|
242
|
-
scaled: l.scaled
|
|
243
|
-
}));
|
|
244
|
-
return Cactus.applyLoraAdapters(this.id, loraAdapters);
|
|
245
|
-
}
|
|
246
|
-
async removeLoraAdapters() {
|
|
247
|
-
return Cactus.removeLoraAdapters(this.id);
|
|
248
|
-
}
|
|
249
|
-
async getLoadedLoraAdapters() {
|
|
250
|
-
return Cactus.getLoadedLoraAdapters(this.id);
|
|
251
|
-
}
|
|
252
|
-
async release() {
|
|
253
|
-
return Cactus.releaseContext(this.id);
|
|
254
|
-
}
|
|
255
|
-
async rewind() {
|
|
256
|
-
return Cactus.rewind(this.id);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
export async function toggleNativeLog(enabled) {
|
|
260
|
-
return Cactus.toggleNativeLog(enabled);
|
|
261
|
-
}
|
|
262
|
-
export function addNativeLogListener(listener) {
|
|
263
|
-
logListeners.push(listener);
|
|
264
|
-
return {
|
|
265
|
-
remove: () => {
|
|
266
|
-
logListeners.splice(logListeners.indexOf(listener), 1);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
export async function setContextLimit(limit) {
|
|
271
|
-
return Cactus.setContextLimit(limit);
|
|
272
|
-
}
|
|
273
|
-
let contextIdCounter = 0;
|
|
274
|
-
const contextIdRandom = () => process.env.NODE_ENV === 'test' ? 0 : Math.floor(Math.random() * 100000);
|
|
275
|
-
const modelInfoSkip = [
|
|
276
|
-
// Large fields
|
|
277
|
-
'tokenizer.ggml.tokens', 'tokenizer.ggml.token_type', 'tokenizer.ggml.merges', 'tokenizer.ggml.scores'];
|
|
278
|
-
export async function loadLlamaModelInfo(model) {
|
|
279
|
-
let path = model;
|
|
280
|
-
if (path.startsWith('file://')) path = path.slice(7);
|
|
281
|
-
return Cactus.modelInfo(path, modelInfoSkip);
|
|
282
|
-
}
|
|
283
|
-
const poolTypeMap = {
|
|
284
|
-
none: 0,
|
|
285
|
-
mean: 1,
|
|
286
|
-
cls: 2,
|
|
287
|
-
last: 3,
|
|
288
|
-
rank: 4
|
|
289
|
-
};
|
|
290
|
-
export async function initLlama({
|
|
291
|
-
model,
|
|
292
|
-
is_model_asset: isModelAsset,
|
|
293
|
-
pooling_type: poolingType,
|
|
294
|
-
lora,
|
|
295
|
-
lora_list: loraList,
|
|
296
|
-
...rest
|
|
297
|
-
}, onProgress) {
|
|
298
|
-
let path = model;
|
|
299
|
-
if (path.startsWith('file://')) path = path.slice(7);
|
|
300
|
-
let loraPath = lora;
|
|
301
|
-
if (loraPath?.startsWith('file://')) loraPath = loraPath.slice(7);
|
|
302
|
-
let loraAdapters = [];
|
|
303
|
-
if (loraList) loraAdapters = loraList.map(l => ({
|
|
304
|
-
path: l.path.replace(/file:\/\//, ''),
|
|
305
|
-
scaled: l.scaled
|
|
306
|
-
}));
|
|
307
|
-
telemetryParams.n_gpu_layers = rest.n_gpu_layers || null;
|
|
308
|
-
telemetryParams.n_ctx = rest.n_ctx || null;
|
|
309
|
-
telemetryParams.model = model;
|
|
310
|
-
const contextId = contextIdCounter + contextIdRandom();
|
|
311
|
-
contextIdCounter += 1;
|
|
312
|
-
let removeProgressListener = null;
|
|
313
|
-
if (onProgress) {
|
|
314
|
-
removeProgressListener = EventEmitter.addListener(EVENT_ON_INIT_CONTEXT_PROGRESS, evt => {
|
|
315
|
-
if (evt.contextId !== contextId) return;
|
|
316
|
-
onProgress(evt.progress);
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
const poolType = poolTypeMap[poolingType];
|
|
320
|
-
const {
|
|
321
|
-
gpu,
|
|
322
|
-
reasonNoGPU,
|
|
323
|
-
model: modelDetails,
|
|
324
|
-
androidLib
|
|
325
|
-
} = await Cactus.initContext(contextId, {
|
|
326
|
-
model: path,
|
|
327
|
-
is_model_asset: !!isModelAsset,
|
|
328
|
-
use_progress_callback: !!onProgress,
|
|
329
|
-
pooling_type: poolType,
|
|
330
|
-
lora: loraPath,
|
|
331
|
-
lora_list: loraAdapters,
|
|
332
|
-
...rest
|
|
333
|
-
}).catch(err => {
|
|
334
|
-
removeProgressListener?.remove();
|
|
335
|
-
throw err;
|
|
336
|
-
});
|
|
337
|
-
removeProgressListener?.remove();
|
|
338
|
-
return new LlamaContext({
|
|
339
|
-
contextId,
|
|
340
|
-
gpu,
|
|
341
|
-
reasonNoGPU,
|
|
342
|
-
model: modelDetails,
|
|
343
|
-
androidLib
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
export async function releaseAllLlama() {
|
|
347
|
-
return Cactus.releaseAllContexts();
|
|
348
|
-
}
|
|
349
|
-
export const initContext = async params => {
|
|
350
|
-
return await Cactus.initContext(contextIdCounter++, params);
|
|
351
|
-
};
|
|
352
|
-
export const initMultimodal = async (contextId, mmprojPath, useGpu = false) => {
|
|
353
|
-
return await Cactus.initMultimodal(contextId, mmprojPath, useGpu);
|
|
354
|
-
};
|
|
355
|
-
export const isMultimodalEnabled = async contextId => {
|
|
356
|
-
return await Cactus.isMultimodalEnabled(contextId);
|
|
357
|
-
};
|
|
358
|
-
export const isMultimodalSupportVision = async contextId => {
|
|
359
|
-
return await Cactus.isMultimodalSupportVision(contextId);
|
|
360
|
-
};
|
|
361
|
-
export const isMultimodalSupportAudio = async contextId => {
|
|
362
|
-
return await Cactus.isMultimodalSupportAudio(contextId);
|
|
363
|
-
};
|
|
364
|
-
export const releaseMultimodal = async contextId => {
|
|
365
|
-
return await Cactus.releaseMultimodal(contextId);
|
|
366
|
-
};
|
|
367
|
-
export const multimodalCompletion = async (contextId, prompt, mediaPaths, params) => {
|
|
368
|
-
const result = await Cactus.multimodalCompletion(contextId, prompt, mediaPaths, params);
|
|
369
|
-
const deviceInfo = await getDeviceInfo(contextId);
|
|
370
|
-
Telemetry.track({
|
|
371
|
-
event: 'completion',
|
|
372
|
-
tok_per_sec: result.timings?.predicted_per_second,
|
|
373
|
-
toks_generated: result.timings?.predicted_n,
|
|
374
|
-
num_images: mediaPaths?.length
|
|
375
|
-
}, telemetryParams, deviceInfo);
|
|
376
|
-
return result;
|
|
377
|
-
};
|
|
378
|
-
export const initVocoder = async (contextId, vocoderModelPath) => {
|
|
379
|
-
return await Cactus.initVocoder(contextId, vocoderModelPath);
|
|
380
|
-
};
|
|
381
|
-
export const isVocoderEnabled = async contextId => {
|
|
382
|
-
return await Cactus.isVocoderEnabled(contextId);
|
|
383
|
-
};
|
|
384
|
-
export const getTTSType = async contextId => {
|
|
385
|
-
return await Cactus.getTTSType(contextId);
|
|
386
|
-
};
|
|
387
|
-
export const getFormattedAudioCompletion = async (contextId, speakerJsonStr, textToSpeak) => {
|
|
388
|
-
return await Cactus.getFormattedAudioCompletion(contextId, speakerJsonStr, textToSpeak);
|
|
389
|
-
};
|
|
390
|
-
export const getAudioCompletionGuideTokens = async (contextId, textToSpeak) => {
|
|
391
|
-
return await Cactus.getAudioCompletionGuideTokens(contextId, textToSpeak);
|
|
392
|
-
};
|
|
393
|
-
export const decodeAudioTokens = async (contextId, tokens) => {
|
|
394
|
-
return await Cactus.decodeAudioTokens(contextId, tokens);
|
|
395
|
-
};
|
|
396
|
-
export const releaseVocoder = async contextId => {
|
|
397
|
-
return await Cactus.releaseVocoder(contextId);
|
|
398
|
-
};
|
|
399
|
-
export const tokenize = async (contextId, text, mediaPaths) => {
|
|
400
|
-
if (mediaPaths && mediaPaths.length > 0) {
|
|
401
|
-
return await Cactus.tokenize(contextId, text, mediaPaths);
|
|
402
|
-
} else {
|
|
403
|
-
return await Cactus.tokenize(contextId, text);
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
export const getDeviceInfo = async contextId => {
|
|
407
|
-
return await Cactus.getDeviceInfo(contextId);
|
|
408
|
-
};
|
|
409
|
-
export { CactusLM } from './lm';
|
|
410
|
-
export { CactusVLM } from './vlm';
|
|
411
|
-
export { CactusTTS } from './tts';
|
|
412
|
-
export { CactusAgent } from './agent';
|
|
6
|
+
// Hooks
|
|
7
|
+
export { useCactusLM } from "./hooks/useCactusLM.js";
|
|
8
|
+
|
|
9
|
+
// Types
|
|
10
|
+
|
|
11
|
+
// Config
|
|
12
|
+
export { CactusConfig } from "./config/CactusConfig.js";
|
|
413
13
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","DeviceEventEmitter","Platform","Cactus","formatChat","parseAndExecuteTool","Telemetry","Tools","EVENT_ON_INIT_CONTEXT_PROGRESS","EVENT_ON_TOKEN","EVENT_ON_NATIVE_LOG","EventEmitter","OS","logListeners","addListener","evt","forEach","listener","level","text","toggleNativeLog","catch","getJsonSchema","responseFormat","type","json_schema","schema","telemetryParams","n_gpu_layers","n_ctx","model","LlamaContext","gpu","reasonNoGPU","constructor","contextId","id","loadSession","filepath","path","startsWith","slice","saveSession","options","tokenSize","isLlamaChatSupported","chatTemplates","llamaChat","isJinjaSupported","minja","toolUse","default","getFormattedChat","messages","template","params","chat","useJinja","jinja","tmpl","undefined","jsonSchema","response_format","JSON","stringify","tools","parallel_tool_calls","tool_choice","completionWithTools","callback","recursionCount","recursionLimit","completion","getSchemas","result","toolCalled","toolName","toolInput","toolOutput","assistantMessage","role","content","tool_calls","push","toolCallId","toolMessage","tool_call_id","nativeParams","prompt","emit_partial_completion","formattedResult","chat_template","chatTemplate","chat_format","grammar","grammar_lazy","grammar_triggers","preserved_tokens","additional_stops","stop","startTime","Date","now","firstTokenTime","deviceInfo","getDeviceInfo","wrappedCallback","data","tokenListener","tokenResult","Error","promise","then","completionResult","track","event","tok_per_sec","timings","predicted_per_second","toks_generated","predicted_n","ttft","remove","err","stopCompletion","tokenize","detokenize","tokens","embedding","embeddingResult","totalTime","mode","embedding_time","bench","pp","tg","pl","nr","modelDesc","modelSize","modelNParams","ppAvg","ppStd","tgAvg","tgStd","parse","applyLoraAdapters","loraList","loraAdapters","map","l","replace","scaled","removeLoraAdapters","getLoadedLoraAdapters","release","releaseContext","rewind","enabled","addNativeLogListener","splice","indexOf","setContextLimit","limit","contextIdCounter","contextIdRandom","process","env","NODE_ENV","Math","floor","random","modelInfoSkip","loadLlamaModelInfo","modelInfo","poolTypeMap","none","mean","cls","last","rank","initLlama","is_model_asset","isModelAsset","pooling_type","poolingType","lora","lora_list","rest","onProgress","loraPath","removeProgressListener","progress","poolType","modelDetails","androidLib","initContext","use_progress_callback","releaseAllLlama","releaseAllContexts","initMultimodal","mmprojPath","useGpu","isMultimodalEnabled","isMultimodalSupportVision","isMultimodalSupportAudio","releaseMultimodal","multimodalCompletion","mediaPaths","num_images","length","initVocoder","vocoderModelPath","isVocoderEnabled","getTTSType","getFormattedAudioCompletion","speakerJsonStr","textToSpeak","getAudioCompletionGuideTokens","decodeAudioTokens","releaseVocoder","CactusLM","CactusVLM","CactusTTS","CactusAgent"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,kBAAkB,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAE/E,OAAOC,MAAM,MAAM,gBAAgB;AAwBnC,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAAgBC,mBAAmB,QAAQ,SAAS;AACpD,SAASC,SAAS,QAA8B,aAAa;AAmB7D,cAAc,UAAU;AACxB,SACEC,KAAK,EACLF,mBAAmB,QACd,SAAS;AAEhB,MAAMG,8BAA8B,GAAG,+BAA+B;AACtE,MAAMC,cAAc,GAAG,iBAAiB;AACxC,MAAMC,mBAAmB,GAAG,qBAAqB;AAEjD,IAAIC,YAA2D;AAC/D,IAAIT,QAAQ,CAACU,EAAE,KAAK,KAAK,EAAE;EACzB;EACAD,YAAY,GAAG,IAAIX,kBAAkB,CAACG,MAAM,CAAC;AAC/C;AACA,IAAID,QAAQ,CAACU,EAAE,KAAK,SAAS,EAAE;EAC7BD,YAAY,GAAGV,kBAAkB;AACnC;AAEA,MAAMY,YAA0D,GAAG,EAAE;;AAErE;AACA,IAAIF,YAAY,EAAE;EAChBA,YAAY,CAACG,WAAW,CACtBJ,mBAAmB,EAClBK,GAAoC,IAAK;IACxCF,YAAY,CAACG,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAACF,GAAG,CAACG,KAAK,EAAEH,GAAG,CAACI,IAAI,CAAC,CAAC;EACnE,CACF,CAAC;EACDhB,MAAM,EAAEiB,eAAe,GAAG,KAAK,CAAC,EAAEC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;AACrD;AA2EA,MAAMC,aAAa,GAAIC,cAAyC,IAAK;EACnE,IAAIA,cAAc,EAAEC,IAAI,KAAK,aAAa,EAAE;IAC1C,OAAO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;AAC3E,CAAC;AAED,OAAO,MAAME,iBAAiB,GAAG,MAAAA,CAAOxL,SAAiB,EAAE4F,MAAgB,KAAuC;EAChH,OAAO,MAAM5H,MAAM,CAACwN,iBAAiB,CAACxL,SAAS,EAAE4F,MAAM,CAAC;AAC1D,CAAC;AAED,OAAO,MAAM6F,cAAc,GAAG,MAAOzL,SAAiB,IAAK;EACzD,OAAO,MAAMhC,MAAM,CAACyN,cAAc,CAACzL,SAAS,CAAC;AAC/C,CAAC;AAED,OAAO,MAAM0F,QAAQ,GAAG,MAAAA,CAAO1F,SAAiB,EAAEhB,IAAY,EAAE6L,UAAqB,KAAoC;EACvH,IAAIA,UAAU,IAAIA,UAAU,CAACE,MAAM,GAAG,CAAC,EAAE;IACvC,OAAO,MAAM/M,MAAM,CAAC0H,QAAQ,CAAC1F,SAAS,EAAEhB,IAAI,EAAE6L,UAAU,CAAC;EAC3D,CAAC,MAAM;IACL,OAAO,MAAM7M,MAAM,CAAC0H,QAAQ,CAAC1F,SAAS,EAAEhB,IAAI,CAAC;EAC/C;AACF,CAAC;AAED,OAAO,MAAMsF,aAAa,GAAG,MAAOtE,SAAiB,IAAgC;EACnF,OAAO,MAAMhC,MAAM,CAACsG,aAAa,CAACtE,SAAS,CAAC;AAC9C,CAAC;AAED,SAAS0L,QAAQ,QAAQ,MAAM;AAC/B,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,QAAQ,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CactusLM","useCactusLM","CactusConfig"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,SAASA,QAAQ,QAAQ,uBAAoB;;AAE7C;AACA,SAASC,WAAW,QAAQ,wBAAqB;;AAEjD;;AAeA;AACA,SAASC,YAAY,QAAQ,0BAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
export class Cactus {
|
|
5
|
+
hybridCactus = NitroModules.createHybridObject('Cactus');
|
|
6
|
+
init(modelPath, contextSize) {
|
|
7
|
+
return this.hybridCactus.init(modelPath, contextSize);
|
|
8
|
+
}
|
|
9
|
+
async complete(messages, responseBufferSize, options, tools, callback) {
|
|
10
|
+
const messagesJson = JSON.stringify(messages);
|
|
11
|
+
const optionsJson = options ? JSON.stringify({
|
|
12
|
+
temperature: options.temperature,
|
|
13
|
+
top_p: options.topP,
|
|
14
|
+
top_k: options.topK,
|
|
15
|
+
max_tokens: options.maxTokens,
|
|
16
|
+
stop_sequences: options.stopSequences
|
|
17
|
+
}) : undefined;
|
|
18
|
+
const toolsJson = JSON.stringify(tools);
|
|
19
|
+
const response = await this.hybridCactus.complete(messagesJson, responseBufferSize, optionsJson, toolsJson, callback);
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(response);
|
|
22
|
+
return {
|
|
23
|
+
success: parsed.success,
|
|
24
|
+
response: parsed.response,
|
|
25
|
+
functionCalls: parsed.function_calls,
|
|
26
|
+
timeToFirstTokenMs: parsed.time_to_first_token_ms,
|
|
27
|
+
totalTimeMs: parsed.total_time_ms,
|
|
28
|
+
tokensPerSecond: parsed.tokens_per_second,
|
|
29
|
+
prefillTokens: parsed.prefill_tokens,
|
|
30
|
+
decodeTokens: parsed.decode_tokens,
|
|
31
|
+
totalTokens: parsed.total_tokens
|
|
32
|
+
};
|
|
33
|
+
} catch {
|
|
34
|
+
throw new Error('Unable to parse completion response');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
embed(text, embeddingBufferSize) {
|
|
38
|
+
return this.hybridCactus.embed(text, embeddingBufferSize);
|
|
39
|
+
}
|
|
40
|
+
reset() {
|
|
41
|
+
return this.hybridCactus.reset();
|
|
42
|
+
}
|
|
43
|
+
stop() {
|
|
44
|
+
return this.hybridCactus.stop();
|
|
45
|
+
}
|
|
46
|
+
destroy() {
|
|
47
|
+
return this.hybridCactus.destroy();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Cactus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Cactus","hybridCactus","createHybridObject","init","modelPath","contextSize","complete","messages","responseBufferSize","options","tools","callback","messagesJson","JSON","stringify","optionsJson","temperature","top_p","topP","top_k","topK","max_tokens","maxTokens","stop_sequences","stopSequences","undefined","toolsJson","response","parsed","parse","success","functionCalls","function_calls","timeToFirstTokenMs","time_to_first_token_ms","totalTimeMs","total_time_ms","tokensPerSecond","tokens_per_second","prefillTokens","prefill_tokens","decodeTokens","decode_tokens","totalTokens","total_tokens","Error","embed","text","embeddingBufferSize","reset","stop","destroy"],"sourceRoot":"../../../src","sources":["native/Cactus.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AASzD,OAAO,MAAMC,MAAM,CAAC;EACDC,YAAY,GAC3BF,YAAY,CAACG,kBAAkB,CAAa,QAAQ,CAAC;EAEhDC,IAAIA,CAACC,SAAiB,EAAEC,WAAmB,EAAiB;IACjE,OAAO,IAAI,CAACJ,YAAY,CAACE,IAAI,CAACC,SAAS,EAAEC,WAAW,CAAC;EACvD;EAEA,MAAaC,QAAQA,CACnBC,QAAmB,EACnBC,kBAA0B,EAC1BC,OAAiB,EACjBC,KAAc,EACdC,QAAmD,EAClB;IACjC,MAAMC,YAAY,GAAGC,IAAI,CAACC,SAAS,CAACP,QAAQ,CAAC;IAC7C,MAAMQ,WAAW,GAAGN,OAAO,GACvBI,IAAI,CAACC,SAAS,CAAC;MACbE,WAAW,EAAEP,OAAO,CAACO,WAAW;MAChCC,KAAK,EAAER,OAAO,CAACS,IAAI;MACnBC,KAAK,EAAEV,OAAO,CAACW,IAAI;MACnBC,UAAU,EAAEZ,OAAO,CAACa,SAAS;MAC7BC,cAAc,EAAEd,OAAO,CAACe;IAC1B,CAAC,CAAC,GACFC,SAAS;IACb,MAAM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 'react-native-nitro-modules';
|
|
4
|
+
export class CactusCrypto {
|
|
5
|
+
static hybridCactusCrypto = NitroModules.createHybridObject('CactusCrypto');
|
|
6
|
+
static uuidv5(namespaceUuid, name) {
|
|
7
|
+
return this.hybridCactusCrypto.uuidv5(namespaceUuid, name);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=CactusCrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","CactusCrypto","hybridCactusCrypto","createHybridObject","uuidv5","namespaceUuid","name"],"sourceRoot":"../../../src","sources":["native/CactusCrypto.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,YAAY,CAAC;EACxB,OAAwBC,kBAAkB,GACxCF,YAAY,CAACG,kBAAkB,CAAmB,cAAc,CAAC;EAEnE,OAAcC,MAAMA,CAACC,aAAqB,EAAEC,IAAY,EAAmB;IACzE,OAAO,IAAI,CAACJ,kBAAkB,CAACE,MAAM,CAACC,aAAa,EAAEC,IAAI,CAAC;EAC5D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
export class CactusDeviceInfo {
|
|
5
|
+
static hybridCactusDeviceInfo = NitroModules.createHybridObject('CactusDeviceInfo');
|
|
6
|
+
static getAppIdentifier() {
|
|
7
|
+
return this.hybridCactusDeviceInfo.getAppIdentifier();
|
|
8
|
+
}
|
|
9
|
+
static getDeviceInfo() {
|
|
10
|
+
return this.hybridCactusDeviceInfo.getDeviceInfo();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CactusDeviceInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","CactusDeviceInfo","hybridCactusDeviceInfo","createHybridObject","getAppIdentifier","getDeviceInfo"],"sourceRoot":"../../../src","sources":["native/CactusDeviceInfo.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAMzD,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAwBC,sBAAsB,GAC5CF,YAAY,CAACG,kBAAkB,CAAuB,kBAAkB,CAAC;EAE3E,OAAcC,gBAAgBA,CAAA,EAAgC;IAC5D,OAAO,IAAI,CAACF,sBAAsB,CAACE,gBAAgB,CAAC,CAAC;EACvD;EAEA,OAAcC,aAAaA,CAAA,EAAwB;IACjD,OAAO,IAAI,CAACH,sBAAsB,CAACG,aAAa,CAAC,CAAC;EACpD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
export class CactusFileSystem {
|
|
5
|
+
static hybridCactusFileSystem = NitroModules.createHybridObject('CactusFileSystem');
|
|
6
|
+
static getCactusDirectory() {
|
|
7
|
+
return this.hybridCactusFileSystem.getCactusDirectory();
|
|
8
|
+
}
|
|
9
|
+
static fileExists(path) {
|
|
10
|
+
return this.hybridCactusFileSystem.fileExists(path);
|
|
11
|
+
}
|
|
12
|
+
static writeFile(path, content) {
|
|
13
|
+
return this.hybridCactusFileSystem.writeFile(path, content);
|
|
14
|
+
}
|
|
15
|
+
static readFile(path) {
|
|
16
|
+
return this.hybridCactusFileSystem.readFile(path);
|
|
17
|
+
}
|
|
18
|
+
static deleteFile(path) {
|
|
19
|
+
return this.hybridCactusFileSystem.deleteFile(path);
|
|
20
|
+
}
|
|
21
|
+
static modelExists(model) {
|
|
22
|
+
return this.hybridCactusFileSystem.modelExists(model);
|
|
23
|
+
}
|
|
24
|
+
static getModelPath(model) {
|
|
25
|
+
return this.hybridCactusFileSystem.getModelPath(model);
|
|
26
|
+
}
|
|
27
|
+
static downloadModel(model, onProgress) {
|
|
28
|
+
const from = `https://vlqqczxwyaodtcdmdmlw.supabase.co/storage/v1/object/public/cactus-models/${model}.zip`;
|
|
29
|
+
return this.hybridCactusFileSystem.downloadModel(model, from, onProgress);
|
|
30
|
+
}
|
|
31
|
+
static deleteModel(model) {
|
|
32
|
+
return this.hybridCactusFileSystem.deleteModel(model);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=CactusFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","CactusFileSystem","hybridCactusFileSystem","createHybridObject","getCactusDirectory","fileExists","path","writeFile","content","readFile","deleteFile","modelExists","model","getModelPath","downloadModel","onProgress","from","deleteModel"],"sourceRoot":"../../../src","sources":["native/CactusFileSystem.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAwBC,sBAAsB,GAC5CF,YAAY,CAACG,kBAAkB,CAAuB,kBAAkB,CAAC;EAE3E,OAAcC,kBAAkBA,CAAA,EAAoB;IAClD,OAAO,IAAI,CAACF,sBAAsB,CAACE,kBAAkB,CAAC,CAAC;EACzD;EAEA,OAAcC,UAAUA,CAACC,IAAY,EAAoB;IACvD,OAAO,IAAI,CAACJ,sBAAsB,CAACG,UAAU,CAACC,IAAI,CAAC;EACrD;EAEA,OAAcC,SAASA,CAACD,IAAY,EAAEE,OAAe,EAAiB;IACpE,OAAO,IAAI,CAACN,sBAAsB,CAACK,SAAS,CAACD,IAAI,EAAEE,OAAO,CAAC;EAC7D;EAEA,OAAcC,QAAQA,CAACH,IAAY,EAAmB;IACpD,OAAO,IAAI,CAACJ,sBAAsB,CAACO,QAAQ,CAACH,IAAI,CAAC;EACnD;EAEA,OAAcI,UAAUA,CAACJ,IAAY,EAAiB;IACpD,OAAO,IAAI,CAACJ,sBAAsB,CAACQ,UAAU,CAACJ,IAAI,CAAC;EACrD;EAEA,OAAcK,WAAWA,CAACC,KAAa,EAAoB;IACzD,OAAO,IAAI,CAACV,sBAAsB,CAACS,WAAW,CAACC,KAAK,CAAC;EACvD;EAEA,OAAcC,YAAYA,CAACD,KAAa,EAAmB;IACzD,OAAO,IAAI,CAACV,sBAAsB,CAACW,YAAY,CAACD,KAAK,CAAC;EACxD;EAEA,OAAcE,aAAaA,CACzBF,KAAa,EACbG,UAAuC,EACxB;IACf,MAAMC,IAAI,GAAG,mFAAmFJ,KAAK,MAAM;IAC3G,OAAO,IAAI,CAACV,sBAAsB,CAACY,aAAa,CAACF,KAAK,EAAEI,IAAI,EAAED,UAAU,CAAC;EAC3E;EAEA,OAAcE,WAAWA,CAACL,KAAa,EAAiB;IACtD,OAAO,IAAI,CAACV,sBAAsB,CAACe,WAAW,CAACL,KAAK,CAAC;EACvD;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
5
|
+
import { CactusFileSystem } from "./CactusFileSystem.js";
|
|
6
|
+
export class CactusUtil {
|
|
7
|
+
static hybridCactusUtil = NitroModules.createHybridObject('CactusUtil');
|
|
8
|
+
static async registerApp(encryptedData) {
|
|
9
|
+
if (Platform.OS === 'android') {
|
|
10
|
+
const cactusDirectory = await CactusFileSystem.getCactusDirectory();
|
|
11
|
+
this.hybridCactusUtil.setAndroidDataDirectory(cactusDirectory);
|
|
12
|
+
}
|
|
13
|
+
return this.hybridCactusUtil.registerApp(encryptedData);
|
|
14
|
+
}
|
|
15
|
+
static async getDeviceId() {
|
|
16
|
+
if (Platform.OS === 'android') {
|
|
17
|
+
const cactusDirectory = await CactusFileSystem.getCactusDirectory();
|
|
18
|
+
this.hybridCactusUtil.setAndroidDataDirectory(cactusDirectory);
|
|
19
|
+
}
|
|
20
|
+
return this.hybridCactusUtil.getDeviceId();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=CactusUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","Platform","CactusFileSystem","CactusUtil","hybridCactusUtil","createHybridObject","registerApp","encryptedData","OS","cactusDirectory","getCactusDirectory","setAndroidDataDirectory","getDeviceId"],"sourceRoot":"../../../src","sources":["native/CactusUtil.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,gBAAgB,QAAQ,uBAAoB;AAErD,OAAO,MAAMC,UAAU,CAAC;EACtB,OAAwBC,gBAAgB,GACtCJ,YAAY,CAACK,kBAAkB,CAAiB,YAAY,CAAC;EAE/D,aAAoBC,WAAWA,CAACC,aAAqB,EAAmB;IACtE,IAAIN,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7B,MAAMC,eAAe,GAAG,MAAMP,gBAAgB,CAACQ,kBAAkB,CAAC,CAAC;MACnE,IAAI,CAACN,gBAAgB,CAACO,uBAAuB,CAACF,eAAe,CAAC;IAChE;IAEA,OAAO,IAAI,CAACL,gBAAgB,CAACE,WAAW,CAACC,aAAa,CAAC;EACzD;EAEA,aAAoBK,WAAWA,CAAA,EAA2B;IACxD,IAAIX,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7B,MAAMC,eAAe,GAAG,MAAMP,gBAAgB,CAACQ,kBAAkB,CAAC,CAAC;MACnE,IAAI,CAACN,gBAAgB,CAACO,uBAAuB,CAACF,eAAe,CAAC;IAChE;IAEA,OAAO,IAAI,CAACL,gBAAgB,CAACQ,WAAW,CAAC,CAAC;EAC5C;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { Cactus } from "./Cactus.js";
|
|
4
|
+
export { CactusCrypto } from "./CactusCrypto.js";
|
|
5
|
+
export { CactusDeviceInfo } from "./CactusDeviceInfo.js";
|
|
6
|
+
export { CactusFileSystem } from "./CactusFileSystem.js";
|
|
7
|
+
export { CactusUtil } from "./CactusUtil.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Cactus","CactusCrypto","CactusDeviceInfo","CactusFileSystem","CactusUtil"],"sourceRoot":"../../../src","sources":["native/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;AACjC,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,UAAU,QAAQ,iBAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/Cactus.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/CactusCrypto.nitro.ts"],"mappings":"","ignoreList":[]}
|