@litert-lm/core 0.16.0 → 0.17.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/README.md +164 -0
- package/dist/cleanup.d.ts +25 -0
- package/dist/cleanup.d.ts.map +1 -0
- package/dist/cleanup.js +36 -0
- package/dist/cleanup.js.map +1 -0
- package/dist/conversation.d.ts +51 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +171 -0
- package/dist/conversation.js.map +1 -0
- package/dist/conversation_config.d.ts +157 -0
- package/dist/conversation_config.d.ts.map +1 -0
- package/dist/conversation_config.js +42 -0
- package/dist/conversation_config.js.map +1 -0
- package/dist/embedding_engine.d.ts +51 -0
- package/dist/embedding_engine.d.ts.map +1 -0
- package/dist/embedding_engine.js +198 -0
- package/dist/embedding_engine.js.map +1 -0
- package/dist/embedding_engine_settings.d.ts +39 -0
- package/dist/embedding_engine_settings.d.ts.map +1 -0
- package/dist/embedding_engine_settings.js +35 -0
- package/dist/embedding_engine_settings.js.map +1 -0
- package/dist/engine.d.ts +37 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +203 -0
- package/dist/engine.js.map +1 -0
- package/dist/engine_settings.d.ts +57 -0
- package/dist/engine_settings.d.ts.map +1 -0
- package/dist/engine_settings.js +114 -0
- package/dist/engine_settings.js.map +1 -0
- package/dist/global_litertlm.d.ts +66 -0
- package/dist/global_litertlm.d.ts.map +1 -0
- package/dist/global_litertlm.js +85 -0
- package/dist/global_litertlm.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/litertlm_web.d.ts +32 -0
- package/dist/litertlm_web.d.ts.map +1 -0
- package/dist/litertlm_web.js +75 -0
- package/dist/litertlm_web.js.map +1 -0
- package/dist/load.d.ts +28 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +50 -0
- package/dist/load.js.map +1 -0
- package/dist/load_litertlm.d.ts +58 -0
- package/dist/load_litertlm.d.ts.map +1 -0
- package/dist/load_litertlm.js +87 -0
- package/dist/load_litertlm.js.map +1 -0
- package/dist/mutex.d.ts +45 -0
- package/dist/mutex.d.ts.map +1 -0
- package/dist/mutex.js +62 -0
- package/dist/mutex.js.map +1 -0
- package/dist/orchestration/auto_tool_chat.d.ts +82 -0
- package/dist/orchestration/auto_tool_chat.d.ts.map +1 -0
- package/dist/orchestration/auto_tool_chat.js +304 -0
- package/dist/orchestration/auto_tool_chat.js.map +1 -0
- package/dist/orchestration/chat_interface.d.ts +30 -0
- package/dist/orchestration/chat_interface.d.ts.map +1 -0
- package/dist/orchestration/chat_interface.js +17 -0
- package/dist/orchestration/chat_interface.js.map +1 -0
- package/dist/orchestration/webmcp_tool.d.ts +41 -0
- package/dist/orchestration/webmcp_tool.d.ts.map +1 -0
- package/dist/orchestration/webmcp_tool.js +32 -0
- package/dist/orchestration/webmcp_tool.js.map +1 -0
- package/dist/readable_stream_data_stream_wrapper.d.ts +44 -0
- package/dist/readable_stream_data_stream_wrapper.d.ts.map +1 -0
- package/dist/readable_stream_data_stream_wrapper.js +315 -0
- package/dist/readable_stream_data_stream_wrapper.js.map +1 -0
- package/dist/session.d.ts +51 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +107 -0
- package/dist/session.js.map +1 -0
- package/dist/session_config.d.ts +60 -0
- package/dist/session_config.d.ts.map +1 -0
- package/dist/session_config.js +109 -0
- package/dist/session_config.js.map +1 -0
- package/dist/stream_utils.d.ts +25 -0
- package/dist/stream_utils.d.ts.map +1 -0
- package/dist/stream_utils.js +95 -0
- package/dist/stream_utils.js.map +1 -0
- package/dist/testing/fakes.d.ts +67 -0
- package/dist/testing/fakes.d.ts.map +1 -0
- package/dist/testing/fakes.js +125 -0
- package/dist/testing/fakes.js.map +1 -0
- package/dist/testing/index.d.ts +17 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +17 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/dist/url_path_utils.d.ts +28 -0
- package/dist/url_path_utils.d.ts.map +1 -0
- package/dist/url_path_utils.js +34 -0
- package/dist/url_path_utils.js.map +1 -0
- package/dist/wasm_binding_types.d.ts +473 -0
- package/dist/wasm_binding_types.d.ts.map +1 -0
- package/dist/wasm_binding_types.js +47 -0
- package/dist/wasm_binding_types.js.map +1 -0
- package/dist/wasm_feature_detect.d.ts +45 -0
- package/dist/wasm_feature_detect.d.ts.map +1 -0
- package/dist/wasm_feature_detect.js +139 -0
- package/dist/wasm_feature_detect.js.map +1 -0
- package/dist/wasm_utils.d.ts +30 -0
- package/dist/wasm_utils.d.ts.map +1 -0
- package/dist/wasm_utils.js +41 -0
- package/dist/wasm_utils.js.map +1 -0
- package/package.json +3 -2
- package/wasm/litertlm_wasm_asyncify_internal.js +8749 -0
- package/wasm/litertlm_wasm_asyncify_internal.wasm +0 -0
- package/wasm/litertlm_wasm_compat_asyncify_internal.js +8758 -0
- package/wasm/litertlm_wasm_compat_asyncify_internal.wasm +0 -0
- package/wasm/litertlm_wasm_compat_internal.js +8543 -0
- package/wasm/litertlm_wasm_compat_internal.wasm +0 -0
- package/wasm/litertlm_wasm_internal.js +8532 -0
- package/wasm/litertlm_wasm_internal.wasm +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Backend types for LiteRT-LM.
|
|
18
|
+
*/
|
|
19
|
+
export const Backend = {
|
|
20
|
+
// Ideally, we'd pull these from the Wasm module, but we want them to be
|
|
21
|
+
// available in JS before the Wasm module is loaded.
|
|
22
|
+
UNSPECIFIED: 0,
|
|
23
|
+
CPU_ARTISAN: 1,
|
|
24
|
+
GPU_ARTISAN: 2,
|
|
25
|
+
CPU: 3,
|
|
26
|
+
GPU: 4,
|
|
27
|
+
GOOGLE_TENSOR_ARTISAN: 5,
|
|
28
|
+
NPU: 6,
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* LiteRT-LM SamplerType enum values
|
|
32
|
+
*/
|
|
33
|
+
export const SamplerType = {
|
|
34
|
+
TYPE_UNSPECIFIED: 0,
|
|
35
|
+
TOP_K: 1,
|
|
36
|
+
TOP_P: 2,
|
|
37
|
+
GREEDY: 3,
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Input overflow strategies for embedding computations.
|
|
41
|
+
*/
|
|
42
|
+
export const InputOverflowStrategy = {
|
|
43
|
+
CHUNK_AND_AVERAGE: 0,
|
|
44
|
+
TRUNCATE: 1,
|
|
45
|
+
ERROR: 2,
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=wasm_binding_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm_binding_types.js","sourceRoot":"","sources":["../src/wasm_binding_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,wEAAwE;IACxE,oDAAoD;IACpD,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,qBAAqB,EAAE,CAAC;IACxB,GAAG,EAAE,CAAC;CACP,CAAC;AAyRF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,gBAAgB,EAAE,CAAC;IACnB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACD,CAAC;AAiMX;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;CACA,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
interface SupportStatus {
|
|
17
|
+
supported: boolean;
|
|
18
|
+
error?: Error;
|
|
19
|
+
}
|
|
20
|
+
declare interface WasmFeatureValues {
|
|
21
|
+
relaxedSimd: Promise<SupportStatus> | undefined;
|
|
22
|
+
threads: Promise<SupportStatus> | undefined;
|
|
23
|
+
jspi: Promise<SupportStatus> | undefined;
|
|
24
|
+
}
|
|
25
|
+
declare const WASM_FEATURE_VALUES: WasmFeatureValues;
|
|
26
|
+
/** Returns true if JSPI is supported in the browser. */
|
|
27
|
+
export declare function isJspiSupported(): boolean;
|
|
28
|
+
declare const WASM_FEATURE_CHECKS: Record<keyof typeof WASM_FEATURE_VALUES, () => Promise<SupportStatus>>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a given WASM feature is supported.
|
|
31
|
+
*
|
|
32
|
+
* @param feature The feature to check.
|
|
33
|
+
* @return A promise that resolves to true if the feature is supported,
|
|
34
|
+
* false otherwise.
|
|
35
|
+
*/
|
|
36
|
+
export declare function supportsFeature(feature: keyof typeof WASM_FEATURE_CHECKS): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Throw an error if a given WASM feature is not supported.
|
|
39
|
+
*
|
|
40
|
+
* @param feature The feature to check.
|
|
41
|
+
* @throws An error if the feature is not supported.
|
|
42
|
+
*/
|
|
43
|
+
export declare function throwIfFeatureNotSupported(feature: keyof typeof WASM_FEATURE_CHECKS): Promise<void>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=wasm_feature_detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm_feature_detect.d.ts","sourceRoot":"","sources":["../src/wasm_feature_detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqCH,UAAU,aAAa;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAID,OAAO,WAAW,iBAAiB;IACjC,WAAW,EAAE,OAAO,CAAC,aAAa,CAAC,GAAC,SAAS,CAAC;IAC9C,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAC,SAAS,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAAC,SAAS,CAAC;CACxC;AAED,QAAA,MAAM,mBAAmB,EAAE,iBAI1B,CAAC;AAEF,wDAAwD;AACxD,wBAAgB,eAAe,YAG9B;AAWD,QAAA,MAAM,mBAAmB,EACrB,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAoCpE,CAAC;AAEN;;;;;;GAMG;AACH,wBAAsB,eAAe,CACjC,OAAO,EAAE,MAAM,OAAO,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC5C,OAAO,EAAE,MAAM,OAAO,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5D"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Checks for relaxed SIMD support.
|
|
18
|
+
*
|
|
19
|
+
* (module
|
|
20
|
+
* (func (result v128)
|
|
21
|
+
* i32.const 1
|
|
22
|
+
* i8x16.splat
|
|
23
|
+
* i32.const 2
|
|
24
|
+
* i8x16.splat
|
|
25
|
+
* i8x16.relaxed_swizzle
|
|
26
|
+
* )
|
|
27
|
+
* )
|
|
28
|
+
*/
|
|
29
|
+
const WASM_RELAXED_SIMD_CHECK = new Uint8Array([
|
|
30
|
+
0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1,
|
|
31
|
+
0, 10, 15, 1, 13, 0, 65, 1, 253, 15, 65, 2, 253, 15, 253, 128, 2, 11
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* Checks for WebAssembly Pthreads emulation.
|
|
35
|
+
*
|
|
36
|
+
* (module
|
|
37
|
+
* (memory 1 1 shared)
|
|
38
|
+
* (func
|
|
39
|
+
* i32.const 0
|
|
40
|
+
* i32.atomic.load
|
|
41
|
+
* drop
|
|
42
|
+
* )
|
|
43
|
+
* )
|
|
44
|
+
*/
|
|
45
|
+
const WASM_THREADS_CHECK = new Uint8Array([
|
|
46
|
+
0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 2, 1, 0, 5,
|
|
47
|
+
4, 1, 3, 1, 1, 10, 11, 1, 9, 0, 65, 0, 254, 16, 2, 0, 26, 11
|
|
48
|
+
]);
|
|
49
|
+
const WASM_FEATURE_VALUES = {
|
|
50
|
+
'relaxedSimd': undefined,
|
|
51
|
+
'threads': undefined,
|
|
52
|
+
'jspi': undefined,
|
|
53
|
+
};
|
|
54
|
+
/** Returns true if JSPI is supported in the browser. */
|
|
55
|
+
export function isJspiSupported() {
|
|
56
|
+
// tslint:disable-next-line:ban-unsafe-reflection
|
|
57
|
+
return ('Suspending' in WebAssembly);
|
|
58
|
+
}
|
|
59
|
+
async function tryWasm(wasm) {
|
|
60
|
+
try {
|
|
61
|
+
await WebAssembly.instantiate(wasm);
|
|
62
|
+
return { supported: true };
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
return { supported: false, error: e };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const WASM_FEATURE_CHECKS = {
|
|
69
|
+
'relaxedSimd': () => {
|
|
70
|
+
if (WASM_FEATURE_VALUES.relaxedSimd === undefined) {
|
|
71
|
+
WASM_FEATURE_VALUES.relaxedSimd = tryWasm(WASM_RELAXED_SIMD_CHECK);
|
|
72
|
+
}
|
|
73
|
+
return WASM_FEATURE_VALUES.relaxedSimd;
|
|
74
|
+
},
|
|
75
|
+
'threads': () => {
|
|
76
|
+
if (WASM_FEATURE_VALUES.threads === undefined) {
|
|
77
|
+
try {
|
|
78
|
+
if (typeof MessageChannel !== 'undefined') {
|
|
79
|
+
new MessageChannel().port1.postMessage(new SharedArrayBuffer(1));
|
|
80
|
+
}
|
|
81
|
+
WASM_FEATURE_VALUES.threads = tryWasm(WASM_THREADS_CHECK);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
WASM_FEATURE_VALUES.threads =
|
|
85
|
+
Promise.resolve({ supported: false, error: e });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return WASM_FEATURE_VALUES.threads;
|
|
89
|
+
},
|
|
90
|
+
'jspi': () => {
|
|
91
|
+
if (WASM_FEATURE_VALUES.jspi === undefined) {
|
|
92
|
+
try {
|
|
93
|
+
const supported = isJspiSupported();
|
|
94
|
+
WASM_FEATURE_VALUES.jspi = Promise.resolve({
|
|
95
|
+
supported,
|
|
96
|
+
error: supported ? undefined : new Error('JSPI is not supported')
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
WASM_FEATURE_VALUES.jspi =
|
|
101
|
+
Promise.resolve({ supported: false, error: e });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return WASM_FEATURE_VALUES.jspi;
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Check if a given WASM feature is supported.
|
|
109
|
+
*
|
|
110
|
+
* @param feature The feature to check.
|
|
111
|
+
* @return A promise that resolves to true if the feature is supported,
|
|
112
|
+
* false otherwise.
|
|
113
|
+
*/
|
|
114
|
+
export async function supportsFeature(feature) {
|
|
115
|
+
const check = WASM_FEATURE_CHECKS[feature]?.();
|
|
116
|
+
if (!check) {
|
|
117
|
+
// Then we don't know how to check for this feature.
|
|
118
|
+
throw new Error(`Unknown feature: ${feature}`);
|
|
119
|
+
}
|
|
120
|
+
return (await check).supported;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Throw an error if a given WASM feature is not supported.
|
|
124
|
+
*
|
|
125
|
+
* @param feature The feature to check.
|
|
126
|
+
* @throws An error if the feature is not supported.
|
|
127
|
+
*/
|
|
128
|
+
export async function throwIfFeatureNotSupported(feature) {
|
|
129
|
+
const check = WASM_FEATURE_CHECKS[feature]?.();
|
|
130
|
+
if (!check) {
|
|
131
|
+
// Then we don't know how to check for this feature.
|
|
132
|
+
throw new Error(`Unknown feature: ${feature}`);
|
|
133
|
+
}
|
|
134
|
+
const result = await check;
|
|
135
|
+
if (!result.supported) {
|
|
136
|
+
throw result.error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=wasm_feature_detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm_feature_detect.js","sourceRoot":"","sources":["../src/wasm_feature_detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,uBAAuB,GAAG,IAAI,UAAU,CAAC;IAC7C,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAG,CAAC,EAAE,CAAC,EAAG,CAAC,EAAE,CAAC,EAAI,CAAC,EAAG,CAAC,EAAG,EAAE,EAAE,CAAC,EAAI,CAAC,EAAG,GAAG,EAAE,CAAC,EAAI,CAAC,EAAE,CAAC;IACvE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAG,CAAC,EAAI,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAG,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;CACzE,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,kBAAkB,GAAG,IAAI,UAAU,CAAC;IACxC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAG,CAAC,EAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAG,EAAE,EAAE,CAAC,EAAI,CAAC,EAA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AAC;IACD,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC5C,OAAyC;IAC3C,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;IAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,oDAAoD;QACpD,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC;IAC3B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,MAAM,CAAC,KAAM,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { EmscriptenVector } from './wasm_binding_types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Convert an EmscriptenVector to a native array and delete the vector
|
|
19
|
+
*
|
|
20
|
+
* Deletes the EmscriptenVector when done. The caller must still delete the
|
|
21
|
+
* individual elements of the returned array.
|
|
22
|
+
*/
|
|
23
|
+
export declare function consumeEmscriptenVectorToArray<T>(vector: EmscriptenVector<T>): T[];
|
|
24
|
+
/**
|
|
25
|
+
* Fill an EmscriptenVector from an Iterable.
|
|
26
|
+
*
|
|
27
|
+
* The EmscriptenVector must be large enough to hold the data.
|
|
28
|
+
*/
|
|
29
|
+
export declare function fillEmscriptenVector<T>(data: Iterable<T>, vector: EmscriptenVector<T>): void;
|
|
30
|
+
//# sourceMappingURL=wasm_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm_utils.d.ts","sourceRoot":"","sources":["../src/wasm_utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GACzE,CAAC,EAAE,CAON;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAClC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAKjD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Convert an EmscriptenVector to a native array and delete the vector
|
|
18
|
+
*
|
|
19
|
+
* Deletes the EmscriptenVector when done. The caller must still delete the
|
|
20
|
+
* individual elements of the returned array.
|
|
21
|
+
*/
|
|
22
|
+
export function consumeEmscriptenVectorToArray(vector) {
|
|
23
|
+
const array = new Array(vector.size());
|
|
24
|
+
for (let i = 0; i < vector.size(); ++i) {
|
|
25
|
+
array[i] = vector.get(i);
|
|
26
|
+
}
|
|
27
|
+
vector.delete();
|
|
28
|
+
return array;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fill an EmscriptenVector from an Iterable.
|
|
32
|
+
*
|
|
33
|
+
* The EmscriptenVector must be large enough to hold the data.
|
|
34
|
+
*/
|
|
35
|
+
export function fillEmscriptenVector(data, vector) {
|
|
36
|
+
// Embind lacks vector.reserve().
|
|
37
|
+
for (const item of data) {
|
|
38
|
+
vector.push_back(item);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=wasm_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm_utils.js","sourceRoot":"","sources":["../src/wasm_utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAI,MAA2B;IAE3E,MAAM,KAAK,GAAG,IAAI,KAAK,CAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAChC,IAAiB,EAAE,MAA2B;IAChD,iCAAiC;IACjC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litert-lm/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "LiteRT-LM package",
|
|
5
5
|
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
8
|
},
|
|
8
9
|
"main": "./dist/index.js",
|
|
9
10
|
"types": "./dist/index.d.ts",
|