edge-intelligence-sdk 0.3.7
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/android/jniLibs/arm64-v8a/libel_ffi.so +0 -0
- package/ios/libel_ffi.a +0 -0
- package/package.json +18 -0
- package/src/rn/cpp/el_ffi.cpp +2668 -0
- package/src/rn/cpp/el_ffi.hpp +66 -0
- package/src/rn/el_ffi-ffi.ts +119 -0
- package/src/rn/el_ffi.ts +545 -0
- package/src/web/el_ffi.d.ts +68 -0
- package/src/web/el_ffi.js +298 -0
- package/src/web/el_ffi_bg.wasm +0 -0
- package/src/web/el_ffi_bg.wasm.d.ts +13 -0
- package/src/web/package.json +17 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
#pragma once
|
|
4
|
+
#include <jsi/jsi.h>
|
|
5
|
+
#include <iostream>
|
|
6
|
+
#include <map>
|
|
7
|
+
#include <memory>
|
|
8
|
+
#include <ReactCommon/CallInvoker.h>
|
|
9
|
+
#include "UniffiCallInvoker.h"
|
|
10
|
+
|
|
11
|
+
namespace react = facebook::react;
|
|
12
|
+
namespace jsi = facebook::jsi;
|
|
13
|
+
|
|
14
|
+
class NativeElFfi : public jsi::HostObject {
|
|
15
|
+
private:
|
|
16
|
+
// For calling back into JS from Rust.
|
|
17
|
+
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker;
|
|
18
|
+
|
|
19
|
+
protected:
|
|
20
|
+
std::map<std::string,jsi::Value> props;
|
|
21
|
+
jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
22
|
+
jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_buffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
23
|
+
jsi::Value cpp_uniffi_internal_fn_func_ffi__string_from_buffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
24
|
+
jsi::Value cpp_uniffi_internal_fn_func_ffi__read_string_from_buffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
25
|
+
jsi::Value cpp_uniffi_el_ffi_fn_clone_edgellm(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
26
|
+
jsi::Value cpp_uniffi_el_ffi_fn_free_edgellm(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
27
|
+
jsi::Value cpp_uniffi_el_ffi_fn_constructor_edgellm_cloud(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
28
|
+
jsi::Value cpp_uniffi_el_ffi_fn_constructor_edgellm_local(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
29
|
+
jsi::Value cpp_uniffi_el_ffi_fn_method_edgellm_ask(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
30
|
+
jsi::Value cpp_uniffi_el_ffi_fn_method_edgellm_ask_stream_cb(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
31
|
+
jsi::Value cpp_uniffi_el_ffi_fn_method_edgellm_reset(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
32
|
+
jsi::Value cpp_uniffi_el_ffi_fn_init_callback_vtable_streamhandler(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
33
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_method_edgellm_ask(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
34
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_method_edgellm_ask_stream_cb(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
35
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_method_edgellm_reset(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
36
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_constructor_edgellm_cloud(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
37
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_constructor_edgellm_local(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
38
|
+
jsi::Value cpp_uniffi_el_ffi_checksum_method_streamhandler_on_token(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
39
|
+
jsi::Value cpp_ffi_el_ffi_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
40
|
+
jsi::Value cpp_uniffi_internal_fn_method_edgellm_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
NativeElFfi(jsi::Runtime &rt, std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker);
|
|
44
|
+
virtual ~NativeElFfi();
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The entry point into the crate.
|
|
48
|
+
*
|
|
49
|
+
* React Native must call `NativeElFfi.registerModule(rt, callInvoker)` before using
|
|
50
|
+
* the Javascript interface.
|
|
51
|
+
*/
|
|
52
|
+
static void registerModule(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Some cleanup into the crate goes here.
|
|
56
|
+
*
|
|
57
|
+
* Current implementation is empty, however, this is not guaranteed to always be the case.
|
|
58
|
+
*
|
|
59
|
+
* Clients should call `NativeElFfi.unregisterModule(rt)` after final use where possible.
|
|
60
|
+
*/
|
|
61
|
+
static void unregisterModule(jsi::Runtime &rt);
|
|
62
|
+
|
|
63
|
+
virtual jsi::Value get(jsi::Runtime& rt, const jsi::PropNameID& name);
|
|
64
|
+
virtual void set(jsi::Runtime& rt,const jsi::PropNameID& name,const jsi::Value& value);
|
|
65
|
+
virtual std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt);
|
|
66
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
/* tslint:disable */
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type StructuralEquality as UniffiStructuralEquality,
|
|
10
|
+
type UniffiForeignFuture as RuntimeUniffiForeignFuture,
|
|
11
|
+
type UniffiRustCallStatus,
|
|
12
|
+
type UniffiGcObject,
|
|
13
|
+
type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
|
|
14
|
+
type UniffiResult,
|
|
15
|
+
} from '@ubjs/core';
|
|
16
|
+
|
|
17
|
+
interface NativeModuleInterface {
|
|
18
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(string: string, uniffi_out_err: UniffiRustCallStatus): number;
|
|
19
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_buffer(string: string, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
20
|
+
ubrn_uniffi_internal_fn_func_ffi__string_from_buffer(buffer: Uint8Array, uniffi_out_err: UniffiRustCallStatus): string;
|
|
21
|
+
ubrn_uniffi_internal_fn_func_ffi__read_string_from_buffer(buffer: any, offset: number, length: number): string;
|
|
22
|
+
ubrn_ffi_el_ffi_rust_future_poll_u8(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
23
|
+
ubrn_ffi_el_ffi_rust_future_cancel_u8(handle: bigint): void;
|
|
24
|
+
ubrn_ffi_el_ffi_rust_future_complete_u8(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
25
|
+
ubrn_ffi_el_ffi_rust_future_free_u8(handle: bigint): void;
|
|
26
|
+
ubrn_ffi_el_ffi_rust_future_poll_i8(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
27
|
+
ubrn_ffi_el_ffi_rust_future_cancel_i8(handle: bigint): void;
|
|
28
|
+
ubrn_ffi_el_ffi_rust_future_complete_i8(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
29
|
+
ubrn_ffi_el_ffi_rust_future_free_i8(handle: bigint): void;
|
|
30
|
+
ubrn_ffi_el_ffi_rust_future_poll_u16(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
31
|
+
ubrn_ffi_el_ffi_rust_future_cancel_u16(handle: bigint): void;
|
|
32
|
+
ubrn_ffi_el_ffi_rust_future_complete_u16(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
33
|
+
ubrn_ffi_el_ffi_rust_future_free_u16(handle: bigint): void;
|
|
34
|
+
ubrn_ffi_el_ffi_rust_future_poll_i16(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
35
|
+
ubrn_ffi_el_ffi_rust_future_cancel_i16(handle: bigint): void;
|
|
36
|
+
ubrn_ffi_el_ffi_rust_future_complete_i16(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
37
|
+
ubrn_ffi_el_ffi_rust_future_free_i16(handle: bigint): void;
|
|
38
|
+
ubrn_ffi_el_ffi_rust_future_poll_u32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
39
|
+
ubrn_ffi_el_ffi_rust_future_cancel_u32(handle: bigint): void;
|
|
40
|
+
ubrn_ffi_el_ffi_rust_future_complete_u32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
41
|
+
ubrn_ffi_el_ffi_rust_future_free_u32(handle: bigint): void;
|
|
42
|
+
ubrn_ffi_el_ffi_rust_future_poll_i32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
43
|
+
ubrn_ffi_el_ffi_rust_future_cancel_i32(handle: bigint): void;
|
|
44
|
+
ubrn_ffi_el_ffi_rust_future_complete_i32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
45
|
+
ubrn_ffi_el_ffi_rust_future_free_i32(handle: bigint): void;
|
|
46
|
+
ubrn_ffi_el_ffi_rust_future_poll_u64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
47
|
+
ubrn_ffi_el_ffi_rust_future_cancel_u64(handle: bigint): void;
|
|
48
|
+
ubrn_ffi_el_ffi_rust_future_complete_u64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
49
|
+
ubrn_ffi_el_ffi_rust_future_free_u64(handle: bigint): void;
|
|
50
|
+
ubrn_ffi_el_ffi_rust_future_poll_i64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
51
|
+
ubrn_ffi_el_ffi_rust_future_cancel_i64(handle: bigint): void;
|
|
52
|
+
ubrn_ffi_el_ffi_rust_future_complete_i64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
53
|
+
ubrn_ffi_el_ffi_rust_future_free_i64(handle: bigint): void;
|
|
54
|
+
ubrn_ffi_el_ffi_rust_future_poll_f32(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
55
|
+
ubrn_ffi_el_ffi_rust_future_cancel_f32(handle: bigint): void;
|
|
56
|
+
ubrn_ffi_el_ffi_rust_future_complete_f32(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
57
|
+
ubrn_ffi_el_ffi_rust_future_free_f32(handle: bigint): void;
|
|
58
|
+
ubrn_ffi_el_ffi_rust_future_poll_f64(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
59
|
+
ubrn_ffi_el_ffi_rust_future_cancel_f64(handle: bigint): void;
|
|
60
|
+
ubrn_ffi_el_ffi_rust_future_complete_f64(handle: bigint, uniffi_out_err: UniffiRustCallStatus): number;
|
|
61
|
+
ubrn_ffi_el_ffi_rust_future_free_f64(handle: bigint): void;
|
|
62
|
+
ubrn_ffi_el_ffi_rust_future_poll_rust_buffer(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
63
|
+
ubrn_ffi_el_ffi_rust_future_cancel_rust_buffer(handle: bigint): void;
|
|
64
|
+
ubrn_ffi_el_ffi_rust_future_complete_rust_buffer(handle: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
65
|
+
ubrn_ffi_el_ffi_rust_future_free_rust_buffer(handle: bigint): void;
|
|
66
|
+
ubrn_ffi_el_ffi_rust_future_poll_void(handle: bigint, callback: UniffiRustFutureContinuationCallback, callbackData: bigint): void;
|
|
67
|
+
ubrn_ffi_el_ffi_rust_future_cancel_void(handle: bigint): void;
|
|
68
|
+
ubrn_ffi_el_ffi_rust_future_complete_void(handle: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
69
|
+
ubrn_ffi_el_ffi_rust_future_free_void(handle: bigint): void;
|
|
70
|
+
ubrn_uniffi_el_ffi_fn_clone_edgellm(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
71
|
+
ubrn_uniffi_el_ffi_fn_free_edgellm(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
72
|
+
ubrn_uniffi_el_ffi_fn_init_callback_vtable_streamhandler(vtable: UniffiVTableCallbackInterfaceElFfiStreamHandler): void;
|
|
73
|
+
ubrn_uniffi_el_ffi_fn_constructor_edgellm_cloud(model: Uint8Array, apiKey: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
74
|
+
ubrn_uniffi_el_ffi_fn_constructor_edgellm_local(modelUri: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
|
|
75
|
+
ubrn_uniffi_el_ffi_fn_method_edgellm_ask(uniffiSelf: bigint, prompt: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
76
|
+
ubrn_uniffi_el_ffi_fn_method_edgellm_ask_stream_cb(uniffiSelf: bigint, prompt: Uint8Array, handler: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
77
|
+
ubrn_uniffi_el_ffi_fn_method_edgellm_reset(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): void;
|
|
78
|
+
ubrn_ffi_el_ffi_uniffi_contract_version(): number;
|
|
79
|
+
ubrn_uniffi_el_ffi_checksum_constructor_edgellm_cloud(): number;
|
|
80
|
+
ubrn_uniffi_el_ffi_checksum_constructor_edgellm_local(): number;
|
|
81
|
+
ubrn_uniffi_el_ffi_checksum_method_edgellm_ask(): number;
|
|
82
|
+
ubrn_uniffi_el_ffi_checksum_method_edgellm_ask_stream_cb(): number;
|
|
83
|
+
ubrn_uniffi_el_ffi_checksum_method_edgellm_reset(): number;
|
|
84
|
+
ubrn_uniffi_internal_fn_method_edgellm_ffi__bless_pointer(pointer: bigint, uniffi_out_err: UniffiRustCallStatus): UniffiGcObject;
|
|
85
|
+
// Codegen call sites use these via `nativeModule().rustbuffer_alloc(...)`
|
|
86
|
+
// and `nativeModule().rustbuffer_free(...)`. The JSI host object exposes
|
|
87
|
+
// them as properties; see `props["rustbuffer_alloc"]` / `props["rustbuffer_free"]`
|
|
88
|
+
// in the C++ wrapper template.
|
|
89
|
+
rustbuffer_alloc(n: number): Uint8Array;
|
|
90
|
+
rustbuffer_free(view: Uint8Array): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const getter: () => NativeModuleInterface = () => (globalThis as any).NativeElFfi;
|
|
94
|
+
export default getter;
|
|
95
|
+
|
|
96
|
+
// Structs and function types for calling back into Typescript from Rust.
|
|
97
|
+
export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
|
|
98
|
+
export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
|
|
99
|
+
export type UniffiForeignFutureDroppedCallbackStruct = {
|
|
100
|
+
handle: bigint;
|
|
101
|
+
free: UniffiForeignFutureDroppedCallback;
|
|
102
|
+
};
|
|
103
|
+
type UniffiCallbackInterfaceElFfiStreamHandlerMethod0 = (uniffiHandle: bigint, token: Uint8Array) => UniffiResult<void>;
|
|
104
|
+
type UniffiCallbackInterfaceCloneElFfiStreamHandler = (handle: bigint) => UniffiResult<void>;
|
|
105
|
+
type UniffiCallbackInterfaceFreeElFfiStreamHandler = (handle: bigint) => void;
|
|
106
|
+
export type UniffiVTableCallbackInterfaceElFfiStreamHandler = {
|
|
107
|
+
uniffi_free: UniffiCallbackInterfaceFreeElFfiStreamHandler;
|
|
108
|
+
uniffi_clone: UniffiCallbackInterfaceCloneElFfiStreamHandler;
|
|
109
|
+
on_token: UniffiCallbackInterfaceElFfiStreamHandlerMethod0;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
113
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
114
|
+
// We chose to generate the declaration anyway, and use a different declaration in the runtime.
|
|
115
|
+
// We perform a compile time check that the two versions are structurally equivalent.
|
|
116
|
+
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
|
117
|
+
RuntimeUniffiRustFutureContinuationCallback,
|
|
118
|
+
UniffiRustFutureContinuationCallback
|
|
119
|
+
> = true;
|