@agengine/runtime 1.0.6 → 1.0.7
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/index.js +2 -461
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -29171,472 +29171,13 @@ var require_zod_utils = __commonJS({
|
|
|
29171
29171
|
}
|
|
29172
29172
|
});
|
|
29173
29173
|
|
|
29174
|
-
// node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs
|
|
29175
|
-
var require_tiktoken_bg = __commonJS({
|
|
29176
|
-
"node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken_bg.cjs"(exports2, module2) {
|
|
29177
|
-
var wasm;
|
|
29178
|
-
module2.exports.__wbg_set_wasm = function(val) {
|
|
29179
|
-
wasm = val;
|
|
29180
|
-
};
|
|
29181
|
-
var lTextDecoder = typeof TextDecoder === "undefined" ? (0, module2.require)("util").TextDecoder : TextDecoder;
|
|
29182
|
-
var cachedTextDecoder = new lTextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
29183
|
-
cachedTextDecoder.decode();
|
|
29184
|
-
var cachedUint8ArrayMemory0 = null;
|
|
29185
|
-
function getUint8ArrayMemory0() {
|
|
29186
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
29187
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
29188
|
-
}
|
|
29189
|
-
return cachedUint8ArrayMemory0;
|
|
29190
|
-
}
|
|
29191
|
-
function getStringFromWasm0(ptr, len) {
|
|
29192
|
-
ptr = ptr >>> 0;
|
|
29193
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
29194
|
-
}
|
|
29195
|
-
var heap = new Array(128).fill(void 0);
|
|
29196
|
-
heap.push(void 0, null, true, false);
|
|
29197
|
-
var heap_next = heap.length;
|
|
29198
|
-
function addHeapObject(obj) {
|
|
29199
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
29200
|
-
const idx2 = heap_next;
|
|
29201
|
-
heap_next = heap[idx2];
|
|
29202
|
-
heap[idx2] = obj;
|
|
29203
|
-
return idx2;
|
|
29204
|
-
}
|
|
29205
|
-
function handleError(f3, args) {
|
|
29206
|
-
try {
|
|
29207
|
-
return f3.apply(this, args);
|
|
29208
|
-
} catch (e2) {
|
|
29209
|
-
wasm.__wbindgen_export_0(addHeapObject(e2));
|
|
29210
|
-
}
|
|
29211
|
-
}
|
|
29212
|
-
function getObject(idx2) {
|
|
29213
|
-
return heap[idx2];
|
|
29214
|
-
}
|
|
29215
|
-
function dropObject(idx2) {
|
|
29216
|
-
if (idx2 < 132) return;
|
|
29217
|
-
heap[idx2] = heap_next;
|
|
29218
|
-
heap_next = idx2;
|
|
29219
|
-
}
|
|
29220
|
-
function takeObject(idx2) {
|
|
29221
|
-
const ret = getObject(idx2);
|
|
29222
|
-
dropObject(idx2);
|
|
29223
|
-
return ret;
|
|
29224
|
-
}
|
|
29225
|
-
var WASM_VECTOR_LEN = 0;
|
|
29226
|
-
var lTextEncoder = typeof TextEncoder === "undefined" ? (0, module2.require)("util").TextEncoder : TextEncoder;
|
|
29227
|
-
var cachedTextEncoder = new lTextEncoder("utf-8");
|
|
29228
|
-
var encodeString = typeof cachedTextEncoder.encodeInto === "function" ? function(arg, view) {
|
|
29229
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
29230
|
-
} : function(arg, view) {
|
|
29231
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
29232
|
-
view.set(buf);
|
|
29233
|
-
return {
|
|
29234
|
-
read: arg.length,
|
|
29235
|
-
written: buf.length
|
|
29236
|
-
};
|
|
29237
|
-
};
|
|
29238
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
29239
|
-
if (realloc === void 0) {
|
|
29240
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
29241
|
-
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
29242
|
-
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
29243
|
-
WASM_VECTOR_LEN = buf.length;
|
|
29244
|
-
return ptr2;
|
|
29245
|
-
}
|
|
29246
|
-
let len = arg.length;
|
|
29247
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
29248
|
-
const mem = getUint8ArrayMemory0();
|
|
29249
|
-
let offset = 0;
|
|
29250
|
-
for (; offset < len; offset++) {
|
|
29251
|
-
const code3 = arg.charCodeAt(offset);
|
|
29252
|
-
if (code3 > 127) break;
|
|
29253
|
-
mem[ptr + offset] = code3;
|
|
29254
|
-
}
|
|
29255
|
-
if (offset !== len) {
|
|
29256
|
-
if (offset !== 0) {
|
|
29257
|
-
arg = arg.slice(offset);
|
|
29258
|
-
}
|
|
29259
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
29260
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
29261
|
-
const ret = encodeString(arg, view);
|
|
29262
|
-
offset += ret.written;
|
|
29263
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
29264
|
-
}
|
|
29265
|
-
WASM_VECTOR_LEN = offset;
|
|
29266
|
-
return ptr;
|
|
29267
|
-
}
|
|
29268
|
-
function isLikeNone(x3) {
|
|
29269
|
-
return x3 === void 0 || x3 === null;
|
|
29270
|
-
}
|
|
29271
|
-
var cachedDataViewMemory0 = null;
|
|
29272
|
-
function getDataViewMemory0() {
|
|
29273
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
29274
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
29275
|
-
}
|
|
29276
|
-
return cachedDataViewMemory0;
|
|
29277
|
-
}
|
|
29278
|
-
var cachedUint32ArrayMemory0 = null;
|
|
29279
|
-
function getUint32ArrayMemory0() {
|
|
29280
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
29281
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
29282
|
-
}
|
|
29283
|
-
return cachedUint32ArrayMemory0;
|
|
29284
|
-
}
|
|
29285
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
29286
|
-
ptr = ptr >>> 0;
|
|
29287
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
29288
|
-
}
|
|
29289
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
29290
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
29291
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
29292
|
-
WASM_VECTOR_LEN = arg.length;
|
|
29293
|
-
return ptr;
|
|
29294
|
-
}
|
|
29295
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
29296
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
29297
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
29298
|
-
WASM_VECTOR_LEN = arg.length;
|
|
29299
|
-
return ptr;
|
|
29300
|
-
}
|
|
29301
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
29302
|
-
ptr = ptr >>> 0;
|
|
29303
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
29304
|
-
}
|
|
29305
|
-
module2.exports.get_encoding = function(encoding, extend_special_tokens) {
|
|
29306
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29307
|
-
try {
|
|
29308
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29309
|
-
const ptr0 = passStringToWasm0(encoding, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29310
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29311
|
-
wasm.get_encoding(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
29312
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29313
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29314
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
29315
|
-
if (r2) {
|
|
29316
|
-
throw takeObject(r1);
|
|
29317
|
-
}
|
|
29318
|
-
return Tiktoken.__wrap(r0);
|
|
29319
|
-
} finally {
|
|
29320
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29321
|
-
}
|
|
29322
|
-
};
|
|
29323
|
-
module2.exports.encoding_for_model = function(model, extend_special_tokens) {
|
|
29324
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29325
|
-
try {
|
|
29326
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29327
|
-
const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29328
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29329
|
-
wasm.encoding_for_model(retptr, ptr0, len0, addHeapObject(extend_special_tokens));
|
|
29330
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29331
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29332
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
29333
|
-
if (r2) {
|
|
29334
|
-
throw takeObject(r1);
|
|
29335
|
-
}
|
|
29336
|
-
return Tiktoken.__wrap(r0);
|
|
29337
|
-
} finally {
|
|
29338
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29339
|
-
}
|
|
29340
|
-
};
|
|
29341
|
-
module2.exports.get_encoding_name_for_model = function(model) {
|
|
29342
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29343
|
-
let deferred3_0;
|
|
29344
|
-
let deferred3_1;
|
|
29345
|
-
try {
|
|
29346
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29347
|
-
const ptr0 = passStringToWasm0(model, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29348
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29349
|
-
wasm.get_encoding_name_for_model(retptr, ptr0, len0);
|
|
29350
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29351
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29352
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
29353
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
29354
|
-
var ptr2 = r0;
|
|
29355
|
-
var len2 = r1;
|
|
29356
|
-
if (r3) {
|
|
29357
|
-
ptr2 = 0;
|
|
29358
|
-
len2 = 0;
|
|
29359
|
-
throw takeObject(r2);
|
|
29360
|
-
}
|
|
29361
|
-
deferred3_0 = ptr2;
|
|
29362
|
-
deferred3_1 = len2;
|
|
29363
|
-
return getStringFromWasm0(ptr2, len2);
|
|
29364
|
-
} finally {
|
|
29365
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29366
|
-
wasm.__wbindgen_export_3(deferred3_0, deferred3_1, 1);
|
|
29367
|
-
}
|
|
29368
|
-
};
|
|
29369
|
-
var TiktokenFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
29370
|
-
}, unregister: () => {
|
|
29371
|
-
} } : new FinalizationRegistry((ptr) => wasm.__wbg_tiktoken_free(ptr >>> 0, 1));
|
|
29372
|
-
var Tiktoken = class _Tiktoken {
|
|
29373
|
-
/**
|
|
29374
|
-
* @param {string} tiktoken_bfe
|
|
29375
|
-
* @param {any} special_tokens
|
|
29376
|
-
* @param {string} pat_str
|
|
29377
|
-
*/
|
|
29378
|
-
constructor(tiktoken_bfe, special_tokens, pat_str) {
|
|
29379
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29380
|
-
const ptr0 = passStringToWasm0(tiktoken_bfe, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29381
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29382
|
-
const ptr1 = passStringToWasm0(pat_str, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29383
|
-
const len1 = WASM_VECTOR_LEN;
|
|
29384
|
-
const ret = wasm.tiktoken_new(ptr0, len0, addHeapObject(special_tokens), ptr1, len1);
|
|
29385
|
-
this.__wbg_ptr = ret >>> 0;
|
|
29386
|
-
TiktokenFinalization.register(this, this.__wbg_ptr, this);
|
|
29387
|
-
return this;
|
|
29388
|
-
}
|
|
29389
|
-
/** @returns {string | undefined} */
|
|
29390
|
-
get name() {
|
|
29391
|
-
try {
|
|
29392
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29393
|
-
wasm.tiktoken_name(retptr, this.__wbg_ptr);
|
|
29394
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29395
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29396
|
-
let v1;
|
|
29397
|
-
if (r0 !== 0) {
|
|
29398
|
-
v1 = getStringFromWasm0(r0, r1).slice();
|
|
29399
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
29400
|
-
}
|
|
29401
|
-
return v1;
|
|
29402
|
-
} finally {
|
|
29403
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29404
|
-
}
|
|
29405
|
-
}
|
|
29406
|
-
static __wrap(ptr) {
|
|
29407
|
-
ptr = ptr >>> 0;
|
|
29408
|
-
const obj = Object.create(_Tiktoken.prototype);
|
|
29409
|
-
obj.__wbg_ptr = ptr;
|
|
29410
|
-
TiktokenFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
29411
|
-
return obj;
|
|
29412
|
-
}
|
|
29413
|
-
__destroy_into_raw() {
|
|
29414
|
-
const ptr = this.__wbg_ptr;
|
|
29415
|
-
this.__wbg_ptr = 0;
|
|
29416
|
-
TiktokenFinalization.unregister(this);
|
|
29417
|
-
return ptr;
|
|
29418
|
-
}
|
|
29419
|
-
free() {
|
|
29420
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29421
|
-
const ptr = this.__destroy_into_raw();
|
|
29422
|
-
wasm.__wbg_tiktoken_free(ptr, 0);
|
|
29423
|
-
}
|
|
29424
|
-
/**
|
|
29425
|
-
* @param {string} text
|
|
29426
|
-
* @param {any} allowed_special
|
|
29427
|
-
* @param {any} disallowed_special
|
|
29428
|
-
* @returns {Uint32Array}
|
|
29429
|
-
*/
|
|
29430
|
-
encode(text4, allowed_special, disallowed_special) {
|
|
29431
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29432
|
-
try {
|
|
29433
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29434
|
-
const ptr0 = passStringToWasm0(text4, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29435
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29436
|
-
wasm.tiktoken_encode(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
29437
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29438
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29439
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
29440
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
29441
|
-
if (r3) {
|
|
29442
|
-
throw takeObject(r2);
|
|
29443
|
-
}
|
|
29444
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
29445
|
-
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
29446
|
-
return v2;
|
|
29447
|
-
} finally {
|
|
29448
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29449
|
-
}
|
|
29450
|
-
}
|
|
29451
|
-
/**
|
|
29452
|
-
* @param {string} text
|
|
29453
|
-
* @returns {Uint32Array}
|
|
29454
|
-
*/
|
|
29455
|
-
encode_ordinary(text4) {
|
|
29456
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29457
|
-
try {
|
|
29458
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29459
|
-
const ptr0 = passStringToWasm0(text4, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29460
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29461
|
-
wasm.tiktoken_encode_ordinary(retptr, this.__wbg_ptr, ptr0, len0);
|
|
29462
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29463
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29464
|
-
var v2 = getArrayU32FromWasm0(r0, r1).slice();
|
|
29465
|
-
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
29466
|
-
return v2;
|
|
29467
|
-
} finally {
|
|
29468
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29469
|
-
}
|
|
29470
|
-
}
|
|
29471
|
-
/**
|
|
29472
|
-
* @param {string} text
|
|
29473
|
-
* @param {any} allowed_special
|
|
29474
|
-
* @param {any} disallowed_special
|
|
29475
|
-
* @returns {any}
|
|
29476
|
-
*/
|
|
29477
|
-
encode_with_unstable(text4, allowed_special, disallowed_special) {
|
|
29478
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29479
|
-
try {
|
|
29480
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29481
|
-
const ptr0 = passStringToWasm0(text4, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29482
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29483
|
-
wasm.tiktoken_encode_with_unstable(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(allowed_special), addHeapObject(disallowed_special));
|
|
29484
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29485
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29486
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
29487
|
-
if (r2) {
|
|
29488
|
-
throw takeObject(r1);
|
|
29489
|
-
}
|
|
29490
|
-
return takeObject(r0);
|
|
29491
|
-
} finally {
|
|
29492
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29493
|
-
}
|
|
29494
|
-
}
|
|
29495
|
-
/**
|
|
29496
|
-
* @param {Uint8Array} bytes
|
|
29497
|
-
* @returns {number}
|
|
29498
|
-
*/
|
|
29499
|
-
encode_single_token(bytes) {
|
|
29500
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29501
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export_1);
|
|
29502
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29503
|
-
const ret = wasm.tiktoken_encode_single_token(this.__wbg_ptr, ptr0, len0);
|
|
29504
|
-
return ret >>> 0;
|
|
29505
|
-
}
|
|
29506
|
-
/**
|
|
29507
|
-
* @param {Uint32Array} tokens
|
|
29508
|
-
* @returns {Uint8Array}
|
|
29509
|
-
*/
|
|
29510
|
-
decode(tokens) {
|
|
29511
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29512
|
-
try {
|
|
29513
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29514
|
-
const ptr0 = passArray32ToWasm0(tokens, wasm.__wbindgen_export_1);
|
|
29515
|
-
const len0 = WASM_VECTOR_LEN;
|
|
29516
|
-
wasm.tiktoken_decode(retptr, this.__wbg_ptr, ptr0, len0);
|
|
29517
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29518
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29519
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
29520
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
29521
|
-
return v2;
|
|
29522
|
-
} finally {
|
|
29523
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29524
|
-
}
|
|
29525
|
-
}
|
|
29526
|
-
/**
|
|
29527
|
-
* @param {number} token
|
|
29528
|
-
* @returns {Uint8Array}
|
|
29529
|
-
*/
|
|
29530
|
-
decode_single_token_bytes(token) {
|
|
29531
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29532
|
-
try {
|
|
29533
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
29534
|
-
wasm.tiktoken_decode_single_token_bytes(retptr, this.__wbg_ptr, token);
|
|
29535
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
29536
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
29537
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
29538
|
-
wasm.__wbindgen_export_3(r0, r1 * 1, 1);
|
|
29539
|
-
return v1;
|
|
29540
|
-
} finally {
|
|
29541
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
29542
|
-
}
|
|
29543
|
-
}
|
|
29544
|
-
/** @returns {any} */
|
|
29545
|
-
token_byte_values() {
|
|
29546
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29547
|
-
const ret = wasm.tiktoken_token_byte_values(this.__wbg_ptr);
|
|
29548
|
-
return takeObject(ret);
|
|
29549
|
-
}
|
|
29550
|
-
};
|
|
29551
|
-
module2.exports.Tiktoken = Tiktoken;
|
|
29552
|
-
module2.exports.__wbg_parse_def2e24ef1252aff = function() {
|
|
29553
|
-
return handleError(function(arg0, arg1) {
|
|
29554
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
29555
|
-
return addHeapObject(ret);
|
|
29556
|
-
}, arguments);
|
|
29557
|
-
};
|
|
29558
|
-
module2.exports.__wbg_stringify_f7ed6987935b4a24 = function() {
|
|
29559
|
-
return handleError(function(arg0) {
|
|
29560
|
-
const ret = JSON.stringify(getObject(arg0));
|
|
29561
|
-
return addHeapObject(ret);
|
|
29562
|
-
}, arguments);
|
|
29563
|
-
};
|
|
29564
|
-
module2.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
29565
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
29566
|
-
return addHeapObject(ret);
|
|
29567
|
-
};
|
|
29568
|
-
module2.exports.__wbindgen_is_undefined = function(arg0) {
|
|
29569
|
-
const ret = getObject(arg0) === void 0;
|
|
29570
|
-
return ret;
|
|
29571
|
-
};
|
|
29572
|
-
module2.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
29573
|
-
takeObject(arg0);
|
|
29574
|
-
};
|
|
29575
|
-
module2.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
29576
|
-
if (wasm == null) throw new Error("tiktoken: WASM binary has not been propery initialized.");
|
|
29577
|
-
const obj = getObject(arg1);
|
|
29578
|
-
const ret = typeof obj === "string" ? obj : void 0;
|
|
29579
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_1, wasm.__wbindgen_export_2);
|
|
29580
|
-
var len1 = WASM_VECTOR_LEN;
|
|
29581
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
29582
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
29583
|
-
};
|
|
29584
|
-
module2.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
29585
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
29586
|
-
};
|
|
29587
|
-
}
|
|
29588
|
-
});
|
|
29589
|
-
|
|
29590
|
-
// node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs
|
|
29591
|
-
var require_tiktoken = __commonJS({
|
|
29592
|
-
"node_modules/.pnpm/tiktoken@1.0.22/node_modules/tiktoken/tiktoken.cjs"(exports2) {
|
|
29593
|
-
var wasm = require_tiktoken_bg();
|
|
29594
|
-
var imports = {};
|
|
29595
|
-
imports["./tiktoken_bg.js"] = wasm;
|
|
29596
|
-
var path3 = require("path");
|
|
29597
|
-
var fs4 = require("fs");
|
|
29598
|
-
var candidates = __dirname.split(path3.sep).reduce((memo, _3, index5, array) => {
|
|
29599
|
-
const prefix2 = array.slice(0, index5 + 1).join(path3.sep) + path3.sep;
|
|
29600
|
-
if (!prefix2.includes("node_modules" + path3.sep)) {
|
|
29601
|
-
memo.unshift(
|
|
29602
|
-
path3.join(
|
|
29603
|
-
prefix2,
|
|
29604
|
-
"node_modules",
|
|
29605
|
-
"tiktoken",
|
|
29606
|
-
"",
|
|
29607
|
-
"./tiktoken_bg.wasm"
|
|
29608
|
-
)
|
|
29609
|
-
);
|
|
29610
|
-
}
|
|
29611
|
-
return memo;
|
|
29612
|
-
}, []);
|
|
29613
|
-
candidates.unshift(path3.join(__dirname, "./tiktoken_bg.wasm"));
|
|
29614
|
-
var bytes = null;
|
|
29615
|
-
for (const candidate of candidates) {
|
|
29616
|
-
try {
|
|
29617
|
-
bytes = fs4.readFileSync(candidate);
|
|
29618
|
-
break;
|
|
29619
|
-
} catch {
|
|
29620
|
-
}
|
|
29621
|
-
}
|
|
29622
|
-
if (bytes == null) throw new Error("Missing tiktoken_bg.wasm");
|
|
29623
|
-
var wasmModule = new WebAssembly.Module(bytes);
|
|
29624
|
-
var wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
29625
|
-
wasm.__wbg_set_wasm(wasmInstance.exports);
|
|
29626
|
-
exports2["get_encoding"] = wasm["get_encoding"];
|
|
29627
|
-
exports2["encoding_for_model"] = wasm["encoding_for_model"];
|
|
29628
|
-
exports2["get_encoding_name_for_model"] = wasm["get_encoding_name_for_model"];
|
|
29629
|
-
exports2["Tiktoken"] = wasm["Tiktoken"];
|
|
29630
|
-
}
|
|
29631
|
-
});
|
|
29632
|
-
|
|
29633
29174
|
// node_modules/.pnpm/shared-lib@file+..+..+gitrepos+html+valleyfinder+shared-lib_@anthropic-ai+sdk@0.39.0_@c_121f0616285b5642b052c00108103614/node_modules/shared-lib/node/token_utils.js
|
|
29634
29175
|
var require_token_utils = __commonJS({
|
|
29635
29176
|
"node_modules/.pnpm/shared-lib@file+..+..+gitrepos+html+valleyfinder+shared-lib_@anthropic-ai+sdk@0.39.0_@c_121f0616285b5642b052c00108103614/node_modules/shared-lib/node/token_utils.js"(exports2, module2) {
|
|
29636
29177
|
var _3 = require("lodash");
|
|
29637
29178
|
var fs4 = require("fs-extra");
|
|
29638
29179
|
var { execSync: execSync2 } = require("child_process");
|
|
29639
|
-
var tiktoken =
|
|
29180
|
+
var tiktoken = require("tiktoken");
|
|
29640
29181
|
var Log3 = { debug: console.debug, error: console.error };
|
|
29641
29182
|
exports2.count_tokens = (text4, model = "gpt-5-mini") => {
|
|
29642
29183
|
try {
|
|
@@ -29887,7 +29428,7 @@ var require_token_utils = __commonJS({
|
|
|
29887
29428
|
}
|
|
29888
29429
|
exports2.list_supported_models = async (params2) => {
|
|
29889
29430
|
try {
|
|
29890
|
-
const tiktoken2 =
|
|
29431
|
+
const tiktoken2 = require("tiktoken");
|
|
29891
29432
|
Log3.debug("tiktoken \u652F\u63F4\u7684\u6A21\u578B\u6E05\u55AE\uFF1A");
|
|
29892
29433
|
Log3.debug("================================");
|
|
29893
29434
|
const models = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agengine/runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "agentflow runtime enine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dotenv": "^17.4.2",
|
|
24
24
|
"fs-extra": "^11.3.5",
|
|
25
25
|
"jsdom": "^29.1.1",
|
|
26
|
+
"tiktoken": "^1.0.22",
|
|
26
27
|
"lodash": "^4.18.1",
|
|
27
28
|
"shared-lib": "file:/Users/jlu/gitrepos/html/valleyfinder/shared-lib",
|
|
28
29
|
"zod": "^4.4.3"
|