@laxture/vibe-pm 0.1.0 → 0.1.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/dist/tui/index.js CHANGED
@@ -32,751 +32,6 @@ var __toESM = (mod, isNodeMode, target) => {
32
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
33
  var __require = import.meta.require;
34
34
 
35
- // node_modules/tiktoken/tiktoken_bg.cjs
36
- var require_tiktoken_bg = __commonJS((exports, module) => {
37
- var wasm;
38
- exports.__wbg_set_wasm = function(val) {
39
- wasm = val;
40
- };
41
- var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
42
- var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
43
- cachedTextDecoder.decode();
44
- var cachedUint8ArrayMemory0 = null;
45
- function getUint8ArrayMemory0() {
46
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
47
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
48
- }
49
- return cachedUint8ArrayMemory0;
50
- }
51
- function getStringFromWasm0(ptr, len) {
52
- ptr = ptr >>> 0;
53
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
54
- }
55
- var heap = new Array(128).fill(undefined);
56
- heap.push(undefined, null, true, false);
57
- var heap_next = heap.length;
58
- function addHeapObject(obj) {
59
- if (heap_next === heap.length)
60
- heap.push(heap.length + 1);
61
- const idx = heap_next;
62
- heap_next = heap[idx];
63
- heap[idx] = obj;
64
- return idx;
65
- }
66
- function handleError(f, args) {
67
- try {
68
- return f.apply(this, args);
69
- } catch (e) {
70
- wasm.__wbindgen_export_0(addHeapObject(e));
71
- }
72
- }
73
- function getObject(idx) {
74
- return heap[idx];
75
- }
76
- function dropObject(idx) {
77
- if (idx < 132)
78
- return;
79
- heap[idx] = heap_next;
80
- heap_next = idx;
81
- }
82
- function takeObject(idx) {
83
- const ret = getObject(idx);
84
- dropObject(idx);
85
- return ret;
86
- }
87
- var WASM_VECTOR_LEN = 0;
88
- var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
89
- var cachedTextEncoder = new lTextEncoder("utf-8");
90
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
91
- return cachedTextEncoder.encodeInto(arg, view);
92
- } : function(arg, view) {
93
- const buf = cachedTextEncoder.encode(arg);
94
- view.set(buf);
95
- return {
96
- read: arg.length,
97
- written: buf.length
98
- };
99
- };
100
- function passStringToWasm0(arg, malloc, realloc) {
101
- if (realloc === undefined) {
102
- const buf = cachedTextEncoder.encode(arg);
103
- const ptr2 = malloc(buf.length, 1) >>> 0;
104
- getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
105
- WASM_VECTOR_LEN = buf.length;
106
- return ptr2;
107
- }
108
- let len = arg.length;
109
- let ptr = malloc(len, 1) >>> 0;
110
- const mem = getUint8ArrayMemory0();
111
- let offset = 0;
112
- for (;offset < len; offset++) {
113
- const code = arg.charCodeAt(offset);
114
- if (code > 127)
115
- break;
116
- mem[ptr + offset] = code;
117
- }
118
- if (offset !== len) {
119
- if (offset !== 0) {
120
- arg = arg.slice(offset);
121
- }
122
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
123
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
124
- const ret = encodeString(arg, view);
125
- offset += ret.written;
126
- ptr = realloc(ptr, len, offset, 1) >>> 0;
127
- }
128
- WASM_VECTOR_LEN = offset;
129
- return ptr;
130
- }
131
- function isLikeNone(x) {
132
- return x === undefined || x === null;
133
- }
134
- var cachedDataViewMemory0 = null;
135
- function getDataViewMemory0() {
136
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
137
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
138
- }
139
- return cachedDataViewMemory0;
140
- }
141
- var cachedUint32ArrayMemory0 = null;
142
- function getUint32ArrayMemory0() {
143
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
144
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
145
- }
146
- return cachedUint32ArrayMemory0;
147
- }
148
- function getArrayU32FromWasm0(ptr, len) {
149
- ptr = ptr >>> 0;
150
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
151
- }
152
- function passArray8ToWasm0(arg, malloc) {
153
- const ptr = malloc(arg.length * 1, 1) >>> 0;
154
- getUint8ArrayMemory0().set(arg, ptr / 1);
155
- WASM_VECTOR_LEN = arg.length;
156
- return ptr;
157
- }
158
- function passArray32ToWasm0(arg, malloc) {
159
- const ptr = malloc(arg.length * 4, 4) >>> 0;
160
- getUint32ArrayMemory0().set(arg, ptr / 4);
161
- WASM_VECTOR_LEN = arg.length;
162
- return ptr;
163
- }
164
- function getArrayU8FromWasm0(ptr, len) {
165
- ptr = ptr >>> 0;
166
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
167
- }
168
- exports.get_encoding = function(encoding, extend_special_tokens) {
169
- if (wasm == null)
170
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
171
- try {
172
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
173
- const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
174
- const len0 = WASM_VECTOR_LEN;
175
- wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
176
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
177
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
178
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
179
- if (r2) {
180
- throw takeObject(r1);
181
- }
182
- return Tiktoken.__wrap(r0);
183
- } finally {
184
- wasm.__wbindgen_add_to_stack_pointer(16);
185
- }
186
- };
187
- exports.encoding_for_model = function(model, extend_special_tokens) {
188
- if (wasm == null)
189
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
190
- try {
191
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
192
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
193
- const len0 = WASM_VECTOR_LEN;
194
- wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
195
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
196
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
197
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
198
- if (r2) {
199
- throw takeObject(r1);
200
- }
201
- return Tiktoken.__wrap(r0);
202
- } finally {
203
- wasm.__wbindgen_add_to_stack_pointer(16);
204
- }
205
- };
206
- exports.get_encoding_name_for_model = function(model) {
207
- if (wasm == null)
208
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
209
- let deferred3_0;
210
- let deferred3_1;
211
- try {
212
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
- const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
214
- const len0 = WASM_VECTOR_LEN;
215
- wasm.get_encoding_name_for_model(retptr, ptr0, len0);
216
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
217
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
218
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
219
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
220
- var ptr2 = r0;
221
- var len2 = r1;
222
- if (r3) {
223
- ptr2 = 0;
224
- len2 = 0;
225
- throw takeObject(r2);
226
- }
227
- deferred3_0 = ptr2;
228
- deferred3_1 = len2;
229
- return getStringFromWasm0(ptr2, len2);
230
- } finally {
231
- wasm.__wbindgen_add_to_stack_pointer(16);
232
- wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
233
- }
234
- };
235
- var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
236
-
237
- class Tiktoken {
238
- constructor(tiktoken_bfe, special_tokens, pat_str) {
239
- if (wasm == null)
240
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
241
- const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
242
- const len0 = WASM_VECTOR_LEN;
243
- const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
244
- const len1 = WASM_VECTOR_LEN;
245
- const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
246
- this.__wbg_ptr = ret >>> 0;
247
- TiktokenFinalization.register(this, this.__wbg_ptr, this);
248
- return this;
249
- }
250
- get name() {
251
- try {
252
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
253
- wasm.tiktoken_name(retptr, this.__wbg_ptr);
254
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
255
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
256
- let v1;
257
- if (r0 !== 0) {
258
- v1 = getStringFromWasm0(r0, r1).slice();
259
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
260
- }
261
- return v1;
262
- } finally {
263
- wasm.__wbindgen_add_to_stack_pointer(16);
264
- }
265
- }
266
- static __wrap(ptr) {
267
- ptr = ptr >>> 0;
268
- const obj = Object.create(Tiktoken.prototype);
269
- obj.__wbg_ptr = ptr;
270
- TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
271
- return obj;
272
- }
273
- __destroy_into_raw() {
274
- const ptr = this.__wbg_ptr;
275
- this.__wbg_ptr = 0;
276
- TiktokenFinalization.unregister(this);
277
- return ptr;
278
- }
279
- free() {
280
- if (wasm == null)
281
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
282
- const ptr = this.__destroy_into_raw();
283
- wasm.__wbg_tiktoken_free(ptr, 0);
284
- }
285
- encode(text, allowed_special, disallowed_special) {
286
- if (wasm == null)
287
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
288
- try {
289
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
290
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
291
- const len0 = WASM_VECTOR_LEN;
292
- wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
293
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
294
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
295
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
296
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
297
- if (r3) {
298
- throw takeObject(r2);
299
- }
300
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
301
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
302
- return v2;
303
- } finally {
304
- wasm.__wbindgen_add_to_stack_pointer(16);
305
- }
306
- }
307
- encode_ordinary(text) {
308
- if (wasm == null)
309
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
310
- try {
311
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
312
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
313
- const len0 = WASM_VECTOR_LEN;
314
- wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
315
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
316
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
317
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
318
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
319
- return v2;
320
- } finally {
321
- wasm.__wbindgen_add_to_stack_pointer(16);
322
- }
323
- }
324
- encode_with_unstable(text, allowed_special, disallowed_special) {
325
- if (wasm == null)
326
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
327
- try {
328
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
329
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
330
- const len0 = WASM_VECTOR_LEN;
331
- wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
332
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
333
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
334
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
335
- if (r2) {
336
- throw takeObject(r1);
337
- }
338
- return takeObject(r0);
339
- } finally {
340
- wasm.__wbindgen_add_to_stack_pointer(16);
341
- }
342
- }
343
- encode_single_token(bytes) {
344
- if (wasm == null)
345
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
346
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
349
- return ret >>> 0;
350
- }
351
- decode(tokens) {
352
- if (wasm == null)
353
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
354
- try {
355
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
357
- const len0 = WASM_VECTOR_LEN;
358
- wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
359
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
360
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
361
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
362
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
363
- return v2;
364
- } finally {
365
- wasm.__wbindgen_add_to_stack_pointer(16);
366
- }
367
- }
368
- decode_single_token_bytes(token) {
369
- if (wasm == null)
370
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
371
- try {
372
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
373
- wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
374
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
375
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
376
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
377
- wasm.__wbindgen_export_3(r0, r1 * 1, 1);
378
- return v1;
379
- } finally {
380
- wasm.__wbindgen_add_to_stack_pointer(16);
381
- }
382
- }
383
- token_byte_values() {
384
- if (wasm == null)
385
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
386
- const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
387
- return takeObject(ret);
388
- }
389
- }
390
- exports.Tiktoken = Tiktoken;
391
- exports.__wbg_parse_def2e24ef1252aff = function() {
392
- return handleError(function(arg0, arg1) {
393
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
394
- return addHeapObject(ret);
395
- }, arguments);
396
- };
397
- exports.__wbg_stringify_f7ed6987935b4a24 = function() {
398
- return handleError(function(arg0) {
399
- const ret = JSON.stringify(getObject(arg0));
400
- return addHeapObject(ret);
401
- }, arguments);
402
- };
403
- exports.__wbindgen_error_new = function(arg0, arg1) {
404
- const ret = new Error(getStringFromWasm0(arg0, arg1));
405
- return addHeapObject(ret);
406
- };
407
- exports.__wbindgen_is_undefined = function(arg0) {
408
- const ret = getObject(arg0) === undefined;
409
- return ret;
410
- };
411
- exports.__wbindgen_object_drop_ref = function(arg0) {
412
- takeObject(arg0);
413
- };
414
- exports.__wbindgen_string_get = function(arg0, arg1) {
415
- if (wasm == null)
416
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
417
- const obj = getObject(arg1);
418
- const ret = typeof obj === "string" ? obj : undefined;
419
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
420
- var len1 = WASM_VECTOR_LEN;
421
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
422
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
423
- };
424
- exports.__wbindgen_throw = function(arg0, arg1) {
425
- throw new Error(getStringFromWasm0(arg0, arg1));
426
- };
427
- });
428
-
429
- // node_modules/tiktoken/lite/tiktoken_bg.cjs
430
- var require_tiktoken_bg2 = __commonJS((exports, module) => {
431
- var wasm2;
432
- exports.__wbg_set_wasm = function(val) {
433
- wasm2 = val;
434
- };
435
- var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module.require)("util").TextDecoder : TextDecoder;
436
- var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
437
- cachedTextDecoder.decode();
438
- var cachedUint8ArrayMemory0 = null;
439
- function getUint8ArrayMemory0() {
440
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
441
- cachedUint8ArrayMemory0 = new Uint8Array(wasm2.memory.buffer);
442
- }
443
- return cachedUint8ArrayMemory0;
444
- }
445
- function getStringFromWasm0(ptr, len) {
446
- ptr = ptr >>> 0;
447
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
448
- }
449
- var heap = new Array(128).fill(undefined);
450
- heap.push(undefined, null, true, false);
451
- var heap_next = heap.length;
452
- function addHeapObject(obj) {
453
- if (heap_next === heap.length)
454
- heap.push(heap.length + 1);
455
- const idx = heap_next;
456
- heap_next = heap[idx];
457
- heap[idx] = obj;
458
- return idx;
459
- }
460
- function handleError(f, args) {
461
- try {
462
- return f.apply(this, args);
463
- } catch (e) {
464
- wasm2.__wbindgen_export_0(addHeapObject(e));
465
- }
466
- }
467
- function getObject(idx) {
468
- return heap[idx];
469
- }
470
- function dropObject(idx) {
471
- if (idx < 132)
472
- return;
473
- heap[idx] = heap_next;
474
- heap_next = idx;
475
- }
476
- function takeObject(idx) {
477
- const ret = getObject(idx);
478
- dropObject(idx);
479
- return ret;
480
- }
481
- var WASM_VECTOR_LEN = 0;
482
- var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module.require)("util").TextEncoder : TextEncoder;
483
- var cachedTextEncoder = new lTextEncoder("utf-8");
484
- var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
485
- return cachedTextEncoder.encodeInto(arg, view);
486
- } : function(arg, view) {
487
- const buf = cachedTextEncoder.encode(arg);
488
- view.set(buf);
489
- return {
490
- read: arg.length,
491
- written: buf.length
492
- };
493
- };
494
- function passStringToWasm0(arg, malloc, realloc) {
495
- if (realloc === undefined) {
496
- const buf = cachedTextEncoder.encode(arg);
497
- const ptr2 = malloc(buf.length, 1) >>> 0;
498
- getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
499
- WASM_VECTOR_LEN = buf.length;
500
- return ptr2;
501
- }
502
- let len = arg.length;
503
- let ptr = malloc(len, 1) >>> 0;
504
- const mem = getUint8ArrayMemory0();
505
- let offset = 0;
506
- for (;offset < len; offset++) {
507
- const code = arg.charCodeAt(offset);
508
- if (code > 127)
509
- break;
510
- mem[ptr + offset] = code;
511
- }
512
- if (offset !== len) {
513
- if (offset !== 0) {
514
- arg = arg.slice(offset);
515
- }
516
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
517
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
518
- const ret = encodeString(arg, view);
519
- offset += ret.written;
520
- ptr = realloc(ptr, len, offset, 1) >>> 0;
521
- }
522
- WASM_VECTOR_LEN = offset;
523
- return ptr;
524
- }
525
- function isLikeNone(x) {
526
- return x === undefined || x === null;
527
- }
528
- var cachedDataViewMemory0 = null;
529
- function getDataViewMemory0() {
530
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm2.memory.buffer) {
531
- cachedDataViewMemory0 = new DataView(wasm2.memory.buffer);
532
- }
533
- return cachedDataViewMemory0;
534
- }
535
- var cachedUint32ArrayMemory0 = null;
536
- function getUint32ArrayMemory0() {
537
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
538
- cachedUint32ArrayMemory0 = new Uint32Array(wasm2.memory.buffer);
539
- }
540
- return cachedUint32ArrayMemory0;
541
- }
542
- function getArrayU32FromWasm0(ptr, len) {
543
- ptr = ptr >>> 0;
544
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
545
- }
546
- function passArray8ToWasm0(arg, malloc) {
547
- const ptr = malloc(arg.length * 1, 1) >>> 0;
548
- getUint8ArrayMemory0().set(arg, ptr / 1);
549
- WASM_VECTOR_LEN = arg.length;
550
- return ptr;
551
- }
552
- function passArray32ToWasm0(arg, malloc) {
553
- const ptr = malloc(arg.length * 4, 4) >>> 0;
554
- getUint32ArrayMemory0().set(arg, ptr / 4);
555
- WASM_VECTOR_LEN = arg.length;
556
- return ptr;
557
- }
558
- function getArrayU8FromWasm0(ptr, len) {
559
- ptr = ptr >>> 0;
560
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
561
- }
562
- var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {}, unregister: () => {} } : new FinalizationRegistry((ptr) => wasm2.__wbg_tiktoken_free(ptr >>> 0, 1));
563
-
564
- class Tiktoken {
565
- constructor(tiktoken_bfe, special_tokens, pat_str) {
566
- if (wasm2 == null)
567
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
568
- const ptr0 = passStringToWasm0(tiktoken_bfe, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
569
- const len0 = WASM_VECTOR_LEN;
570
- const ptr1 = passStringToWasm0(pat_str, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
571
- const len1 = WASM_VECTOR_LEN;
572
- const ret = wasm2.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
573
- this.__wbg_ptr = ret >>> 0;
574
- TiktokenFinalization.register(this, this.__wbg_ptr, this);
575
- return this;
576
- }
577
- get name() {
578
- try {
579
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
580
- wasm2.tiktoken_name(retptr, this.__wbg_ptr);
581
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
582
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
583
- let v1;
584
- if (r0 !== 0) {
585
- v1 = getStringFromWasm0(r0, r1).slice();
586
- wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
587
- }
588
- return v1;
589
- } finally {
590
- wasm2.__wbindgen_add_to_stack_pointer(16);
591
- }
592
- }
593
- __destroy_into_raw() {
594
- const ptr = this.__wbg_ptr;
595
- this.__wbg_ptr = 0;
596
- TiktokenFinalization.unregister(this);
597
- return ptr;
598
- }
599
- free() {
600
- if (wasm2 == null)
601
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
602
- const ptr = this.__destroy_into_raw();
603
- wasm2.__wbg_tiktoken_free(ptr, 0);
604
- }
605
- encode(text, allowed_special, disallowed_special) {
606
- if (wasm2 == null)
607
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
608
- try {
609
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
610
- const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
611
- const len0 = WASM_VECTOR_LEN;
612
- wasm2.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
613
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
614
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
615
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
616
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
617
- if (r3) {
618
- throw takeObject(r2);
619
- }
620
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
621
- wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
622
- return v2;
623
- } finally {
624
- wasm2.__wbindgen_add_to_stack_pointer(16);
625
- }
626
- }
627
- encode_ordinary(text) {
628
- if (wasm2 == null)
629
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
630
- try {
631
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
632
- const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
633
- const len0 = WASM_VECTOR_LEN;
634
- wasm2.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
635
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
636
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
637
- var v2 = getArrayU32FromWasm0(r0, r1).slice();
638
- wasm2.__wbindgen_export_3(r0, r1 * 4, 4);
639
- return v2;
640
- } finally {
641
- wasm2.__wbindgen_add_to_stack_pointer(16);
642
- }
643
- }
644
- encode_with_unstable(text, allowed_special, disallowed_special) {
645
- if (wasm2 == null)
646
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
647
- try {
648
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
649
- const ptr0 = passStringToWasm0(text, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
650
- const len0 = WASM_VECTOR_LEN;
651
- wasm2.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
652
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
653
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
654
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
655
- if (r2) {
656
- throw takeObject(r1);
657
- }
658
- return takeObject(r0);
659
- } finally {
660
- wasm2.__wbindgen_add_to_stack_pointer(16);
661
- }
662
- }
663
- encode_single_token(bytes2) {
664
- if (wasm2 == null)
665
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
666
- const ptr0 = passArray8ToWasm0(bytes2, wasm2.__wbindgen_export_1);
667
- const len0 = WASM_VECTOR_LEN;
668
- const ret = wasm2.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
669
- return ret >>> 0;
670
- }
671
- decode(tokens) {
672
- if (wasm2 == null)
673
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
674
- try {
675
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
676
- const ptr0 = passArray32ToWasm0(tokens, wasm2.__wbindgen_export_1);
677
- const len0 = WASM_VECTOR_LEN;
678
- wasm2.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
679
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
680
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
681
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
682
- wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
683
- return v2;
684
- } finally {
685
- wasm2.__wbindgen_add_to_stack_pointer(16);
686
- }
687
- }
688
- decode_single_token_bytes(token) {
689
- if (wasm2 == null)
690
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
691
- try {
692
- const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
693
- wasm2.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
694
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
695
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
696
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
697
- wasm2.__wbindgen_export_3(r0, r1 * 1, 1);
698
- return v1;
699
- } finally {
700
- wasm2.__wbindgen_add_to_stack_pointer(16);
701
- }
702
- }
703
- token_byte_values() {
704
- if (wasm2 == null)
705
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
706
- const ret = wasm2.tiktoken_token_byte_values(this.__wbg_ptr);
707
- return takeObject(ret);
708
- }
709
- }
710
- exports.Tiktoken = Tiktoken;
711
- exports.__wbg_parse_def2e24ef1252aff = function() {
712
- return handleError(function(arg0, arg1) {
713
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
714
- return addHeapObject(ret);
715
- }, arguments);
716
- };
717
- exports.__wbg_stringify_f7ed6987935b4a24 = function() {
718
- return handleError(function(arg0) {
719
- const ret = JSON.stringify(getObject(arg0));
720
- return addHeapObject(ret);
721
- }, arguments);
722
- };
723
- exports.__wbindgen_error_new = function(arg0, arg1) {
724
- const ret = new Error(getStringFromWasm0(arg0, arg1));
725
- return addHeapObject(ret);
726
- };
727
- exports.__wbindgen_is_undefined = function(arg0) {
728
- const ret = getObject(arg0) === undefined;
729
- return ret;
730
- };
731
- exports.__wbindgen_object_drop_ref = function(arg0) {
732
- takeObject(arg0);
733
- };
734
- exports.__wbindgen_string_get = function(arg0, arg1) {
735
- if (wasm2 == null)
736
- throw new Error("tiktoken: WASM binary has not been propery initialized.");
737
- const obj = getObject(arg1);
738
- const ret = typeof obj === "string" ? obj : undefined;
739
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm2.__wbindgen_export_1, wasm2.__wbindgen_export_2);
740
- var len1 = WASM_VECTOR_LEN;
741
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
742
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
743
- };
744
- exports.__wbindgen_throw = function(arg0, arg1) {
745
- throw new Error(getStringFromWasm0(arg0, arg1));
746
- };
747
- });
748
-
749
- // node_modules/tiktoken/lite/tiktoken.cjs
750
- var require_tiktoken = __commonJS((exports) => {
751
- var __dirname = "/home/runner/work/opencode-vibe-pm/opencode-vibe-pm/node_modules/tiktoken/lite";
752
- var wasm2 = require_tiktoken_bg2();
753
- var imports2 = {};
754
- imports2["./tiktoken_bg.js"] = wasm2;
755
- var path4 = __require("path");
756
- var fs2 = __require("fs");
757
- var candidates2 = __dirname.split(path4.sep).reduce((memo, _, index, array) => {
758
- const prefix = array.slice(0, index + 1).join(path4.sep) + path4.sep;
759
- if (!prefix.includes("node_modules" + path4.sep)) {
760
- memo.unshift(path4.join(prefix, "node_modules", "tiktoken", "lite", "./tiktoken_bg.wasm"));
761
- }
762
- return memo;
763
- }, []);
764
- candidates2.unshift(path4.join(__dirname, "./tiktoken_bg.wasm"));
765
- var bytes2 = null;
766
- for (const candidate of candidates2) {
767
- try {
768
- bytes2 = fs2.readFileSync(candidate);
769
- break;
770
- } catch {}
771
- }
772
- if (bytes2 == null)
773
- throw new Error("Missing tiktoken_bg.wasm");
774
- var wasmModule2 = new WebAssembly.Module(bytes2);
775
- var wasmInstance2 = new WebAssembly.Instance(wasmModule2, imports2);
776
- wasm2.__wbg_set_wasm(wasmInstance2.exports);
777
- exports.Tiktoken = wasm2["Tiktoken"];
778
- });
779
-
780
35
  // node_modules/@anthropic-ai/tokenizer/dist/cjs/claude.json
