@small-ltsc/sdk 0.2.4 → 0.2.11
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/dist/esm/dictionaries/index.js +6 -6
- package/dist/esm/dictionaries/index.js.map +1 -1
- package/dist/esm/dictionaries/json.json +26 -26
- package/dist/esm/dictionaries/markdown.json +26 -26
- package/dist/esm/dictionaries/python.json +26 -26
- package/dist/esm/dictionaries/sql.json +26 -26
- package/dist/esm/dictionaries/typescript.json +26 -26
- package/dist/esm/wasm/import-helper.js +12 -0
- package/dist/esm/wasm/import-helper.js.map +1 -0
- package/dist/esm/wasm/loader.js +58 -102
- package/dist/esm/wasm/loader.js.map +1 -1
- package/dist/esm/wasm/pkg/small_ltsc_core.d.ts +333 -0
- package/dist/esm/wasm/pkg/small_ltsc_core.js +1212 -0
- package/dist/esm/wasm/pkg/small_ltsc_core_bg.wasm +0 -0
- package/dist/esm/wasm/pkg/small_ltsc_core_bg.wasm.d.ts +82 -0
- package/dist/types/wasm/import-helper.d.ts +6 -0
- package/dist/types/wasm/import-helper.d.ts.map +1 -0
- package/dist/types/wasm/loader.d.ts +15 -15
- package/dist/types/wasm/loader.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for compression.
|
|
6
|
+
*/
|
|
7
|
+
export class CompressionConfig {
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
constructor();
|
|
11
|
+
meta_token_prefix: string;
|
|
12
|
+
meta_token_suffix: string;
|
|
13
|
+
selection_mode: string;
|
|
14
|
+
/**
|
|
15
|
+
* Beam width for beam search
|
|
16
|
+
*/
|
|
17
|
+
beam_width: number;
|
|
18
|
+
/**
|
|
19
|
+
* Dictionary end delimiter token ID
|
|
20
|
+
*/
|
|
21
|
+
dict_end_token: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to include length tokens in dictionary
|
|
24
|
+
*/
|
|
25
|
+
dict_length_enabled: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Dictionary start delimiter token ID
|
|
28
|
+
*/
|
|
29
|
+
dict_start_token: number;
|
|
30
|
+
/**
|
|
31
|
+
* Enable hierarchical compression
|
|
32
|
+
*/
|
|
33
|
+
hierarchical_enabled: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum hierarchical compression depth
|
|
36
|
+
*/
|
|
37
|
+
hierarchical_max_depth: number;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum pattern length to consider
|
|
40
|
+
*/
|
|
41
|
+
max_subsequence_length: number;
|
|
42
|
+
/**
|
|
43
|
+
* Size of meta-token pool
|
|
44
|
+
*/
|
|
45
|
+
meta_token_pool_size: number;
|
|
46
|
+
/**
|
|
47
|
+
* Minimum pattern length to consider
|
|
48
|
+
*/
|
|
49
|
+
min_subsequence_length: number;
|
|
50
|
+
/**
|
|
51
|
+
* Enable round-trip verification
|
|
52
|
+
*/
|
|
53
|
+
verify: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Metrics from a compression operation.
|
|
58
|
+
*/
|
|
59
|
+
export class CompressionMetrics {
|
|
60
|
+
private constructor();
|
|
61
|
+
free(): void;
|
|
62
|
+
[Symbol.dispose](): void;
|
|
63
|
+
/**
|
|
64
|
+
* Number of candidates discovered
|
|
65
|
+
*/
|
|
66
|
+
candidates_discovered: number;
|
|
67
|
+
/**
|
|
68
|
+
* Number of candidates selected
|
|
69
|
+
*/
|
|
70
|
+
candidates_selected: number;
|
|
71
|
+
/**
|
|
72
|
+
* Time spent in pattern discovery (ms)
|
|
73
|
+
*/
|
|
74
|
+
discovery_time_ms: number;
|
|
75
|
+
/**
|
|
76
|
+
* Peak memory usage (bytes, approximate)
|
|
77
|
+
*/
|
|
78
|
+
peak_memory_bytes: number;
|
|
79
|
+
/**
|
|
80
|
+
* Time spent in selection (ms)
|
|
81
|
+
*/
|
|
82
|
+
selection_time_ms: number;
|
|
83
|
+
/**
|
|
84
|
+
* Time spent in serialization (ms)
|
|
85
|
+
*/
|
|
86
|
+
serialization_time_ms: number;
|
|
87
|
+
/**
|
|
88
|
+
* Total compression time (ms)
|
|
89
|
+
*/
|
|
90
|
+
total_time_ms: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Result of compression operation.
|
|
95
|
+
*/
|
|
96
|
+
export class CompressionResult {
|
|
97
|
+
private constructor();
|
|
98
|
+
free(): void;
|
|
99
|
+
[Symbol.dispose](): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get the body tokens as a JS array.
|
|
102
|
+
*/
|
|
103
|
+
getBodyTokens(): Uint32Array;
|
|
104
|
+
/**
|
|
105
|
+
* Get the dictionary tokens as a JS array.
|
|
106
|
+
*/
|
|
107
|
+
getDictionaryTokens(): Uint32Array;
|
|
108
|
+
/**
|
|
109
|
+
* Get the original tokens as a JS array.
|
|
110
|
+
*/
|
|
111
|
+
getOriginalTokens(): Uint32Array;
|
|
112
|
+
/**
|
|
113
|
+
* Get the serialized tokens as a JS array.
|
|
114
|
+
*/
|
|
115
|
+
getSerializedTokens(): Uint32Array;
|
|
116
|
+
/**
|
|
117
|
+
* Get the static dictionary ID if used.
|
|
118
|
+
*/
|
|
119
|
+
getStaticDictionaryId(): string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Get the compression ratio (compressed/original).
|
|
122
|
+
*/
|
|
123
|
+
readonly compression_ratio: number;
|
|
124
|
+
/**
|
|
125
|
+
* Get tokens saved by compression.
|
|
126
|
+
*/
|
|
127
|
+
readonly tokens_saved: bigint;
|
|
128
|
+
/**
|
|
129
|
+
* Compressed sequence length
|
|
130
|
+
*/
|
|
131
|
+
compressed_length: number;
|
|
132
|
+
/**
|
|
133
|
+
* Original sequence length
|
|
134
|
+
*/
|
|
135
|
+
original_length: number;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Streaming compressor for large inputs.
|
|
140
|
+
*/
|
|
141
|
+
export class StreamingCompressor {
|
|
142
|
+
free(): void;
|
|
143
|
+
[Symbol.dispose](): void;
|
|
144
|
+
/**
|
|
145
|
+
* Add a chunk of tokens.
|
|
146
|
+
*/
|
|
147
|
+
add_chunk(tokens: Uint32Array): void;
|
|
148
|
+
/**
|
|
149
|
+
* Finish streaming and produce compressed result.
|
|
150
|
+
*/
|
|
151
|
+
finish(): CompressionResult;
|
|
152
|
+
/**
|
|
153
|
+
* Get approximate memory usage.
|
|
154
|
+
*/
|
|
155
|
+
memory_usage(): number;
|
|
156
|
+
/**
|
|
157
|
+
* Create a new streaming compressor.
|
|
158
|
+
*/
|
|
159
|
+
constructor(config: any);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* WASM-specific configuration for memory and performance tuning.
|
|
164
|
+
*/
|
|
165
|
+
export class WasmConfig {
|
|
166
|
+
free(): void;
|
|
167
|
+
[Symbol.dispose](): void;
|
|
168
|
+
constructor();
|
|
169
|
+
/**
|
|
170
|
+
* Chunk size for streaming processing (default: 32768)
|
|
171
|
+
*/
|
|
172
|
+
chunk_size: number;
|
|
173
|
+
/**
|
|
174
|
+
* Maximum memory usage in MB (default: 256)
|
|
175
|
+
*/
|
|
176
|
+
max_memory_mb: number;
|
|
177
|
+
/**
|
|
178
|
+
* Enable streaming for inputs above threshold (default: 50000)
|
|
179
|
+
*/
|
|
180
|
+
streaming_threshold: number;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Compress a token sequence.
|
|
185
|
+
*
|
|
186
|
+
* # Arguments
|
|
187
|
+
*
|
|
188
|
+
* * `tokens` - The token sequence to compress (Uint32Array from JS)
|
|
189
|
+
* * `config` - Optional configuration (JsValue representing JsCompressionConfig)
|
|
190
|
+
*
|
|
191
|
+
* # Returns
|
|
192
|
+
*
|
|
193
|
+
* A CompressionResult containing the compressed tokens and metadata.
|
|
194
|
+
*/
|
|
195
|
+
export function compress(tokens: Uint32Array, config: any): CompressionResult;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Decompress a compressed token sequence.
|
|
199
|
+
*
|
|
200
|
+
* # Arguments
|
|
201
|
+
*
|
|
202
|
+
* * `tokens` - The compressed token sequence
|
|
203
|
+
* * `config` - Optional configuration
|
|
204
|
+
*
|
|
205
|
+
* # Returns
|
|
206
|
+
*
|
|
207
|
+
* The original token sequence.
|
|
208
|
+
*/
|
|
209
|
+
export function decompress(tokens: Uint32Array, config: any): Uint32Array;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Discover patterns without compressing.
|
|
213
|
+
*
|
|
214
|
+
* Useful for analysis and building static dictionaries.
|
|
215
|
+
*/
|
|
216
|
+
export function discover_patterns(tokens: Uint32Array, min_length: number, max_length: number): any;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Initialize panic hook for better error messages in WASM.
|
|
220
|
+
*/
|
|
221
|
+
export function init(): void;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get version information.
|
|
225
|
+
*/
|
|
226
|
+
export function version(): string;
|
|
227
|
+
|
|
228
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
229
|
+
|
|
230
|
+
export interface InitOutput {
|
|
231
|
+
readonly memory: WebAssembly.Memory;
|
|
232
|
+
readonly __wbg_compressionconfig_free: (a: number, b: number) => void;
|
|
233
|
+
readonly __wbg_compressionmetrics_free: (a: number, b: number) => void;
|
|
234
|
+
readonly __wbg_compressionresult_free: (a: number, b: number) => void;
|
|
235
|
+
readonly __wbg_get_compressionconfig_beam_width: (a: number) => number;
|
|
236
|
+
readonly __wbg_get_compressionconfig_dict_end_token: (a: number) => number;
|
|
237
|
+
readonly __wbg_get_compressionconfig_dict_length_enabled: (a: number) => number;
|
|
238
|
+
readonly __wbg_get_compressionconfig_dict_start_token: (a: number) => number;
|
|
239
|
+
readonly __wbg_get_compressionconfig_hierarchical_enabled: (a: number) => number;
|
|
240
|
+
readonly __wbg_get_compressionconfig_hierarchical_max_depth: (a: number) => number;
|
|
241
|
+
readonly __wbg_get_compressionconfig_max_subsequence_length: (a: number) => number;
|
|
242
|
+
readonly __wbg_get_compressionconfig_meta_token_pool_size: (a: number) => number;
|
|
243
|
+
readonly __wbg_get_compressionconfig_min_subsequence_length: (a: number) => number;
|
|
244
|
+
readonly __wbg_get_compressionconfig_verify: (a: number) => number;
|
|
245
|
+
readonly __wbg_get_compressionmetrics_candidates_discovered: (a: number) => number;
|
|
246
|
+
readonly __wbg_get_compressionmetrics_discovery_time_ms: (a: number) => number;
|
|
247
|
+
readonly __wbg_get_compressionmetrics_peak_memory_bytes: (a: number) => number;
|
|
248
|
+
readonly __wbg_get_compressionmetrics_selection_time_ms: (a: number) => number;
|
|
249
|
+
readonly __wbg_get_compressionmetrics_serialization_time_ms: (a: number) => number;
|
|
250
|
+
readonly __wbg_get_compressionmetrics_total_time_ms: (a: number) => number;
|
|
251
|
+
readonly __wbg_get_wasmconfig_chunk_size: (a: number) => number;
|
|
252
|
+
readonly __wbg_get_wasmconfig_max_memory_mb: (a: number) => number;
|
|
253
|
+
readonly __wbg_get_wasmconfig_streaming_threshold: (a: number) => number;
|
|
254
|
+
readonly __wbg_set_compressionconfig_beam_width: (a: number, b: number) => void;
|
|
255
|
+
readonly __wbg_set_compressionconfig_dict_end_token: (a: number, b: number) => void;
|
|
256
|
+
readonly __wbg_set_compressionconfig_dict_length_enabled: (a: number, b: number) => void;
|
|
257
|
+
readonly __wbg_set_compressionconfig_dict_start_token: (a: number, b: number) => void;
|
|
258
|
+
readonly __wbg_set_compressionconfig_hierarchical_enabled: (a: number, b: number) => void;
|
|
259
|
+
readonly __wbg_set_compressionconfig_hierarchical_max_depth: (a: number, b: number) => void;
|
|
260
|
+
readonly __wbg_set_compressionconfig_max_subsequence_length: (a: number, b: number) => void;
|
|
261
|
+
readonly __wbg_set_compressionconfig_meta_token_pool_size: (a: number, b: number) => void;
|
|
262
|
+
readonly __wbg_set_compressionconfig_min_subsequence_length: (a: number, b: number) => void;
|
|
263
|
+
readonly __wbg_set_compressionconfig_verify: (a: number, b: number) => void;
|
|
264
|
+
readonly __wbg_set_compressionmetrics_candidates_discovered: (a: number, b: number) => void;
|
|
265
|
+
readonly __wbg_set_compressionmetrics_discovery_time_ms: (a: number, b: number) => void;
|
|
266
|
+
readonly __wbg_set_compressionmetrics_peak_memory_bytes: (a: number, b: number) => void;
|
|
267
|
+
readonly __wbg_set_compressionmetrics_selection_time_ms: (a: number, b: number) => void;
|
|
268
|
+
readonly __wbg_set_compressionmetrics_serialization_time_ms: (a: number, b: number) => void;
|
|
269
|
+
readonly __wbg_set_compressionmetrics_total_time_ms: (a: number, b: number) => void;
|
|
270
|
+
readonly __wbg_set_wasmconfig_chunk_size: (a: number, b: number) => void;
|
|
271
|
+
readonly __wbg_set_wasmconfig_max_memory_mb: (a: number, b: number) => void;
|
|
272
|
+
readonly __wbg_set_wasmconfig_streaming_threshold: (a: number, b: number) => void;
|
|
273
|
+
readonly __wbg_streamingcompressor_free: (a: number, b: number) => void;
|
|
274
|
+
readonly __wbg_wasmconfig_free: (a: number, b: number) => void;
|
|
275
|
+
readonly compress: (a: number, b: number, c: any) => [number, number, number];
|
|
276
|
+
readonly compressionconfig_meta_token_prefix: (a: number) => [number, number];
|
|
277
|
+
readonly compressionconfig_meta_token_suffix: (a: number) => [number, number];
|
|
278
|
+
readonly compressionconfig_new: () => number;
|
|
279
|
+
readonly compressionconfig_selection_mode: (a: number) => [number, number];
|
|
280
|
+
readonly compressionconfig_set_meta_token_prefix: (a: number, b: number, c: number) => void;
|
|
281
|
+
readonly compressionconfig_set_meta_token_suffix: (a: number, b: number, c: number) => void;
|
|
282
|
+
readonly compressionconfig_set_selection_mode: (a: number, b: number, c: number) => void;
|
|
283
|
+
readonly compressionresult_compression_ratio: (a: number) => number;
|
|
284
|
+
readonly compressionresult_getBodyTokens: (a: number) => [number, number];
|
|
285
|
+
readonly compressionresult_getDictionaryTokens: (a: number) => [number, number];
|
|
286
|
+
readonly compressionresult_getOriginalTokens: (a: number) => [number, number];
|
|
287
|
+
readonly compressionresult_getSerializedTokens: (a: number) => [number, number];
|
|
288
|
+
readonly compressionresult_getStaticDictionaryId: (a: number) => [number, number];
|
|
289
|
+
readonly compressionresult_tokens_saved: (a: number) => bigint;
|
|
290
|
+
readonly decompress: (a: number, b: number, c: any) => [number, number, number, number];
|
|
291
|
+
readonly discover_patterns: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
292
|
+
readonly streamingcompressor_add_chunk: (a: number, b: number, c: number) => void;
|
|
293
|
+
readonly streamingcompressor_finish: (a: number) => [number, number, number];
|
|
294
|
+
readonly streamingcompressor_memory_usage: (a: number) => number;
|
|
295
|
+
readonly streamingcompressor_new: (a: any) => [number, number, number];
|
|
296
|
+
readonly version: () => [number, number];
|
|
297
|
+
readonly wasmconfig_new: () => number;
|
|
298
|
+
readonly init: () => void;
|
|
299
|
+
readonly __wbg_set_compressionmetrics_candidates_selected: (a: number, b: number) => void;
|
|
300
|
+
readonly __wbg_set_compressionresult_compressed_length: (a: number, b: number) => void;
|
|
301
|
+
readonly __wbg_set_compressionresult_original_length: (a: number, b: number) => void;
|
|
302
|
+
readonly __wbg_get_compressionmetrics_candidates_selected: (a: number) => number;
|
|
303
|
+
readonly __wbg_get_compressionresult_compressed_length: (a: number) => number;
|
|
304
|
+
readonly __wbg_get_compressionresult_original_length: (a: number) => number;
|
|
305
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
306
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
307
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
308
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
309
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
310
|
+
readonly __wbindgen_start: () => void;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
317
|
+
* a precompiled `WebAssembly.Module`.
|
|
318
|
+
*
|
|
319
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
320
|
+
*
|
|
321
|
+
* @returns {InitOutput}
|
|
322
|
+
*/
|
|
323
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
327
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
328
|
+
*
|
|
329
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
330
|
+
*
|
|
331
|
+
* @returns {Promise<InitOutput>}
|
|
332
|
+
*/
|
|
333
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|