llmz 0.6.1 → 0.6.3
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/{_baseForOwn-D8-Dvy2A.js → _baseForOwn-CFhWe_W6.js} +1 -1
- package/dist/{_baseForOwn-9MK5s55q.cjs → _baseForOwn-buOZDFbK.cjs} +1 -1
- package/dist/{_baseIteratee-7Un0_Up5.cjs → _baseIteratee-CF4qP2a8.cjs} +3 -3
- package/dist/{_baseIteratee-D5Jf7fip.js → _baseIteratee-P_firB7b.js} +3 -3
- package/dist/{_getPrototype-DslcqzTw.js → _getPrototype-CG7Dxrrz.js} +1 -1
- package/dist/{_getPrototype-ClNRmwmh.cjs → _getPrototype-DQDlNVVM.cjs} +1 -1
- package/dist/{_overArg-ypvt7e2w.cjs → _overArg-C5Hy7oCi.cjs} +4 -2
- package/dist/{_overArg-BLtNSzsS.js → _overArg-CRYbj1NH.js} +4 -2
- package/dist/{component-505RuR8N.cjs → component-BwixNVH8.cjs} +2 -2
- package/dist/{component-BEupuE6R.js → component-DGG7d_Mz.js} +1 -1
- package/dist/{custom-client-CCwAr3HL.cjs → custom-client-BPmEoWKu.cjs} +10 -10
- package/dist/{custom-client-CGLO1gl2.js → custom-client-NUoxrFQh.js} +10 -10
- package/dist/{dual-modes-RFJ2wqKn.js → dual-modes-D_p-jedw.js} +17 -14
- package/dist/{dual-modes-VSvmn7CC.cjs → dual-modes-wAOAlaBS.cjs} +17 -14
- package/dist/{execute-CsMxT51Z.cjs → execute-BEaq3jkV.cjs} +7 -7
- package/dist/{execute-Cy0aokFn.js → execute-DYvFRs54.js} +6 -6
- package/dist/{exit-s7Vuu_cZ.cjs → exit-BGi0Kk0y.cjs} +8 -6
- package/dist/{exit-D8q65E62.js → exit-CDdxDBRT.js} +7 -5
- package/dist/index.cjs +20 -20
- package/dist/index.js +20 -20
- package/dist/index.workerd.js +85 -60
- package/dist/{isEmpty-C-uBEvAD.js → isEmpty-BhJRCqIF.js} +2 -2
- package/dist/{isEmpty-BRazOx0g.cjs → isEmpty-LY533Wmh.cjs} +2 -2
- package/dist/{isPlainObject-ChaHUF2F.cjs → isPlainObject-CSxXVKCk.cjs} +2 -2
- package/dist/{isPlainObject-BB1ER-H9.js → isPlainObject-D39AzPO2.js} +2 -2
- package/dist/{jsx-BQPpLyio.cjs → jsx-BWvT6ukg.cjs} +3 -3
- package/dist/{jsx-DDGNq80p.js → jsx-CIgdGGVs.js} +2 -2
- package/dist/{tool-DOS3cQkd.js → tool-CAo-BQHs.js} +29 -23
- package/dist/{tool-GH5dsFIz.cjs → tool-DdPZb0JW.cjs} +30 -24
- package/dist/{truncator-r91qJjmi.cjs → truncator-B6aaJaN1.cjs} +10 -6
- package/dist/{truncator-BRlpGJpc.js → truncator-DZqEqnpD.js} +9 -5
- package/dist/{typings-Cg4iFis8.cjs → typings-BwAz_TM9.cjs} +6 -4
- package/dist/{typings-o1oM8StG.js → typings-CrBa7Tyy.js} +5 -3
- package/dist/{uniq-BNJ4Jqjc.js → uniq-BYQ7GWwb.js} +2 -2
- package/dist/{uniq-C0m757AJ.cjs → uniq-G872RWmE.cjs} +2 -2
- package/dist/{utils-CXVukcZs.js → utils-UBeAFeEI.js} +2 -2
- package/dist/{utils-BHvQ0Rup.cjs → utils-ZpJm00ed.cjs} +3 -3
- package/dist/{vm-CXx3RAQt.cjs → vm-BjkJqSQH.cjs} +28 -22
- package/dist/{vm-BHo3ENPb.js → vm-C5vf1LH3.js} +28 -22
- package/package.json +2 -2
package/dist/index.workerd.js
CHANGED
|
@@ -52,7 +52,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
52
52
|
}) : target, mod));
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region package.json
|
|
55
|
-
var version = "0.6.
|
|
55
|
+
var version = "0.6.3";
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
|
|
58
58
|
var freeGlobal;
|
|
@@ -90,8 +90,10 @@ function getRawTag(value) {
|
|
|
90
90
|
var unmasked = true;
|
|
91
91
|
} catch (e) {}
|
|
92
92
|
var result = nativeObjectToString$1.call(value);
|
|
93
|
-
if (unmasked)
|
|
94
|
-
|
|
93
|
+
if (unmasked) {
|
|
94
|
+
if (isOwn) value[symToStringTag$1] = tag;
|
|
95
|
+
else delete value[symToStringTag$1];
|
|
96
|
+
}
|
|
95
97
|
return result;
|
|
96
98
|
}
|
|
97
99
|
var objectProto$4, hasOwnProperty$16, nativeObjectToString$1, symToStringTag$1;
|
|
@@ -244,7 +246,7 @@ var init__baseToString = __esmMin((() => {
|
|
|
244
246
|
init__arrayMap();
|
|
245
247
|
init_isArray();
|
|
246
248
|
init_isSymbol();
|
|
247
|
-
INFINITY$2 =
|
|
249
|
+
INFINITY$2 = 1 / 0;
|
|
248
250
|
symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
|
|
249
251
|
symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
|
|
250
252
|
}));
|
|
@@ -398,7 +400,7 @@ function toFinite(value) {
|
|
|
398
400
|
var INFINITY$1, MAX_INTEGER;
|
|
399
401
|
var init_toFinite = __esmMin((() => {
|
|
400
402
|
init_toNumber();
|
|
401
|
-
INFINITY$1 =
|
|
403
|
+
INFINITY$1 = 1 / 0;
|
|
402
404
|
MAX_INTEGER = 17976931348623157e292;
|
|
403
405
|
}));
|
|
404
406
|
//#endregion
|
|
@@ -2391,7 +2393,7 @@ function toKey(value) {
|
|
|
2391
2393
|
var INFINITY;
|
|
2392
2394
|
var init__toKey = __esmMin((() => {
|
|
2393
2395
|
init_isSymbol();
|
|
2394
|
-
INFINITY =
|
|
2396
|
+
INFINITY = 1 / 0;
|
|
2395
2397
|
}));
|
|
2396
2398
|
//#endregion
|
|
2397
2399
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGet.js
|
|
@@ -2501,9 +2503,10 @@ function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
|
2501
2503
|
result || (result = []);
|
|
2502
2504
|
while (++index < length) {
|
|
2503
2505
|
var value = array[index];
|
|
2504
|
-
if (depth > 0 && predicate(value))
|
|
2505
|
-
|
|
2506
|
-
|
|
2506
|
+
if (depth > 0 && predicate(value)) {
|
|
2507
|
+
if (depth > 1) baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
2508
|
+
else arrayPush(result, value);
|
|
2509
|
+
} else if (!isStrict) result[result.length] = value;
|
|
2507
2510
|
}
|
|
2508
2511
|
return result;
|
|
2509
2512
|
}
|
|
@@ -5978,7 +5981,7 @@ var init__createSet = __esmMin((() => {
|
|
|
5978
5981
|
init__Set();
|
|
5979
5982
|
init_noop();
|
|
5980
5983
|
init__setToArray();
|
|
5981
|
-
createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] ==
|
|
5984
|
+
createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == 1 / 0) ? noop : function(values) {
|
|
5982
5985
|
return new Set$1(values);
|
|
5983
5986
|
};
|
|
5984
5987
|
}));
|
|
@@ -6886,8 +6889,10 @@ function renderStatements(p, nodes, level) {
|
|
|
6886
6889
|
const { members: statements } = splitMembers(nodes, false);
|
|
6887
6890
|
for (let i = 0; i < statements.length; i++) {
|
|
6888
6891
|
const stmt = statements[i];
|
|
6889
|
-
if (i > 0)
|
|
6890
|
-
|
|
6892
|
+
if (i > 0) {
|
|
6893
|
+
if ((stmt[0].nl ?? 0) >= 2) p.blankLine(level);
|
|
6894
|
+
else p.newline(level);
|
|
6895
|
+
}
|
|
6891
6896
|
renderStatement(p, stmt, level);
|
|
6892
6897
|
}
|
|
6893
6898
|
}
|
|
@@ -7427,13 +7432,15 @@ var init_tool = __esmMin((() => {
|
|
|
7427
7432
|
input = transforms.fromJSONSchemaLegacy(this.input);
|
|
7428
7433
|
}
|
|
7429
7434
|
else input = z.any();
|
|
7430
|
-
if (!isEmpty(this._staticInputValues))
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7435
|
+
if (!isEmpty(this._staticInputValues)) {
|
|
7436
|
+
if (z.is.zuiObject(input)) {
|
|
7437
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
7438
|
+
input = input.extend(inputExtensions);
|
|
7439
|
+
} else if (z.is.zuiArray(input)) {
|
|
7440
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
7441
|
+
input = z.array(input.element.extend(inputExtensions));
|
|
7442
|
+
} else input = convertObjectToZuiLiterals(this._staticInputValues);
|
|
7443
|
+
}
|
|
7437
7444
|
return input;
|
|
7438
7445
|
}
|
|
7439
7446
|
/**
|
|
@@ -7640,20 +7647,24 @@ var init_tool = __esmMin((() => {
|
|
|
7640
7647
|
if (typeof props.handler !== "function") throw new Error(`Invalid handler for tool ${props.name}. Expected a function, but got type "${typeof props.handler}"`);
|
|
7641
7648
|
if (props.aliases !== void 0 && !Array.isArray(props.aliases)) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array, but got type "${typeof props.aliases}"`);
|
|
7642
7649
|
if (props.aliases && props.aliases.some((alias) => !isValidIdentifier(alias))) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array of valid identifiers.`);
|
|
7643
|
-
if (typeof props.input !== "undefined")
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7650
|
+
if (typeof props.input !== "undefined") {
|
|
7651
|
+
if (isZuiSchema(props.input)) try {
|
|
7652
|
+
this.input = transforms.toJSONSchema(props.input);
|
|
7653
|
+
} catch {
|
|
7654
|
+
this.input = transforms.toJSONSchemaLegacy(props.input);
|
|
7655
|
+
}
|
|
7656
|
+
else if (isJsonSchema(props.input)) this.input = props.input;
|
|
7657
|
+
else throw new Error(`Invalid input schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.input}"`);
|
|
7647
7658
|
}
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7659
|
+
if (typeof props.output !== "undefined") {
|
|
7660
|
+
if (isZuiSchema(props.output)) try {
|
|
7661
|
+
this.output = transforms.toJSONSchema(props.output);
|
|
7662
|
+
} catch {
|
|
7663
|
+
this.output = transforms.toJSONSchemaLegacy(props.output);
|
|
7664
|
+
}
|
|
7665
|
+
else if (isJsonSchema(props.output)) this.output = props.output;
|
|
7666
|
+
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
7654
7667
|
}
|
|
7655
|
-
else if (isJsonSchema(props.output)) this.output = props.output;
|
|
7656
|
-
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
7657
7668
|
this.name = props.name;
|
|
7658
7669
|
this.aliases = uniq([props.name, ...props.aliases ?? []]);
|
|
7659
7670
|
this.description = props.description;
|
|
@@ -7985,9 +7996,11 @@ var init_exit = __esmMin((() => {
|
|
|
7985
7996
|
if (props.metadata !== void 0 && typeof props.metadata !== "object") throw new Error(`Invalid metadata for exit ${props.name}. Expected an object, but got type "${typeof props.metadata}"`);
|
|
7986
7997
|
if (props.aliases !== void 0 && !Array.isArray(props.aliases)) throw new Error(`Invalid aliases for exit ${props.name}. Expected an array, but got type "${typeof props.aliases}"`);
|
|
7987
7998
|
if (props.aliases && props.aliases.some((alias) => !isValidIdentifier(alias))) throw new Error(`Invalid aliases for exit ${props.name}. Expected an array of valid identifiers.`);
|
|
7988
|
-
if (typeof props.schema !== "undefined")
|
|
7989
|
-
|
|
7990
|
-
|
|
7999
|
+
if (typeof props.schema !== "undefined") {
|
|
8000
|
+
if (isZuiSchema(props.schema)) this.schema = transforms.toJSONSchemaLegacy(props.schema);
|
|
8001
|
+
else if (isJsonSchema(props.schema)) this.schema = props.schema;
|
|
8002
|
+
else throw new Error(`Invalid input schema for exit ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.schema}"`);
|
|
8003
|
+
}
|
|
7991
8004
|
this.name = props.name;
|
|
7992
8005
|
this.aliases = uniq([props.name, ...props.aliases ?? []]);
|
|
7993
8006
|
this.description = props.description;
|
|
@@ -9602,8 +9615,10 @@ var init_inspect = __esmMin((() => {
|
|
|
9602
9615
|
else if (genericType === "error") return header + previewError(value);
|
|
9603
9616
|
else if (genericType === "object") return header + previewObject(value, options);
|
|
9604
9617
|
else if (genericType === "boolean") return header + previewValue(value);
|
|
9605
|
-
else if (typeof value === "string")
|
|
9606
|
-
|
|
9618
|
+
else if (typeof value === "string") {
|
|
9619
|
+
if (getTokenizer().count(value) < options.tokens) return header + previewValue(value);
|
|
9620
|
+
else return header + previewLongText(value);
|
|
9621
|
+
}
|
|
9607
9622
|
return header + previewValue(value);
|
|
9608
9623
|
} catch (err) {
|
|
9609
9624
|
return `Error: ${err?.message ?? "Unknown Error"}`;
|
|
@@ -10284,13 +10299,17 @@ function truncateWrappedContent({ messages, tokenLimit, throwOnFailure = true })
|
|
|
10284
10299
|
let currentCount = _countTotalTokens(parts);
|
|
10285
10300
|
while (currentCount > tokenLimit) {
|
|
10286
10301
|
const { biggest, secondBiggest } = _getTwoBiggestTruncables(parts);
|
|
10287
|
-
if (!biggest || !biggest.truncatable || biggest.tokens <= 0)
|
|
10288
|
-
|
|
10302
|
+
if (!biggest || !biggest.truncatable || biggest.tokens <= 0) {
|
|
10303
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
10304
|
+
else break;
|
|
10305
|
+
}
|
|
10289
10306
|
const delta = Math.max(biggest.tokens - (secondBiggest?.tokens ?? 0), DEFAULT_REMOVE_CHUNK);
|
|
10290
10307
|
const room = Math.min(delta, biggest.tokens);
|
|
10291
10308
|
let toRemove = Math.min(room, currentCount - tokenLimit);
|
|
10292
|
-
if (toRemove <= 0)
|
|
10293
|
-
|
|
10309
|
+
if (toRemove <= 0) {
|
|
10310
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
10311
|
+
else break;
|
|
10312
|
+
}
|
|
10294
10313
|
if (biggest.tokens - toRemove < (biggest.attributes?.minTokens ?? 0)) toRemove = biggest.tokens - (biggest.attributes?.minTokens ?? 0);
|
|
10295
10314
|
const preserve = biggest.attributes?.preserve ?? DEFAULT_TRUNCATE_OPTIONS.preserve;
|
|
10296
10315
|
const split = tokenizer.splitAndSlice(biggest.content);
|
|
@@ -13826,12 +13845,14 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13826
13845
|
part = parts[i];
|
|
13827
13846
|
if (part === ".") parts.splice(i, 1);
|
|
13828
13847
|
else if (part === "..") up++;
|
|
13829
|
-
else if (up > 0)
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13848
|
+
else if (up > 0) {
|
|
13849
|
+
if (part === "") {
|
|
13850
|
+
parts.splice(i + 1, up);
|
|
13851
|
+
up = 0;
|
|
13852
|
+
} else {
|
|
13853
|
+
parts.splice(i, 2);
|
|
13854
|
+
up--;
|
|
13855
|
+
}
|
|
13835
13856
|
}
|
|
13836
13857
|
}
|
|
13837
13858
|
path = parts.join("/");
|
|
@@ -14107,8 +14128,10 @@ var require_array_set = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
14107
14128
|
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
|
|
14108
14129
|
var idx = this._array.length;
|
|
14109
14130
|
if (!isDuplicate || aAllowDuplicates) this._array.push(aStr);
|
|
14110
|
-
if (!isDuplicate)
|
|
14111
|
-
|
|
14131
|
+
if (!isDuplicate) {
|
|
14132
|
+
if (hasNativeMap) this._set.set(aStr, idx);
|
|
14133
|
+
else this._set[sStr] = idx;
|
|
14134
|
+
}
|
|
14112
14135
|
};
|
|
14113
14136
|
/**
|
|
14114
14137
|
* Is the given string a member of this set?
|
|
@@ -15479,18 +15502,20 @@ var require_source_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
15479
15502
|
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
|
15480
15503
|
var lastMapping = null;
|
|
15481
15504
|
aSourceMapConsumer.eachMapping(function(mapping) {
|
|
15482
|
-
if (lastMapping !== null)
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15487
|
-
|
|
15488
|
-
|
|
15489
|
-
|
|
15490
|
-
|
|
15491
|
-
|
|
15492
|
-
|
|
15493
|
-
|
|
15505
|
+
if (lastMapping !== null) {
|
|
15506
|
+
if (lastGeneratedLine < mapping.generatedLine) {
|
|
15507
|
+
addMappingWithCode(lastMapping, shiftNextLine());
|
|
15508
|
+
lastGeneratedLine++;
|
|
15509
|
+
lastGeneratedColumn = 0;
|
|
15510
|
+
} else {
|
|
15511
|
+
var nextLine = remainingLines[remainingLinesIndex] || "";
|
|
15512
|
+
var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
|
|
15513
|
+
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
|
|
15514
|
+
lastGeneratedColumn = mapping.generatedColumn;
|
|
15515
|
+
addMappingWithCode(lastMapping, code);
|
|
15516
|
+
lastMapping = mapping;
|
|
15517
|
+
return;
|
|
15518
|
+
}
|
|
15494
15519
|
}
|
|
15495
15520
|
while (lastGeneratedLine < mapping.generatedLine) {
|
|
15496
15521
|
node.add(shiftNextLine());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as isArray } from "./_overArg-
|
|
2
|
-
import { A as isArrayLike, D as isBuffer, O as isArguments, S as baseKeys, c as _getTag_default, k as isPrototype, w as isTypedArray } from "./_baseIteratee-
|
|
1
|
+
import { n as isArray } from "./_overArg-CRYbj1NH.js";
|
|
2
|
+
import { A as isArrayLike, D as isBuffer, O as isArguments, S as baseKeys, c as _getTag_default, k as isPrototype, w as isTypedArray } from "./_baseIteratee-P_firB7b.js";
|
|
3
3
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js
|
|
4
4
|
/** `Object#toString` result references. */
|
|
5
5
|
var mapTag = "[object Map]";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require__overArg = require("./_overArg-
|
|
2
|
-
const require__baseIteratee = require("./_baseIteratee-
|
|
1
|
+
const require__overArg = require("./_overArg-C5Hy7oCi.cjs");
|
|
2
|
+
const require__baseIteratee = require("./_baseIteratee-CF4qP2a8.cjs");
|
|
3
3
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js
|
|
4
4
|
/** `Object#toString` result references. */
|
|
5
5
|
var mapTag = "[object Map]";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require__overArg = require("./_overArg-
|
|
2
|
-
const require__getPrototype = require("./_getPrototype-
|
|
1
|
+
const require__overArg = require("./_overArg-C5Hy7oCi.cjs");
|
|
2
|
+
const require__getPrototype = require("./_getPrototype-DQDlNVVM.cjs");
|
|
3
3
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js
|
|
4
4
|
/** `Object#toString` result references. */
|
|
5
5
|
var objectTag = "[object Object]";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as baseGetTag, r as isObjectLike } from "./_overArg-
|
|
2
|
-
import { t as getPrototype } from "./_getPrototype-
|
|
1
|
+
import { i as baseGetTag, r as isObjectLike } from "./_overArg-CRYbj1NH.js";
|
|
2
|
+
import { t as getPrototype } from "./_getPrototype-CG7Dxrrz.js";
|
|
3
3
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isPlainObject.js
|
|
4
4
|
/** `Object#toString` result references. */
|
|
5
5
|
var objectTag = "[object Object]";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require__baseForOwn = require("./_baseForOwn-
|
|
2
|
-
const require__overArg = require("./_overArg-
|
|
3
|
-
const require_isPlainObject = require("./isPlainObject-
|
|
1
|
+
const require__baseForOwn = require("./_baseForOwn-buOZDFbK.cjs");
|
|
2
|
+
const require__overArg = require("./_overArg-C5Hy7oCi.cjs");
|
|
3
|
+
const require_isPlainObject = require("./isPlainObject-CSxXVKCk.cjs");
|
|
4
4
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
5
5
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js
|
|
6
6
|
/** `Object#toString` result references. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-EAsCxrDo.js";
|
|
2
|
-
import { i as baseGetTag, n as isArray, r as isObjectLike } from "./_overArg-
|
|
3
|
-
import { t as isPlainObject } from "./isPlainObject-
|
|
2
|
+
import { i as baseGetTag, n as isArray, r as isObjectLike } from "./_overArg-CRYbj1NH.js";
|
|
3
|
+
import { t as isPlainObject } from "./isPlainObject-D39AzPO2.js";
|
|
4
4
|
import { z } from "@bpinternal/zui";
|
|
5
5
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js
|
|
6
6
|
/** `Object#toString` result references. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-EAsCxrDo.js";
|
|
2
|
-
import { t as uniq } from "./uniq-
|
|
3
|
-
import { c as isJsonSchema, l as isValidIdentifier, r as fromJSONSchemaCompat, u as isZuiSchema } from "./utils-
|
|
4
|
-
import { t as isEmpty } from "./isEmpty-
|
|
5
|
-
import { t as getTypings } from "./typings-
|
|
2
|
+
import { t as uniq } from "./uniq-BYQ7GWwb.js";
|
|
3
|
+
import { c as isJsonSchema, l as isValidIdentifier, r as fromJSONSchemaCompat, u as isZuiSchema } from "./utils-UBeAFeEI.js";
|
|
4
|
+
import { t as isEmpty } from "./isEmpty-BhJRCqIF.js";
|
|
5
|
+
import { t as getTypings } from "./typings-CrBa7Tyy.js";
|
|
6
6
|
import { transforms, z } from "@bpinternal/zui";
|
|
7
7
|
//#region src/convert.ts
|
|
8
8
|
function convertObjectToZuiLiterals(obj, nested = false) {
|
|
@@ -248,13 +248,15 @@ var Tool = class Tool {
|
|
|
248
248
|
input = transforms.fromJSONSchemaLegacy(this.input);
|
|
249
249
|
}
|
|
250
250
|
else input = z.any();
|
|
251
|
-
if (!isEmpty(this._staticInputValues))
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
if (!isEmpty(this._staticInputValues)) {
|
|
252
|
+
if (z.is.zuiObject(input)) {
|
|
253
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
254
|
+
input = input.extend(inputExtensions);
|
|
255
|
+
} else if (z.is.zuiArray(input)) {
|
|
256
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
257
|
+
input = z.array(input.element.extend(inputExtensions));
|
|
258
|
+
} else input = convertObjectToZuiLiterals(this._staticInputValues);
|
|
259
|
+
}
|
|
258
260
|
return input;
|
|
259
261
|
}
|
|
260
262
|
/**
|
|
@@ -462,20 +464,24 @@ var Tool = class Tool {
|
|
|
462
464
|
if (typeof props.handler !== "function") throw new Error(`Invalid handler for tool ${props.name}. Expected a function, but got type "${typeof props.handler}"`);
|
|
463
465
|
if (props.aliases !== void 0 && !Array.isArray(props.aliases)) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array, but got type "${typeof props.aliases}"`);
|
|
464
466
|
if (props.aliases && props.aliases.some((alias) => !isValidIdentifier(alias))) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array of valid identifiers.`);
|
|
465
|
-
if (typeof props.input !== "undefined")
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
if (typeof props.input !== "undefined") {
|
|
468
|
+
if (isZuiSchema(props.input)) try {
|
|
469
|
+
this.input = transforms.toJSONSchema(props.input);
|
|
470
|
+
} catch {
|
|
471
|
+
this.input = transforms.toJSONSchemaLegacy(props.input);
|
|
472
|
+
}
|
|
473
|
+
else if (isJsonSchema(props.input)) this.input = props.input;
|
|
474
|
+
else throw new Error(`Invalid input schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.input}"`);
|
|
469
475
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
+
if (typeof props.output !== "undefined") {
|
|
477
|
+
if (isZuiSchema(props.output)) try {
|
|
478
|
+
this.output = transforms.toJSONSchema(props.output);
|
|
479
|
+
} catch {
|
|
480
|
+
this.output = transforms.toJSONSchemaLegacy(props.output);
|
|
481
|
+
}
|
|
482
|
+
else if (isJsonSchema(props.output)) this.output = props.output;
|
|
483
|
+
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
476
484
|
}
|
|
477
|
-
else if (isJsonSchema(props.output)) this.output = props.output;
|
|
478
|
-
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
479
485
|
this.name = props.name;
|
|
480
486
|
this.aliases = uniq([props.name, ...props.aliases ?? []]);
|
|
481
487
|
this.description = props.description;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require__baseForOwn = require("./_baseForOwn-
|
|
2
|
-
const require_uniq = require("./uniq-
|
|
3
|
-
const require_utils = require("./utils-
|
|
4
|
-
const require_isEmpty = require("./isEmpty-
|
|
5
|
-
const require_typings = require("./typings-
|
|
1
|
+
const require__baseForOwn = require("./_baseForOwn-buOZDFbK.cjs");
|
|
2
|
+
const require_uniq = require("./uniq-G872RWmE.cjs");
|
|
3
|
+
const require_utils = require("./utils-ZpJm00ed.cjs");
|
|
4
|
+
const require_isEmpty = require("./isEmpty-LY533Wmh.cjs");
|
|
5
|
+
const require_typings = require("./typings-BwAz_TM9.cjs");
|
|
6
6
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
7
7
|
//#region src/convert.ts
|
|
8
8
|
function convertObjectToZuiLiterals(obj, nested = false) {
|
|
@@ -248,13 +248,15 @@ var Tool = class Tool {
|
|
|
248
248
|
input = _bpinternal_zui.transforms.fromJSONSchemaLegacy(this.input);
|
|
249
249
|
}
|
|
250
250
|
else input = _bpinternal_zui.z.any();
|
|
251
|
-
if (!require_isEmpty.isEmpty(this._staticInputValues))
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
if (!require_isEmpty.isEmpty(this._staticInputValues)) {
|
|
252
|
+
if (_bpinternal_zui.z.is.zuiObject(input)) {
|
|
253
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
254
|
+
input = input.extend(inputExtensions);
|
|
255
|
+
} else if (_bpinternal_zui.z.is.zuiArray(input)) {
|
|
256
|
+
const inputExtensions = convertObjectToZuiLiterals(this._staticInputValues);
|
|
257
|
+
input = _bpinternal_zui.z.array(input.element.extend(inputExtensions));
|
|
258
|
+
} else input = convertObjectToZuiLiterals(this._staticInputValues);
|
|
259
|
+
}
|
|
258
260
|
return input;
|
|
259
261
|
}
|
|
260
262
|
/**
|
|
@@ -462,20 +464,24 @@ var Tool = class Tool {
|
|
|
462
464
|
if (typeof props.handler !== "function") throw new Error(`Invalid handler for tool ${props.name}. Expected a function, but got type "${typeof props.handler}"`);
|
|
463
465
|
if (props.aliases !== void 0 && !Array.isArray(props.aliases)) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array, but got type "${typeof props.aliases}"`);
|
|
464
466
|
if (props.aliases && props.aliases.some((alias) => !require_utils.isValidIdentifier(alias))) throw new Error(`Invalid aliases for tool ${props.name}. Expected an array of valid identifiers.`);
|
|
465
|
-
if (typeof props.input !== "undefined")
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
if (typeof props.input !== "undefined") {
|
|
468
|
+
if (require_utils.isZuiSchema(props.input)) try {
|
|
469
|
+
this.input = _bpinternal_zui.transforms.toJSONSchema(props.input);
|
|
470
|
+
} catch {
|
|
471
|
+
this.input = _bpinternal_zui.transforms.toJSONSchemaLegacy(props.input);
|
|
472
|
+
}
|
|
473
|
+
else if (require_utils.isJsonSchema(props.input)) this.input = props.input;
|
|
474
|
+
else throw new Error(`Invalid input schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.input}"`);
|
|
469
475
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
+
if (typeof props.output !== "undefined") {
|
|
477
|
+
if (require_utils.isZuiSchema(props.output)) try {
|
|
478
|
+
this.output = _bpinternal_zui.transforms.toJSONSchema(props.output);
|
|
479
|
+
} catch {
|
|
480
|
+
this.output = _bpinternal_zui.transforms.toJSONSchemaLegacy(props.output);
|
|
481
|
+
}
|
|
482
|
+
else if (require_utils.isJsonSchema(props.output)) this.output = props.output;
|
|
483
|
+
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
476
484
|
}
|
|
477
|
-
else if (require_utils.isJsonSchema(props.output)) this.output = props.output;
|
|
478
|
-
else throw new Error(`Invalid output schema for tool ${props.name}. Expected a ZodType or JSONSchema, but got type "${typeof props.output}"`);
|
|
479
485
|
this.name = props.name;
|
|
480
486
|
this.aliases = require_uniq.uniq([props.name, ...props.aliases ?? []]);
|
|
481
487
|
this.description = props.description;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require__baseForOwn = require("./_baseForOwn-
|
|
2
|
-
const require_utils = require("./utils-
|
|
1
|
+
const require__baseForOwn = require("./_baseForOwn-buOZDFbK.cjs");
|
|
2
|
+
const require_utils = require("./utils-ZpJm00ed.cjs");
|
|
3
3
|
//#region src/truncator.ts
|
|
4
4
|
var truncator_exports = /* @__PURE__ */ require__baseForOwn.__exportAll({
|
|
5
5
|
stripTruncationTags: () => stripTruncationTags,
|
|
@@ -161,13 +161,17 @@ function truncateWrappedContent({ messages, tokenLimit, throwOnFailure = true })
|
|
|
161
161
|
while (currentCount > tokenLimit) {
|
|
162
162
|
var _biggest$attributes, _biggest$attributes3;
|
|
163
163
|
const { biggest, secondBiggest } = _getTwoBiggestTruncables(parts);
|
|
164
|
-
if (!biggest || !biggest.truncatable || biggest.tokens <= 0)
|
|
165
|
-
|
|
164
|
+
if (!biggest || !biggest.truncatable || biggest.tokens <= 0) {
|
|
165
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
166
|
+
else break;
|
|
167
|
+
}
|
|
166
168
|
const delta = Math.max(biggest.tokens - ((secondBiggest === null || secondBiggest === void 0 ? void 0 : secondBiggest.tokens) ?? 0), DEFAULT_REMOVE_CHUNK);
|
|
167
169
|
const room = Math.min(delta, biggest.tokens);
|
|
168
170
|
let toRemove = Math.min(room, currentCount - tokenLimit);
|
|
169
|
-
if (toRemove <= 0)
|
|
170
|
-
|
|
171
|
+
if (toRemove <= 0) {
|
|
172
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
173
|
+
else break;
|
|
174
|
+
}
|
|
171
175
|
if (biggest.tokens - toRemove < (((_biggest$attributes = biggest.attributes) === null || _biggest$attributes === void 0 ? void 0 : _biggest$attributes.minTokens) ?? 0)) {
|
|
172
176
|
var _biggest$attributes2;
|
|
173
177
|
toRemove = biggest.tokens - (((_biggest$attributes2 = biggest.attributes) === null || _biggest$attributes2 === void 0 ? void 0 : _biggest$attributes2.minTokens) ?? 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-EAsCxrDo.js";
|
|
2
|
-
import { o as getTokenizer } from "./utils-
|
|
2
|
+
import { o as getTokenizer } from "./utils-UBeAFeEI.js";
|
|
3
3
|
//#region src/truncator.ts
|
|
4
4
|
var truncator_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
stripTruncationTags: () => stripTruncationTags,
|
|
@@ -161,13 +161,17 @@ function truncateWrappedContent({ messages, tokenLimit, throwOnFailure = true })
|
|
|
161
161
|
while (currentCount > tokenLimit) {
|
|
162
162
|
var _biggest$attributes, _biggest$attributes3;
|
|
163
163
|
const { biggest, secondBiggest } = _getTwoBiggestTruncables(parts);
|
|
164
|
-
if (!biggest || !biggest.truncatable || biggest.tokens <= 0)
|
|
165
|
-
|
|
164
|
+
if (!biggest || !biggest.truncatable || biggest.tokens <= 0) {
|
|
165
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
166
|
+
else break;
|
|
167
|
+
}
|
|
166
168
|
const delta = Math.max(biggest.tokens - ((secondBiggest === null || secondBiggest === void 0 ? void 0 : secondBiggest.tokens) ?? 0), DEFAULT_REMOVE_CHUNK);
|
|
167
169
|
const room = Math.min(delta, biggest.tokens);
|
|
168
170
|
let toRemove = Math.min(room, currentCount - tokenLimit);
|
|
169
|
-
if (toRemove <= 0)
|
|
170
|
-
|
|
171
|
+
if (toRemove <= 0) {
|
|
172
|
+
if (throwOnFailure) throw new Error(`Cannot truncate further, current count: ${currentCount}`);
|
|
173
|
+
else break;
|
|
174
|
+
}
|
|
171
175
|
if (biggest.tokens - toRemove < (((_biggest$attributes = biggest.attributes) === null || _biggest$attributes === void 0 ? void 0 : _biggest$attributes.minTokens) ?? 0)) {
|
|
172
176
|
var _biggest$attributes2;
|
|
173
177
|
toRemove = biggest.tokens - (((_biggest$attributes2 = biggest.attributes) === null || _biggest$attributes2 === void 0 ? void 0 : _biggest$attributes2.minTokens) ?? 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require__baseForOwn = require("./_baseForOwn-
|
|
2
|
-
const require_utils = require("./utils-
|
|
1
|
+
const require__baseForOwn = require("./_baseForOwn-buOZDFbK.cjs");
|
|
2
|
+
const require_utils = require("./utils-ZpJm00ed.cjs");
|
|
3
3
|
const require_errors = require("./errors-C962uJdS.cjs");
|
|
4
4
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
5
5
|
//#region src/typings-formatter.ts
|
|
@@ -507,8 +507,10 @@ function renderStatements(p, nodes, level) {
|
|
|
507
507
|
const { members: statements } = splitMembers(nodes, false);
|
|
508
508
|
for (let i = 0; i < statements.length; i++) {
|
|
509
509
|
const stmt = statements[i];
|
|
510
|
-
if (i > 0)
|
|
511
|
-
|
|
510
|
+
if (i > 0) {
|
|
511
|
+
if ((stmt[0].nl ?? 0) >= 2) p.blankLine(level);
|
|
512
|
+
else p.newline(level);
|
|
513
|
+
}
|
|
512
514
|
renderStatement(p, stmt, level);
|
|
513
515
|
}
|
|
514
516
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-EAsCxrDo.js";
|
|
2
|
-
import { a as getMultilineComment, f as toPropertyKey, n as escapeString } from "./utils-
|
|
2
|
+
import { a as getMultilineComment, f as toPropertyKey, n as escapeString } from "./utils-UBeAFeEI.js";
|
|
3
3
|
import { r as CodeFormattingError } from "./errors-Cg1G0Awu.js";
|
|
4
4
|
import { z } from "@bpinternal/zui";
|
|
5
5
|
//#region src/typings-formatter.ts
|
|
@@ -507,8 +507,10 @@ function renderStatements(p, nodes, level) {
|
|
|
507
507
|
const { members: statements } = splitMembers(nodes, false);
|
|
508
508
|
for (let i = 0; i < statements.length; i++) {
|
|
509
509
|
const stmt = statements[i];
|
|
510
|
-
if (i > 0)
|
|
511
|
-
|
|
510
|
+
if (i > 0) {
|
|
511
|
+
if ((stmt[0].nl ?? 0) >= 2) p.blankLine(level);
|
|
512
|
+
else p.newline(level);
|
|
513
|
+
}
|
|
512
514
|
renderStatement(p, stmt, level);
|
|
513
515
|
}
|
|
514
516
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as cacheHas, l as Set, o as SetCache, r as setToArray } from "./_baseIteratee-
|
|
1
|
+
import { a as cacheHas, l as Set, o as SetCache, r as setToArray } from "./_baseIteratee-P_firB7b.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js
|
|
3
3
|
/**
|
|
4
4
|
* This method returns `undefined`.
|
|
@@ -113,7 +113,7 @@ function arrayIncludesWith(array, value, comparator) {
|
|
|
113
113
|
* @param {Array} values The values to add to the set.
|
|
114
114
|
* @returns {Object} Returns the new set.
|
|
115
115
|
*/
|
|
116
|
-
var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] ==
|
|
116
|
+
var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == 1 / 0) ? noop : function(values) {
|
|
117
117
|
return new Set(values);
|
|
118
118
|
};
|
|
119
119
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require__baseIteratee = require("./_baseIteratee-
|
|
1
|
+
const require__baseIteratee = require("./_baseIteratee-CF4qP2a8.cjs");
|
|
2
2
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js
|
|
3
3
|
/**
|
|
4
4
|
* This method returns `undefined`.
|
|
@@ -113,7 +113,7 @@ function arrayIncludesWith(array, value, comparator) {
|
|
|
113
113
|
* @param {Array} values The values to add to the set.
|
|
114
114
|
* @returns {Object} Returns the new set.
|
|
115
115
|
*/
|
|
116
|
-
var createSet = !(require__baseIteratee.Set && 1 / require__baseIteratee.setToArray(new require__baseIteratee.Set([, -0]))[1] ==
|
|
116
|
+
var createSet = !(require__baseIteratee.Set && 1 / require__baseIteratee.setToArray(new require__baseIteratee.Set([, -0]))[1] == 1 / 0) ? noop : function(values) {
|
|
117
117
|
return new require__baseIteratee.Set(values);
|
|
118
118
|
};
|
|
119
119
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-EAsCxrDo.js";
|
|
2
|
-
import { A as isArrayLike, C as arrayLikeKeys, M as baseAssignValue, N as isIndex, R as isObject, _ as baseGet, b as toString, d as baseGetAllKeys, f as getSymbols, g as arrayPush, j as eq, k as isPrototype, p as stubArray, t as baseIteratee, v as toKey, y as castPath, z as arrayMap } from "./_baseIteratee-
|
|
3
|
-
import { t as getPrototype } from "./_getPrototype-
|
|
2
|
+
import { A as isArrayLike, C as arrayLikeKeys, M as baseAssignValue, N as isIndex, R as isObject, _ as baseGet, b as toString, d as baseGetAllKeys, f as getSymbols, g as arrayPush, j as eq, k as isPrototype, p as stubArray, t as baseIteratee, v as toKey, y as castPath, z as arrayMap } from "./_baseIteratee-P_firB7b.js";
|
|
3
|
+
import { t as getPrototype } from "./_getPrototype-CG7Dxrrz.js";
|
|
4
4
|
import { transforms, z } from "@bpinternal/zui";
|
|
5
5
|
import { getWasmTokenizer } from "@bpinternal/thicktoken";
|
|
6
6
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignValue.js
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require__baseForOwn = require("./_baseForOwn-
|
|
2
|
-
const require__baseIteratee = require("./_baseIteratee-
|
|
3
|
-
const require__getPrototype = require("./_getPrototype-
|
|
1
|
+
const require__baseForOwn = require("./_baseForOwn-buOZDFbK.cjs");
|
|
2
|
+
const require__baseIteratee = require("./_baseIteratee-CF4qP2a8.cjs");
|
|
3
|
+
const require__getPrototype = require("./_getPrototype-DQDlNVVM.cjs");
|
|
4
4
|
let _bpinternal_zui = require("@bpinternal/zui");
|
|
5
5
|
let _bpinternal_thicktoken = require("@bpinternal/thicktoken");
|
|
6
6
|
//#region ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assignValue.js
|