entroly-wasm 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +67 -0
- package/js/agentskills_export.js +129 -0
- package/js/auto_index.js +262 -0
- package/js/autotune.js +627 -0
- package/js/checkpoint.js +108 -0
- package/js/cli.js +321 -0
- package/js/cogops.js +513 -0
- package/js/config.js +53 -0
- package/js/distill.js +155 -0
- package/js/evolution_daemon.js +335 -0
- package/js/federation.js +444 -0
- package/js/gateways.js +170 -0
- package/js/multimodal.js +64 -0
- package/js/repo_map.js +112 -0
- package/js/server.js +465 -0
- package/js/skills.js +124 -0
- package/js/value_tracker.js +181 -0
- package/js/vault.js +237 -0
- package/js/vault_observer.js +129 -0
- package/js/workspace.js +116 -0
- package/package.json +51 -0
- package/pkg/entroly_wasm.d.ts +156 -0
- package/pkg/entroly_wasm.js +468 -0
- package/pkg/entroly_wasm_bg.wasm +0 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
/* @ts-self-types="./entroly_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
class WasmEntrolyEngine {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
WasmEntrolyEngineFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_wasmentrolyengine_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Advance the turn counter and apply Ebbinghaus decay.
|
|
16
|
+
*/
|
|
17
|
+
advance_turn() {
|
|
18
|
+
wasm.wasmentrolyengine_advance_turn(this.__wbg_ptr);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Analyze codebase health (A-F grade).
|
|
22
|
+
* @returns {any}
|
|
23
|
+
*/
|
|
24
|
+
analyze_health() {
|
|
25
|
+
const ret = wasm.wasmentrolyengine_analyze_health(this.__wbg_ptr);
|
|
26
|
+
return ret;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Clear EGSC cache.
|
|
30
|
+
*/
|
|
31
|
+
cache_clear() {
|
|
32
|
+
wasm.wasmentrolyengine_cache_clear(this.__wbg_ptr);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cache hit rate.
|
|
36
|
+
* @returns {number}
|
|
37
|
+
*/
|
|
38
|
+
cache_hit_rate() {
|
|
39
|
+
const ret = wasm.wasmentrolyengine_cache_hit_rate(this.__wbg_ptr);
|
|
40
|
+
return ret;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Cache empty check.
|
|
44
|
+
* @returns {boolean}
|
|
45
|
+
*/
|
|
46
|
+
cache_is_empty() {
|
|
47
|
+
const ret = wasm.wasmentrolyengine_cache_is_empty(this.__wbg_ptr);
|
|
48
|
+
return ret !== 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Cache entry count.
|
|
52
|
+
* @returns {number}
|
|
53
|
+
*/
|
|
54
|
+
cache_len() {
|
|
55
|
+
const ret = wasm.wasmentrolyengine_cache_len(this.__wbg_ptr);
|
|
56
|
+
return ret >>> 0;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Classify a task query.
|
|
60
|
+
* @param {string} query
|
|
61
|
+
* @returns {any}
|
|
62
|
+
*/
|
|
63
|
+
classify_task(query) {
|
|
64
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
|
+
const len0 = WASM_VECTOR_LEN;
|
|
66
|
+
const ret = wasm.wasmentrolyengine_classify_task(this.__wbg_ptr, ptr0, len0);
|
|
67
|
+
return ret;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Clear all fragments and reset engine.
|
|
71
|
+
*/
|
|
72
|
+
clear() {
|
|
73
|
+
wasm.wasmentrolyengine_clear(this.__wbg_ptr);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Dependency graph stats.
|
|
77
|
+
* @returns {any}
|
|
78
|
+
*/
|
|
79
|
+
dep_graph_stats() {
|
|
80
|
+
const ret = wasm.wasmentrolyengine_dep_graph_stats(this.__wbg_ptr);
|
|
81
|
+
return ret;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Detect entropy anomalies.
|
|
85
|
+
* @returns {any}
|
|
86
|
+
*/
|
|
87
|
+
entropy_anomalies() {
|
|
88
|
+
const ret = wasm.wasmentrolyengine_entropy_anomalies(this.__wbg_ptr);
|
|
89
|
+
return ret;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Explain why each fragment was selected/excluded in last optimization.
|
|
93
|
+
* @returns {any}
|
|
94
|
+
*/
|
|
95
|
+
explain_selection() {
|
|
96
|
+
const ret = wasm.wasmentrolyengine_explain_selection(this.__wbg_ptr);
|
|
97
|
+
return ret;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Export all fragments as JSON.
|
|
101
|
+
* @returns {any}
|
|
102
|
+
*/
|
|
103
|
+
export_fragments() {
|
|
104
|
+
const ret = wasm.wasmentrolyengine_export_fragments(this.__wbg_ptr);
|
|
105
|
+
return ret;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Export full engine state as JSON string.
|
|
109
|
+
* @returns {any}
|
|
110
|
+
*/
|
|
111
|
+
export_state() {
|
|
112
|
+
const ret = wasm.wasmentrolyengine_export_state(this.__wbg_ptr);
|
|
113
|
+
return ret;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get fragment count.
|
|
117
|
+
* @returns {number}
|
|
118
|
+
*/
|
|
119
|
+
fragment_count() {
|
|
120
|
+
const ret = wasm.wasmentrolyengine_fragment_count(this.__wbg_ptr);
|
|
121
|
+
return ret >>> 0;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get the current turn number.
|
|
125
|
+
* @returns {number}
|
|
126
|
+
*/
|
|
127
|
+
get_turn() {
|
|
128
|
+
const ret = wasm.wasmentrolyengine_get_turn(this.__wbg_ptr);
|
|
129
|
+
return ret >>> 0;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Hierarchical context compression.
|
|
133
|
+
* @param {number} token_budget
|
|
134
|
+
* @param {string} query
|
|
135
|
+
* @returns {any}
|
|
136
|
+
*/
|
|
137
|
+
hierarchical_compress(token_budget, query) {
|
|
138
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
139
|
+
const len0 = WASM_VECTOR_LEN;
|
|
140
|
+
const ret = wasm.wasmentrolyengine_hierarchical_compress(this.__wbg_ptr, token_budget, ptr0, len0);
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Import engine state from JSON string.
|
|
145
|
+
* @param {string} json_str
|
|
146
|
+
* @returns {any}
|
|
147
|
+
*/
|
|
148
|
+
import_state(json_str) {
|
|
149
|
+
const ptr0 = passStringToWasm0(json_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
150
|
+
const len0 = WASM_VECTOR_LEN;
|
|
151
|
+
const ret = wasm.wasmentrolyengine_import_state(this.__wbg_ptr, ptr0, len0);
|
|
152
|
+
return ret;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Ingest a context fragment into the engine.
|
|
156
|
+
* Pipeline: tokens → SimHash → dedup → entropy → criticality → depgraph → store
|
|
157
|
+
* @param {string} content
|
|
158
|
+
* @param {string} source
|
|
159
|
+
* @param {number} token_count
|
|
160
|
+
* @param {boolean} is_pinned
|
|
161
|
+
* @returns {any}
|
|
162
|
+
*/
|
|
163
|
+
ingest(content, source, token_count, is_pinned) {
|
|
164
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
165
|
+
const len0 = WASM_VECTOR_LEN;
|
|
166
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
167
|
+
const len1 = WASM_VECTOR_LEN;
|
|
168
|
+
const ret = wasm.wasmentrolyengine_ingest(this.__wbg_ptr, ptr0, len0, ptr1, len1, token_count, is_pinned);
|
|
169
|
+
return ret;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create a new Entroly engine with default parameters.
|
|
173
|
+
*/
|
|
174
|
+
constructor() {
|
|
175
|
+
const ret = wasm.wasmentrolyengine_new();
|
|
176
|
+
this.__wbg_ptr = ret >>> 0;
|
|
177
|
+
WasmEntrolyEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Full optimization pipeline: IOS + PRISM + Channel Coding + Resonance + Causal.
|
|
182
|
+
* @param {number} token_budget
|
|
183
|
+
* @param {string} query
|
|
184
|
+
* @returns {any}
|
|
185
|
+
*/
|
|
186
|
+
optimize(token_budget, query) {
|
|
187
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
189
|
+
const ret = wasm.wasmentrolyengine_optimize(this.__wbg_ptr, token_budget, ptr0, len0);
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Query manifold stats.
|
|
194
|
+
* @returns {any}
|
|
195
|
+
*/
|
|
196
|
+
query_manifold_stats() {
|
|
197
|
+
const ret = wasm.wasmentrolyengine_query_manifold_stats(this.__wbg_ptr);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Semantic recall of relevant fragments.
|
|
202
|
+
* @param {string} query
|
|
203
|
+
* @param {number} top_k
|
|
204
|
+
* @returns {any}
|
|
205
|
+
*/
|
|
206
|
+
recall(query, top_k) {
|
|
207
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
209
|
+
const ret = wasm.wasmentrolyengine_recall(this.__wbg_ptr, ptr0, len0, top_k);
|
|
210
|
+
return ret;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Record failed outcome for specific fragment IDs.
|
|
214
|
+
* @param {string} fragment_ids_json
|
|
215
|
+
*/
|
|
216
|
+
record_failure(fragment_ids_json) {
|
|
217
|
+
const ptr0 = passStringToWasm0(fragment_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
218
|
+
const len0 = WASM_VECTOR_LEN;
|
|
219
|
+
wasm.wasmentrolyengine_record_failure(this.__wbg_ptr, ptr0, len0);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Record a continuous reward signal.
|
|
223
|
+
* @param {string} fragment_ids_json
|
|
224
|
+
* @param {number} reward
|
|
225
|
+
*/
|
|
226
|
+
record_reward(fragment_ids_json, reward) {
|
|
227
|
+
const ptr0 = passStringToWasm0(fragment_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
229
|
+
wasm.wasmentrolyengine_record_reward(this.__wbg_ptr, ptr0, len0, reward);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Record successful outcome for specific fragment IDs.
|
|
233
|
+
* @param {string} fragment_ids_json
|
|
234
|
+
*/
|
|
235
|
+
record_success(fragment_ids_json) {
|
|
236
|
+
const ptr0 = passStringToWasm0(fragment_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
|
+
const len0 = WASM_VECTOR_LEN;
|
|
238
|
+
wasm.wasmentrolyengine_record_success(this.__wbg_ptr, ptr0, len0);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Remove a fragment by ID.
|
|
242
|
+
* @param {string} fragment_id
|
|
243
|
+
* @returns {boolean}
|
|
244
|
+
*/
|
|
245
|
+
remove(fragment_id) {
|
|
246
|
+
const ptr0 = passStringToWasm0(fragment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
248
|
+
const ret = wasm.wasmentrolyengine_remove(this.__wbg_ptr, ptr0, len0);
|
|
249
|
+
return ret !== 0;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Scan a fragment for security vulnerabilities.
|
|
253
|
+
* @param {string} fragment_id
|
|
254
|
+
* @returns {any}
|
|
255
|
+
*/
|
|
256
|
+
scan_fragment(fragment_id) {
|
|
257
|
+
const ptr0 = passStringToWasm0(fragment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ret = wasm.wasmentrolyengine_scan_fragment(this.__wbg_ptr, ptr0, len0);
|
|
260
|
+
return ret;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Score context utilization from LLM response.
|
|
264
|
+
* @param {string} response
|
|
265
|
+
* @returns {any}
|
|
266
|
+
*/
|
|
267
|
+
score_utilization(response) {
|
|
268
|
+
const ptr0 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.wasmentrolyengine_score_utilization(this.__wbg_ptr, ptr0, len0);
|
|
271
|
+
return ret;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Security report for all fragments.
|
|
275
|
+
* @returns {any}
|
|
276
|
+
*/
|
|
277
|
+
security_report() {
|
|
278
|
+
const ret = wasm.wasmentrolyengine_security_report(this.__wbg_ptr);
|
|
279
|
+
return ret;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Semantic dedup report.
|
|
283
|
+
* @returns {any}
|
|
284
|
+
*/
|
|
285
|
+
semantic_dedup_report() {
|
|
286
|
+
const ret = wasm.wasmentrolyengine_semantic_dedup_report(this.__wbg_ptr);
|
|
287
|
+
return ret;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Set cost-per-token directly.
|
|
291
|
+
* @param {number} cost
|
|
292
|
+
*/
|
|
293
|
+
set_cache_cost_per_token(cost) {
|
|
294
|
+
wasm.wasmentrolyengine_set_cache_cost_per_token(this.__wbg_ptr, cost);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Enable/disable channel coding.
|
|
298
|
+
* @param {boolean} enabled
|
|
299
|
+
*/
|
|
300
|
+
set_channel_coding_enabled(enabled) {
|
|
301
|
+
wasm.wasmentrolyengine_set_channel_coding_enabled(this.__wbg_ptr, enabled);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Set exploration rate.
|
|
305
|
+
* @param {number} rate
|
|
306
|
+
*/
|
|
307
|
+
set_exploration_rate(rate) {
|
|
308
|
+
wasm.wasmentrolyengine_set_exploration_rate(this.__wbg_ptr, rate);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Set cost model from model name.
|
|
312
|
+
* @param {string} model_name
|
|
313
|
+
*/
|
|
314
|
+
set_model(model_name) {
|
|
315
|
+
const ptr0 = passStringToWasm0(model_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
316
|
+
const len0 = WASM_VECTOR_LEN;
|
|
317
|
+
wasm.wasmentrolyengine_set_model(this.__wbg_ptr, ptr0, len0);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Enable/disable query personas.
|
|
321
|
+
* @param {boolean} enabled
|
|
322
|
+
*/
|
|
323
|
+
set_query_personas_enabled(enabled) {
|
|
324
|
+
wasm.wasmentrolyengine_set_query_personas_enabled(this.__wbg_ptr, enabled);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Set scoring weights (normalized to sum=1.0).
|
|
328
|
+
* @param {number} w_recency
|
|
329
|
+
* @param {number} w_frequency
|
|
330
|
+
* @param {number} w_semantic
|
|
331
|
+
* @param {number} w_entropy
|
|
332
|
+
*/
|
|
333
|
+
set_weights(w_recency, w_frequency, w_semantic, w_entropy) {
|
|
334
|
+
wasm.wasmentrolyengine_set_weights(this.__wbg_ptr, w_recency, w_frequency, w_semantic, w_entropy);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Get full engine statistics as JSON.
|
|
338
|
+
* @returns {any}
|
|
339
|
+
*/
|
|
340
|
+
stats() {
|
|
341
|
+
const ret = wasm.wasmentrolyengine_stats(this.__wbg_ptr);
|
|
342
|
+
return ret;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (Symbol.dispose) WasmEntrolyEngine.prototype[Symbol.dispose] = WasmEntrolyEngine.prototype.free;
|
|
346
|
+
exports.WasmEntrolyEngine = WasmEntrolyEngine;
|
|
347
|
+
|
|
348
|
+
function __wbg_get_imports() {
|
|
349
|
+
const import0 = {
|
|
350
|
+
__proto__: null,
|
|
351
|
+
__wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
|
|
352
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
353
|
+
},
|
|
354
|
+
__wbg_parse_545d11396395fbbd: function() { return handleError(function (arg0, arg1) {
|
|
355
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
356
|
+
return ret;
|
|
357
|
+
}, arguments); },
|
|
358
|
+
__wbindgen_init_externref_table: function() {
|
|
359
|
+
const table = wasm.__wbindgen_externrefs;
|
|
360
|
+
const offset = table.grow(4);
|
|
361
|
+
table.set(0, undefined);
|
|
362
|
+
table.set(offset + 0, undefined);
|
|
363
|
+
table.set(offset + 1, null);
|
|
364
|
+
table.set(offset + 2, true);
|
|
365
|
+
table.set(offset + 3, false);
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
return {
|
|
369
|
+
__proto__: null,
|
|
370
|
+
"./entroly_wasm_bg.js": import0,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const WasmEntrolyEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
375
|
+
? { register: () => {}, unregister: () => {} }
|
|
376
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmentrolyengine_free(ptr >>> 0, 1));
|
|
377
|
+
|
|
378
|
+
function addToExternrefTable0(obj) {
|
|
379
|
+
const idx = wasm.__externref_table_alloc();
|
|
380
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
381
|
+
return idx;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function getStringFromWasm0(ptr, len) {
|
|
385
|
+
ptr = ptr >>> 0;
|
|
386
|
+
return decodeText(ptr, len);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
let cachedUint8ArrayMemory0 = null;
|
|
390
|
+
function getUint8ArrayMemory0() {
|
|
391
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
392
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
393
|
+
}
|
|
394
|
+
return cachedUint8ArrayMemory0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function handleError(f, args) {
|
|
398
|
+
try {
|
|
399
|
+
return f.apply(this, args);
|
|
400
|
+
} catch (e) {
|
|
401
|
+
const idx = addToExternrefTable0(e);
|
|
402
|
+
wasm.__wbindgen_exn_store(idx);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
407
|
+
if (realloc === undefined) {
|
|
408
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
409
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
410
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
411
|
+
WASM_VECTOR_LEN = buf.length;
|
|
412
|
+
return ptr;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
let len = arg.length;
|
|
416
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
417
|
+
|
|
418
|
+
const mem = getUint8ArrayMemory0();
|
|
419
|
+
|
|
420
|
+
let offset = 0;
|
|
421
|
+
|
|
422
|
+
for (; offset < len; offset++) {
|
|
423
|
+
const code = arg.charCodeAt(offset);
|
|
424
|
+
if (code > 0x7F) break;
|
|
425
|
+
mem[ptr + offset] = code;
|
|
426
|
+
}
|
|
427
|
+
if (offset !== len) {
|
|
428
|
+
if (offset !== 0) {
|
|
429
|
+
arg = arg.slice(offset);
|
|
430
|
+
}
|
|
431
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
432
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
433
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
434
|
+
|
|
435
|
+
offset += ret.written;
|
|
436
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
WASM_VECTOR_LEN = offset;
|
|
440
|
+
return ptr;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
444
|
+
cachedTextDecoder.decode();
|
|
445
|
+
function decodeText(ptr, len) {
|
|
446
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const cachedTextEncoder = new TextEncoder();
|
|
450
|
+
|
|
451
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
452
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
453
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
454
|
+
view.set(buf);
|
|
455
|
+
return {
|
|
456
|
+
read: arg.length,
|
|
457
|
+
written: buf.length
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
let WASM_VECTOR_LEN = 0;
|
|
463
|
+
|
|
464
|
+
const wasmPath = `${__dirname}/entroly_wasm_bg.wasm`;
|
|
465
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
466
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
467
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
468
|
+
wasm.__wbindgen_start();
|
|
Binary file
|