@opentiny/next-sdk 0.2.4 → 0.2.5
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.es.dev.js +858 -252
- package/dist/index.es.js +11148 -10578
- package/dist/index.umd.dev.js +858 -252
- package/dist/index.umd.js +55 -55
- package/dist/mcpsdk@1.25.3.dev.js +190 -181
- package/dist/mcpsdk@1.25.3.es.dev.js +190 -181
- package/dist/mcpsdk@1.25.3.es.js +1111 -1105
- package/dist/mcpsdk@1.25.3.js +14 -14
- package/dist/webagent.dev.js +858 -252
- package/dist/webagent.es.dev.js +858 -252
- package/dist/webagent.es.js +10766 -10196
- package/dist/webagent.js +56 -56
- package/dist/webmcp-full.dev.js +190 -181
- package/dist/webmcp-full.es.dev.js +190 -181
- package/dist/webmcp-full.es.js +74 -68
- package/dist/webmcp-full.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.dev.js
CHANGED
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
(function(exports3) {
|
|
176
176
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
177
177
|
exports3.ValueScope = exports3.ValueScopeName = exports3.Scope = exports3.varKinds = exports3.UsedValueState = void 0;
|
|
178
|
-
const code_1 = requireCode$1();
|
|
178
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
179
179
|
class ValueError extends Error {
|
|
180
180
|
constructor(name16) {
|
|
181
181
|
super(`CodeGen: "code" for ${name16} not defined`);
|
|
@@ -321,9 +321,9 @@
|
|
|
321
321
|
(function(exports3) {
|
|
322
322
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
323
323
|
exports3.or = exports3.and = exports3.not = exports3.CodeGen = exports3.operators = exports3.varKinds = exports3.ValueScopeName = exports3.ValueScope = exports3.Scope = exports3.Name = exports3.regexpCode = exports3.stringify = exports3.getProperty = exports3.nil = exports3.strConcat = exports3.str = exports3._ = void 0;
|
|
324
|
-
const code_1 = requireCode$1();
|
|
325
|
-
const scope_1 = requireScope();
|
|
326
|
-
var code_2 = requireCode$1();
|
|
324
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
325
|
+
const scope_1 = /* @__PURE__ */ requireScope();
|
|
326
|
+
var code_2 = /* @__PURE__ */ requireCode$1();
|
|
327
327
|
Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
|
|
328
328
|
return code_2._;
|
|
329
329
|
} });
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
Object.defineProperty(exports3, "Name", { enumerable: true, get: function() {
|
|
349
349
|
return code_2.Name;
|
|
350
350
|
} });
|
|
351
|
-
var scope_2 = requireScope();
|
|
351
|
+
var scope_2 = /* @__PURE__ */ requireScope();
|
|
352
352
|
Object.defineProperty(exports3, "Scope", { enumerable: true, get: function() {
|
|
353
353
|
return scope_2.Scope;
|
|
354
354
|
} });
|
|
@@ -1042,8 +1042,8 @@
|
|
|
1042
1042
|
hasRequiredUtil = 1;
|
|
1043
1043
|
Object.defineProperty(util$1, "__esModule", { value: true });
|
|
1044
1044
|
util$1.checkStrictMode = util$1.getErrorPath = util$1.Type = util$1.useFunc = util$1.setEvaluated = util$1.evaluatedPropsToName = util$1.mergeEvaluated = util$1.eachItem = util$1.unescapeJsonPointer = util$1.escapeJsonPointer = util$1.escapeFragment = util$1.unescapeFragment = util$1.schemaRefOrVal = util$1.schemaHasRulesButRef = util$1.schemaHasRules = util$1.checkUnknownRules = util$1.alwaysValidSchema = util$1.toHash = void 0;
|
|
1045
|
-
const codegen_1 = requireCodegen();
|
|
1046
|
-
const code_1 = requireCode$1();
|
|
1045
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1046
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
1047
1047
|
function toHash(arr) {
|
|
1048
1048
|
const hash = {};
|
|
1049
1049
|
for (const item of arr)
|
|
@@ -1208,7 +1208,7 @@
|
|
|
1208
1208
|
if (hasRequiredNames) return names;
|
|
1209
1209
|
hasRequiredNames = 1;
|
|
1210
1210
|
Object.defineProperty(names, "__esModule", { value: true });
|
|
1211
|
-
const codegen_1 = requireCodegen();
|
|
1211
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1212
1212
|
const names$1 = {
|
|
1213
1213
|
// validation function arguments
|
|
1214
1214
|
data: new codegen_1.Name("data"),
|
|
@@ -1248,9 +1248,9 @@
|
|
|
1248
1248
|
(function(exports3) {
|
|
1249
1249
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
1250
1250
|
exports3.extendErrors = exports3.resetErrorsCount = exports3.reportExtraError = exports3.reportError = exports3.keyword$DataError = exports3.keywordError = void 0;
|
|
1251
|
-
const codegen_1 = requireCodegen();
|
|
1252
|
-
const util_1 = requireUtil();
|
|
1253
|
-
const names_1 = requireNames();
|
|
1251
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1252
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1253
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1254
1254
|
exports3.keywordError = {
|
|
1255
1255
|
message: ({ keyword: keyword2 }) => (0, codegen_1.str)`must pass "${keyword2}" keyword validation`
|
|
1256
1256
|
};
|
|
@@ -1370,9 +1370,9 @@
|
|
|
1370
1370
|
hasRequiredBoolSchema = 1;
|
|
1371
1371
|
Object.defineProperty(boolSchema, "__esModule", { value: true });
|
|
1372
1372
|
boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
|
|
1373
|
-
const errors_1 = requireErrors();
|
|
1374
|
-
const codegen_1 = requireCodegen();
|
|
1375
|
-
const names_1 = requireNames();
|
|
1373
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1374
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1375
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1376
1376
|
const boolError = {
|
|
1377
1377
|
message: "boolean schema is false"
|
|
1378
1378
|
};
|
|
@@ -1475,11 +1475,11 @@
|
|
|
1475
1475
|
hasRequiredDataType = 1;
|
|
1476
1476
|
Object.defineProperty(dataType, "__esModule", { value: true });
|
|
1477
1477
|
dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
|
|
1478
|
-
const rules_1 = requireRules();
|
|
1479
|
-
const applicability_1 = requireApplicability();
|
|
1480
|
-
const errors_1 = requireErrors();
|
|
1481
|
-
const codegen_1 = requireCodegen();
|
|
1482
|
-
const util_1 = requireUtil();
|
|
1478
|
+
const rules_1 = /* @__PURE__ */ requireRules();
|
|
1479
|
+
const applicability_1 = /* @__PURE__ */ requireApplicability();
|
|
1480
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1481
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1482
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1483
1483
|
var DataType;
|
|
1484
1484
|
(function(DataType2) {
|
|
1485
1485
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
@@ -1659,8 +1659,8 @@
|
|
|
1659
1659
|
hasRequiredDefaults = 1;
|
|
1660
1660
|
Object.defineProperty(defaults, "__esModule", { value: true });
|
|
1661
1661
|
defaults.assignDefaults = void 0;
|
|
1662
|
-
const codegen_1 = requireCodegen();
|
|
1663
|
-
const util_1 = requireUtil();
|
|
1662
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1663
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1664
1664
|
function assignDefaults(it, ty) {
|
|
1665
1665
|
const { properties: properties2, items: items2 } = it.schema;
|
|
1666
1666
|
if (ty === "object" && properties2) {
|
|
@@ -1697,10 +1697,10 @@
|
|
|
1697
1697
|
hasRequiredCode = 1;
|
|
1698
1698
|
Object.defineProperty(code, "__esModule", { value: true });
|
|
1699
1699
|
code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
|
|
1700
|
-
const codegen_1 = requireCodegen();
|
|
1701
|
-
const util_1 = requireUtil();
|
|
1702
|
-
const names_1 = requireNames();
|
|
1703
|
-
const util_2 = requireUtil();
|
|
1700
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1701
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1702
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1703
|
+
const util_2 = /* @__PURE__ */ requireUtil();
|
|
1704
1704
|
function checkReportMissingProp(cxt, prop) {
|
|
1705
1705
|
const { gen, data, it } = cxt;
|
|
1706
1706
|
gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
|
|
@@ -1829,10 +1829,10 @@
|
|
|
1829
1829
|
hasRequiredKeyword = 1;
|
|
1830
1830
|
Object.defineProperty(keyword, "__esModule", { value: true });
|
|
1831
1831
|
keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
|
|
1832
|
-
const codegen_1 = requireCodegen();
|
|
1833
|
-
const names_1 = requireNames();
|
|
1834
|
-
const code_1 = requireCode();
|
|
1835
|
-
const errors_1 = requireErrors();
|
|
1832
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1833
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1834
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
1835
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1836
1836
|
function macroKeywordCode(cxt, def) {
|
|
1837
1837
|
const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
|
|
1838
1838
|
const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
|
|
@@ -1947,8 +1947,8 @@
|
|
|
1947
1947
|
hasRequiredSubschema = 1;
|
|
1948
1948
|
Object.defineProperty(subschema, "__esModule", { value: true });
|
|
1949
1949
|
subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
|
|
1950
|
-
const codegen_1 = requireCodegen();
|
|
1951
|
-
const util_1 = requireUtil();
|
|
1950
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1951
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1952
1952
|
function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
1953
1953
|
if (keyword2 !== void 0 && schema !== void 0) {
|
|
1954
1954
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
@@ -2153,7 +2153,7 @@
|
|
|
2153
2153
|
hasRequiredResolve = 1;
|
|
2154
2154
|
Object.defineProperty(resolve$1, "__esModule", { value: true });
|
|
2155
2155
|
resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
|
|
2156
|
-
const util_1 = requireUtil();
|
|
2156
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2157
2157
|
const equal2 = requireFastDeepEqual();
|
|
2158
2158
|
const traverse = requireJsonSchemaTraverse();
|
|
2159
2159
|
const SIMPLE_INLINED = /* @__PURE__ */ new Set([
|
|
@@ -2308,18 +2308,18 @@
|
|
|
2308
2308
|
hasRequiredValidate = 1;
|
|
2309
2309
|
Object.defineProperty(validate, "__esModule", { value: true });
|
|
2310
2310
|
validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
|
|
2311
|
-
const boolSchema_1 = requireBoolSchema();
|
|
2312
|
-
const dataType_1 = requireDataType();
|
|
2313
|
-
const applicability_1 = requireApplicability();
|
|
2314
|
-
const dataType_2 = requireDataType();
|
|
2315
|
-
const defaults_1 = requireDefaults();
|
|
2316
|
-
const keyword_1 = requireKeyword();
|
|
2317
|
-
const subschema_1 = requireSubschema();
|
|
2318
|
-
const codegen_1 = requireCodegen();
|
|
2319
|
-
const names_1 = requireNames();
|
|
2320
|
-
const resolve_1 = requireResolve();
|
|
2321
|
-
const util_1 = requireUtil();
|
|
2322
|
-
const errors_1 = requireErrors();
|
|
2311
|
+
const boolSchema_1 = /* @__PURE__ */ requireBoolSchema();
|
|
2312
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
2313
|
+
const applicability_1 = /* @__PURE__ */ requireApplicability();
|
|
2314
|
+
const dataType_2 = /* @__PURE__ */ requireDataType();
|
|
2315
|
+
const defaults_1 = /* @__PURE__ */ requireDefaults();
|
|
2316
|
+
const keyword_1 = /* @__PURE__ */ requireKeyword();
|
|
2317
|
+
const subschema_1 = /* @__PURE__ */ requireSubschema();
|
|
2318
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
2319
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
2320
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2321
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2322
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
2323
2323
|
function validateFunctionCode(it) {
|
|
2324
2324
|
if (isSchemaObj(it)) {
|
|
2325
2325
|
checkKeywords(it);
|
|
@@ -2830,7 +2830,7 @@
|
|
|
2830
2830
|
if (hasRequiredRef_error) return ref_error;
|
|
2831
2831
|
hasRequiredRef_error = 1;
|
|
2832
2832
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
2833
|
-
const resolve_1 = requireResolve();
|
|
2833
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2834
2834
|
class MissingRefError extends Error {
|
|
2835
2835
|
constructor(resolver, baseId, ref2, msg) {
|
|
2836
2836
|
super(msg || `can't resolve reference ${ref2} from id ${baseId}`);
|
|
@@ -2848,12 +2848,12 @@
|
|
|
2848
2848
|
hasRequiredCompile = 1;
|
|
2849
2849
|
Object.defineProperty(compile, "__esModule", { value: true });
|
|
2850
2850
|
compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
|
|
2851
|
-
const codegen_1 = requireCodegen();
|
|
2852
|
-
const validation_error_1 = requireValidation_error();
|
|
2853
|
-
const names_1 = requireNames();
|
|
2854
|
-
const resolve_1 = requireResolve();
|
|
2855
|
-
const util_1 = requireUtil();
|
|
2856
|
-
const validate_1 = requireValidate();
|
|
2851
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
2852
|
+
const validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
2853
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
2854
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2855
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2856
|
+
const validate_1 = /* @__PURE__ */ requireValidate();
|
|
2857
2857
|
class SchemaEnv {
|
|
2858
2858
|
constructor(env) {
|
|
2859
2859
|
var _a10;
|
|
@@ -3819,11 +3819,11 @@
|
|
|
3819
3819
|
(function(exports3) {
|
|
3820
3820
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
3821
3821
|
exports3.CodeGen = exports3.Name = exports3.nil = exports3.stringify = exports3.str = exports3._ = exports3.KeywordCxt = void 0;
|
|
3822
|
-
var validate_1 = requireValidate();
|
|
3822
|
+
var validate_1 = /* @__PURE__ */ requireValidate();
|
|
3823
3823
|
Object.defineProperty(exports3, "KeywordCxt", { enumerable: true, get: function() {
|
|
3824
3824
|
return validate_1.KeywordCxt;
|
|
3825
3825
|
} });
|
|
3826
|
-
var codegen_1 = requireCodegen();
|
|
3826
|
+
var codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
3827
3827
|
Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
|
|
3828
3828
|
return codegen_1._;
|
|
3829
3829
|
} });
|
|
@@ -3842,16 +3842,16 @@
|
|
|
3842
3842
|
Object.defineProperty(exports3, "CodeGen", { enumerable: true, get: function() {
|
|
3843
3843
|
return codegen_1.CodeGen;
|
|
3844
3844
|
} });
|
|
3845
|
-
const validation_error_1 = requireValidation_error();
|
|
3846
|
-
const ref_error_1 = requireRef_error();
|
|
3847
|
-
const rules_1 = requireRules();
|
|
3848
|
-
const compile_1 = requireCompile();
|
|
3849
|
-
const codegen_2 = requireCodegen();
|
|
3850
|
-
const resolve_1 = requireResolve();
|
|
3851
|
-
const dataType_1 = requireDataType();
|
|
3852
|
-
const util_1 = requireUtil();
|
|
3845
|
+
const validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
3846
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
3847
|
+
const rules_1 = /* @__PURE__ */ requireRules();
|
|
3848
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
3849
|
+
const codegen_2 = /* @__PURE__ */ requireCodegen();
|
|
3850
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
3851
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
3852
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
3853
3853
|
const $dataRefSchema = require$$9;
|
|
3854
|
-
const uri_1 = requireUri();
|
|
3854
|
+
const uri_1 = /* @__PURE__ */ requireUri();
|
|
3855
3855
|
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
3856
3856
|
defaultRegExp.code = "new RegExp";
|
|
3857
3857
|
const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
@@ -4448,12 +4448,12 @@
|
|
|
4448
4448
|
hasRequiredRef = 1;
|
|
4449
4449
|
Object.defineProperty(ref, "__esModule", { value: true });
|
|
4450
4450
|
ref.callRef = ref.getValidate = void 0;
|
|
4451
|
-
const ref_error_1 = requireRef_error();
|
|
4452
|
-
const code_1 = requireCode();
|
|
4453
|
-
const codegen_1 = requireCodegen();
|
|
4454
|
-
const names_1 = requireNames();
|
|
4455
|
-
const compile_1 = requireCompile();
|
|
4456
|
-
const util_1 = requireUtil();
|
|
4451
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
4452
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4453
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4454
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
4455
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
4456
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4457
4457
|
const def = {
|
|
4458
4458
|
keyword: "$ref",
|
|
4459
4459
|
schemaType: "string",
|
|
@@ -4568,8 +4568,8 @@
|
|
|
4568
4568
|
if (hasRequiredCore) return core;
|
|
4569
4569
|
hasRequiredCore = 1;
|
|
4570
4570
|
Object.defineProperty(core, "__esModule", { value: true });
|
|
4571
|
-
const id_1 = requireId();
|
|
4572
|
-
const ref_1 = requireRef();
|
|
4571
|
+
const id_1 = /* @__PURE__ */ requireId();
|
|
4572
|
+
const ref_1 = /* @__PURE__ */ requireRef();
|
|
4573
4573
|
const core$12 = [
|
|
4574
4574
|
"$schema",
|
|
4575
4575
|
"$id",
|
|
@@ -4590,7 +4590,7 @@
|
|
|
4590
4590
|
if (hasRequiredLimitNumber) return limitNumber;
|
|
4591
4591
|
hasRequiredLimitNumber = 1;
|
|
4592
4592
|
Object.defineProperty(limitNumber, "__esModule", { value: true });
|
|
4593
|
-
const codegen_1 = requireCodegen();
|
|
4593
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4594
4594
|
const ops = codegen_1.operators;
|
|
4595
4595
|
const KWDs = {
|
|
4596
4596
|
maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
@@ -4622,7 +4622,7 @@
|
|
|
4622
4622
|
if (hasRequiredMultipleOf) return multipleOf;
|
|
4623
4623
|
hasRequiredMultipleOf = 1;
|
|
4624
4624
|
Object.defineProperty(multipleOf, "__esModule", { value: true });
|
|
4625
|
-
const codegen_1 = requireCodegen();
|
|
4625
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4626
4626
|
const error = {
|
|
4627
4627
|
message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
|
|
4628
4628
|
params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
|
|
@@ -4676,9 +4676,9 @@
|
|
|
4676
4676
|
if (hasRequiredLimitLength) return limitLength;
|
|
4677
4677
|
hasRequiredLimitLength = 1;
|
|
4678
4678
|
Object.defineProperty(limitLength, "__esModule", { value: true });
|
|
4679
|
-
const codegen_1 = requireCodegen();
|
|
4680
|
-
const util_1 = requireUtil();
|
|
4681
|
-
const ucs2length_1 = requireUcs2length();
|
|
4679
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4680
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4681
|
+
const ucs2length_1 = /* @__PURE__ */ requireUcs2length();
|
|
4682
4682
|
const error = {
|
|
4683
4683
|
message({ keyword: keyword2, schemaCode }) {
|
|
4684
4684
|
const comp = keyword2 === "maxLength" ? "more" : "fewer";
|
|
@@ -4708,8 +4708,9 @@
|
|
|
4708
4708
|
if (hasRequiredPattern) return pattern;
|
|
4709
4709
|
hasRequiredPattern = 1;
|
|
4710
4710
|
Object.defineProperty(pattern, "__esModule", { value: true });
|
|
4711
|
-
const code_1 = requireCode();
|
|
4712
|
-
const
|
|
4711
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4712
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4713
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4713
4714
|
const error = {
|
|
4714
4715
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
4715
4716
|
params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
|
|
@@ -4721,10 +4722,18 @@
|
|
|
4721
4722
|
$data: true,
|
|
4722
4723
|
error,
|
|
4723
4724
|
code(cxt) {
|
|
4724
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
4725
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
4725
4726
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4726
|
-
|
|
4727
|
-
|
|
4727
|
+
if ($data) {
|
|
4728
|
+
const { regExp } = it.opts.code;
|
|
4729
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
4730
|
+
const valid = gen.let("valid");
|
|
4731
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
4732
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4733
|
+
} else {
|
|
4734
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
4735
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4736
|
+
}
|
|
4728
4737
|
}
|
|
4729
4738
|
};
|
|
4730
4739
|
pattern.default = def;
|
|
@@ -4736,7 +4745,7 @@
|
|
|
4736
4745
|
if (hasRequiredLimitProperties) return limitProperties;
|
|
4737
4746
|
hasRequiredLimitProperties = 1;
|
|
4738
4747
|
Object.defineProperty(limitProperties, "__esModule", { value: true });
|
|
4739
|
-
const codegen_1 = requireCodegen();
|
|
4748
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4740
4749
|
const error = {
|
|
4741
4750
|
message({ keyword: keyword2, schemaCode }) {
|
|
4742
4751
|
const comp = keyword2 === "maxProperties" ? "more" : "fewer";
|
|
@@ -4765,9 +4774,9 @@
|
|
|
4765
4774
|
if (hasRequiredRequired) return required$1;
|
|
4766
4775
|
hasRequiredRequired = 1;
|
|
4767
4776
|
Object.defineProperty(required$1, "__esModule", { value: true });
|
|
4768
|
-
const code_1 = requireCode();
|
|
4769
|
-
const codegen_1 = requireCodegen();
|
|
4770
|
-
const util_1 = requireUtil();
|
|
4777
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4778
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4779
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4771
4780
|
const error = {
|
|
4772
4781
|
message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
|
|
4773
4782
|
params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
|
|
@@ -4847,7 +4856,7 @@
|
|
|
4847
4856
|
if (hasRequiredLimitItems) return limitItems;
|
|
4848
4857
|
hasRequiredLimitItems = 1;
|
|
4849
4858
|
Object.defineProperty(limitItems, "__esModule", { value: true });
|
|
4850
|
-
const codegen_1 = requireCodegen();
|
|
4859
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4851
4860
|
const error = {
|
|
4852
4861
|
message({ keyword: keyword2, schemaCode }) {
|
|
4853
4862
|
const comp = keyword2 === "maxItems" ? "more" : "fewer";
|
|
@@ -4887,10 +4896,10 @@
|
|
|
4887
4896
|
if (hasRequiredUniqueItems) return uniqueItems;
|
|
4888
4897
|
hasRequiredUniqueItems = 1;
|
|
4889
4898
|
Object.defineProperty(uniqueItems, "__esModule", { value: true });
|
|
4890
|
-
const dataType_1 = requireDataType();
|
|
4891
|
-
const codegen_1 = requireCodegen();
|
|
4892
|
-
const util_1 = requireUtil();
|
|
4893
|
-
const equal_1 = requireEqual();
|
|
4899
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
4900
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4901
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4902
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4894
4903
|
const error = {
|
|
4895
4904
|
message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
|
|
4896
4905
|
params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
|
|
@@ -4954,9 +4963,9 @@
|
|
|
4954
4963
|
if (hasRequired_const) return _const;
|
|
4955
4964
|
hasRequired_const = 1;
|
|
4956
4965
|
Object.defineProperty(_const, "__esModule", { value: true });
|
|
4957
|
-
const codegen_1 = requireCodegen();
|
|
4958
|
-
const util_1 = requireUtil();
|
|
4959
|
-
const equal_1 = requireEqual();
|
|
4966
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4967
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4968
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4960
4969
|
const error = {
|
|
4961
4970
|
message: "must be equal to constant",
|
|
4962
4971
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
|
|
@@ -4983,9 +4992,9 @@
|
|
|
4983
4992
|
if (hasRequired_enum) return _enum$1;
|
|
4984
4993
|
hasRequired_enum = 1;
|
|
4985
4994
|
Object.defineProperty(_enum$1, "__esModule", { value: true });
|
|
4986
|
-
const codegen_1 = requireCodegen();
|
|
4987
|
-
const util_1 = requireUtil();
|
|
4988
|
-
const equal_1 = requireEqual();
|
|
4995
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4996
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4997
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4989
4998
|
const error = {
|
|
4990
4999
|
message: "must be equal to one of the allowed values",
|
|
4991
5000
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
|
|
@@ -5031,16 +5040,16 @@
|
|
|
5031
5040
|
if (hasRequiredValidation) return validation;
|
|
5032
5041
|
hasRequiredValidation = 1;
|
|
5033
5042
|
Object.defineProperty(validation, "__esModule", { value: true });
|
|
5034
|
-
const limitNumber_1 = requireLimitNumber();
|
|
5035
|
-
const multipleOf_1 = requireMultipleOf();
|
|
5036
|
-
const limitLength_1 = requireLimitLength();
|
|
5037
|
-
const pattern_1 = requirePattern();
|
|
5038
|
-
const limitProperties_1 = requireLimitProperties();
|
|
5039
|
-
const required_1 = requireRequired();
|
|
5040
|
-
const limitItems_1 = requireLimitItems();
|
|
5041
|
-
const uniqueItems_1 = requireUniqueItems();
|
|
5042
|
-
const const_1 = require_const();
|
|
5043
|
-
const enum_1 = require_enum();
|
|
5043
|
+
const limitNumber_1 = /* @__PURE__ */ requireLimitNumber();
|
|
5044
|
+
const multipleOf_1 = /* @__PURE__ */ requireMultipleOf();
|
|
5045
|
+
const limitLength_1 = /* @__PURE__ */ requireLimitLength();
|
|
5046
|
+
const pattern_1 = /* @__PURE__ */ requirePattern();
|
|
5047
|
+
const limitProperties_1 = /* @__PURE__ */ requireLimitProperties();
|
|
5048
|
+
const required_1 = /* @__PURE__ */ requireRequired();
|
|
5049
|
+
const limitItems_1 = /* @__PURE__ */ requireLimitItems();
|
|
5050
|
+
const uniqueItems_1 = /* @__PURE__ */ requireUniqueItems();
|
|
5051
|
+
const const_1 = /* @__PURE__ */ require_const();
|
|
5052
|
+
const enum_1 = /* @__PURE__ */ require_enum();
|
|
5044
5053
|
const validation$1 = [
|
|
5045
5054
|
// number
|
|
5046
5055
|
limitNumber_1.default,
|
|
@@ -5071,8 +5080,8 @@
|
|
|
5071
5080
|
hasRequiredAdditionalItems = 1;
|
|
5072
5081
|
Object.defineProperty(additionalItems, "__esModule", { value: true });
|
|
5073
5082
|
additionalItems.validateAdditionalItems = void 0;
|
|
5074
|
-
const codegen_1 = requireCodegen();
|
|
5075
|
-
const util_1 = requireUtil();
|
|
5083
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5084
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5076
5085
|
const error = {
|
|
5077
5086
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
5078
5087
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
@@ -5125,9 +5134,9 @@
|
|
|
5125
5134
|
hasRequiredItems = 1;
|
|
5126
5135
|
Object.defineProperty(items, "__esModule", { value: true });
|
|
5127
5136
|
items.validateTuple = void 0;
|
|
5128
|
-
const codegen_1 = requireCodegen();
|
|
5129
|
-
const util_1 = requireUtil();
|
|
5130
|
-
const code_1 = requireCode();
|
|
5137
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5138
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5139
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5131
5140
|
const def = {
|
|
5132
5141
|
keyword: "items",
|
|
5133
5142
|
type: "array",
|
|
@@ -5180,7 +5189,7 @@
|
|
|
5180
5189
|
if (hasRequiredPrefixItems) return prefixItems;
|
|
5181
5190
|
hasRequiredPrefixItems = 1;
|
|
5182
5191
|
Object.defineProperty(prefixItems, "__esModule", { value: true });
|
|
5183
|
-
const items_1 = requireItems();
|
|
5192
|
+
const items_1 = /* @__PURE__ */ requireItems();
|
|
5184
5193
|
const def = {
|
|
5185
5194
|
keyword: "prefixItems",
|
|
5186
5195
|
type: "array",
|
|
@@ -5197,10 +5206,10 @@
|
|
|
5197
5206
|
if (hasRequiredItems2020) return items2020;
|
|
5198
5207
|
hasRequiredItems2020 = 1;
|
|
5199
5208
|
Object.defineProperty(items2020, "__esModule", { value: true });
|
|
5200
|
-
const codegen_1 = requireCodegen();
|
|
5201
|
-
const util_1 = requireUtil();
|
|
5202
|
-
const code_1 = requireCode();
|
|
5203
|
-
const additionalItems_1 = requireAdditionalItems();
|
|
5209
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5210
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5211
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5212
|
+
const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
|
|
5204
5213
|
const error = {
|
|
5205
5214
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
5206
5215
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
@@ -5232,8 +5241,8 @@
|
|
|
5232
5241
|
if (hasRequiredContains) return contains;
|
|
5233
5242
|
hasRequiredContains = 1;
|
|
5234
5243
|
Object.defineProperty(contains, "__esModule", { value: true });
|
|
5235
|
-
const codegen_1 = requireCodegen();
|
|
5236
|
-
const util_1 = requireUtil();
|
|
5244
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5245
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5237
5246
|
const error = {
|
|
5238
5247
|
message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
|
|
5239
5248
|
params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
|
|
@@ -5328,9 +5337,9 @@
|
|
|
5328
5337
|
(function(exports3) {
|
|
5329
5338
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
5330
5339
|
exports3.validateSchemaDeps = exports3.validatePropertyDeps = exports3.error = void 0;
|
|
5331
|
-
const codegen_1 = requireCodegen();
|
|
5332
|
-
const util_1 = requireUtil();
|
|
5333
|
-
const code_1 = requireCode();
|
|
5340
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5341
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5342
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5334
5343
|
exports3.error = {
|
|
5335
5344
|
message: ({ params: { property, depsCount, deps } }) => {
|
|
5336
5345
|
const property_ies = depsCount === 1 ? "property" : "properties";
|
|
@@ -5422,8 +5431,8 @@
|
|
|
5422
5431
|
if (hasRequiredPropertyNames) return propertyNames;
|
|
5423
5432
|
hasRequiredPropertyNames = 1;
|
|
5424
5433
|
Object.defineProperty(propertyNames, "__esModule", { value: true });
|
|
5425
|
-
const codegen_1 = requireCodegen();
|
|
5426
|
-
const util_1 = requireUtil();
|
|
5434
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5435
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5427
5436
|
const error = {
|
|
5428
5437
|
message: "property name must be valid",
|
|
5429
5438
|
params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
|
|
@@ -5465,10 +5474,10 @@
|
|
|
5465
5474
|
if (hasRequiredAdditionalProperties) return additionalProperties;
|
|
5466
5475
|
hasRequiredAdditionalProperties = 1;
|
|
5467
5476
|
Object.defineProperty(additionalProperties, "__esModule", { value: true });
|
|
5468
|
-
const code_1 = requireCode();
|
|
5469
|
-
const codegen_1 = requireCodegen();
|
|
5470
|
-
const names_1 = requireNames();
|
|
5471
|
-
const util_1 = requireUtil();
|
|
5477
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5478
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5479
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
5480
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5472
5481
|
const error = {
|
|
5473
5482
|
message: "must NOT have additional properties",
|
|
5474
5483
|
params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
|
|
@@ -5571,10 +5580,10 @@
|
|
|
5571
5580
|
if (hasRequiredProperties) return properties$1;
|
|
5572
5581
|
hasRequiredProperties = 1;
|
|
5573
5582
|
Object.defineProperty(properties$1, "__esModule", { value: true });
|
|
5574
|
-
const validate_1 = requireValidate();
|
|
5575
|
-
const code_1 = requireCode();
|
|
5576
|
-
const util_1 = requireUtil();
|
|
5577
|
-
const additionalProperties_1 = requireAdditionalProperties();
|
|
5583
|
+
const validate_1 = /* @__PURE__ */ requireValidate();
|
|
5584
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5585
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5586
|
+
const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
|
|
5578
5587
|
const def = {
|
|
5579
5588
|
keyword: "properties",
|
|
5580
5589
|
type: "object",
|
|
@@ -5629,10 +5638,10 @@
|
|
|
5629
5638
|
if (hasRequiredPatternProperties) return patternProperties;
|
|
5630
5639
|
hasRequiredPatternProperties = 1;
|
|
5631
5640
|
Object.defineProperty(patternProperties, "__esModule", { value: true });
|
|
5632
|
-
const code_1 = requireCode();
|
|
5633
|
-
const codegen_1 = requireCodegen();
|
|
5634
|
-
const util_1 = requireUtil();
|
|
5635
|
-
const util_2 = requireUtil();
|
|
5641
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5642
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5643
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5644
|
+
const util_2 = /* @__PURE__ */ requireUtil();
|
|
5636
5645
|
const def = {
|
|
5637
5646
|
keyword: "patternProperties",
|
|
5638
5647
|
type: "object",
|
|
@@ -5703,7 +5712,7 @@
|
|
|
5703
5712
|
if (hasRequiredNot) return not;
|
|
5704
5713
|
hasRequiredNot = 1;
|
|
5705
5714
|
Object.defineProperty(not, "__esModule", { value: true });
|
|
5706
|
-
const util_1 = requireUtil();
|
|
5715
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5707
5716
|
const def = {
|
|
5708
5717
|
keyword: "not",
|
|
5709
5718
|
schemaType: ["object", "boolean"],
|
|
@@ -5734,7 +5743,7 @@
|
|
|
5734
5743
|
if (hasRequiredAnyOf) return anyOf;
|
|
5735
5744
|
hasRequiredAnyOf = 1;
|
|
5736
5745
|
Object.defineProperty(anyOf, "__esModule", { value: true });
|
|
5737
|
-
const code_1 = requireCode();
|
|
5746
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5738
5747
|
const def = {
|
|
5739
5748
|
keyword: "anyOf",
|
|
5740
5749
|
schemaType: "array",
|
|
@@ -5751,8 +5760,8 @@
|
|
|
5751
5760
|
if (hasRequiredOneOf) return oneOf;
|
|
5752
5761
|
hasRequiredOneOf = 1;
|
|
5753
5762
|
Object.defineProperty(oneOf, "__esModule", { value: true });
|
|
5754
|
-
const codegen_1 = requireCodegen();
|
|
5755
|
-
const util_1 = requireUtil();
|
|
5763
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5764
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5756
5765
|
const error = {
|
|
5757
5766
|
message: "must match exactly one schema in oneOf",
|
|
5758
5767
|
params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
|
|
@@ -5809,7 +5818,7 @@
|
|
|
5809
5818
|
if (hasRequiredAllOf) return allOf;
|
|
5810
5819
|
hasRequiredAllOf = 1;
|
|
5811
5820
|
Object.defineProperty(allOf, "__esModule", { value: true });
|
|
5812
|
-
const util_1 = requireUtil();
|
|
5821
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5813
5822
|
const def = {
|
|
5814
5823
|
keyword: "allOf",
|
|
5815
5824
|
schemaType: "array",
|
|
@@ -5836,8 +5845,8 @@
|
|
|
5836
5845
|
if (hasRequired_if) return _if;
|
|
5837
5846
|
hasRequired_if = 1;
|
|
5838
5847
|
Object.defineProperty(_if, "__esModule", { value: true });
|
|
5839
|
-
const codegen_1 = requireCodegen();
|
|
5840
|
-
const util_1 = requireUtil();
|
|
5848
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5849
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5841
5850
|
const error = {
|
|
5842
5851
|
message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
|
|
5843
5852
|
params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
|
|
@@ -5905,7 +5914,7 @@
|
|
|
5905
5914
|
if (hasRequiredThenElse) return thenElse;
|
|
5906
5915
|
hasRequiredThenElse = 1;
|
|
5907
5916
|
Object.defineProperty(thenElse, "__esModule", { value: true });
|
|
5908
|
-
const util_1 = requireUtil();
|
|
5917
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5909
5918
|
const def = {
|
|
5910
5919
|
keyword: ["then", "else"],
|
|
5911
5920
|
schemaType: ["object", "boolean"],
|
|
@@ -5922,22 +5931,22 @@
|
|
|
5922
5931
|
if (hasRequiredApplicator) return applicator;
|
|
5923
5932
|
hasRequiredApplicator = 1;
|
|
5924
5933
|
Object.defineProperty(applicator, "__esModule", { value: true });
|
|
5925
|
-
const additionalItems_1 = requireAdditionalItems();
|
|
5926
|
-
const prefixItems_1 = requirePrefixItems();
|
|
5927
|
-
const items_1 = requireItems();
|
|
5928
|
-
const items2020_1 = requireItems2020();
|
|
5929
|
-
const contains_1 = requireContains();
|
|
5930
|
-
const dependencies_1 = requireDependencies();
|
|
5931
|
-
const propertyNames_1 = requirePropertyNames();
|
|
5932
|
-
const additionalProperties_1 = requireAdditionalProperties();
|
|
5933
|
-
const properties_1 = requireProperties();
|
|
5934
|
-
const patternProperties_1 = requirePatternProperties();
|
|
5935
|
-
const not_1 = requireNot();
|
|
5936
|
-
const anyOf_1 = requireAnyOf();
|
|
5937
|
-
const oneOf_1 = requireOneOf();
|
|
5938
|
-
const allOf_1 = requireAllOf();
|
|
5939
|
-
const if_1 = require_if();
|
|
5940
|
-
const thenElse_1 = requireThenElse();
|
|
5934
|
+
const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
|
|
5935
|
+
const prefixItems_1 = /* @__PURE__ */ requirePrefixItems();
|
|
5936
|
+
const items_1 = /* @__PURE__ */ requireItems();
|
|
5937
|
+
const items2020_1 = /* @__PURE__ */ requireItems2020();
|
|
5938
|
+
const contains_1 = /* @__PURE__ */ requireContains();
|
|
5939
|
+
const dependencies_1 = /* @__PURE__ */ requireDependencies();
|
|
5940
|
+
const propertyNames_1 = /* @__PURE__ */ requirePropertyNames();
|
|
5941
|
+
const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
|
|
5942
|
+
const properties_1 = /* @__PURE__ */ requireProperties();
|
|
5943
|
+
const patternProperties_1 = /* @__PURE__ */ requirePatternProperties();
|
|
5944
|
+
const not_1 = /* @__PURE__ */ requireNot();
|
|
5945
|
+
const anyOf_1 = /* @__PURE__ */ requireAnyOf();
|
|
5946
|
+
const oneOf_1 = /* @__PURE__ */ requireOneOf();
|
|
5947
|
+
const allOf_1 = /* @__PURE__ */ requireAllOf();
|
|
5948
|
+
const if_1 = /* @__PURE__ */ require_if();
|
|
5949
|
+
const thenElse_1 = /* @__PURE__ */ requireThenElse();
|
|
5941
5950
|
function getApplicator(draft2020 = false) {
|
|
5942
5951
|
const applicator2 = [
|
|
5943
5952
|
// any
|
|
@@ -5971,7 +5980,7 @@
|
|
|
5971
5980
|
if (hasRequiredFormat$1) return format;
|
|
5972
5981
|
hasRequiredFormat$1 = 1;
|
|
5973
5982
|
Object.defineProperty(format, "__esModule", { value: true });
|
|
5974
|
-
const codegen_1 = requireCodegen();
|
|
5983
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5975
5984
|
const error = {
|
|
5976
5985
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
|
|
5977
5986
|
params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
|
|
@@ -6060,7 +6069,7 @@
|
|
|
6060
6069
|
if (hasRequiredFormat) return format$1;
|
|
6061
6070
|
hasRequiredFormat = 1;
|
|
6062
6071
|
Object.defineProperty(format$1, "__esModule", { value: true });
|
|
6063
|
-
const format_1 = requireFormat$1();
|
|
6072
|
+
const format_1 = /* @__PURE__ */ requireFormat$1();
|
|
6064
6073
|
const format2 = [format_1.default];
|
|
6065
6074
|
format$1.default = format2;
|
|
6066
6075
|
return format$1;
|
|
@@ -6093,11 +6102,11 @@
|
|
|
6093
6102
|
if (hasRequiredDraft7) return draft7;
|
|
6094
6103
|
hasRequiredDraft7 = 1;
|
|
6095
6104
|
Object.defineProperty(draft7, "__esModule", { value: true });
|
|
6096
|
-
const core_1 = requireCore();
|
|
6097
|
-
const validation_1 = requireValidation();
|
|
6098
|
-
const applicator_1 = requireApplicator();
|
|
6099
|
-
const format_1 = requireFormat();
|
|
6100
|
-
const metadata_1 = requireMetadata();
|
|
6105
|
+
const core_1 = /* @__PURE__ */ requireCore();
|
|
6106
|
+
const validation_1 = /* @__PURE__ */ requireValidation();
|
|
6107
|
+
const applicator_1 = /* @__PURE__ */ requireApplicator();
|
|
6108
|
+
const format_1 = /* @__PURE__ */ requireFormat();
|
|
6109
|
+
const metadata_1 = /* @__PURE__ */ requireMetadata();
|
|
6101
6110
|
const draft7Vocabularies = [
|
|
6102
6111
|
core_1.default,
|
|
6103
6112
|
validation_1.default,
|
|
@@ -6129,11 +6138,11 @@
|
|
|
6129
6138
|
if (hasRequiredDiscriminator) return discriminator;
|
|
6130
6139
|
hasRequiredDiscriminator = 1;
|
|
6131
6140
|
Object.defineProperty(discriminator, "__esModule", { value: true });
|
|
6132
|
-
const codegen_1 = requireCodegen();
|
|
6133
|
-
const types_1 = requireTypes();
|
|
6134
|
-
const compile_1 = requireCompile();
|
|
6135
|
-
const ref_error_1 = requireRef_error();
|
|
6136
|
-
const util_1 = requireUtil();
|
|
6141
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
6142
|
+
const types_1 = /* @__PURE__ */ requireTypes();
|
|
6143
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
6144
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
6145
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
6137
6146
|
const error = {
|
|
6138
6147
|
message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
|
|
6139
6148
|
params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
|
|
@@ -6250,9 +6259,9 @@
|
|
|
6250
6259
|
(function(module2, exports3) {
|
|
6251
6260
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
6252
6261
|
exports3.MissingRefError = exports3.ValidationError = exports3.CodeGen = exports3.Name = exports3.nil = exports3.stringify = exports3.str = exports3._ = exports3.KeywordCxt = exports3.Ajv = void 0;
|
|
6253
|
-
const core_1 = requireCore$1();
|
|
6254
|
-
const draft7_1 = requireDraft7();
|
|
6255
|
-
const discriminator_1 = requireDiscriminator();
|
|
6262
|
+
const core_1 = /* @__PURE__ */ requireCore$1();
|
|
6263
|
+
const draft7_1 = /* @__PURE__ */ requireDraft7();
|
|
6264
|
+
const discriminator_1 = /* @__PURE__ */ requireDiscriminator();
|
|
6256
6265
|
const draft7MetaSchema = require$$3;
|
|
6257
6266
|
const META_SUPPORT_DATA = ["/properties"];
|
|
6258
6267
|
const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
@@ -6280,11 +6289,11 @@
|
|
|
6280
6289
|
module2.exports.Ajv = Ajv2;
|
|
6281
6290
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
6282
6291
|
exports3.default = Ajv2;
|
|
6283
|
-
var validate_1 = requireValidate();
|
|
6292
|
+
var validate_1 = /* @__PURE__ */ requireValidate();
|
|
6284
6293
|
Object.defineProperty(exports3, "KeywordCxt", { enumerable: true, get: function() {
|
|
6285
6294
|
return validate_1.KeywordCxt;
|
|
6286
6295
|
} });
|
|
6287
|
-
var codegen_1 = requireCodegen();
|
|
6296
|
+
var codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
6288
6297
|
Object.defineProperty(exports3, "_", { enumerable: true, get: function() {
|
|
6289
6298
|
return codegen_1._;
|
|
6290
6299
|
} });
|
|
@@ -6303,18 +6312,18 @@
|
|
|
6303
6312
|
Object.defineProperty(exports3, "CodeGen", { enumerable: true, get: function() {
|
|
6304
6313
|
return codegen_1.CodeGen;
|
|
6305
6314
|
} });
|
|
6306
|
-
var validation_error_1 = requireValidation_error();
|
|
6315
|
+
var validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
6307
6316
|
Object.defineProperty(exports3, "ValidationError", { enumerable: true, get: function() {
|
|
6308
6317
|
return validation_error_1.default;
|
|
6309
6318
|
} });
|
|
6310
|
-
var ref_error_1 = requireRef_error();
|
|
6319
|
+
var ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
6311
6320
|
Object.defineProperty(exports3, "MissingRefError", { enumerable: true, get: function() {
|
|
6312
6321
|
return ref_error_1.default;
|
|
6313
6322
|
} });
|
|
6314
6323
|
})(ajv, ajv.exports);
|
|
6315
6324
|
return ajv.exports;
|
|
6316
6325
|
}
|
|
6317
|
-
var ajvExports = requireAjv();
|
|
6326
|
+
var ajvExports = /* @__PURE__ */ requireAjv();
|
|
6318
6327
|
const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports);
|
|
6319
6328
|
var util;
|
|
6320
6329
|
(function(util2) {
|
|
@@ -18625,8 +18634,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18625
18634
|
(function(exports3) {
|
|
18626
18635
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
18627
18636
|
exports3.formatLimitDefinition = void 0;
|
|
18628
|
-
const ajv_1 = requireAjv();
|
|
18629
|
-
const codegen_1 = requireCodegen();
|
|
18637
|
+
const ajv_1 = /* @__PURE__ */ requireAjv();
|
|
18638
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
18630
18639
|
const ops = codegen_1.operators;
|
|
18631
18640
|
const KWDs = {
|
|
18632
18641
|
formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
@@ -18699,7 +18708,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18699
18708
|
Object.defineProperty(exports3, "__esModule", { value: true });
|
|
18700
18709
|
const formats_1 = requireFormats();
|
|
18701
18710
|
const limit_1 = requireLimit();
|
|
18702
|
-
const codegen_1 = requireCodegen();
|
|
18711
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
18703
18712
|
const fullName = new codegen_1.Name("fullFormats");
|
|
18704
18713
|
const fastName = new codegen_1.Name("fastFormats");
|
|
18705
18714
|
const formatsPlugin = (ajv2, opts = { keywords: true }) => {
|
|
@@ -31197,17 +31206,14 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
31197
31206
|
var _a92;
|
|
31198
31207
|
const resolvedHeaders = await resolve(this.config.headers());
|
|
31199
31208
|
try {
|
|
31200
|
-
const {
|
|
31201
|
-
responseHeaders,
|
|
31202
|
-
value: responseBody,
|
|
31203
|
-
rawValue
|
|
31204
|
-
} = await postJsonToApi$1({
|
|
31209
|
+
const { responseHeaders, value: responseBody } = await postJsonToApi$1({
|
|
31205
31210
|
url: this.getUrl(),
|
|
31206
31211
|
headers: combineHeaders$1(
|
|
31207
31212
|
resolvedHeaders,
|
|
31208
31213
|
headers != null ? headers : {},
|
|
31209
31214
|
this.getModelConfigHeaders(),
|
|
31210
|
-
await resolve(this.config.o11yHeaders)
|
|
31215
|
+
await resolve(this.config.o11yHeaders),
|
|
31216
|
+
{ accept: "text/event-stream" }
|
|
31211
31217
|
),
|
|
31212
31218
|
body: {
|
|
31213
31219
|
prompt,
|
|
@@ -31220,9 +31226,70 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
31220
31226
|
...providerOptions && { providerOptions },
|
|
31221
31227
|
...image && { image: maybeEncodeVideoFile(image) }
|
|
31222
31228
|
},
|
|
31223
|
-
successfulResponseHandler:
|
|
31224
|
-
|
|
31225
|
-
|
|
31229
|
+
successfulResponseHandler: async ({
|
|
31230
|
+
response,
|
|
31231
|
+
url: url2,
|
|
31232
|
+
requestBodyValues
|
|
31233
|
+
}) => {
|
|
31234
|
+
if (response.body == null) {
|
|
31235
|
+
throw new APICallError$1({
|
|
31236
|
+
message: "SSE response body is empty",
|
|
31237
|
+
url: url2,
|
|
31238
|
+
requestBodyValues,
|
|
31239
|
+
statusCode: response.status
|
|
31240
|
+
});
|
|
31241
|
+
}
|
|
31242
|
+
const eventStream = parseJsonEventStream$1({
|
|
31243
|
+
stream: response.body,
|
|
31244
|
+
schema: gatewayVideoEventSchema
|
|
31245
|
+
});
|
|
31246
|
+
const reader = eventStream.getReader();
|
|
31247
|
+
const { done, value: parseResult } = await reader.read();
|
|
31248
|
+
reader.releaseLock();
|
|
31249
|
+
if (done || !parseResult) {
|
|
31250
|
+
throw new APICallError$1({
|
|
31251
|
+
message: "SSE stream ended without a data event",
|
|
31252
|
+
url: url2,
|
|
31253
|
+
requestBodyValues,
|
|
31254
|
+
statusCode: response.status
|
|
31255
|
+
});
|
|
31256
|
+
}
|
|
31257
|
+
if (!parseResult.success) {
|
|
31258
|
+
throw new APICallError$1({
|
|
31259
|
+
message: "Failed to parse video SSE event",
|
|
31260
|
+
cause: parseResult.error,
|
|
31261
|
+
url: url2,
|
|
31262
|
+
requestBodyValues,
|
|
31263
|
+
statusCode: response.status
|
|
31264
|
+
});
|
|
31265
|
+
}
|
|
31266
|
+
const event = parseResult.value;
|
|
31267
|
+
if (event.type === "error") {
|
|
31268
|
+
throw new APICallError$1({
|
|
31269
|
+
message: event.message,
|
|
31270
|
+
statusCode: event.statusCode,
|
|
31271
|
+
url: url2,
|
|
31272
|
+
requestBodyValues,
|
|
31273
|
+
responseHeaders: Object.fromEntries([...response.headers]),
|
|
31274
|
+
responseBody: JSON.stringify(event),
|
|
31275
|
+
data: {
|
|
31276
|
+
error: {
|
|
31277
|
+
message: event.message,
|
|
31278
|
+
type: event.errorType,
|
|
31279
|
+
param: event.param
|
|
31280
|
+
}
|
|
31281
|
+
}
|
|
31282
|
+
});
|
|
31283
|
+
}
|
|
31284
|
+
return {
|
|
31285
|
+
value: {
|
|
31286
|
+
videos: event.videos,
|
|
31287
|
+
warnings: event.warnings,
|
|
31288
|
+
providerMetadata: event.providerMetadata
|
|
31289
|
+
},
|
|
31290
|
+
responseHeaders: Object.fromEntries([...response.headers])
|
|
31291
|
+
};
|
|
31292
|
+
},
|
|
31226
31293
|
failedResponseHandler: createJsonErrorResponseHandler$1({
|
|
31227
31294
|
errorSchema: any(),
|
|
31228
31295
|
errorToMessage: (data) => data
|
|
@@ -31294,11 +31361,21 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
31294
31361
|
message: string()
|
|
31295
31362
|
})
|
|
31296
31363
|
]);
|
|
31297
|
-
var
|
|
31298
|
-
|
|
31299
|
-
|
|
31300
|
-
|
|
31301
|
-
|
|
31364
|
+
var gatewayVideoEventSchema = discriminatedUnion("type", [
|
|
31365
|
+
object$2({
|
|
31366
|
+
type: literal("result"),
|
|
31367
|
+
videos: array$1(gatewayVideoDataSchema),
|
|
31368
|
+
warnings: array$1(gatewayVideoWarningSchema).optional(),
|
|
31369
|
+
providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
|
|
31370
|
+
}),
|
|
31371
|
+
object$2({
|
|
31372
|
+
type: literal("error"),
|
|
31373
|
+
message: string(),
|
|
31374
|
+
errorType: string(),
|
|
31375
|
+
statusCode: number$1(),
|
|
31376
|
+
param: unknown().nullable()
|
|
31377
|
+
})
|
|
31378
|
+
]);
|
|
31302
31379
|
var parallelSearchInputSchema = lazySchema(
|
|
31303
31380
|
() => zodSchema(
|
|
31304
31381
|
objectType({
|
|
@@ -31475,7 +31552,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
31475
31552
|
var _a92;
|
|
31476
31553
|
return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
|
|
31477
31554
|
}
|
|
31478
|
-
var VERSION$6 = "3.0.
|
|
31555
|
+
var VERSION$6 = "3.0.55";
|
|
31479
31556
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
31480
31557
|
function createGatewayProvider(options = {}) {
|
|
31481
31558
|
var _a92, _b9;
|
|
@@ -31518,13 +31595,18 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
31518
31595
|
settingValue: void 0,
|
|
31519
31596
|
environmentVariableName: "VERCEL_REGION"
|
|
31520
31597
|
});
|
|
31598
|
+
const projectId = loadOptionalSetting({
|
|
31599
|
+
settingValue: void 0,
|
|
31600
|
+
environmentVariableName: "VERCEL_PROJECT_ID"
|
|
31601
|
+
});
|
|
31521
31602
|
return async () => {
|
|
31522
31603
|
const requestId = await getVercelRequestId();
|
|
31523
31604
|
return {
|
|
31524
31605
|
...deploymentId && { "ai-o11y-deployment-id": deploymentId },
|
|
31525
31606
|
...environment && { "ai-o11y-environment": environment },
|
|
31526
31607
|
...region && { "ai-o11y-region": region },
|
|
31527
|
-
...requestId && { "ai-o11y-request-id": requestId }
|
|
31608
|
+
...requestId && { "ai-o11y-request-id": requestId },
|
|
31609
|
+
...projectId && { "ai-o11y-project-id": projectId }
|
|
31528
31610
|
};
|
|
31529
31611
|
};
|
|
31530
31612
|
};
|
|
@@ -33292,7 +33374,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
33292
33374
|
}
|
|
33293
33375
|
return void 0;
|
|
33294
33376
|
}
|
|
33295
|
-
var VERSION$4 = "6.0.
|
|
33377
|
+
var VERSION$4 = "6.0.99";
|
|
33296
33378
|
var download = async ({
|
|
33297
33379
|
url: url2,
|
|
33298
33380
|
maxBytes,
|
|
@@ -34717,6 +34799,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34717
34799
|
}
|
|
34718
34800
|
return { approvedToolApprovals, deniedToolApprovals };
|
|
34719
34801
|
}
|
|
34802
|
+
function now() {
|
|
34803
|
+
var _a21, _b9;
|
|
34804
|
+
return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
|
|
34805
|
+
}
|
|
34720
34806
|
async function executeToolCall({
|
|
34721
34807
|
toolCall,
|
|
34722
34808
|
tools,
|
|
@@ -34725,13 +34811,27 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34725
34811
|
messages,
|
|
34726
34812
|
abortSignal,
|
|
34727
34813
|
experimental_context,
|
|
34728
|
-
|
|
34814
|
+
stepNumber,
|
|
34815
|
+
model,
|
|
34816
|
+
onPreliminaryToolResult,
|
|
34817
|
+
onToolCallStart,
|
|
34818
|
+
onToolCallFinish
|
|
34729
34819
|
}) {
|
|
34730
34820
|
const { toolName, toolCallId, input } = toolCall;
|
|
34731
34821
|
const tool2 = tools == null ? void 0 : tools[toolName];
|
|
34732
34822
|
if ((tool2 == null ? void 0 : tool2.execute) == null) {
|
|
34733
34823
|
return void 0;
|
|
34734
34824
|
}
|
|
34825
|
+
const baseCallbackEvent = {
|
|
34826
|
+
stepNumber,
|
|
34827
|
+
model,
|
|
34828
|
+
toolCall,
|
|
34829
|
+
messages,
|
|
34830
|
+
abortSignal,
|
|
34831
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
34832
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
34833
|
+
experimental_context
|
|
34834
|
+
};
|
|
34735
34835
|
return recordSpan({
|
|
34736
34836
|
name: "ai.toolCall",
|
|
34737
34837
|
attributes: selectTelemetryAttributes({
|
|
@@ -34751,6 +34851,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34751
34851
|
tracer,
|
|
34752
34852
|
fn: async (span) => {
|
|
34753
34853
|
let output;
|
|
34854
|
+
try {
|
|
34855
|
+
await (onToolCallStart == null ? void 0 : onToolCallStart(baseCallbackEvent));
|
|
34856
|
+
} catch (_ignored) {
|
|
34857
|
+
}
|
|
34858
|
+
const startTime = now();
|
|
34754
34859
|
try {
|
|
34755
34860
|
const stream = executeTool({
|
|
34756
34861
|
execute: tool2.execute.bind(tool2),
|
|
@@ -34775,6 +34880,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34775
34880
|
}
|
|
34776
34881
|
}
|
|
34777
34882
|
} catch (error) {
|
|
34883
|
+
const durationMs2 = now() - startTime;
|
|
34884
|
+
try {
|
|
34885
|
+
await (onToolCallFinish == null ? void 0 : onToolCallFinish({
|
|
34886
|
+
...baseCallbackEvent,
|
|
34887
|
+
success: false,
|
|
34888
|
+
error,
|
|
34889
|
+
durationMs: durationMs2
|
|
34890
|
+
}));
|
|
34891
|
+
} catch (_ignored) {
|
|
34892
|
+
}
|
|
34778
34893
|
recordErrorOnSpan(span, error);
|
|
34779
34894
|
return {
|
|
34780
34895
|
type: "tool-error",
|
|
@@ -34786,6 +34901,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34786
34901
|
...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
|
|
34787
34902
|
};
|
|
34788
34903
|
}
|
|
34904
|
+
const durationMs = now() - startTime;
|
|
34905
|
+
try {
|
|
34906
|
+
await (onToolCallFinish == null ? void 0 : onToolCallFinish({
|
|
34907
|
+
...baseCallbackEvent,
|
|
34908
|
+
success: true,
|
|
34909
|
+
output,
|
|
34910
|
+
durationMs
|
|
34911
|
+
}));
|
|
34912
|
+
} catch (_ignored) {
|
|
34913
|
+
}
|
|
34789
34914
|
try {
|
|
34790
34915
|
span.setAttributes(
|
|
34791
34916
|
await selectTelemetryAttributes({
|
|
@@ -35649,6 +35774,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35649
35774
|
}
|
|
35650
35775
|
var DefaultStepResult = class {
|
|
35651
35776
|
constructor({
|
|
35777
|
+
stepNumber,
|
|
35778
|
+
model,
|
|
35779
|
+
functionId,
|
|
35780
|
+
metadata: metadata2,
|
|
35781
|
+
experimental_context,
|
|
35652
35782
|
content,
|
|
35653
35783
|
finishReason,
|
|
35654
35784
|
rawFinishReason,
|
|
@@ -35658,6 +35788,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35658
35788
|
response,
|
|
35659
35789
|
providerMetadata
|
|
35660
35790
|
}) {
|
|
35791
|
+
this.stepNumber = stepNumber;
|
|
35792
|
+
this.model = model;
|
|
35793
|
+
this.functionId = functionId;
|
|
35794
|
+
this.metadata = metadata2;
|
|
35795
|
+
this.experimental_context = experimental_context;
|
|
35661
35796
|
this.content = content;
|
|
35662
35797
|
this.finishReason = finishReason;
|
|
35663
35798
|
this.rawFinishReason = rawFinishReason;
|
|
@@ -35899,6 +36034,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35899
36034
|
experimental_context,
|
|
35900
36035
|
experimental_include: include,
|
|
35901
36036
|
_internal: { generateId: generateId2 = originalGenerateId } = {},
|
|
36037
|
+
experimental_onStart: onStart,
|
|
36038
|
+
experimental_onStepStart: onStepStart,
|
|
36039
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
36040
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
35902
36041
|
onStepFinish,
|
|
35903
36042
|
onFinish,
|
|
35904
36043
|
...settings
|
|
@@ -35928,11 +36067,43 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35928
36067
|
headers: headersWithUserAgent,
|
|
35929
36068
|
settings: { ...callSettings, maxRetries }
|
|
35930
36069
|
});
|
|
36070
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
35931
36071
|
const initialPrompt = await standardizePrompt({
|
|
35932
36072
|
system,
|
|
35933
36073
|
prompt,
|
|
35934
36074
|
messages
|
|
35935
36075
|
});
|
|
36076
|
+
try {
|
|
36077
|
+
await (onStart == null ? void 0 : onStart({
|
|
36078
|
+
model: modelInfo,
|
|
36079
|
+
system,
|
|
36080
|
+
prompt,
|
|
36081
|
+
messages,
|
|
36082
|
+
tools,
|
|
36083
|
+
toolChoice,
|
|
36084
|
+
activeTools,
|
|
36085
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
36086
|
+
temperature: callSettings.temperature,
|
|
36087
|
+
topP: callSettings.topP,
|
|
36088
|
+
topK: callSettings.topK,
|
|
36089
|
+
presencePenalty: callSettings.presencePenalty,
|
|
36090
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
36091
|
+
stopSequences: callSettings.stopSequences,
|
|
36092
|
+
seed: callSettings.seed,
|
|
36093
|
+
maxRetries,
|
|
36094
|
+
timeout,
|
|
36095
|
+
headers,
|
|
36096
|
+
providerOptions,
|
|
36097
|
+
stopWhen,
|
|
36098
|
+
output,
|
|
36099
|
+
abortSignal,
|
|
36100
|
+
include,
|
|
36101
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36102
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36103
|
+
experimental_context
|
|
36104
|
+
}));
|
|
36105
|
+
} catch (_ignored) {
|
|
36106
|
+
}
|
|
35936
36107
|
const tracer = getTracer(telemetry);
|
|
35937
36108
|
try {
|
|
35938
36109
|
return await recordSpan({
|
|
@@ -35956,7 +36127,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35956
36127
|
}),
|
|
35957
36128
|
tracer,
|
|
35958
36129
|
fn: async (span) => {
|
|
35959
|
-
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
36130
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
35960
36131
|
const initialMessages = initialPrompt.messages;
|
|
35961
36132
|
const responseMessages = [];
|
|
35962
36133
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -35973,7 +36144,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35973
36144
|
telemetry,
|
|
35974
36145
|
messages: initialMessages,
|
|
35975
36146
|
abortSignal: mergedAbortSignal,
|
|
35976
|
-
experimental_context
|
|
36147
|
+
experimental_context,
|
|
36148
|
+
stepNumber: 0,
|
|
36149
|
+
model: modelInfo,
|
|
36150
|
+
onToolCallStart,
|
|
36151
|
+
onToolCallFinish
|
|
35977
36152
|
});
|
|
35978
36153
|
const toolContent = [];
|
|
35979
36154
|
for (const output2 of toolOutputs) {
|
|
@@ -36053,6 +36228,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36053
36228
|
const stepModel = resolveLanguageModel(
|
|
36054
36229
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
36055
36230
|
);
|
|
36231
|
+
const stepModelInfo = {
|
|
36232
|
+
provider: stepModel.provider,
|
|
36233
|
+
modelId: stepModel.modelId
|
|
36234
|
+
};
|
|
36056
36235
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
36057
36236
|
prompt: {
|
|
36058
36237
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -36062,11 +36241,41 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36062
36241
|
download: download2
|
|
36063
36242
|
});
|
|
36064
36243
|
experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
|
|
36244
|
+
const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
|
|
36065
36245
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
36066
36246
|
tools,
|
|
36067
|
-
toolChoice: (
|
|
36068
|
-
activeTools:
|
|
36247
|
+
toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
|
|
36248
|
+
activeTools: stepActiveTools
|
|
36069
36249
|
});
|
|
36250
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
36251
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
36252
|
+
const stepProviderOptions = mergeObjects(
|
|
36253
|
+
providerOptions,
|
|
36254
|
+
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
36255
|
+
);
|
|
36256
|
+
try {
|
|
36257
|
+
await (onStepStart == null ? void 0 : onStepStart({
|
|
36258
|
+
stepNumber: steps.length,
|
|
36259
|
+
model: stepModelInfo,
|
|
36260
|
+
system: stepSystem,
|
|
36261
|
+
messages: stepMessages,
|
|
36262
|
+
tools,
|
|
36263
|
+
toolChoice: stepToolChoice,
|
|
36264
|
+
activeTools: stepActiveTools,
|
|
36265
|
+
steps: [...steps],
|
|
36266
|
+
providerOptions: stepProviderOptions,
|
|
36267
|
+
timeout,
|
|
36268
|
+
headers,
|
|
36269
|
+
stopWhen,
|
|
36270
|
+
output,
|
|
36271
|
+
abortSignal,
|
|
36272
|
+
include,
|
|
36273
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36274
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36275
|
+
experimental_context
|
|
36276
|
+
}));
|
|
36277
|
+
} catch (_ignored) {
|
|
36278
|
+
}
|
|
36070
36279
|
currentModelResponse = await retry(
|
|
36071
36280
|
() => {
|
|
36072
36281
|
var _a22;
|
|
@@ -36109,10 +36318,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36109
36318
|
tracer,
|
|
36110
36319
|
fn: async (span2) => {
|
|
36111
36320
|
var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
36112
|
-
const stepProviderOptions = mergeObjects(
|
|
36113
|
-
providerOptions,
|
|
36114
|
-
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
36115
|
-
);
|
|
36116
36321
|
const result = await stepModel.doGenerate({
|
|
36117
36322
|
...callSettings2,
|
|
36118
36323
|
tools: stepTools,
|
|
@@ -36244,7 +36449,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36244
36449
|
telemetry,
|
|
36245
36450
|
messages: stepInputMessages,
|
|
36246
36451
|
abortSignal: mergedAbortSignal,
|
|
36247
|
-
experimental_context
|
|
36452
|
+
experimental_context,
|
|
36453
|
+
stepNumber: steps.length,
|
|
36454
|
+
model: stepModelInfo,
|
|
36455
|
+
onToolCallStart,
|
|
36456
|
+
onToolCallFinish
|
|
36248
36457
|
})
|
|
36249
36458
|
);
|
|
36250
36459
|
}
|
|
@@ -36281,15 +36490,21 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36281
36490
|
tools
|
|
36282
36491
|
})
|
|
36283
36492
|
);
|
|
36284
|
-
const stepRequest = ((
|
|
36493
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
|
|
36285
36494
|
const stepResponse = {
|
|
36286
36495
|
...currentModelResponse.response,
|
|
36287
36496
|
// deep clone msgs to avoid mutating past messages in multi-step:
|
|
36288
36497
|
messages: structuredClone(responseMessages),
|
|
36289
36498
|
// Conditionally include response body:
|
|
36290
|
-
body: ((
|
|
36499
|
+
body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
|
|
36291
36500
|
};
|
|
36501
|
+
const stepNumber = steps.length;
|
|
36292
36502
|
const currentStepResult = new DefaultStepResult({
|
|
36503
|
+
stepNumber,
|
|
36504
|
+
model: stepModelInfo,
|
|
36505
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36506
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36507
|
+
experimental_context,
|
|
36293
36508
|
content: stepContent,
|
|
36294
36509
|
finishReason: currentModelResponse.finishReason.unified,
|
|
36295
36510
|
rawFinishReason: currentModelResponse.finishReason.raw,
|
|
@@ -36300,9 +36515,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36300
36515
|
response: stepResponse
|
|
36301
36516
|
});
|
|
36302
36517
|
logWarnings({
|
|
36303
|
-
warnings: (
|
|
36304
|
-
provider:
|
|
36305
|
-
model:
|
|
36518
|
+
warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
|
|
36519
|
+
provider: stepModelInfo.provider,
|
|
36520
|
+
model: stepModelInfo.modelId
|
|
36306
36521
|
});
|
|
36307
36522
|
steps.push(currentStepResult);
|
|
36308
36523
|
await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
|
|
@@ -36358,6 +36573,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36358
36573
|
}
|
|
36359
36574
|
);
|
|
36360
36575
|
await (onFinish == null ? void 0 : onFinish({
|
|
36576
|
+
stepNumber: lastStep.stepNumber,
|
|
36577
|
+
model: lastStep.model,
|
|
36578
|
+
functionId: lastStep.functionId,
|
|
36579
|
+
metadata: lastStep.metadata,
|
|
36580
|
+
experimental_context: lastStep.experimental_context,
|
|
36361
36581
|
finishReason: lastStep.finishReason,
|
|
36362
36582
|
rawFinishReason: lastStep.rawFinishReason,
|
|
36363
36583
|
usage: lastStep.usage,
|
|
@@ -36378,8 +36598,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36378
36598
|
warnings: lastStep.warnings,
|
|
36379
36599
|
providerMetadata: lastStep.providerMetadata,
|
|
36380
36600
|
steps,
|
|
36381
|
-
totalUsage
|
|
36382
|
-
experimental_context
|
|
36601
|
+
totalUsage
|
|
36383
36602
|
}));
|
|
36384
36603
|
let resolvedOutput;
|
|
36385
36604
|
if (lastStep.finishReason === "stop") {
|
|
@@ -36411,7 +36630,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36411
36630
|
telemetry,
|
|
36412
36631
|
messages,
|
|
36413
36632
|
abortSignal,
|
|
36414
|
-
experimental_context
|
|
36633
|
+
experimental_context,
|
|
36634
|
+
stepNumber,
|
|
36635
|
+
model,
|
|
36636
|
+
onToolCallStart,
|
|
36637
|
+
onToolCallFinish
|
|
36415
36638
|
}) {
|
|
36416
36639
|
const toolOutputs = await Promise.all(
|
|
36417
36640
|
toolCalls.map(
|
|
@@ -36422,7 +36645,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36422
36645
|
telemetry,
|
|
36423
36646
|
messages,
|
|
36424
36647
|
abortSignal,
|
|
36425
|
-
experimental_context
|
|
36648
|
+
experimental_context,
|
|
36649
|
+
stepNumber,
|
|
36650
|
+
model,
|
|
36651
|
+
onToolCallStart,
|
|
36652
|
+
onToolCallFinish
|
|
36426
36653
|
})
|
|
36427
36654
|
)
|
|
36428
36655
|
);
|
|
@@ -37583,10 +37810,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37583
37810
|
terminate
|
|
37584
37811
|
};
|
|
37585
37812
|
}
|
|
37586
|
-
function now() {
|
|
37587
|
-
var _a21, _b9;
|
|
37588
|
-
return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
|
|
37589
|
-
}
|
|
37590
37813
|
function runToolsTransformation({
|
|
37591
37814
|
tools,
|
|
37592
37815
|
generatorStream,
|
|
@@ -37597,7 +37820,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37597
37820
|
abortSignal,
|
|
37598
37821
|
repairToolCall,
|
|
37599
37822
|
experimental_context,
|
|
37600
|
-
generateId: generateId2
|
|
37823
|
+
generateId: generateId2,
|
|
37824
|
+
stepNumber,
|
|
37825
|
+
model,
|
|
37826
|
+
onToolCallStart,
|
|
37827
|
+
onToolCallFinish
|
|
37601
37828
|
}) {
|
|
37602
37829
|
let toolResultsStreamController = null;
|
|
37603
37830
|
const toolResultsStream = new ReadableStream({
|
|
@@ -37739,6 +37966,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37739
37966
|
messages,
|
|
37740
37967
|
abortSignal,
|
|
37741
37968
|
experimental_context,
|
|
37969
|
+
stepNumber,
|
|
37970
|
+
model,
|
|
37971
|
+
onToolCallStart,
|
|
37972
|
+
onToolCallFinish,
|
|
37742
37973
|
onPreliminaryToolResult: (result) => {
|
|
37743
37974
|
toolResultsStreamController.enqueue(result);
|
|
37744
37975
|
}
|
|
@@ -37855,6 +38086,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37855
38086
|
onFinish,
|
|
37856
38087
|
onAbort,
|
|
37857
38088
|
onStepFinish,
|
|
38089
|
+
experimental_onStart: onStart,
|
|
38090
|
+
experimental_onStepStart: onStepStart,
|
|
38091
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
38092
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
37858
38093
|
experimental_context,
|
|
37859
38094
|
experimental_include: include,
|
|
37860
38095
|
_internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
|
|
@@ -37894,11 +38129,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37894
38129
|
providerOptions,
|
|
37895
38130
|
prepareStep,
|
|
37896
38131
|
includeRawChunks,
|
|
38132
|
+
timeout,
|
|
38133
|
+
stopWhen,
|
|
38134
|
+
originalAbortSignal: abortSignal,
|
|
37897
38135
|
onChunk,
|
|
37898
38136
|
onError,
|
|
37899
38137
|
onFinish,
|
|
37900
38138
|
onAbort,
|
|
37901
38139
|
onStepFinish,
|
|
38140
|
+
onStart,
|
|
38141
|
+
onStepStart,
|
|
38142
|
+
onToolCallStart,
|
|
38143
|
+
onToolCallFinish,
|
|
37902
38144
|
now: now2,
|
|
37903
38145
|
generateId: generateId2,
|
|
37904
38146
|
experimental_context,
|
|
@@ -37995,11 +38237,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37995
38237
|
includeRawChunks,
|
|
37996
38238
|
now: now2,
|
|
37997
38239
|
generateId: generateId2,
|
|
38240
|
+
timeout,
|
|
38241
|
+
stopWhen,
|
|
38242
|
+
originalAbortSignal,
|
|
37998
38243
|
onChunk,
|
|
37999
38244
|
onError,
|
|
38000
38245
|
onFinish,
|
|
38001
38246
|
onAbort,
|
|
38002
38247
|
onStepFinish,
|
|
38248
|
+
onStart,
|
|
38249
|
+
onStepStart,
|
|
38250
|
+
onToolCallStart,
|
|
38251
|
+
onToolCallFinish,
|
|
38003
38252
|
experimental_context,
|
|
38004
38253
|
download: download2,
|
|
38005
38254
|
include
|
|
@@ -38142,6 +38391,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38142
38391
|
tools
|
|
38143
38392
|
});
|
|
38144
38393
|
const currentStepResult = new DefaultStepResult({
|
|
38394
|
+
stepNumber: recordedSteps.length,
|
|
38395
|
+
model: modelInfo,
|
|
38396
|
+
...callbackTelemetryProps,
|
|
38397
|
+
experimental_context,
|
|
38145
38398
|
content: recordedContent,
|
|
38146
38399
|
finishReason: part.finishReason,
|
|
38147
38400
|
rawFinishReason: part.rawFinishReason,
|
|
@@ -38157,8 +38410,8 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38157
38410
|
await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
|
|
38158
38411
|
logWarnings({
|
|
38159
38412
|
warnings: recordedWarnings,
|
|
38160
|
-
provider:
|
|
38161
|
-
model:
|
|
38413
|
+
provider: modelInfo.provider,
|
|
38414
|
+
model: modelInfo.modelId
|
|
38162
38415
|
});
|
|
38163
38416
|
recordedSteps.push(currentStepResult);
|
|
38164
38417
|
recordedResponseMessages.push(...stepMessages);
|
|
@@ -38190,6 +38443,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38190
38443
|
self2._steps.resolve(recordedSteps);
|
|
38191
38444
|
const finalStep = recordedSteps[recordedSteps.length - 1];
|
|
38192
38445
|
await (onFinish == null ? void 0 : onFinish({
|
|
38446
|
+
stepNumber: finalStep.stepNumber,
|
|
38447
|
+
model: finalStep.model,
|
|
38448
|
+
functionId: finalStep.functionId,
|
|
38449
|
+
metadata: finalStep.metadata,
|
|
38450
|
+
experimental_context: finalStep.experimental_context,
|
|
38193
38451
|
finishReason: finalStep.finishReason,
|
|
38194
38452
|
rawFinishReason: finalStep.rawFinishReason,
|
|
38195
38453
|
totalUsage,
|
|
@@ -38210,8 +38468,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38210
38468
|
response: finalStep.response,
|
|
38211
38469
|
warnings: finalStep.warnings,
|
|
38212
38470
|
providerMetadata: finalStep.providerMetadata,
|
|
38213
|
-
steps: recordedSteps
|
|
38214
|
-
experimental_context
|
|
38471
|
+
steps: recordedSteps
|
|
38215
38472
|
}));
|
|
38216
38473
|
rootSpan.setAttributes(
|
|
38217
38474
|
await selectTelemetryAttributes({
|
|
@@ -38313,6 +38570,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38313
38570
|
settings: { ...callSettings, maxRetries }
|
|
38314
38571
|
});
|
|
38315
38572
|
const self2 = this;
|
|
38573
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
38574
|
+
const callbackTelemetryProps = {
|
|
38575
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
38576
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata
|
|
38577
|
+
};
|
|
38316
38578
|
recordSpan({
|
|
38317
38579
|
name: "ai.streamText",
|
|
38318
38580
|
attributes: selectTelemetryAttributes({
|
|
@@ -38335,6 +38597,36 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38335
38597
|
prompt,
|
|
38336
38598
|
messages
|
|
38337
38599
|
});
|
|
38600
|
+
try {
|
|
38601
|
+
await (onStart == null ? void 0 : onStart({
|
|
38602
|
+
model: modelInfo,
|
|
38603
|
+
system,
|
|
38604
|
+
prompt,
|
|
38605
|
+
messages,
|
|
38606
|
+
tools,
|
|
38607
|
+
toolChoice,
|
|
38608
|
+
activeTools,
|
|
38609
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
38610
|
+
temperature: callSettings.temperature,
|
|
38611
|
+
topP: callSettings.topP,
|
|
38612
|
+
topK: callSettings.topK,
|
|
38613
|
+
presencePenalty: callSettings.presencePenalty,
|
|
38614
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
38615
|
+
stopSequences: callSettings.stopSequences,
|
|
38616
|
+
seed: callSettings.seed,
|
|
38617
|
+
maxRetries,
|
|
38618
|
+
timeout,
|
|
38619
|
+
headers,
|
|
38620
|
+
providerOptions,
|
|
38621
|
+
stopWhen,
|
|
38622
|
+
output,
|
|
38623
|
+
abortSignal: originalAbortSignal,
|
|
38624
|
+
include,
|
|
38625
|
+
...callbackTelemetryProps,
|
|
38626
|
+
experimental_context
|
|
38627
|
+
}));
|
|
38628
|
+
} catch (_ignored) {
|
|
38629
|
+
}
|
|
38338
38630
|
const initialMessages = initialPrompt.messages;
|
|
38339
38631
|
const initialResponseMessages = [];
|
|
38340
38632
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -38381,6 +38673,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38381
38673
|
messages: initialMessages,
|
|
38382
38674
|
abortSignal,
|
|
38383
38675
|
experimental_context,
|
|
38676
|
+
stepNumber: recordedSteps.length,
|
|
38677
|
+
model: modelInfo,
|
|
38678
|
+
onToolCallStart,
|
|
38679
|
+
onToolCallFinish,
|
|
38384
38680
|
onPreliminaryToolResult: (result2) => {
|
|
38385
38681
|
toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
|
|
38386
38682
|
}
|
|
@@ -38447,7 +38743,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38447
38743
|
responseMessages,
|
|
38448
38744
|
usage
|
|
38449
38745
|
}) {
|
|
38450
|
-
var _a21, _b9, _c, _d, _e, _f, _g;
|
|
38746
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
38451
38747
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
38452
38748
|
const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
|
|
38453
38749
|
let chunkTimeoutId = void 0;
|
|
@@ -38486,6 +38782,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38486
38782
|
const stepModel = resolveLanguageModel(
|
|
38487
38783
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
38488
38784
|
);
|
|
38785
|
+
const stepModelInfo = {
|
|
38786
|
+
provider: stepModel.provider,
|
|
38787
|
+
modelId: stepModel.modelId
|
|
38788
|
+
};
|
|
38489
38789
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
38490
38790
|
prompt: {
|
|
38491
38791
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -38494,16 +38794,41 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38494
38794
|
supportedUrls: await stepModel.supportedUrls,
|
|
38495
38795
|
download: download2
|
|
38496
38796
|
});
|
|
38797
|
+
const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
|
|
38497
38798
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
38498
38799
|
tools,
|
|
38499
|
-
toolChoice: (
|
|
38500
|
-
activeTools:
|
|
38800
|
+
toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
|
|
38801
|
+
activeTools: stepActiveTools
|
|
38501
38802
|
});
|
|
38502
38803
|
experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
|
|
38804
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
38805
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
38503
38806
|
const stepProviderOptions = mergeObjects(
|
|
38504
38807
|
providerOptions,
|
|
38505
38808
|
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
38506
38809
|
);
|
|
38810
|
+
try {
|
|
38811
|
+
await (onStepStart == null ? void 0 : onStepStart({
|
|
38812
|
+
stepNumber: recordedSteps.length,
|
|
38813
|
+
model: stepModelInfo,
|
|
38814
|
+
system: stepSystem,
|
|
38815
|
+
messages: stepMessages,
|
|
38816
|
+
tools,
|
|
38817
|
+
toolChoice: stepToolChoice,
|
|
38818
|
+
activeTools: stepActiveTools,
|
|
38819
|
+
steps: [...recordedSteps],
|
|
38820
|
+
providerOptions: stepProviderOptions,
|
|
38821
|
+
timeout,
|
|
38822
|
+
headers,
|
|
38823
|
+
stopWhen,
|
|
38824
|
+
output,
|
|
38825
|
+
abortSignal: originalAbortSignal,
|
|
38826
|
+
include,
|
|
38827
|
+
...callbackTelemetryProps,
|
|
38828
|
+
experimental_context
|
|
38829
|
+
}));
|
|
38830
|
+
} catch (_ignored) {
|
|
38831
|
+
}
|
|
38507
38832
|
const {
|
|
38508
38833
|
result: { stream: stream2, response, request },
|
|
38509
38834
|
doStreamSpan,
|
|
@@ -38575,9 +38900,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38575
38900
|
repairToolCall,
|
|
38576
38901
|
abortSignal,
|
|
38577
38902
|
experimental_context,
|
|
38578
|
-
generateId: generateId2
|
|
38903
|
+
generateId: generateId2,
|
|
38904
|
+
stepNumber: recordedSteps.length,
|
|
38905
|
+
model: stepModelInfo,
|
|
38906
|
+
onToolCallStart,
|
|
38907
|
+
onToolCallFinish
|
|
38579
38908
|
});
|
|
38580
|
-
const stepRequest = ((
|
|
38909
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
|
|
38581
38910
|
const stepToolCalls = [];
|
|
38582
38911
|
const stepToolOutputs = [];
|
|
38583
38912
|
let warnings;
|
|
@@ -38590,7 +38919,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38590
38919
|
let stepResponse = {
|
|
38591
38920
|
id: generateId2(),
|
|
38592
38921
|
timestamp: /* @__PURE__ */ new Date(),
|
|
38593
|
-
modelId:
|
|
38922
|
+
modelId: modelInfo.modelId
|
|
38594
38923
|
};
|
|
38595
38924
|
let activeText = "";
|
|
38596
38925
|
self2.addStream(
|
|
@@ -43104,7 +43433,8 @@ ${user}:`]
|
|
|
43104
43433
|
"dall-e-2": 10,
|
|
43105
43434
|
"gpt-image-1": 10,
|
|
43106
43435
|
"gpt-image-1-mini": 10,
|
|
43107
|
-
"gpt-image-1.5": 10
|
|
43436
|
+
"gpt-image-1.5": 10,
|
|
43437
|
+
"chatgpt-image-latest": 10
|
|
43108
43438
|
};
|
|
43109
43439
|
var defaultResponseFormatPrefixes = [
|
|
43110
43440
|
"gpt-image-1-mini",
|
|
@@ -43205,15 +43535,20 @@ ${user}:`]
|
|
|
43205
43535
|
},
|
|
43206
43536
|
providerMetadata: {
|
|
43207
43537
|
openai: {
|
|
43208
|
-
images: response2.data.map((item) => {
|
|
43209
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43538
|
+
images: response2.data.map((item, index) => {
|
|
43539
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
43210
43540
|
return {
|
|
43211
43541
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
43212
43542
|
created: (_a22 = response2.created) != null ? _a22 : void 0,
|
|
43213
43543
|
size: (_b22 = response2.size) != null ? _b22 : void 0,
|
|
43214
43544
|
quality: (_c2 = response2.quality) != null ? _c2 : void 0,
|
|
43215
43545
|
background: (_d2 = response2.background) != null ? _d2 : void 0,
|
|
43216
|
-
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
|
|
43546
|
+
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
|
|
43547
|
+
...distributeTokenDetails(
|
|
43548
|
+
(_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43549
|
+
index,
|
|
43550
|
+
response2.data.length
|
|
43551
|
+
)
|
|
43217
43552
|
};
|
|
43218
43553
|
})
|
|
43219
43554
|
}
|
|
@@ -43256,15 +43591,20 @@ ${user}:`]
|
|
|
43256
43591
|
},
|
|
43257
43592
|
providerMetadata: {
|
|
43258
43593
|
openai: {
|
|
43259
|
-
images: response.data.map((item) => {
|
|
43260
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43594
|
+
images: response.data.map((item, index) => {
|
|
43595
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
43261
43596
|
return {
|
|
43262
43597
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
43263
43598
|
created: (_a22 = response.created) != null ? _a22 : void 0,
|
|
43264
43599
|
size: (_b22 = response.size) != null ? _b22 : void 0,
|
|
43265
43600
|
quality: (_c2 = response.quality) != null ? _c2 : void 0,
|
|
43266
43601
|
background: (_d2 = response.background) != null ? _d2 : void 0,
|
|
43267
|
-
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
|
|
43602
|
+
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
|
|
43603
|
+
...distributeTokenDetails(
|
|
43604
|
+
(_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43605
|
+
index,
|
|
43606
|
+
response.data.length
|
|
43607
|
+
)
|
|
43268
43608
|
};
|
|
43269
43609
|
})
|
|
43270
43610
|
}
|
|
@@ -43272,6 +43612,23 @@ ${user}:`]
|
|
|
43272
43612
|
};
|
|
43273
43613
|
}
|
|
43274
43614
|
};
|
|
43615
|
+
function distributeTokenDetails(details, index, total) {
|
|
43616
|
+
if (details == null) {
|
|
43617
|
+
return {};
|
|
43618
|
+
}
|
|
43619
|
+
const result = {};
|
|
43620
|
+
if (details.image_tokens != null) {
|
|
43621
|
+
const base = Math.floor(details.image_tokens / total);
|
|
43622
|
+
const remainder = details.image_tokens - base * (total - 1);
|
|
43623
|
+
result.imageTokens = index === total - 1 ? remainder : base;
|
|
43624
|
+
}
|
|
43625
|
+
if (details.text_tokens != null) {
|
|
43626
|
+
const base = Math.floor(details.text_tokens / total);
|
|
43627
|
+
const remainder = details.text_tokens - base * (total - 1);
|
|
43628
|
+
result.textTokens = index === total - 1 ? remainder : base;
|
|
43629
|
+
}
|
|
43630
|
+
return result;
|
|
43631
|
+
}
|
|
43275
43632
|
async function fileToBlob(file) {
|
|
43276
43633
|
if (!file) return void 0;
|
|
43277
43634
|
if (file.type === "url") {
|
|
@@ -43482,6 +43839,67 @@ ${user}:`]
|
|
|
43482
43839
|
})
|
|
43483
43840
|
)
|
|
43484
43841
|
);
|
|
43842
|
+
var shellSkillsSchema = array$1(
|
|
43843
|
+
discriminatedUnion("type", [
|
|
43844
|
+
object$2({
|
|
43845
|
+
type: literal("skillReference"),
|
|
43846
|
+
skillId: string(),
|
|
43847
|
+
version: string().optional()
|
|
43848
|
+
}),
|
|
43849
|
+
object$2({
|
|
43850
|
+
type: literal("inline"),
|
|
43851
|
+
name: string(),
|
|
43852
|
+
description: string(),
|
|
43853
|
+
source: object$2({
|
|
43854
|
+
type: literal("base64"),
|
|
43855
|
+
mediaType: literal("application/zip"),
|
|
43856
|
+
data: string()
|
|
43857
|
+
})
|
|
43858
|
+
})
|
|
43859
|
+
])
|
|
43860
|
+
).optional();
|
|
43861
|
+
var shellArgsSchema = lazySchema(
|
|
43862
|
+
() => zodSchema(
|
|
43863
|
+
object$2({
|
|
43864
|
+
environment: union([
|
|
43865
|
+
object$2({
|
|
43866
|
+
type: literal("containerAuto"),
|
|
43867
|
+
fileIds: array$1(string()).optional(),
|
|
43868
|
+
memoryLimit: _enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
43869
|
+
networkPolicy: discriminatedUnion("type", [
|
|
43870
|
+
object$2({ type: literal("disabled") }),
|
|
43871
|
+
object$2({
|
|
43872
|
+
type: literal("allowlist"),
|
|
43873
|
+
allowedDomains: array$1(string()),
|
|
43874
|
+
domainSecrets: array$1(
|
|
43875
|
+
object$2({
|
|
43876
|
+
domain: string(),
|
|
43877
|
+
name: string(),
|
|
43878
|
+
value: string()
|
|
43879
|
+
})
|
|
43880
|
+
).optional()
|
|
43881
|
+
})
|
|
43882
|
+
]).optional(),
|
|
43883
|
+
skills: shellSkillsSchema
|
|
43884
|
+
}),
|
|
43885
|
+
object$2({
|
|
43886
|
+
type: literal("containerReference"),
|
|
43887
|
+
containerId: string()
|
|
43888
|
+
}),
|
|
43889
|
+
object$2({
|
|
43890
|
+
type: literal("local").optional(),
|
|
43891
|
+
skills: array$1(
|
|
43892
|
+
object$2({
|
|
43893
|
+
name: string(),
|
|
43894
|
+
description: string(),
|
|
43895
|
+
path: string()
|
|
43896
|
+
})
|
|
43897
|
+
).optional()
|
|
43898
|
+
})
|
|
43899
|
+
]).optional()
|
|
43900
|
+
})
|
|
43901
|
+
)
|
|
43902
|
+
);
|
|
43485
43903
|
var shell = createProviderToolFactoryWithOutputSchema({
|
|
43486
43904
|
id: "openai.shell",
|
|
43487
43905
|
inputSchema: shellInputSchema,
|
|
@@ -43521,7 +43939,7 @@ ${user}:`]
|
|
|
43521
43939
|
url: string().nullish(),
|
|
43522
43940
|
pattern: string().nullish()
|
|
43523
43941
|
})
|
|
43524
|
-
]),
|
|
43942
|
+
]).optional(),
|
|
43525
43943
|
sources: array$1(
|
|
43526
43944
|
discriminatedUnion("type", [
|
|
43527
43945
|
object$2({ type: literal("url"), url: string() }),
|
|
@@ -43571,7 +43989,7 @@ ${user}:`]
|
|
|
43571
43989
|
url: string().nullish(),
|
|
43572
43990
|
pattern: string().nullish()
|
|
43573
43991
|
})
|
|
43574
|
-
])
|
|
43992
|
+
]).optional()
|
|
43575
43993
|
})
|
|
43576
43994
|
)
|
|
43577
43995
|
);
|
|
@@ -43971,8 +44389,32 @@ ${user}:`]
|
|
|
43971
44389
|
if (hasConversation) {
|
|
43972
44390
|
break;
|
|
43973
44391
|
}
|
|
44392
|
+
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
44393
|
+
part.toolName
|
|
44394
|
+
);
|
|
44395
|
+
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
44396
|
+
if (part.output.type === "json") {
|
|
44397
|
+
const parsedOutput = await validateTypes$1({
|
|
44398
|
+
value: part.output.value,
|
|
44399
|
+
schema: shellOutputSchema
|
|
44400
|
+
});
|
|
44401
|
+
input.push({
|
|
44402
|
+
type: "shell_call_output",
|
|
44403
|
+
call_id: part.toolCallId,
|
|
44404
|
+
output: parsedOutput.output.map((item) => ({
|
|
44405
|
+
stdout: item.stdout,
|
|
44406
|
+
stderr: item.stderr,
|
|
44407
|
+
outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
|
|
44408
|
+
type: "exit",
|
|
44409
|
+
exit_code: item.outcome.exitCode
|
|
44410
|
+
}
|
|
44411
|
+
}))
|
|
44412
|
+
});
|
|
44413
|
+
}
|
|
44414
|
+
break;
|
|
44415
|
+
}
|
|
43974
44416
|
if (store) {
|
|
43975
|
-
const itemId = (_j = (_i = (_h = part.
|
|
44417
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
43976
44418
|
input.push({ type: "item_reference", id: itemId });
|
|
43977
44419
|
} else {
|
|
43978
44420
|
warnings.push({
|
|
@@ -44341,6 +44783,25 @@ ${user}:`]
|
|
|
44341
44783
|
action: object$2({
|
|
44342
44784
|
commands: array$1(string())
|
|
44343
44785
|
})
|
|
44786
|
+
}),
|
|
44787
|
+
object$2({
|
|
44788
|
+
type: literal("shell_call_output"),
|
|
44789
|
+
id: string(),
|
|
44790
|
+
call_id: string(),
|
|
44791
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
44792
|
+
output: array$1(
|
|
44793
|
+
object$2({
|
|
44794
|
+
stdout: string(),
|
|
44795
|
+
stderr: string(),
|
|
44796
|
+
outcome: discriminatedUnion("type", [
|
|
44797
|
+
object$2({ type: literal("timeout") }),
|
|
44798
|
+
object$2({
|
|
44799
|
+
type: literal("exit"),
|
|
44800
|
+
exit_code: number$1()
|
|
44801
|
+
})
|
|
44802
|
+
])
|
|
44803
|
+
})
|
|
44804
|
+
)
|
|
44344
44805
|
})
|
|
44345
44806
|
])
|
|
44346
44807
|
}),
|
|
@@ -44406,7 +44867,7 @@ ${user}:`]
|
|
|
44406
44867
|
url: string().nullish(),
|
|
44407
44868
|
pattern: string().nullish()
|
|
44408
44869
|
})
|
|
44409
|
-
])
|
|
44870
|
+
]).nullish()
|
|
44410
44871
|
}),
|
|
44411
44872
|
object$2({
|
|
44412
44873
|
type: literal("file_search_call"),
|
|
@@ -44520,6 +44981,25 @@ ${user}:`]
|
|
|
44520
44981
|
action: object$2({
|
|
44521
44982
|
commands: array$1(string())
|
|
44522
44983
|
})
|
|
44984
|
+
}),
|
|
44985
|
+
object$2({
|
|
44986
|
+
type: literal("shell_call_output"),
|
|
44987
|
+
id: string(),
|
|
44988
|
+
call_id: string(),
|
|
44989
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
44990
|
+
output: array$1(
|
|
44991
|
+
object$2({
|
|
44992
|
+
stdout: string(),
|
|
44993
|
+
stderr: string(),
|
|
44994
|
+
outcome: discriminatedUnion("type", [
|
|
44995
|
+
object$2({ type: literal("timeout") }),
|
|
44996
|
+
object$2({
|
|
44997
|
+
type: literal("exit"),
|
|
44998
|
+
exit_code: number$1()
|
|
44999
|
+
})
|
|
45000
|
+
])
|
|
45001
|
+
})
|
|
45002
|
+
)
|
|
44523
45003
|
})
|
|
44524
45004
|
])
|
|
44525
45005
|
}),
|
|
@@ -44703,7 +45183,10 @@ ${user}:`]
|
|
|
44703
45183
|
sources: array$1(
|
|
44704
45184
|
discriminatedUnion("type", [
|
|
44705
45185
|
object$2({ type: literal("url"), url: string() }),
|
|
44706
|
-
object$2({
|
|
45186
|
+
object$2({
|
|
45187
|
+
type: literal("api"),
|
|
45188
|
+
name: string()
|
|
45189
|
+
})
|
|
44707
45190
|
])
|
|
44708
45191
|
).nullish()
|
|
44709
45192
|
}),
|
|
@@ -44716,7 +45199,7 @@ ${user}:`]
|
|
|
44716
45199
|
url: string().nullish(),
|
|
44717
45200
|
pattern: string().nullish()
|
|
44718
45201
|
})
|
|
44719
|
-
])
|
|
45202
|
+
]).nullish()
|
|
44720
45203
|
}),
|
|
44721
45204
|
object$2({
|
|
44722
45205
|
type: literal("file_search_call"),
|
|
@@ -44865,6 +45348,25 @@ ${user}:`]
|
|
|
44865
45348
|
action: object$2({
|
|
44866
45349
|
commands: array$1(string())
|
|
44867
45350
|
})
|
|
45351
|
+
}),
|
|
45352
|
+
object$2({
|
|
45353
|
+
type: literal("shell_call_output"),
|
|
45354
|
+
id: string(),
|
|
45355
|
+
call_id: string(),
|
|
45356
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
45357
|
+
output: array$1(
|
|
45358
|
+
object$2({
|
|
45359
|
+
stdout: string(),
|
|
45360
|
+
stderr: string(),
|
|
45361
|
+
outcome: discriminatedUnion("type", [
|
|
45362
|
+
object$2({ type: literal("timeout") }),
|
|
45363
|
+
object$2({
|
|
45364
|
+
type: literal("exit"),
|
|
45365
|
+
exit_code: number$1()
|
|
45366
|
+
})
|
|
45367
|
+
])
|
|
45368
|
+
})
|
|
45369
|
+
)
|
|
44868
45370
|
})
|
|
44869
45371
|
])
|
|
44870
45372
|
).optional(),
|
|
@@ -45081,8 +45583,15 @@ ${user}:`]
|
|
|
45081
45583
|
break;
|
|
45082
45584
|
}
|
|
45083
45585
|
case "openai.shell": {
|
|
45586
|
+
const args = await validateTypes$1({
|
|
45587
|
+
value: tool2.args,
|
|
45588
|
+
schema: shellArgsSchema
|
|
45589
|
+
});
|
|
45084
45590
|
openaiTools2.push({
|
|
45085
|
-
type: "shell"
|
|
45591
|
+
type: "shell",
|
|
45592
|
+
...args.environment && {
|
|
45593
|
+
environment: mapShellEnvironment(args.environment)
|
|
45594
|
+
}
|
|
45086
45595
|
});
|
|
45087
45596
|
break;
|
|
45088
45597
|
}
|
|
@@ -45212,6 +45721,52 @@ ${user}:`]
|
|
|
45212
45721
|
}
|
|
45213
45722
|
}
|
|
45214
45723
|
}
|
|
45724
|
+
function mapShellEnvironment(environment) {
|
|
45725
|
+
if (environment.type === "containerReference") {
|
|
45726
|
+
const env2 = environment;
|
|
45727
|
+
return {
|
|
45728
|
+
type: "container_reference",
|
|
45729
|
+
container_id: env2.containerId
|
|
45730
|
+
};
|
|
45731
|
+
}
|
|
45732
|
+
if (environment.type === "containerAuto") {
|
|
45733
|
+
const env2 = environment;
|
|
45734
|
+
return {
|
|
45735
|
+
type: "container_auto",
|
|
45736
|
+
file_ids: env2.fileIds,
|
|
45737
|
+
memory_limit: env2.memoryLimit,
|
|
45738
|
+
network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
|
|
45739
|
+
type: "allowlist",
|
|
45740
|
+
allowed_domains: env2.networkPolicy.allowedDomains,
|
|
45741
|
+
domain_secrets: env2.networkPolicy.domainSecrets
|
|
45742
|
+
},
|
|
45743
|
+
skills: mapShellSkills(env2.skills)
|
|
45744
|
+
};
|
|
45745
|
+
}
|
|
45746
|
+
const env = environment;
|
|
45747
|
+
return {
|
|
45748
|
+
type: "local",
|
|
45749
|
+
skills: env.skills
|
|
45750
|
+
};
|
|
45751
|
+
}
|
|
45752
|
+
function mapShellSkills(skills) {
|
|
45753
|
+
return skills == null ? void 0 : skills.map(
|
|
45754
|
+
(skill) => skill.type === "skillReference" ? {
|
|
45755
|
+
type: "skill_reference",
|
|
45756
|
+
skill_id: skill.skillId,
|
|
45757
|
+
version: skill.version
|
|
45758
|
+
} : {
|
|
45759
|
+
type: "inline",
|
|
45760
|
+
name: skill.name,
|
|
45761
|
+
description: skill.description,
|
|
45762
|
+
source: {
|
|
45763
|
+
type: "base64",
|
|
45764
|
+
media_type: skill.source.mediaType,
|
|
45765
|
+
data: skill.source.data
|
|
45766
|
+
}
|
|
45767
|
+
}
|
|
45768
|
+
);
|
|
45769
|
+
}
|
|
45215
45770
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
45216
45771
|
var _a10, _b9;
|
|
45217
45772
|
const mapping = {};
|
|
@@ -45255,7 +45810,7 @@ ${user}:`]
|
|
|
45255
45810
|
toolChoice,
|
|
45256
45811
|
responseFormat
|
|
45257
45812
|
}) {
|
|
45258
|
-
var _a10, _b9, _c, _d, _e, _f;
|
|
45813
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
45259
45814
|
const warnings = [];
|
|
45260
45815
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
45261
45816
|
if (topK != null) {
|
|
@@ -45459,6 +46014,10 @@ ${user}:`]
|
|
|
45459
46014
|
tools,
|
|
45460
46015
|
toolChoice
|
|
45461
46016
|
});
|
|
46017
|
+
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
46018
|
+
(tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
|
|
46019
|
+
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
46020
|
+
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
45462
46021
|
return {
|
|
45463
46022
|
webSearchToolName,
|
|
45464
46023
|
args: {
|
|
@@ -45469,7 +46028,8 @@ ${user}:`]
|
|
|
45469
46028
|
warnings: [...warnings, ...toolWarnings],
|
|
45470
46029
|
store,
|
|
45471
46030
|
toolNameMapping,
|
|
45472
|
-
providerOptionsName
|
|
46031
|
+
providerOptionsName,
|
|
46032
|
+
isShellProviderExecuted
|
|
45473
46033
|
};
|
|
45474
46034
|
}
|
|
45475
46035
|
async doGenerate(options) {
|
|
@@ -45479,7 +46039,8 @@ ${user}:`]
|
|
|
45479
46039
|
warnings,
|
|
45480
46040
|
webSearchToolName,
|
|
45481
46041
|
toolNameMapping,
|
|
45482
|
-
providerOptionsName
|
|
46042
|
+
providerOptionsName,
|
|
46043
|
+
isShellProviderExecuted
|
|
45483
46044
|
} = await this.getArgs(options);
|
|
45484
46045
|
const url2 = this.config.url({
|
|
45485
46046
|
path: "/responses",
|
|
@@ -45579,6 +46140,7 @@ ${user}:`]
|
|
|
45579
46140
|
commands: part.action.commands
|
|
45580
46141
|
}
|
|
45581
46142
|
}),
|
|
46143
|
+
...isShellProviderExecuted && { providerExecuted: true },
|
|
45582
46144
|
providerMetadata: {
|
|
45583
46145
|
[providerOptionsName]: {
|
|
45584
46146
|
itemId: part.id
|
|
@@ -45587,6 +46149,24 @@ ${user}:`]
|
|
|
45587
46149
|
});
|
|
45588
46150
|
break;
|
|
45589
46151
|
}
|
|
46152
|
+
case "shell_call_output": {
|
|
46153
|
+
content.push({
|
|
46154
|
+
type: "tool-result",
|
|
46155
|
+
toolCallId: part.call_id,
|
|
46156
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46157
|
+
result: {
|
|
46158
|
+
output: part.output.map((item) => ({
|
|
46159
|
+
stdout: item.stdout,
|
|
46160
|
+
stderr: item.stderr,
|
|
46161
|
+
outcome: item.outcome.type === "exit" ? {
|
|
46162
|
+
type: "exit",
|
|
46163
|
+
exitCode: item.outcome.exit_code
|
|
46164
|
+
} : { type: "timeout" }
|
|
46165
|
+
}))
|
|
46166
|
+
}
|
|
46167
|
+
});
|
|
46168
|
+
break;
|
|
46169
|
+
}
|
|
45590
46170
|
case "message": {
|
|
45591
46171
|
for (const contentPart of part.content) {
|
|
45592
46172
|
if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -45876,7 +46456,8 @@ ${user}:`]
|
|
|
45876
46456
|
webSearchToolName,
|
|
45877
46457
|
toolNameMapping,
|
|
45878
46458
|
store,
|
|
45879
|
-
providerOptionsName
|
|
46459
|
+
providerOptionsName,
|
|
46460
|
+
isShellProviderExecuted
|
|
45880
46461
|
} = await this.getArgs(options);
|
|
45881
46462
|
const { responseHeaders, value: response } = await postJsonToApi$1({
|
|
45882
46463
|
url: this.config.url({
|
|
@@ -46055,7 +46636,8 @@ ${user}:`]
|
|
|
46055
46636
|
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46056
46637
|
toolCallId: value.item.call_id
|
|
46057
46638
|
};
|
|
46058
|
-
} else if (value.item.type === "
|
|
46639
|
+
} else if (value.item.type === "shell_call_output") ;
|
|
46640
|
+
else if (value.item.type === "message") {
|
|
46059
46641
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
46060
46642
|
controller.enqueue({
|
|
46061
46643
|
type: "text-start",
|
|
@@ -46308,10 +46890,31 @@ ${user}:`]
|
|
|
46308
46890
|
commands: value.item.action.commands
|
|
46309
46891
|
}
|
|
46310
46892
|
}),
|
|
46893
|
+
...isShellProviderExecuted && {
|
|
46894
|
+
providerExecuted: true
|
|
46895
|
+
},
|
|
46311
46896
|
providerMetadata: {
|
|
46312
46897
|
[providerOptionsName]: { itemId: value.item.id }
|
|
46313
46898
|
}
|
|
46314
46899
|
});
|
|
46900
|
+
} else if (value.item.type === "shell_call_output") {
|
|
46901
|
+
controller.enqueue({
|
|
46902
|
+
type: "tool-result",
|
|
46903
|
+
toolCallId: value.item.call_id,
|
|
46904
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46905
|
+
result: {
|
|
46906
|
+
output: value.item.output.map(
|
|
46907
|
+
(item) => ({
|
|
46908
|
+
stdout: item.stdout,
|
|
46909
|
+
stderr: item.stderr,
|
|
46910
|
+
outcome: item.outcome.type === "exit" ? {
|
|
46911
|
+
type: "exit",
|
|
46912
|
+
exitCode: item.outcome.exit_code
|
|
46913
|
+
} : { type: "timeout" }
|
|
46914
|
+
})
|
|
46915
|
+
)
|
|
46916
|
+
}
|
|
46917
|
+
});
|
|
46315
46918
|
} else if (value.item.type === "reasoning") {
|
|
46316
46919
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
46317
46920
|
const summaryPartIndices = Object.entries(
|
|
@@ -46628,6 +47231,9 @@ ${user}:`]
|
|
|
46628
47231
|
}
|
|
46629
47232
|
function mapWebSearchOutput(action) {
|
|
46630
47233
|
var _a10;
|
|
47234
|
+
if (action == null) {
|
|
47235
|
+
return {};
|
|
47236
|
+
}
|
|
46631
47237
|
switch (action.type) {
|
|
46632
47238
|
case "search":
|
|
46633
47239
|
return {
|
|
@@ -46980,7 +47586,7 @@ ${user}:`]
|
|
|
46980
47586
|
};
|
|
46981
47587
|
}
|
|
46982
47588
|
};
|
|
46983
|
-
var VERSION$2 = "3.0.
|
|
47589
|
+
var VERSION$2 = "3.0.33";
|
|
46984
47590
|
function createOpenAI(options = {}) {
|
|
46985
47591
|
var _a10, _b9;
|
|
46986
47592
|
const baseURL = (_a10 = withoutTrailingSlash$1(
|