781
36
  var require_claude = __commonJS((exports, module) => {
782
37
  module.exports = {
@@ -800,7 +55,7 @@ var require_cjs = __commonJS((exports) => {
800
55
  };
801
56
  Object.defineProperty(exports, "__esModule", { value: true });
802
57
  exports.getTokenizer = exports.countTokens = undefined;
803
- var lite_1 = require_tiktoken();
58
+ var lite_1 = __require("tiktoken/lite");
804
59
  var claude_json_1 = __importDefault(require_claude());
805
60
  function countTokens(text) {
806
61
  const tokenizer = getTokenizer();
@@ -821,8 +76,8 @@ import { createSignal as createSignal2, onCleanup } from "solid-js";
821
76
  // src/memory/memory-system.ts
822
77
  import { Database } from "bun:sqlite";
823
78
  import * as crypto from "crypto";
824
- import * as fs2 from "fs";
825
- import * as path4 from "path";
79
+ import * as fs from "fs";
80
+ import * as path3 from "path";
826
81
 
827
82
  // src/core/config.ts
828
83
  import * as path from "path";
@@ -901,44 +156,8 @@ import { tool } from "@opencode-ai/plugin";
901
156
  import * as path2 from "path";
902
157
  var TEMPLATE_DIR = "template";
903
158
  var CODING_STYLE_TEMPLATE_SUBDIR = path2.join(TEMPLATE_DIR, "_coding_style");
904
- // src/memory/errors.ts
905
- class DuplicateTaskError extends Error {
906
- constructor(sessionId) {
907
- super(`Cannot create Task: session "${sessionId}" already has an active task.`);
908
- this.name = "DuplicateTaskError";
909
- }
910
- }
911
- // node_modules/tiktoken/tiktoken.cjs
912
- var __dirname = "/home/runner/work/opencode-vibe-pm/opencode-vibe-pm/node_modules/tiktoken";
913
- var wasm = require_tiktoken_bg();
914
- var imports = {};
915
- imports["./tiktoken_bg.js"] = wasm;
916
- var path3 = __require("path");
917
- var fs = __require("fs");
918
- var candidates = __dirname.split(path3.sep).reduce((memo, _, index, array) => {
919
- const prefix = array.slice(0, index + 1).join(path3.sep) + path3.sep;
920
- if (!prefix.includes("node_modules" + path3.sep)) {
921
- memo.unshift(path3.join(prefix, "node_modules", "tiktoken", "", "./tiktoken_bg.wasm"));
922
- }
923
- return memo;
924
- }, []);
925
- candidates.unshift(path3.join(__dirname, "./tiktoken_bg.wasm"));
926
- var bytes = null;
927
- for (const candidate of candidates) {
928
- try {
929
- bytes = fs.readFileSync(candidate);
930
- break;
931
- } catch {}
932
- }
933
- if (bytes == null)
934
- throw new Error("Missing tiktoken_bg.wasm");
935
- var wasmModule = new WebAssembly.Module(bytes);
936
- var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
937
- wasm.__wbg_set_wasm(wasmInstance.exports);
938
- var $get_encoding = wasm["get_encoding"];
939
- var $encoding_for_model = wasm["encoding_for_model"];
940
- var $get_encoding_name_for_model = wasm["get_encoding_name_for_model"];
941
- var $Tiktoken = wasm["Tiktoken"];
159
+ // src/token/backends/tiktoken.ts
160
+ import { get_encoding, encoding_for_model } from "tiktoken";
942
161
 
943
162
  // src/token/backends/anthropic.ts
944
163
  var import_tokenizer = __toESM(require_cjs(), 1);
@@ -1086,12 +305,12 @@ class LlamaTokenizer {
1086
305
  if (this.vocabByString.has(c)) {
1087
306
  tokenIds.push(this.vocabByString.get(c));
1088
307
  } else {
1089
- const bytes2 = this.utf8Encoder.encode(c);
1090
- for (let j = 0;j < bytes2.length; j++) {
1091
- const hex = this.vocabByString.get(utf8ByteToHex(bytes2[j]));
308
+ const bytes = this.utf8Encoder.encode(c);
309
+ for (let j = 0;j < bytes.length; j++) {
310
+ const hex = this.vocabByString.get(utf8ByteToHex(bytes[j]));
1092
311
  tokenIds.push(hex);
1093
312
  if (!(hex >= 0)) {
1094
- console.log("Encountered unknown character " + c + " (partial UTF-8 byte " + bytes2[j] + " + hex + " + utf8ByteToHex(bytes2[j]) + ")");
313
+ console.log("Encountered unknown character " + c + " (partial UTF-8 byte " + bytes[j] + " + hex + " + utf8ByteToHex(bytes[j]) + ")");
1095
314
  tokenIds[tokenIds.length - 1] = 0;
1096
315
  }
1097
316
  }
@@ -2189,6 +1408,14 @@ var llama3Tokenizer = new Llama3Tokenizer;
2189
1408
  if (typeof window !== "undefined") {
2190
1409
  window.llama3Tokenizer = llama3Tokenizer;
2191
1410
  }
1411
+ // src/memory/errors.ts
1412
+ class DuplicateTaskError extends Error {
1413
+ constructor(sessionId) {
1414
+ super(`Cannot create Task: session "${sessionId}" already has an active task.`);
1415
+ this.name = "DuplicateTaskError";
1416
+ }
1417
+ }
1418
+
2192
1419
  // src/memory/memory-system.ts
2193
1420
  function generateId() {
2194
1421
  return crypto.randomUUID();
@@ -2211,7 +1438,7 @@ function prefixKeys(params) {
2211
1438
  return out;
2212
1439
  }
2213
1440
 
2214
- class MemorySystem {
1441
+ class MemorySystem2 {
2215
1442
  db;
2216
1443
  stmtInsertTask;
2217
1444
  stmtGetTaskBySession;
@@ -2241,7 +1468,7 @@ class MemorySystem {
2241
1468
  async init(dataDir) {
2242
1469
  this.db?.close();
2243
1470
  const dbPath = `${dataDir}/vibe-pm.db`;
2244
- fs2.mkdirSync(path4.dirname(dbPath), { recursive: true });
1471
+ fs.mkdirSync(path3.dirname(dbPath), { recursive: true });
2245
1472
  this.db = new Database(dbPath, { create: true });
2246
1473
  this.db.run("PRAGMA journal_mode = WAL");
2247
1474
  for (const stmt of `
@@ -2741,7 +1968,6 @@ class MemorySystem {
2741
1968
  };
2742
1969
  }
2743
1970
  }
2744
-
2745
1971
  // src/tui/types.ts
2746
1972
  import { RGBA } from "@opentui/core";
2747
1973
  var SOURCE_COLORS = {
@@ -3228,7 +2454,7 @@ function createTuiPlugin() {
3228
2454
  try {
3229
2455
  const projectDir = api.state.path.directory ?? ".";
3230
2456
  const dd = `${projectDir}/.vibe-pm`;
3231
- const ms = new MemorySystem;
2457
+ const ms = new MemorySystem2;
3232
2458
  await ms.init(dd);
3233
2459
  console.error(`[vibe-pm] TUI created MemorySystem, dataDir=${dd}`);
3234
2460
  console.error("[vibe-pm] TUI ready");