entroly 0.6.2 → 0.15.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/entroly_wasm.d.ts +121 -12
- package/entroly_wasm.js +279 -66
- package/entroly_wasm_bg.wasm +0 -0
- package/package.json +3 -23
- package/entroly_wasm_bg.wasm.d.ts +0 -17
package/entroly_wasm.d.ts
CHANGED
|
@@ -5,43 +5,152 @@ export class WasmEntrolyEngine {
|
|
|
5
5
|
free(): void;
|
|
6
6
|
[Symbol.dispose](): void;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Advance the turn counter and apply Ebbinghaus decay.
|
|
9
|
+
*/
|
|
10
|
+
advance_turn(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Analyze codebase health (A-F grade).
|
|
13
|
+
*/
|
|
14
|
+
analyze_health(): any;
|
|
15
|
+
/**
|
|
16
|
+
* Clear EGSC cache.
|
|
17
|
+
*/
|
|
18
|
+
cache_clear(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Cache hit rate.
|
|
21
|
+
*/
|
|
22
|
+
cache_hit_rate(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Cache empty check.
|
|
25
|
+
*/
|
|
26
|
+
cache_is_empty(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Cache entry count.
|
|
29
|
+
*/
|
|
30
|
+
cache_len(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Classify a task query.
|
|
33
|
+
*/
|
|
34
|
+
classify_task(query: string): any;
|
|
35
|
+
/**
|
|
36
|
+
* Clear all fragments and reset engine.
|
|
9
37
|
*/
|
|
10
38
|
clear(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Dependency graph stats.
|
|
41
|
+
*/
|
|
42
|
+
dep_graph_stats(): any;
|
|
43
|
+
/**
|
|
44
|
+
* Detect entropy anomalies.
|
|
45
|
+
*/
|
|
46
|
+
entropy_anomalies(): any;
|
|
47
|
+
/**
|
|
48
|
+
* Explain why each fragment was selected/excluded in last optimization.
|
|
49
|
+
*/
|
|
50
|
+
explain_selection(): any;
|
|
51
|
+
/**
|
|
52
|
+
* Export all fragments as JSON.
|
|
53
|
+
*/
|
|
54
|
+
export_fragments(): any;
|
|
55
|
+
/**
|
|
56
|
+
* Export full engine state as JSON string.
|
|
57
|
+
*/
|
|
58
|
+
export_state(): any;
|
|
11
59
|
/**
|
|
12
60
|
* Get fragment count.
|
|
13
61
|
*/
|
|
14
62
|
fragment_count(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Get the current turn number.
|
|
65
|
+
*/
|
|
66
|
+
get_turn(): number;
|
|
67
|
+
/**
|
|
68
|
+
* Hierarchical context compression.
|
|
69
|
+
*/
|
|
70
|
+
hierarchical_compress(token_budget: number, query: string): any;
|
|
71
|
+
/**
|
|
72
|
+
* Import engine state from JSON string.
|
|
73
|
+
*/
|
|
74
|
+
import_state(json_str: string): any;
|
|
15
75
|
/**
|
|
16
76
|
* Ingest a context fragment into the engine.
|
|
17
|
-
*
|
|
18
|
-
* Returns a JSON object with fragment metadata.
|
|
77
|
+
* Pipeline: tokens → SimHash → dedup → entropy → criticality → depgraph → store
|
|
19
78
|
*/
|
|
20
|
-
ingest(
|
|
79
|
+
ingest(content: string, source: string, token_count: number, is_pinned: boolean): any;
|
|
21
80
|
/**
|
|
22
81
|
* Create a new Entroly engine with default parameters.
|
|
23
82
|
*/
|
|
24
83
|
constructor();
|
|
25
84
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* Returns a JSON object with selected fragments.
|
|
85
|
+
* Full optimization pipeline: IOS + PRISM + Channel Coding + Resonance + Causal.
|
|
29
86
|
*/
|
|
30
87
|
optimize(token_budget: number, query: string): any;
|
|
31
88
|
/**
|
|
32
|
-
*
|
|
89
|
+
* Query manifold stats.
|
|
90
|
+
*/
|
|
91
|
+
query_manifold_stats(): any;
|
|
92
|
+
/**
|
|
93
|
+
* Semantic recall of relevant fragments.
|
|
94
|
+
*/
|
|
95
|
+
recall(query: string, top_k: number): any;
|
|
96
|
+
/**
|
|
97
|
+
* Record failed outcome for specific fragment IDs.
|
|
98
|
+
*/
|
|
99
|
+
record_failure(fragment_ids_json: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Record a continuous reward signal.
|
|
33
102
|
*/
|
|
34
|
-
|
|
103
|
+
record_reward(fragment_ids_json: string, reward: number): void;
|
|
35
104
|
/**
|
|
36
|
-
* Record successful outcome
|
|
105
|
+
* Record successful outcome for specific fragment IDs.
|
|
37
106
|
*/
|
|
38
|
-
record_success(): void;
|
|
107
|
+
record_success(fragment_ids_json: string): void;
|
|
39
108
|
/**
|
|
40
109
|
* Remove a fragment by ID.
|
|
41
110
|
*/
|
|
42
111
|
remove(fragment_id: string): boolean;
|
|
43
112
|
/**
|
|
44
|
-
*
|
|
113
|
+
* Scan a fragment for security vulnerabilities.
|
|
114
|
+
*/
|
|
115
|
+
scan_fragment(fragment_id: string): any;
|
|
116
|
+
/**
|
|
117
|
+
* Score context utilization from LLM response.
|
|
118
|
+
*/
|
|
119
|
+
score_utilization(response: string): any;
|
|
120
|
+
/**
|
|
121
|
+
* Security report for all fragments.
|
|
122
|
+
*/
|
|
123
|
+
security_report(): any;
|
|
124
|
+
/**
|
|
125
|
+
* Semantic dedup report.
|
|
126
|
+
*/
|
|
127
|
+
semantic_dedup_report(): any;
|
|
128
|
+
/**
|
|
129
|
+
* Set cost-per-token directly.
|
|
130
|
+
*/
|
|
131
|
+
set_cache_cost_per_token(cost: number): void;
|
|
132
|
+
/**
|
|
133
|
+
* Enable/disable channel coding.
|
|
134
|
+
*/
|
|
135
|
+
set_channel_coding_enabled(enabled: boolean): void;
|
|
136
|
+
/**
|
|
137
|
+
* Set exploration rate.
|
|
138
|
+
*/
|
|
139
|
+
set_exploration_rate(rate: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* Set cost model from model name.
|
|
142
|
+
*/
|
|
143
|
+
set_model(model_name: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Enable/disable query personas.
|
|
146
|
+
*/
|
|
147
|
+
set_query_personas_enabled(enabled: boolean): void;
|
|
148
|
+
/**
|
|
149
|
+
* Set scoring weights (normalized to sum=1.0).
|
|
150
|
+
*/
|
|
151
|
+
set_weights(w_recency: number, w_frequency: number, w_semantic: number, w_entropy: number): void;
|
|
152
|
+
/**
|
|
153
|
+
* Get full engine statistics as JSON.
|
|
45
154
|
*/
|
|
46
155
|
stats(): any;
|
|
47
156
|
}
|
package/entroly_wasm.js
CHANGED
|
@@ -12,11 +12,106 @@ class WasmEntrolyEngine {
|
|
|
12
12
|
wasm.__wbg_wasmentrolyengine_free(ptr, 0);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
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.
|
|
16
71
|
*/
|
|
17
72
|
clear() {
|
|
18
73
|
wasm.wasmentrolyengine_clear(this.__wbg_ptr);
|
|
19
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
|
+
}
|
|
20
115
|
/**
|
|
21
116
|
* Get fragment count.
|
|
22
117
|
* @returns {number}
|
|
@@ -25,20 +120,50 @@ class WasmEntrolyEngine {
|
|
|
25
120
|
const ret = wasm.wasmentrolyengine_fragment_count(this.__wbg_ptr);
|
|
26
121
|
return ret >>> 0;
|
|
27
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
|
+
}
|
|
28
154
|
/**
|
|
29
155
|
* Ingest a context fragment into the engine.
|
|
30
|
-
*
|
|
31
|
-
* Returns a JSON object with fragment metadata.
|
|
32
|
-
* @param {string} source
|
|
156
|
+
* Pipeline: tokens → SimHash → dedup → entropy → criticality → depgraph → store
|
|
33
157
|
* @param {string} content
|
|
158
|
+
* @param {string} source
|
|
34
159
|
* @param {number} token_count
|
|
35
160
|
* @param {boolean} is_pinned
|
|
36
161
|
* @returns {any}
|
|
37
162
|
*/
|
|
38
|
-
ingest(
|
|
39
|
-
const ptr0 = passStringToWasm0(
|
|
163
|
+
ingest(content, source, token_count, is_pinned) {
|
|
164
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
40
165
|
const len0 = WASM_VECTOR_LEN;
|
|
41
|
-
const ptr1 = passStringToWasm0(
|
|
166
|
+
const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
42
167
|
const len1 = WASM_VECTOR_LEN;
|
|
43
168
|
const ret = wasm.wasmentrolyengine_ingest(this.__wbg_ptr, ptr0, len0, ptr1, len1, token_count, is_pinned);
|
|
44
169
|
return ret;
|
|
@@ -53,9 +178,7 @@ class WasmEntrolyEngine {
|
|
|
53
178
|
return this;
|
|
54
179
|
}
|
|
55
180
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* Returns a JSON object with selected fragments.
|
|
181
|
+
* Full optimization pipeline: IOS + PRISM + Channel Coding + Resonance + Causal.
|
|
59
182
|
* @param {number} token_budget
|
|
60
183
|
* @param {string} query
|
|
61
184
|
* @returns {any}
|
|
@@ -67,16 +190,52 @@ class WasmEntrolyEngine {
|
|
|
67
190
|
return ret;
|
|
68
191
|
}
|
|
69
192
|
/**
|
|
70
|
-
*
|
|
193
|
+
* Query manifold stats.
|
|
194
|
+
* @returns {any}
|
|
71
195
|
*/
|
|
72
|
-
|
|
73
|
-
wasm.
|
|
196
|
+
query_manifold_stats() {
|
|
197
|
+
const ret = wasm.wasmentrolyengine_query_manifold_stats(this.__wbg_ptr);
|
|
198
|
+
return ret;
|
|
74
199
|
}
|
|
75
200
|
/**
|
|
76
|
-
*
|
|
201
|
+
* Semantic recall of relevant fragments.
|
|
202
|
+
* @param {string} query
|
|
203
|
+
* @param {number} top_k
|
|
204
|
+
* @returns {any}
|
|
77
205
|
*/
|
|
78
|
-
|
|
79
|
-
wasm.
|
|
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);
|
|
80
239
|
}
|
|
81
240
|
/**
|
|
82
241
|
* Remove a fragment by ID.
|
|
@@ -90,7 +249,92 @@ class WasmEntrolyEngine {
|
|
|
90
249
|
return ret !== 0;
|
|
91
250
|
}
|
|
92
251
|
/**
|
|
93
|
-
*
|
|
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.
|
|
94
338
|
* @returns {any}
|
|
95
339
|
*/
|
|
96
340
|
stats() {
|
|
@@ -104,59 +348,13 @@ exports.WasmEntrolyEngine = WasmEntrolyEngine;
|
|
|
104
348
|
function __wbg_get_imports() {
|
|
105
349
|
const import0 = {
|
|
106
350
|
__proto__: null,
|
|
107
|
-
__wbg_Error_2e59b1b37a9a34c3: function(arg0, arg1) {
|
|
108
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
109
|
-
return ret;
|
|
110
|
-
},
|
|
111
|
-
__wbg___wbindgen_is_string_b29b5c5a8065ba1a: function(arg0) {
|
|
112
|
-
const ret = typeof(arg0) === 'string';
|
|
113
|
-
return ret;
|
|
114
|
-
},
|
|
115
351
|
__wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
|
|
116
352
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
117
353
|
},
|
|
118
|
-
|
|
119
|
-
const ret =
|
|
120
|
-
return ret;
|
|
121
|
-
},
|
|
122
|
-
__wbg_new_99cabae501c0a8a0: function() {
|
|
123
|
-
const ret = new Map();
|
|
124
|
-
return ret;
|
|
125
|
-
},
|
|
126
|
-
__wbg_new_f3c9df4f38f3f798: function() {
|
|
127
|
-
const ret = new Array();
|
|
128
|
-
return ret;
|
|
129
|
-
},
|
|
130
|
-
__wbg_set_08463b1df38a7e29: function(arg0, arg1, arg2) {
|
|
131
|
-
const ret = arg0.set(arg1, arg2);
|
|
132
|
-
return ret;
|
|
133
|
-
},
|
|
134
|
-
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
135
|
-
arg0[arg1] = arg2;
|
|
136
|
-
},
|
|
137
|
-
__wbg_set_6c60b2e8ad0e9383: function(arg0, arg1, arg2) {
|
|
138
|
-
arg0[arg1 >>> 0] = arg2;
|
|
139
|
-
},
|
|
140
|
-
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
141
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
142
|
-
const ret = arg0;
|
|
143
|
-
return ret;
|
|
144
|
-
},
|
|
145
|
-
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
146
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
147
|
-
const ret = arg0;
|
|
354
|
+
__wbg_parse_545d11396395fbbd: function() { return handleError(function (arg0, arg1) {
|
|
355
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
148
356
|
return ret;
|
|
149
|
-
},
|
|
150
|
-
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
151
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
152
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
153
|
-
return ret;
|
|
154
|
-
},
|
|
155
|
-
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
156
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
157
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
158
|
-
return ret;
|
|
159
|
-
},
|
|
357
|
+
}, arguments); },
|
|
160
358
|
__wbindgen_init_externref_table: function() {
|
|
161
359
|
const table = wasm.__wbindgen_externrefs;
|
|
162
360
|
const offset = table.grow(4);
|
|
@@ -177,6 +375,12 @@ const WasmEntrolyEngineFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
177
375
|
? { register: () => {}, unregister: () => {} }
|
|
178
376
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmentrolyengine_free(ptr >>> 0, 1));
|
|
179
377
|
|
|
378
|
+
function addToExternrefTable0(obj) {
|
|
379
|
+
const idx = wasm.__externref_table_alloc();
|
|
380
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
381
|
+
return idx;
|
|
382
|
+
}
|
|
383
|
+
|
|
180
384
|
function getStringFromWasm0(ptr, len) {
|
|
181
385
|
ptr = ptr >>> 0;
|
|
182
386
|
return decodeText(ptr, len);
|
|
@@ -190,6 +394,15 @@ function getUint8ArrayMemory0() {
|
|
|
190
394
|
return cachedUint8ArrayMemory0;
|
|
191
395
|
}
|
|
192
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
|
+
|
|
193
406
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
194
407
|
if (realloc === undefined) {
|
|
195
408
|
const buf = cachedTextEncoder.encode(arg);
|
package/entroly_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "entroly",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://github.com/juyterman1000/entroly"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [
|
|
11
|
-
"ai",
|
|
12
|
-
"llm",
|
|
13
|
-
"context-window",
|
|
14
|
-
"token-optimization",
|
|
15
|
-
"entropy",
|
|
16
|
-
"knapsack",
|
|
17
|
-
"wasm",
|
|
18
|
-
"webassembly",
|
|
19
|
-
"cursor",
|
|
20
|
-
"copilot",
|
|
21
|
-
"claude",
|
|
22
|
-
"code-assistant"
|
|
23
|
-
],
|
|
3
|
+
"description": "WebAssembly build of Entroly — information-theoretic context optimization for JavaScript/TypeScript",
|
|
4
|
+
"version": "0.15.0",
|
|
24
5
|
"files": [
|
|
25
6
|
"entroly_wasm_bg.wasm",
|
|
26
7
|
"entroly_wasm.js",
|
|
27
|
-
"entroly_wasm.d.ts"
|
|
28
|
-
"entroly_wasm_bg.wasm.d.ts"
|
|
8
|
+
"entroly_wasm.d.ts"
|
|
29
9
|
],
|
|
30
10
|
"main": "entroly_wasm.js",
|
|
31
11
|
"types": "entroly_wasm.d.ts"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const __wbg_wasmentrolyengine_free: (a: number, b: number) => void;
|
|
5
|
-
export const wasmentrolyengine_clear: (a: number) => void;
|
|
6
|
-
export const wasmentrolyengine_fragment_count: (a: number) => number;
|
|
7
|
-
export const wasmentrolyengine_ingest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
8
|
-
export const wasmentrolyengine_new: () => number;
|
|
9
|
-
export const wasmentrolyengine_optimize: (a: number, b: number, c: number, d: number) => any;
|
|
10
|
-
export const wasmentrolyengine_record_failure: (a: number) => void;
|
|
11
|
-
export const wasmentrolyengine_record_success: (a: number) => void;
|
|
12
|
-
export const wasmentrolyengine_remove: (a: number, b: number, c: number) => number;
|
|
13
|
-
export const wasmentrolyengine_stats: (a: number) => any;
|
|
14
|
-
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
|
-
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
|
-
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
|
-
export const __wbindgen_start: () => void;
|