entroly 0.6.2

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.
@@ -0,0 +1,47 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class WasmEntrolyEngine {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ /**
8
+ * Clear all fragments.
9
+ */
10
+ clear(): void;
11
+ /**
12
+ * Get fragment count.
13
+ */
14
+ fragment_count(): number;
15
+ /**
16
+ * Ingest a context fragment into the engine.
17
+ *
18
+ * Returns a JSON object with fragment metadata.
19
+ */
20
+ ingest(source: string, content: string, token_count: number, is_pinned: boolean): any;
21
+ /**
22
+ * Create a new Entroly engine with default parameters.
23
+ */
24
+ constructor();
25
+ /**
26
+ * Optimize context selection for a given token budget and query.
27
+ *
28
+ * Returns a JSON object with selected fragments.
29
+ */
30
+ optimize(token_budget: number, query: string): any;
31
+ /**
32
+ * Record failed outcome — updates RL feedback weights.
33
+ */
34
+ record_failure(): void;
35
+ /**
36
+ * Record successful outcome — updates RL feedback weights.
37
+ */
38
+ record_success(): void;
39
+ /**
40
+ * Remove a fragment by ID.
41
+ */
42
+ remove(fragment_id: string): boolean;
43
+ /**
44
+ * Get engine statistics as JSON.
45
+ */
46
+ stats(): any;
47
+ }
@@ -0,0 +1,255 @@
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
+ * Clear all fragments.
16
+ */
17
+ clear() {
18
+ wasm.wasmentrolyengine_clear(this.__wbg_ptr);
19
+ }
20
+ /**
21
+ * Get fragment count.
22
+ * @returns {number}
23
+ */
24
+ fragment_count() {
25
+ const ret = wasm.wasmentrolyengine_fragment_count(this.__wbg_ptr);
26
+ return ret >>> 0;
27
+ }
28
+ /**
29
+ * Ingest a context fragment into the engine.
30
+ *
31
+ * Returns a JSON object with fragment metadata.
32
+ * @param {string} source
33
+ * @param {string} content
34
+ * @param {number} token_count
35
+ * @param {boolean} is_pinned
36
+ * @returns {any}
37
+ */
38
+ ingest(source, content, token_count, is_pinned) {
39
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
40
+ const len0 = WASM_VECTOR_LEN;
41
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
42
+ const len1 = WASM_VECTOR_LEN;
43
+ const ret = wasm.wasmentrolyengine_ingest(this.__wbg_ptr, ptr0, len0, ptr1, len1, token_count, is_pinned);
44
+ return ret;
45
+ }
46
+ /**
47
+ * Create a new Entroly engine with default parameters.
48
+ */
49
+ constructor() {
50
+ const ret = wasm.wasmentrolyengine_new();
51
+ this.__wbg_ptr = ret >>> 0;
52
+ WasmEntrolyEngineFinalization.register(this, this.__wbg_ptr, this);
53
+ return this;
54
+ }
55
+ /**
56
+ * Optimize context selection for a given token budget and query.
57
+ *
58
+ * Returns a JSON object with selected fragments.
59
+ * @param {number} token_budget
60
+ * @param {string} query
61
+ * @returns {any}
62
+ */
63
+ optimize(token_budget, query) {
64
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ const ret = wasm.wasmentrolyengine_optimize(this.__wbg_ptr, token_budget, ptr0, len0);
67
+ return ret;
68
+ }
69
+ /**
70
+ * Record failed outcome — updates RL feedback weights.
71
+ */
72
+ record_failure() {
73
+ wasm.wasmentrolyengine_record_failure(this.__wbg_ptr);
74
+ }
75
+ /**
76
+ * Record successful outcome — updates RL feedback weights.
77
+ */
78
+ record_success() {
79
+ wasm.wasmentrolyengine_record_success(this.__wbg_ptr);
80
+ }
81
+ /**
82
+ * Remove a fragment by ID.
83
+ * @param {string} fragment_id
84
+ * @returns {boolean}
85
+ */
86
+ remove(fragment_id) {
87
+ const ptr0 = passStringToWasm0(fragment_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len0 = WASM_VECTOR_LEN;
89
+ const ret = wasm.wasmentrolyengine_remove(this.__wbg_ptr, ptr0, len0);
90
+ return ret !== 0;
91
+ }
92
+ /**
93
+ * Get engine statistics as JSON.
94
+ * @returns {any}
95
+ */
96
+ stats() {
97
+ const ret = wasm.wasmentrolyengine_stats(this.__wbg_ptr);
98
+ return ret;
99
+ }
100
+ }
101
+ if (Symbol.dispose) WasmEntrolyEngine.prototype[Symbol.dispose] = WasmEntrolyEngine.prototype.free;
102
+ exports.WasmEntrolyEngine = WasmEntrolyEngine;
103
+
104
+ function __wbg_get_imports() {
105
+ const import0 = {
106
+ __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
+ __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
116
+ throw new Error(getStringFromWasm0(arg0, arg1));
117
+ },
118
+ __wbg_new_4f9fafbb3909af72: function() {
119
+ const ret = new Object();
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;
148
+ 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
+ },
160
+ __wbindgen_init_externref_table: function() {
161
+ const table = wasm.__wbindgen_externrefs;
162
+ const offset = table.grow(4);
163
+ table.set(0, undefined);
164
+ table.set(offset + 0, undefined);
165
+ table.set(offset + 1, null);
166
+ table.set(offset + 2, true);
167
+ table.set(offset + 3, false);
168
+ },
169
+ };
170
+ return {
171
+ __proto__: null,
172
+ "./entroly_wasm_bg.js": import0,
173
+ };
174
+ }
175
+
176
+ const WasmEntrolyEngineFinalization = (typeof FinalizationRegistry === 'undefined')
177
+ ? { register: () => {}, unregister: () => {} }
178
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmentrolyengine_free(ptr >>> 0, 1));
179
+
180
+ function getStringFromWasm0(ptr, len) {
181
+ ptr = ptr >>> 0;
182
+ return decodeText(ptr, len);
183
+ }
184
+
185
+ let cachedUint8ArrayMemory0 = null;
186
+ function getUint8ArrayMemory0() {
187
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
188
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
189
+ }
190
+ return cachedUint8ArrayMemory0;
191
+ }
192
+
193
+ function passStringToWasm0(arg, malloc, realloc) {
194
+ if (realloc === undefined) {
195
+ const buf = cachedTextEncoder.encode(arg);
196
+ const ptr = malloc(buf.length, 1) >>> 0;
197
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
198
+ WASM_VECTOR_LEN = buf.length;
199
+ return ptr;
200
+ }
201
+
202
+ let len = arg.length;
203
+ let ptr = malloc(len, 1) >>> 0;
204
+
205
+ const mem = getUint8ArrayMemory0();
206
+
207
+ let offset = 0;
208
+
209
+ for (; offset < len; offset++) {
210
+ const code = arg.charCodeAt(offset);
211
+ if (code > 0x7F) break;
212
+ mem[ptr + offset] = code;
213
+ }
214
+ if (offset !== len) {
215
+ if (offset !== 0) {
216
+ arg = arg.slice(offset);
217
+ }
218
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
219
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
220
+ const ret = cachedTextEncoder.encodeInto(arg, view);
221
+
222
+ offset += ret.written;
223
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
224
+ }
225
+
226
+ WASM_VECTOR_LEN = offset;
227
+ return ptr;
228
+ }
229
+
230
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
231
+ cachedTextDecoder.decode();
232
+ function decodeText(ptr, len) {
233
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
234
+ }
235
+
236
+ const cachedTextEncoder = new TextEncoder();
237
+
238
+ if (!('encodeInto' in cachedTextEncoder)) {
239
+ cachedTextEncoder.encodeInto = function (arg, view) {
240
+ const buf = cachedTextEncoder.encode(arg);
241
+ view.set(buf);
242
+ return {
243
+ read: arg.length,
244
+ written: buf.length
245
+ };
246
+ };
247
+ }
248
+
249
+ let WASM_VECTOR_LEN = 0;
250
+
251
+ const wasmPath = `${__dirname}/entroly_wasm_bg.wasm`;
252
+ const wasmBytes = require('fs').readFileSync(wasmPath);
253
+ const wasmModule = new WebAssembly.Module(wasmBytes);
254
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
255
+ wasm.__wbindgen_start();
Binary file
@@ -0,0 +1,17 @@
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;
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "entroly",
3
+ "version": "0.6.2",
4
+ "description": "Information-theoretic context optimization for AI coding tools. Maximizes LLM output quality while minimizing token usage — works with any codebase, any language.",
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
+ ],
24
+ "files": [
25
+ "entroly_wasm_bg.wasm",
26
+ "entroly_wasm.js",
27
+ "entroly_wasm.d.ts",
28
+ "entroly_wasm_bg.wasm.d.ts"
29
+ ],
30
+ "main": "entroly_wasm.js",
31
+ "types": "entroly_wasm.d.ts"
32
+ }