@opentiny/next-sdk 0.2.4 → 0.2.6
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 +987 -336
- package/dist/index.es.js +11753 -11150
- package/dist/index.js +2 -2
- package/dist/index.umd.dev.js +987 -336
- 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/skills/index.d.ts +2 -2
- package/dist/webagent.dev.js +985 -334
- package/dist/webagent.es.dev.js +985 -334
- package/dist/webagent.es.js +11294 -10691
- package/dist/webagent.js +58 -58
- 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/skills/index.ts +4 -4
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.58";
|
|
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
|
};
|
|
@@ -32992,6 +33074,17 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
32992
33074
|
}
|
|
32993
33075
|
};
|
|
32994
33076
|
_a19 = symbol19;
|
|
33077
|
+
function asArray(value) {
|
|
33078
|
+
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
33079
|
+
}
|
|
33080
|
+
async function notify(options) {
|
|
33081
|
+
for (const callback of asArray(options.callbacks)) {
|
|
33082
|
+
try {
|
|
33083
|
+
await callback(options.event);
|
|
33084
|
+
} catch (_ignored) {
|
|
33085
|
+
}
|
|
33086
|
+
}
|
|
33087
|
+
}
|
|
32995
33088
|
function formatWarning({
|
|
32996
33089
|
warning,
|
|
32997
33090
|
provider,
|
|
@@ -33292,7 +33385,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
33292
33385
|
}
|
|
33293
33386
|
return void 0;
|
|
33294
33387
|
}
|
|
33295
|
-
var VERSION$4 = "6.0.
|
|
33388
|
+
var VERSION$4 = "6.0.104";
|
|
33296
33389
|
var download = async ({
|
|
33297
33390
|
url: url2,
|
|
33298
33391
|
maxBytes,
|
|
@@ -33400,9 +33493,6 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
|
|
|
33400
33493
|
}
|
|
33401
33494
|
return convertUint8ArrayToBase64$1(content);
|
|
33402
33495
|
}
|
|
33403
|
-
function asArray(value) {
|
|
33404
|
-
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
33405
|
-
}
|
|
33406
33496
|
async function convertToLanguageModelPrompt({
|
|
33407
33497
|
prompt,
|
|
33408
33498
|
supportedUrls,
|
|
@@ -34717,6 +34807,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34717
34807
|
}
|
|
34718
34808
|
return { approvedToolApprovals, deniedToolApprovals };
|
|
34719
34809
|
}
|
|
34810
|
+
function now() {
|
|
34811
|
+
var _a21, _b9;
|
|
34812
|
+
return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
|
|
34813
|
+
}
|
|
34720
34814
|
async function executeToolCall({
|
|
34721
34815
|
toolCall,
|
|
34722
34816
|
tools,
|
|
@@ -34725,13 +34819,27 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34725
34819
|
messages,
|
|
34726
34820
|
abortSignal,
|
|
34727
34821
|
experimental_context,
|
|
34728
|
-
|
|
34822
|
+
stepNumber,
|
|
34823
|
+
model,
|
|
34824
|
+
onPreliminaryToolResult,
|
|
34825
|
+
onToolCallStart,
|
|
34826
|
+
onToolCallFinish
|
|
34729
34827
|
}) {
|
|
34730
34828
|
const { toolName, toolCallId, input } = toolCall;
|
|
34731
34829
|
const tool2 = tools == null ? void 0 : tools[toolName];
|
|
34732
34830
|
if ((tool2 == null ? void 0 : tool2.execute) == null) {
|
|
34733
34831
|
return void 0;
|
|
34734
34832
|
}
|
|
34833
|
+
const baseCallbackEvent = {
|
|
34834
|
+
stepNumber,
|
|
34835
|
+
model,
|
|
34836
|
+
toolCall,
|
|
34837
|
+
messages,
|
|
34838
|
+
abortSignal,
|
|
34839
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
34840
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
34841
|
+
experimental_context
|
|
34842
|
+
};
|
|
34735
34843
|
return recordSpan({
|
|
34736
34844
|
name: "ai.toolCall",
|
|
34737
34845
|
attributes: selectTelemetryAttributes({
|
|
@@ -34751,6 +34859,8 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34751
34859
|
tracer,
|
|
34752
34860
|
fn: async (span) => {
|
|
34753
34861
|
let output;
|
|
34862
|
+
await notify({ event: baseCallbackEvent, callbacks: onToolCallStart });
|
|
34863
|
+
const startTime = now();
|
|
34754
34864
|
try {
|
|
34755
34865
|
const stream = executeTool({
|
|
34756
34866
|
execute: tool2.execute.bind(tool2),
|
|
@@ -34775,6 +34885,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34775
34885
|
}
|
|
34776
34886
|
}
|
|
34777
34887
|
} catch (error) {
|
|
34888
|
+
const durationMs2 = now() - startTime;
|
|
34889
|
+
await notify({
|
|
34890
|
+
event: {
|
|
34891
|
+
...baseCallbackEvent,
|
|
34892
|
+
success: false,
|
|
34893
|
+
error,
|
|
34894
|
+
durationMs: durationMs2
|
|
34895
|
+
},
|
|
34896
|
+
callbacks: onToolCallFinish
|
|
34897
|
+
});
|
|
34778
34898
|
recordErrorOnSpan(span, error);
|
|
34779
34899
|
return {
|
|
34780
34900
|
type: "tool-error",
|
|
@@ -34786,6 +34906,16 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
34786
34906
|
...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
|
|
34787
34907
|
};
|
|
34788
34908
|
}
|
|
34909
|
+
const durationMs = now() - startTime;
|
|
34910
|
+
await notify({
|
|
34911
|
+
event: {
|
|
34912
|
+
...baseCallbackEvent,
|
|
34913
|
+
success: true,
|
|
34914
|
+
output,
|
|
34915
|
+
durationMs
|
|
34916
|
+
},
|
|
34917
|
+
callbacks: onToolCallFinish
|
|
34918
|
+
});
|
|
34789
34919
|
try {
|
|
34790
34920
|
span.setAttributes(
|
|
34791
34921
|
await selectTelemetryAttributes({
|
|
@@ -35649,6 +35779,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35649
35779
|
}
|
|
35650
35780
|
var DefaultStepResult = class {
|
|
35651
35781
|
constructor({
|
|
35782
|
+
stepNumber,
|
|
35783
|
+
model,
|
|
35784
|
+
functionId,
|
|
35785
|
+
metadata: metadata2,
|
|
35786
|
+
experimental_context,
|
|
35652
35787
|
content,
|
|
35653
35788
|
finishReason,
|
|
35654
35789
|
rawFinishReason,
|
|
@@ -35658,6 +35793,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35658
35793
|
response,
|
|
35659
35794
|
providerMetadata
|
|
35660
35795
|
}) {
|
|
35796
|
+
this.stepNumber = stepNumber;
|
|
35797
|
+
this.model = model;
|
|
35798
|
+
this.functionId = functionId;
|
|
35799
|
+
this.metadata = metadata2;
|
|
35800
|
+
this.experimental_context = experimental_context;
|
|
35661
35801
|
this.content = content;
|
|
35662
35802
|
this.finishReason = finishReason;
|
|
35663
35803
|
this.rawFinishReason = rawFinishReason;
|
|
@@ -35899,6 +36039,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35899
36039
|
experimental_context,
|
|
35900
36040
|
experimental_include: include,
|
|
35901
36041
|
_internal: { generateId: generateId2 = originalGenerateId } = {},
|
|
36042
|
+
experimental_onStart: onStart,
|
|
36043
|
+
experimental_onStepStart: onStepStart,
|
|
36044
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
36045
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
35902
36046
|
onStepFinish,
|
|
35903
36047
|
onFinish,
|
|
35904
36048
|
...settings
|
|
@@ -35928,11 +36072,43 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35928
36072
|
headers: headersWithUserAgent,
|
|
35929
36073
|
settings: { ...callSettings, maxRetries }
|
|
35930
36074
|
});
|
|
36075
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
35931
36076
|
const initialPrompt = await standardizePrompt({
|
|
35932
36077
|
system,
|
|
35933
36078
|
prompt,
|
|
35934
36079
|
messages
|
|
35935
36080
|
});
|
|
36081
|
+
await notify({
|
|
36082
|
+
event: {
|
|
36083
|
+
model: modelInfo,
|
|
36084
|
+
system,
|
|
36085
|
+
prompt,
|
|
36086
|
+
messages,
|
|
36087
|
+
tools,
|
|
36088
|
+
toolChoice,
|
|
36089
|
+
activeTools,
|
|
36090
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
36091
|
+
temperature: callSettings.temperature,
|
|
36092
|
+
topP: callSettings.topP,
|
|
36093
|
+
topK: callSettings.topK,
|
|
36094
|
+
presencePenalty: callSettings.presencePenalty,
|
|
36095
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
36096
|
+
stopSequences: callSettings.stopSequences,
|
|
36097
|
+
seed: callSettings.seed,
|
|
36098
|
+
maxRetries,
|
|
36099
|
+
timeout,
|
|
36100
|
+
headers,
|
|
36101
|
+
providerOptions,
|
|
36102
|
+
stopWhen,
|
|
36103
|
+
output,
|
|
36104
|
+
abortSignal,
|
|
36105
|
+
include,
|
|
36106
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36107
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36108
|
+
experimental_context
|
|
36109
|
+
},
|
|
36110
|
+
callbacks: onStart
|
|
36111
|
+
});
|
|
35936
36112
|
const tracer = getTracer(telemetry);
|
|
35937
36113
|
try {
|
|
35938
36114
|
return await recordSpan({
|
|
@@ -35956,7 +36132,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35956
36132
|
}),
|
|
35957
36133
|
tracer,
|
|
35958
36134
|
fn: async (span) => {
|
|
35959
|
-
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
36135
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
35960
36136
|
const initialMessages = initialPrompt.messages;
|
|
35961
36137
|
const responseMessages = [];
|
|
35962
36138
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -35973,7 +36149,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
35973
36149
|
telemetry,
|
|
35974
36150
|
messages: initialMessages,
|
|
35975
36151
|
abortSignal: mergedAbortSignal,
|
|
35976
|
-
experimental_context
|
|
36152
|
+
experimental_context,
|
|
36153
|
+
stepNumber: 0,
|
|
36154
|
+
model: modelInfo,
|
|
36155
|
+
onToolCallStart,
|
|
36156
|
+
onToolCallFinish
|
|
35977
36157
|
});
|
|
35978
36158
|
const toolContent = [];
|
|
35979
36159
|
for (const output2 of toolOutputs) {
|
|
@@ -36053,6 +36233,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36053
36233
|
const stepModel = resolveLanguageModel(
|
|
36054
36234
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
36055
36235
|
);
|
|
36236
|
+
const stepModelInfo = {
|
|
36237
|
+
provider: stepModel.provider,
|
|
36238
|
+
modelId: stepModel.modelId
|
|
36239
|
+
};
|
|
36056
36240
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
36057
36241
|
prompt: {
|
|
36058
36242
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -36062,10 +36246,40 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36062
36246
|
download: download2
|
|
36063
36247
|
});
|
|
36064
36248
|
experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
|
|
36249
|
+
const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
|
|
36065
36250
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
36066
36251
|
tools,
|
|
36067
|
-
toolChoice: (
|
|
36068
|
-
activeTools:
|
|
36252
|
+
toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
|
|
36253
|
+
activeTools: stepActiveTools
|
|
36254
|
+
});
|
|
36255
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
36256
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
36257
|
+
const stepProviderOptions = mergeObjects(
|
|
36258
|
+
providerOptions,
|
|
36259
|
+
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
36260
|
+
);
|
|
36261
|
+
await notify({
|
|
36262
|
+
event: {
|
|
36263
|
+
stepNumber: steps.length,
|
|
36264
|
+
model: stepModelInfo,
|
|
36265
|
+
system: stepSystem,
|
|
36266
|
+
messages: stepMessages,
|
|
36267
|
+
tools,
|
|
36268
|
+
toolChoice: stepToolChoice,
|
|
36269
|
+
activeTools: stepActiveTools,
|
|
36270
|
+
steps: [...steps],
|
|
36271
|
+
providerOptions: stepProviderOptions,
|
|
36272
|
+
timeout,
|
|
36273
|
+
headers,
|
|
36274
|
+
stopWhen,
|
|
36275
|
+
output,
|
|
36276
|
+
abortSignal,
|
|
36277
|
+
include,
|
|
36278
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36279
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36280
|
+
experimental_context
|
|
36281
|
+
},
|
|
36282
|
+
callbacks: onStepStart
|
|
36069
36283
|
});
|
|
36070
36284
|
currentModelResponse = await retry(
|
|
36071
36285
|
() => {
|
|
@@ -36109,10 +36323,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36109
36323
|
tracer,
|
|
36110
36324
|
fn: async (span2) => {
|
|
36111
36325
|
var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
36112
|
-
const stepProviderOptions = mergeObjects(
|
|
36113
|
-
providerOptions,
|
|
36114
|
-
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
36115
|
-
);
|
|
36116
36326
|
const result = await stepModel.doGenerate({
|
|
36117
36327
|
...callSettings2,
|
|
36118
36328
|
tools: stepTools,
|
|
@@ -36244,7 +36454,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36244
36454
|
telemetry,
|
|
36245
36455
|
messages: stepInputMessages,
|
|
36246
36456
|
abortSignal: mergedAbortSignal,
|
|
36247
|
-
experimental_context
|
|
36457
|
+
experimental_context,
|
|
36458
|
+
stepNumber: steps.length,
|
|
36459
|
+
model: stepModelInfo,
|
|
36460
|
+
onToolCallStart,
|
|
36461
|
+
onToolCallFinish
|
|
36248
36462
|
})
|
|
36249
36463
|
);
|
|
36250
36464
|
}
|
|
@@ -36281,15 +36495,21 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36281
36495
|
tools
|
|
36282
36496
|
})
|
|
36283
36497
|
);
|
|
36284
|
-
const stepRequest = ((
|
|
36498
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
|
|
36285
36499
|
const stepResponse = {
|
|
36286
36500
|
...currentModelResponse.response,
|
|
36287
36501
|
// deep clone msgs to avoid mutating past messages in multi-step:
|
|
36288
36502
|
messages: structuredClone(responseMessages),
|
|
36289
36503
|
// Conditionally include response body:
|
|
36290
|
-
body: ((
|
|
36504
|
+
body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
|
|
36291
36505
|
};
|
|
36506
|
+
const stepNumber = steps.length;
|
|
36292
36507
|
const currentStepResult = new DefaultStepResult({
|
|
36508
|
+
stepNumber,
|
|
36509
|
+
model: stepModelInfo,
|
|
36510
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36511
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36512
|
+
experimental_context,
|
|
36293
36513
|
content: stepContent,
|
|
36294
36514
|
finishReason: currentModelResponse.finishReason.unified,
|
|
36295
36515
|
rawFinishReason: currentModelResponse.finishReason.raw,
|
|
@@ -36300,12 +36520,12 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36300
36520
|
response: stepResponse
|
|
36301
36521
|
});
|
|
36302
36522
|
logWarnings({
|
|
36303
|
-
warnings: (
|
|
36304
|
-
provider:
|
|
36305
|
-
model:
|
|
36523
|
+
warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
|
|
36524
|
+
provider: stepModelInfo.provider,
|
|
36525
|
+
model: stepModelInfo.modelId
|
|
36306
36526
|
});
|
|
36307
36527
|
steps.push(currentStepResult);
|
|
36308
|
-
await (
|
|
36528
|
+
await notify({ event: currentStepResult, callbacks: onStepFinish });
|
|
36309
36529
|
} finally {
|
|
36310
36530
|
if (stepTimeoutId != null) {
|
|
36311
36531
|
clearTimeout(stepTimeoutId);
|
|
@@ -36357,30 +36577,37 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36357
36577
|
cachedInputTokens: void 0
|
|
36358
36578
|
}
|
|
36359
36579
|
);
|
|
36360
|
-
await (
|
|
36361
|
-
|
|
36362
|
-
|
|
36363
|
-
|
|
36364
|
-
|
|
36365
|
-
|
|
36366
|
-
|
|
36367
|
-
|
|
36368
|
-
|
|
36369
|
-
|
|
36370
|
-
|
|
36371
|
-
|
|
36372
|
-
|
|
36373
|
-
|
|
36374
|
-
|
|
36375
|
-
|
|
36376
|
-
|
|
36377
|
-
|
|
36378
|
-
|
|
36379
|
-
|
|
36380
|
-
|
|
36381
|
-
|
|
36382
|
-
|
|
36383
|
-
|
|
36580
|
+
await notify({
|
|
36581
|
+
event: {
|
|
36582
|
+
stepNumber: lastStep.stepNumber,
|
|
36583
|
+
model: lastStep.model,
|
|
36584
|
+
functionId: lastStep.functionId,
|
|
36585
|
+
metadata: lastStep.metadata,
|
|
36586
|
+
experimental_context: lastStep.experimental_context,
|
|
36587
|
+
finishReason: lastStep.finishReason,
|
|
36588
|
+
rawFinishReason: lastStep.rawFinishReason,
|
|
36589
|
+
usage: lastStep.usage,
|
|
36590
|
+
content: lastStep.content,
|
|
36591
|
+
text: lastStep.text,
|
|
36592
|
+
reasoningText: lastStep.reasoningText,
|
|
36593
|
+
reasoning: lastStep.reasoning,
|
|
36594
|
+
files: lastStep.files,
|
|
36595
|
+
sources: lastStep.sources,
|
|
36596
|
+
toolCalls: lastStep.toolCalls,
|
|
36597
|
+
staticToolCalls: lastStep.staticToolCalls,
|
|
36598
|
+
dynamicToolCalls: lastStep.dynamicToolCalls,
|
|
36599
|
+
toolResults: lastStep.toolResults,
|
|
36600
|
+
staticToolResults: lastStep.staticToolResults,
|
|
36601
|
+
dynamicToolResults: lastStep.dynamicToolResults,
|
|
36602
|
+
request: lastStep.request,
|
|
36603
|
+
response: lastStep.response,
|
|
36604
|
+
warnings: lastStep.warnings,
|
|
36605
|
+
providerMetadata: lastStep.providerMetadata,
|
|
36606
|
+
steps,
|
|
36607
|
+
totalUsage
|
|
36608
|
+
},
|
|
36609
|
+
callbacks: onFinish
|
|
36610
|
+
});
|
|
36384
36611
|
let resolvedOutput;
|
|
36385
36612
|
if (lastStep.finishReason === "stop") {
|
|
36386
36613
|
const outputSpecification = output != null ? output : text();
|
|
@@ -36411,7 +36638,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36411
36638
|
telemetry,
|
|
36412
36639
|
messages,
|
|
36413
36640
|
abortSignal,
|
|
36414
|
-
experimental_context
|
|
36641
|
+
experimental_context,
|
|
36642
|
+
stepNumber,
|
|
36643
|
+
model,
|
|
36644
|
+
onToolCallStart,
|
|
36645
|
+
onToolCallFinish
|
|
36415
36646
|
}) {
|
|
36416
36647
|
const toolOutputs = await Promise.all(
|
|
36417
36648
|
toolCalls.map(
|
|
@@ -36422,7 +36653,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
36422
36653
|
telemetry,
|
|
36423
36654
|
messages,
|
|
36424
36655
|
abortSignal,
|
|
36425
|
-
experimental_context
|
|
36656
|
+
experimental_context,
|
|
36657
|
+
stepNumber,
|
|
36658
|
+
model,
|
|
36659
|
+
onToolCallStart,
|
|
36660
|
+
onToolCallFinish
|
|
36426
36661
|
})
|
|
36427
36662
|
)
|
|
36428
36663
|
);
|
|
@@ -37115,7 +37350,9 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37115
37350
|
break;
|
|
37116
37351
|
}
|
|
37117
37352
|
case "tool-input-error": {
|
|
37118
|
-
|
|
37353
|
+
const existingPart = state.message.parts.filter(isToolUIPart).find((p) => p.toolCallId === chunk.toolCallId);
|
|
37354
|
+
const isDynamic = existingPart != null ? existingPart.type === "dynamic-tool" : !!chunk.dynamic;
|
|
37355
|
+
if (isDynamic) {
|
|
37119
37356
|
updateDynamicToolPart({
|
|
37120
37357
|
toolCallId: chunk.toolCallId,
|
|
37121
37358
|
toolName: chunk.toolName,
|
|
@@ -37583,10 +37820,6 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37583
37820
|
terminate
|
|
37584
37821
|
};
|
|
37585
37822
|
}
|
|
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
37823
|
function runToolsTransformation({
|
|
37591
37824
|
tools,
|
|
37592
37825
|
generatorStream,
|
|
@@ -37597,7 +37830,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37597
37830
|
abortSignal,
|
|
37598
37831
|
repairToolCall,
|
|
37599
37832
|
experimental_context,
|
|
37600
|
-
generateId: generateId2
|
|
37833
|
+
generateId: generateId2,
|
|
37834
|
+
stepNumber,
|
|
37835
|
+
model,
|
|
37836
|
+
onToolCallStart,
|
|
37837
|
+
onToolCallFinish
|
|
37601
37838
|
}) {
|
|
37602
37839
|
let toolResultsStreamController = null;
|
|
37603
37840
|
const toolResultsStream = new ReadableStream({
|
|
@@ -37739,6 +37976,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37739
37976
|
messages,
|
|
37740
37977
|
abortSignal,
|
|
37741
37978
|
experimental_context,
|
|
37979
|
+
stepNumber,
|
|
37980
|
+
model,
|
|
37981
|
+
onToolCallStart,
|
|
37982
|
+
onToolCallFinish,
|
|
37742
37983
|
onPreliminaryToolResult: (result) => {
|
|
37743
37984
|
toolResultsStreamController.enqueue(result);
|
|
37744
37985
|
}
|
|
@@ -37855,6 +38096,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37855
38096
|
onFinish,
|
|
37856
38097
|
onAbort,
|
|
37857
38098
|
onStepFinish,
|
|
38099
|
+
experimental_onStart: onStart,
|
|
38100
|
+
experimental_onStepStart: onStepStart,
|
|
38101
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
38102
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
37858
38103
|
experimental_context,
|
|
37859
38104
|
experimental_include: include,
|
|
37860
38105
|
_internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
|
|
@@ -37894,11 +38139,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37894
38139
|
providerOptions,
|
|
37895
38140
|
prepareStep,
|
|
37896
38141
|
includeRawChunks,
|
|
38142
|
+
timeout,
|
|
38143
|
+
stopWhen,
|
|
38144
|
+
originalAbortSignal: abortSignal,
|
|
37897
38145
|
onChunk,
|
|
37898
38146
|
onError,
|
|
37899
38147
|
onFinish,
|
|
37900
38148
|
onAbort,
|
|
37901
38149
|
onStepFinish,
|
|
38150
|
+
onStart,
|
|
38151
|
+
onStepStart,
|
|
38152
|
+
onToolCallStart,
|
|
38153
|
+
onToolCallFinish,
|
|
37902
38154
|
now: now2,
|
|
37903
38155
|
generateId: generateId2,
|
|
37904
38156
|
experimental_context,
|
|
@@ -37995,11 +38247,18 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
37995
38247
|
includeRawChunks,
|
|
37996
38248
|
now: now2,
|
|
37997
38249
|
generateId: generateId2,
|
|
38250
|
+
timeout,
|
|
38251
|
+
stopWhen,
|
|
38252
|
+
originalAbortSignal,
|
|
37998
38253
|
onChunk,
|
|
37999
38254
|
onError,
|
|
38000
38255
|
onFinish,
|
|
38001
38256
|
onAbort,
|
|
38002
38257
|
onStepFinish,
|
|
38258
|
+
onStart,
|
|
38259
|
+
onStepStart,
|
|
38260
|
+
onToolCallStart,
|
|
38261
|
+
onToolCallFinish,
|
|
38003
38262
|
experimental_context,
|
|
38004
38263
|
download: download2,
|
|
38005
38264
|
include
|
|
@@ -38142,6 +38401,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38142
38401
|
tools
|
|
38143
38402
|
});
|
|
38144
38403
|
const currentStepResult = new DefaultStepResult({
|
|
38404
|
+
stepNumber: recordedSteps.length,
|
|
38405
|
+
model: modelInfo,
|
|
38406
|
+
...callbackTelemetryProps,
|
|
38407
|
+
experimental_context,
|
|
38145
38408
|
content: recordedContent,
|
|
38146
38409
|
finishReason: part.finishReason,
|
|
38147
38410
|
rawFinishReason: part.rawFinishReason,
|
|
@@ -38154,11 +38417,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38154
38417
|
},
|
|
38155
38418
|
providerMetadata: part.providerMetadata
|
|
38156
38419
|
});
|
|
38157
|
-
await (
|
|
38420
|
+
await notify({ event: currentStepResult, callbacks: onStepFinish });
|
|
38158
38421
|
logWarnings({
|
|
38159
38422
|
warnings: recordedWarnings,
|
|
38160
|
-
provider:
|
|
38161
|
-
model:
|
|
38423
|
+
provider: modelInfo.provider,
|
|
38424
|
+
model: modelInfo.modelId
|
|
38162
38425
|
});
|
|
38163
38426
|
recordedSteps.push(currentStepResult);
|
|
38164
38427
|
recordedResponseMessages.push(...stepMessages);
|
|
@@ -38189,30 +38452,37 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38189
38452
|
self2._totalUsage.resolve(totalUsage);
|
|
38190
38453
|
self2._steps.resolve(recordedSteps);
|
|
38191
38454
|
const finalStep = recordedSteps[recordedSteps.length - 1];
|
|
38192
|
-
await (
|
|
38193
|
-
|
|
38194
|
-
|
|
38195
|
-
|
|
38196
|
-
|
|
38197
|
-
|
|
38198
|
-
|
|
38199
|
-
|
|
38200
|
-
|
|
38201
|
-
|
|
38202
|
-
|
|
38203
|
-
|
|
38204
|
-
|
|
38205
|
-
|
|
38206
|
-
|
|
38207
|
-
|
|
38208
|
-
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
|
|
38212
|
-
|
|
38213
|
-
|
|
38214
|
-
|
|
38215
|
-
|
|
38455
|
+
await notify({
|
|
38456
|
+
event: {
|
|
38457
|
+
stepNumber: finalStep.stepNumber,
|
|
38458
|
+
model: finalStep.model,
|
|
38459
|
+
functionId: finalStep.functionId,
|
|
38460
|
+
metadata: finalStep.metadata,
|
|
38461
|
+
experimental_context: finalStep.experimental_context,
|
|
38462
|
+
finishReason: finalStep.finishReason,
|
|
38463
|
+
rawFinishReason: finalStep.rawFinishReason,
|
|
38464
|
+
totalUsage,
|
|
38465
|
+
usage: finalStep.usage,
|
|
38466
|
+
content: finalStep.content,
|
|
38467
|
+
text: finalStep.text,
|
|
38468
|
+
reasoningText: finalStep.reasoningText,
|
|
38469
|
+
reasoning: finalStep.reasoning,
|
|
38470
|
+
files: finalStep.files,
|
|
38471
|
+
sources: finalStep.sources,
|
|
38472
|
+
toolCalls: finalStep.toolCalls,
|
|
38473
|
+
staticToolCalls: finalStep.staticToolCalls,
|
|
38474
|
+
dynamicToolCalls: finalStep.dynamicToolCalls,
|
|
38475
|
+
toolResults: finalStep.toolResults,
|
|
38476
|
+
staticToolResults: finalStep.staticToolResults,
|
|
38477
|
+
dynamicToolResults: finalStep.dynamicToolResults,
|
|
38478
|
+
request: finalStep.request,
|
|
38479
|
+
response: finalStep.response,
|
|
38480
|
+
warnings: finalStep.warnings,
|
|
38481
|
+
providerMetadata: finalStep.providerMetadata,
|
|
38482
|
+
steps: recordedSteps
|
|
38483
|
+
},
|
|
38484
|
+
callbacks: onFinish
|
|
38485
|
+
});
|
|
38216
38486
|
rootSpan.setAttributes(
|
|
38217
38487
|
await selectTelemetryAttributes({
|
|
38218
38488
|
telemetry,
|
|
@@ -38313,6 +38583,11 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38313
38583
|
settings: { ...callSettings, maxRetries }
|
|
38314
38584
|
});
|
|
38315
38585
|
const self2 = this;
|
|
38586
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
38587
|
+
const callbackTelemetryProps = {
|
|
38588
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
38589
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata
|
|
38590
|
+
};
|
|
38316
38591
|
recordSpan({
|
|
38317
38592
|
name: "ai.streamText",
|
|
38318
38593
|
attributes: selectTelemetryAttributes({
|
|
@@ -38335,6 +38610,36 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38335
38610
|
prompt,
|
|
38336
38611
|
messages
|
|
38337
38612
|
});
|
|
38613
|
+
await notify({
|
|
38614
|
+
event: {
|
|
38615
|
+
model: modelInfo,
|
|
38616
|
+
system,
|
|
38617
|
+
prompt,
|
|
38618
|
+
messages,
|
|
38619
|
+
tools,
|
|
38620
|
+
toolChoice,
|
|
38621
|
+
activeTools,
|
|
38622
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
38623
|
+
temperature: callSettings.temperature,
|
|
38624
|
+
topP: callSettings.topP,
|
|
38625
|
+
topK: callSettings.topK,
|
|
38626
|
+
presencePenalty: callSettings.presencePenalty,
|
|
38627
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
38628
|
+
stopSequences: callSettings.stopSequences,
|
|
38629
|
+
seed: callSettings.seed,
|
|
38630
|
+
maxRetries,
|
|
38631
|
+
timeout,
|
|
38632
|
+
headers,
|
|
38633
|
+
providerOptions,
|
|
38634
|
+
stopWhen,
|
|
38635
|
+
output,
|
|
38636
|
+
abortSignal: originalAbortSignal,
|
|
38637
|
+
include,
|
|
38638
|
+
...callbackTelemetryProps,
|
|
38639
|
+
experimental_context
|
|
38640
|
+
},
|
|
38641
|
+
callbacks: onStart
|
|
38642
|
+
});
|
|
38338
38643
|
const initialMessages = initialPrompt.messages;
|
|
38339
38644
|
const initialResponseMessages = [];
|
|
38340
38645
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -38381,6 +38686,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38381
38686
|
messages: initialMessages,
|
|
38382
38687
|
abortSignal,
|
|
38383
38688
|
experimental_context,
|
|
38689
|
+
stepNumber: recordedSteps.length,
|
|
38690
|
+
model: modelInfo,
|
|
38691
|
+
onToolCallStart,
|
|
38692
|
+
onToolCallFinish,
|
|
38384
38693
|
onPreliminaryToolResult: (result2) => {
|
|
38385
38694
|
toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
|
|
38386
38695
|
}
|
|
@@ -38447,7 +38756,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38447
38756
|
responseMessages,
|
|
38448
38757
|
usage
|
|
38449
38758
|
}) {
|
|
38450
|
-
var _a21, _b9, _c, _d, _e, _f, _g;
|
|
38759
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
38451
38760
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
38452
38761
|
const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
|
|
38453
38762
|
let chunkTimeoutId = void 0;
|
|
@@ -38486,6 +38795,10 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38486
38795
|
const stepModel = resolveLanguageModel(
|
|
38487
38796
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
38488
38797
|
);
|
|
38798
|
+
const stepModelInfo = {
|
|
38799
|
+
provider: stepModel.provider,
|
|
38800
|
+
modelId: stepModel.modelId
|
|
38801
|
+
};
|
|
38489
38802
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
38490
38803
|
prompt: {
|
|
38491
38804
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -38494,16 +38807,41 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38494
38807
|
supportedUrls: await stepModel.supportedUrls,
|
|
38495
38808
|
download: download2
|
|
38496
38809
|
});
|
|
38810
|
+
const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
|
|
38497
38811
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
38498
38812
|
tools,
|
|
38499
|
-
toolChoice: (
|
|
38500
|
-
activeTools:
|
|
38813
|
+
toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
|
|
38814
|
+
activeTools: stepActiveTools
|
|
38501
38815
|
});
|
|
38502
38816
|
experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
|
|
38817
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
38818
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
38503
38819
|
const stepProviderOptions = mergeObjects(
|
|
38504
38820
|
providerOptions,
|
|
38505
38821
|
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
38506
38822
|
);
|
|
38823
|
+
await notify({
|
|
38824
|
+
event: {
|
|
38825
|
+
stepNumber: recordedSteps.length,
|
|
38826
|
+
model: stepModelInfo,
|
|
38827
|
+
system: stepSystem,
|
|
38828
|
+
messages: stepMessages,
|
|
38829
|
+
tools,
|
|
38830
|
+
toolChoice: stepToolChoice,
|
|
38831
|
+
activeTools: stepActiveTools,
|
|
38832
|
+
steps: [...recordedSteps],
|
|
38833
|
+
providerOptions: stepProviderOptions,
|
|
38834
|
+
timeout,
|
|
38835
|
+
headers,
|
|
38836
|
+
stopWhen,
|
|
38837
|
+
output,
|
|
38838
|
+
abortSignal: originalAbortSignal,
|
|
38839
|
+
include,
|
|
38840
|
+
...callbackTelemetryProps,
|
|
38841
|
+
experimental_context
|
|
38842
|
+
},
|
|
38843
|
+
callbacks: onStepStart
|
|
38844
|
+
});
|
|
38507
38845
|
const {
|
|
38508
38846
|
result: { stream: stream2, response, request },
|
|
38509
38847
|
doStreamSpan,
|
|
@@ -38575,9 +38913,13 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38575
38913
|
repairToolCall,
|
|
38576
38914
|
abortSignal,
|
|
38577
38915
|
experimental_context,
|
|
38578
|
-
generateId: generateId2
|
|
38916
|
+
generateId: generateId2,
|
|
38917
|
+
stepNumber: recordedSteps.length,
|
|
38918
|
+
model: stepModelInfo,
|
|
38919
|
+
onToolCallStart,
|
|
38920
|
+
onToolCallFinish
|
|
38579
38921
|
});
|
|
38580
|
-
const stepRequest = ((
|
|
38922
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
|
|
38581
38923
|
const stepToolCalls = [];
|
|
38582
38924
|
const stepToolOutputs = [];
|
|
38583
38925
|
let warnings;
|
|
@@ -38590,7 +38932,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
38590
38932
|
let stepResponse = {
|
|
38591
38933
|
id: generateId2(),
|
|
38592
38934
|
timestamp: /* @__PURE__ */ new Date(),
|
|
38593
|
-
modelId:
|
|
38935
|
+
modelId: modelInfo.modelId
|
|
38594
38936
|
};
|
|
38595
38937
|
let activeText = "";
|
|
38596
38938
|
self2.addStream(
|
|
@@ -42414,7 +42756,7 @@ Learn more: \x1B[34m${moreInfoURL}\x1B[0m
|
|
|
42414
42756
|
for (const toolCallDelta of delta.tool_calls) {
|
|
42415
42757
|
const index = toolCallDelta.index;
|
|
42416
42758
|
if (toolCalls[index] == null) {
|
|
42417
|
-
if (toolCallDelta.type !== "function") {
|
|
42759
|
+
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
42418
42760
|
throw new InvalidResponseDataError$1({
|
|
42419
42761
|
data: toolCallDelta,
|
|
42420
42762
|
message: `Expected 'function' type.`
|
|
@@ -43104,9 +43446,11 @@ ${user}:`]
|
|
|
43104
43446
|
"dall-e-2": 10,
|
|
43105
43447
|
"gpt-image-1": 10,
|
|
43106
43448
|
"gpt-image-1-mini": 10,
|
|
43107
|
-
"gpt-image-1.5": 10
|
|
43449
|
+
"gpt-image-1.5": 10,
|
|
43450
|
+
"chatgpt-image-latest": 10
|
|
43108
43451
|
};
|
|
43109
43452
|
var defaultResponseFormatPrefixes = [
|
|
43453
|
+
"chatgpt-image-",
|
|
43110
43454
|
"gpt-image-1-mini",
|
|
43111
43455
|
"gpt-image-1.5",
|
|
43112
43456
|
"gpt-image-1"
|
|
@@ -43205,15 +43549,20 @@ ${user}:`]
|
|
|
43205
43549
|
},
|
|
43206
43550
|
providerMetadata: {
|
|
43207
43551
|
openai: {
|
|
43208
|
-
images: response2.data.map((item) => {
|
|
43209
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43552
|
+
images: response2.data.map((item, index) => {
|
|
43553
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
43210
43554
|
return {
|
|
43211
43555
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
43212
43556
|
created: (_a22 = response2.created) != null ? _a22 : void 0,
|
|
43213
43557
|
size: (_b22 = response2.size) != null ? _b22 : void 0,
|
|
43214
43558
|
quality: (_c2 = response2.quality) != null ? _c2 : void 0,
|
|
43215
43559
|
background: (_d2 = response2.background) != null ? _d2 : void 0,
|
|
43216
|
-
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
|
|
43560
|
+
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
|
|
43561
|
+
...distributeTokenDetails(
|
|
43562
|
+
(_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43563
|
+
index,
|
|
43564
|
+
response2.data.length
|
|
43565
|
+
)
|
|
43217
43566
|
};
|
|
43218
43567
|
})
|
|
43219
43568
|
}
|
|
@@ -43256,15 +43605,20 @@ ${user}:`]
|
|
|
43256
43605
|
},
|
|
43257
43606
|
providerMetadata: {
|
|
43258
43607
|
openai: {
|
|
43259
|
-
images: response.data.map((item) => {
|
|
43260
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43608
|
+
images: response.data.map((item, index) => {
|
|
43609
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
43261
43610
|
return {
|
|
43262
43611
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
43263
43612
|
created: (_a22 = response.created) != null ? _a22 : void 0,
|
|
43264
43613
|
size: (_b22 = response.size) != null ? _b22 : void 0,
|
|
43265
43614
|
quality: (_c2 = response.quality) != null ? _c2 : void 0,
|
|
43266
43615
|
background: (_d2 = response.background) != null ? _d2 : void 0,
|
|
43267
|
-
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
|
|
43616
|
+
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
|
|
43617
|
+
...distributeTokenDetails(
|
|
43618
|
+
(_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43619
|
+
index,
|
|
43620
|
+
response.data.length
|
|
43621
|
+
)
|
|
43268
43622
|
};
|
|
43269
43623
|
})
|
|
43270
43624
|
}
|
|
@@ -43272,6 +43626,23 @@ ${user}:`]
|
|
|
43272
43626
|
};
|
|
43273
43627
|
}
|
|
43274
43628
|
};
|
|
43629
|
+
function distributeTokenDetails(details, index, total) {
|
|
43630
|
+
if (details == null) {
|
|
43631
|
+
return {};
|
|
43632
|
+
}
|
|
43633
|
+
const result = {};
|
|
43634
|
+
if (details.image_tokens != null) {
|
|
43635
|
+
const base = Math.floor(details.image_tokens / total);
|
|
43636
|
+
const remainder = details.image_tokens - base * (total - 1);
|
|
43637
|
+
result.imageTokens = index === total - 1 ? remainder : base;
|
|
43638
|
+
}
|
|
43639
|
+
if (details.text_tokens != null) {
|
|
43640
|
+
const base = Math.floor(details.text_tokens / total);
|
|
43641
|
+
const remainder = details.text_tokens - base * (total - 1);
|
|
43642
|
+
result.textTokens = index === total - 1 ? remainder : base;
|
|
43643
|
+
}
|
|
43644
|
+
return result;
|
|
43645
|
+
}
|
|
43275
43646
|
async function fileToBlob(file) {
|
|
43276
43647
|
if (!file) return void 0;
|
|
43277
43648
|
if (file.type === "url") {
|
|
@@ -43482,6 +43853,67 @@ ${user}:`]
|
|
|
43482
43853
|
})
|
|
43483
43854
|
)
|
|
43484
43855
|
);
|
|
43856
|
+
var shellSkillsSchema = array$1(
|
|
43857
|
+
discriminatedUnion("type", [
|
|
43858
|
+
object$2({
|
|
43859
|
+
type: literal("skillReference"),
|
|
43860
|
+
skillId: string(),
|
|
43861
|
+
version: string().optional()
|
|
43862
|
+
}),
|
|
43863
|
+
object$2({
|
|
43864
|
+
type: literal("inline"),
|
|
43865
|
+
name: string(),
|
|
43866
|
+
description: string(),
|
|
43867
|
+
source: object$2({
|
|
43868
|
+
type: literal("base64"),
|
|
43869
|
+
mediaType: literal("application/zip"),
|
|
43870
|
+
data: string()
|
|
43871
|
+
})
|
|
43872
|
+
})
|
|
43873
|
+
])
|
|
43874
|
+
).optional();
|
|
43875
|
+
var shellArgsSchema = lazySchema(
|
|
43876
|
+
() => zodSchema(
|
|
43877
|
+
object$2({
|
|
43878
|
+
environment: union([
|
|
43879
|
+
object$2({
|
|
43880
|
+
type: literal("containerAuto"),
|
|
43881
|
+
fileIds: array$1(string()).optional(),
|
|
43882
|
+
memoryLimit: _enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
43883
|
+
networkPolicy: discriminatedUnion("type", [
|
|
43884
|
+
object$2({ type: literal("disabled") }),
|
|
43885
|
+
object$2({
|
|
43886
|
+
type: literal("allowlist"),
|
|
43887
|
+
allowedDomains: array$1(string()),
|
|
43888
|
+
domainSecrets: array$1(
|
|
43889
|
+
object$2({
|
|
43890
|
+
domain: string(),
|
|
43891
|
+
name: string(),
|
|
43892
|
+
value: string()
|
|
43893
|
+
})
|
|
43894
|
+
).optional()
|
|
43895
|
+
})
|
|
43896
|
+
]).optional(),
|
|
43897
|
+
skills: shellSkillsSchema
|
|
43898
|
+
}),
|
|
43899
|
+
object$2({
|
|
43900
|
+
type: literal("containerReference"),
|
|
43901
|
+
containerId: string()
|
|
43902
|
+
}),
|
|
43903
|
+
object$2({
|
|
43904
|
+
type: literal("local").optional(),
|
|
43905
|
+
skills: array$1(
|
|
43906
|
+
object$2({
|
|
43907
|
+
name: string(),
|
|
43908
|
+
description: string(),
|
|
43909
|
+
path: string()
|
|
43910
|
+
})
|
|
43911
|
+
).optional()
|
|
43912
|
+
})
|
|
43913
|
+
]).optional()
|
|
43914
|
+
})
|
|
43915
|
+
)
|
|
43916
|
+
);
|
|
43485
43917
|
var shell = createProviderToolFactoryWithOutputSchema({
|
|
43486
43918
|
id: "openai.shell",
|
|
43487
43919
|
inputSchema: shellInputSchema,
|
|
@@ -43521,7 +43953,7 @@ ${user}:`]
|
|
|
43521
43953
|
url: string().nullish(),
|
|
43522
43954
|
pattern: string().nullish()
|
|
43523
43955
|
})
|
|
43524
|
-
]),
|
|
43956
|
+
]).optional(),
|
|
43525
43957
|
sources: array$1(
|
|
43526
43958
|
discriminatedUnion("type", [
|
|
43527
43959
|
object$2({ type: literal("url"), url: string() }),
|
|
@@ -43571,7 +44003,7 @@ ${user}:`]
|
|
|
43571
44003
|
url: string().nullish(),
|
|
43572
44004
|
pattern: string().nullish()
|
|
43573
44005
|
})
|
|
43574
|
-
])
|
|
44006
|
+
]).optional()
|
|
43575
44007
|
})
|
|
43576
44008
|
)
|
|
43577
44009
|
);
|
|
@@ -43788,7 +44220,7 @@ ${user}:`]
|
|
|
43788
44220
|
hasShellTool = false,
|
|
43789
44221
|
hasApplyPatchTool = false
|
|
43790
44222
|
}) {
|
|
43791
|
-
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
44223
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
43792
44224
|
const input = [];
|
|
43793
44225
|
const warnings = [];
|
|
43794
44226
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -43869,7 +44301,9 @@ ${user}:`]
|
|
|
43869
44301
|
for (const part of content) {
|
|
43870
44302
|
switch (part.type) {
|
|
43871
44303
|
case "text": {
|
|
43872
|
-
const
|
|
44304
|
+
const providerOpts = (_a10 = part.providerOptions) == null ? void 0 : _a10[providerOptionsName];
|
|
44305
|
+
const id2 = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
44306
|
+
const phase = providerOpts == null ? void 0 : providerOpts.phase;
|
|
43873
44307
|
if (hasConversation && id2 != null) {
|
|
43874
44308
|
break;
|
|
43875
44309
|
}
|
|
@@ -43880,12 +44314,13 @@ ${user}:`]
|
|
|
43880
44314
|
input.push({
|
|
43881
44315
|
role: "assistant",
|
|
43882
44316
|
content: [{ type: "output_text", text: part.text }],
|
|
43883
|
-
id: id2
|
|
44317
|
+
id: id2,
|
|
44318
|
+
...phase != null && { phase }
|
|
43884
44319
|
});
|
|
43885
44320
|
break;
|
|
43886
44321
|
}
|
|
43887
44322
|
case "tool-call": {
|
|
43888
|
-
const id2 = (
|
|
44323
|
+
const id2 = (_f = (_c = (_b9 = part.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.itemId) != null ? _f : (_e = (_d = part.providerMetadata) == null ? void 0 : _d[providerOptionsName]) == null ? void 0 : _e.itemId;
|
|
43889
44324
|
if (hasConversation && id2 != null) {
|
|
43890
44325
|
break;
|
|
43891
44326
|
}
|
|
@@ -43971,8 +44406,32 @@ ${user}:`]
|
|
|
43971
44406
|
if (hasConversation) {
|
|
43972
44407
|
break;
|
|
43973
44408
|
}
|
|
44409
|
+
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
44410
|
+
part.toolName
|
|
44411
|
+
);
|
|
44412
|
+
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
44413
|
+
if (part.output.type === "json") {
|
|
44414
|
+
const parsedOutput = await validateTypes$1({
|
|
44415
|
+
value: part.output.value,
|
|
44416
|
+
schema: shellOutputSchema
|
|
44417
|
+
});
|
|
44418
|
+
input.push({
|
|
44419
|
+
type: "shell_call_output",
|
|
44420
|
+
call_id: part.toolCallId,
|
|
44421
|
+
output: parsedOutput.output.map((item) => ({
|
|
44422
|
+
stdout: item.stdout,
|
|
44423
|
+
stderr: item.stderr,
|
|
44424
|
+
outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
|
|
44425
|
+
type: "exit",
|
|
44426
|
+
exit_code: item.outcome.exitCode
|
|
44427
|
+
}
|
|
44428
|
+
}))
|
|
44429
|
+
});
|
|
44430
|
+
}
|
|
44431
|
+
break;
|
|
44432
|
+
}
|
|
43974
44433
|
if (store) {
|
|
43975
|
-
const itemId = (
|
|
44434
|
+
const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
|
|
43976
44435
|
input.push({ type: "item_reference", id: itemId });
|
|
43977
44436
|
} else {
|
|
43978
44437
|
warnings.push({
|
|
@@ -44032,10 +44491,26 @@ ${user}:`]
|
|
|
44032
44491
|
}
|
|
44033
44492
|
}
|
|
44034
44493
|
} else {
|
|
44035
|
-
|
|
44036
|
-
|
|
44037
|
-
|
|
44038
|
-
|
|
44494
|
+
const encryptedContent = providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent;
|
|
44495
|
+
if (encryptedContent != null) {
|
|
44496
|
+
const summaryParts = [];
|
|
44497
|
+
if (part.text.length > 0) {
|
|
44498
|
+
summaryParts.push({
|
|
44499
|
+
type: "summary_text",
|
|
44500
|
+
text: part.text
|
|
44501
|
+
});
|
|
44502
|
+
}
|
|
44503
|
+
input.push({
|
|
44504
|
+
type: "reasoning",
|
|
44505
|
+
encrypted_content: encryptedContent,
|
|
44506
|
+
summary: summaryParts
|
|
44507
|
+
});
|
|
44508
|
+
} else {
|
|
44509
|
+
warnings.push({
|
|
44510
|
+
type: "other",
|
|
44511
|
+
message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
44512
|
+
});
|
|
44513
|
+
}
|
|
44039
44514
|
}
|
|
44040
44515
|
break;
|
|
44041
44516
|
}
|
|
@@ -44066,7 +44541,7 @@ ${user}:`]
|
|
|
44066
44541
|
}
|
|
44067
44542
|
const output = part.output;
|
|
44068
44543
|
if (output.type === "execution-denied") {
|
|
44069
|
-
const approvalId = (
|
|
44544
|
+
const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
|
|
44070
44545
|
if (approvalId) {
|
|
44071
44546
|
continue;
|
|
44072
44547
|
}
|
|
@@ -44125,7 +44600,7 @@ ${user}:`]
|
|
|
44125
44600
|
contentValue = output.value;
|
|
44126
44601
|
break;
|
|
44127
44602
|
case "execution-denied":
|
|
44128
|
-
contentValue = (
|
|
44603
|
+
contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
|
|
44129
44604
|
break;
|
|
44130
44605
|
case "json":
|
|
44131
44606
|
case "error-json":
|
|
@@ -44252,7 +44727,8 @@ ${user}:`]
|
|
|
44252
44727
|
item: discriminatedUnion("type", [
|
|
44253
44728
|
object$2({
|
|
44254
44729
|
type: literal("message"),
|
|
44255
|
-
id: string()
|
|
44730
|
+
id: string(),
|
|
44731
|
+
phase: _enum(["commentary", "final_answer"]).nullish()
|
|
44256
44732
|
}),
|
|
44257
44733
|
object$2({
|
|
44258
44734
|
type: literal("reasoning"),
|
|
@@ -44341,6 +44817,25 @@ ${user}:`]
|
|
|
44341
44817
|
action: object$2({
|
|
44342
44818
|
commands: array$1(string())
|
|
44343
44819
|
})
|
|
44820
|
+
}),
|
|
44821
|
+
object$2({
|
|
44822
|
+
type: literal("shell_call_output"),
|
|
44823
|
+
id: string(),
|
|
44824
|
+
call_id: string(),
|
|
44825
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
44826
|
+
output: array$1(
|
|
44827
|
+
object$2({
|
|
44828
|
+
stdout: string(),
|
|
44829
|
+
stderr: string(),
|
|
44830
|
+
outcome: discriminatedUnion("type", [
|
|
44831
|
+
object$2({ type: literal("timeout") }),
|
|
44832
|
+
object$2({
|
|
44833
|
+
type: literal("exit"),
|
|
44834
|
+
exit_code: number$1()
|
|
44835
|
+
})
|
|
44836
|
+
])
|
|
44837
|
+
})
|
|
44838
|
+
)
|
|
44344
44839
|
})
|
|
44345
44840
|
])
|
|
44346
44841
|
}),
|
|
@@ -44350,7 +44845,8 @@ ${user}:`]
|
|
|
44350
44845
|
item: discriminatedUnion("type", [
|
|
44351
44846
|
object$2({
|
|
44352
44847
|
type: literal("message"),
|
|
44353
|
-
id: string()
|
|
44848
|
+
id: string(),
|
|
44849
|
+
phase: _enum(["commentary", "final_answer"]).nullish()
|
|
44354
44850
|
}),
|
|
44355
44851
|
object$2({
|
|
44356
44852
|
type: literal("reasoning"),
|
|
@@ -44406,7 +44902,7 @@ ${user}:`]
|
|
|
44406
44902
|
url: string().nullish(),
|
|
44407
44903
|
pattern: string().nullish()
|
|
44408
44904
|
})
|
|
44409
|
-
])
|
|
44905
|
+
]).nullish()
|
|
44410
44906
|
}),
|
|
44411
44907
|
object$2({
|
|
44412
44908
|
type: literal("file_search_call"),
|
|
@@ -44520,6 +45016,25 @@ ${user}:`]
|
|
|
44520
45016
|
action: object$2({
|
|
44521
45017
|
commands: array$1(string())
|
|
44522
45018
|
})
|
|
45019
|
+
}),
|
|
45020
|
+
object$2({
|
|
45021
|
+
type: literal("shell_call_output"),
|
|
45022
|
+
id: string(),
|
|
45023
|
+
call_id: string(),
|
|
45024
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
45025
|
+
output: array$1(
|
|
45026
|
+
object$2({
|
|
45027
|
+
stdout: string(),
|
|
45028
|
+
stderr: string(),
|
|
45029
|
+
outcome: discriminatedUnion("type", [
|
|
45030
|
+
object$2({ type: literal("timeout") }),
|
|
45031
|
+
object$2({
|
|
45032
|
+
type: literal("exit"),
|
|
45033
|
+
exit_code: number$1()
|
|
45034
|
+
})
|
|
45035
|
+
])
|
|
45036
|
+
})
|
|
45037
|
+
)
|
|
44523
45038
|
})
|
|
44524
45039
|
])
|
|
44525
45040
|
}),
|
|
@@ -44643,6 +45158,7 @@ ${user}:`]
|
|
|
44643
45158
|
type: literal("message"),
|
|
44644
45159
|
role: literal("assistant"),
|
|
44645
45160
|
id: string(),
|
|
45161
|
+
phase: _enum(["commentary", "final_answer"]).nullish(),
|
|
44646
45162
|
content: array$1(
|
|
44647
45163
|
object$2({
|
|
44648
45164
|
type: literal("output_text"),
|
|
@@ -44703,7 +45219,10 @@ ${user}:`]
|
|
|
44703
45219
|
sources: array$1(
|
|
44704
45220
|
discriminatedUnion("type", [
|
|
44705
45221
|
object$2({ type: literal("url"), url: string() }),
|
|
44706
|
-
object$2({
|
|
45222
|
+
object$2({
|
|
45223
|
+
type: literal("api"),
|
|
45224
|
+
name: string()
|
|
45225
|
+
})
|
|
44707
45226
|
])
|
|
44708
45227
|
).nullish()
|
|
44709
45228
|
}),
|
|
@@ -44716,7 +45235,7 @@ ${user}:`]
|
|
|
44716
45235
|
url: string().nullish(),
|
|
44717
45236
|
pattern: string().nullish()
|
|
44718
45237
|
})
|
|
44719
|
-
])
|
|
45238
|
+
]).nullish()
|
|
44720
45239
|
}),
|
|
44721
45240
|
object$2({
|
|
44722
45241
|
type: literal("file_search_call"),
|
|
@@ -44865,6 +45384,25 @@ ${user}:`]
|
|
|
44865
45384
|
action: object$2({
|
|
44866
45385
|
commands: array$1(string())
|
|
44867
45386
|
})
|
|
45387
|
+
}),
|
|
45388
|
+
object$2({
|
|
45389
|
+
type: literal("shell_call_output"),
|
|
45390
|
+
id: string(),
|
|
45391
|
+
call_id: string(),
|
|
45392
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
45393
|
+
output: array$1(
|
|
45394
|
+
object$2({
|
|
45395
|
+
stdout: string(),
|
|
45396
|
+
stderr: string(),
|
|
45397
|
+
outcome: discriminatedUnion("type", [
|
|
45398
|
+
object$2({ type: literal("timeout") }),
|
|
45399
|
+
object$2({
|
|
45400
|
+
type: literal("exit"),
|
|
45401
|
+
exit_code: number$1()
|
|
45402
|
+
})
|
|
45403
|
+
])
|
|
45404
|
+
})
|
|
45405
|
+
)
|
|
44868
45406
|
})
|
|
44869
45407
|
])
|
|
44870
45408
|
).optional(),
|
|
@@ -45081,8 +45619,15 @@ ${user}:`]
|
|
|
45081
45619
|
break;
|
|
45082
45620
|
}
|
|
45083
45621
|
case "openai.shell": {
|
|
45622
|
+
const args = await validateTypes$1({
|
|
45623
|
+
value: tool2.args,
|
|
45624
|
+
schema: shellArgsSchema
|
|
45625
|
+
});
|
|
45084
45626
|
openaiTools2.push({
|
|
45085
|
-
type: "shell"
|
|
45627
|
+
type: "shell",
|
|
45628
|
+
...args.environment && {
|
|
45629
|
+
environment: mapShellEnvironment(args.environment)
|
|
45630
|
+
}
|
|
45086
45631
|
});
|
|
45087
45632
|
break;
|
|
45088
45633
|
}
|
|
@@ -45212,6 +45757,52 @@ ${user}:`]
|
|
|
45212
45757
|
}
|
|
45213
45758
|
}
|
|
45214
45759
|
}
|
|
45760
|
+
function mapShellEnvironment(environment) {
|
|
45761
|
+
if (environment.type === "containerReference") {
|
|
45762
|
+
const env2 = environment;
|
|
45763
|
+
return {
|
|
45764
|
+
type: "container_reference",
|
|
45765
|
+
container_id: env2.containerId
|
|
45766
|
+
};
|
|
45767
|
+
}
|
|
45768
|
+
if (environment.type === "containerAuto") {
|
|
45769
|
+
const env2 = environment;
|
|
45770
|
+
return {
|
|
45771
|
+
type: "container_auto",
|
|
45772
|
+
file_ids: env2.fileIds,
|
|
45773
|
+
memory_limit: env2.memoryLimit,
|
|
45774
|
+
network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
|
|
45775
|
+
type: "allowlist",
|
|
45776
|
+
allowed_domains: env2.networkPolicy.allowedDomains,
|
|
45777
|
+
domain_secrets: env2.networkPolicy.domainSecrets
|
|
45778
|
+
},
|
|
45779
|
+
skills: mapShellSkills(env2.skills)
|
|
45780
|
+
};
|
|
45781
|
+
}
|
|
45782
|
+
const env = environment;
|
|
45783
|
+
return {
|
|
45784
|
+
type: "local",
|
|
45785
|
+
skills: env.skills
|
|
45786
|
+
};
|
|
45787
|
+
}
|
|
45788
|
+
function mapShellSkills(skills) {
|
|
45789
|
+
return skills == null ? void 0 : skills.map(
|
|
45790
|
+
(skill) => skill.type === "skillReference" ? {
|
|
45791
|
+
type: "skill_reference",
|
|
45792
|
+
skill_id: skill.skillId,
|
|
45793
|
+
version: skill.version
|
|
45794
|
+
} : {
|
|
45795
|
+
type: "inline",
|
|
45796
|
+
name: skill.name,
|
|
45797
|
+
description: skill.description,
|
|
45798
|
+
source: {
|
|
45799
|
+
type: "base64",
|
|
45800
|
+
media_type: skill.source.mediaType,
|
|
45801
|
+
data: skill.source.data
|
|
45802
|
+
}
|
|
45803
|
+
}
|
|
45804
|
+
);
|
|
45805
|
+
}
|
|
45215
45806
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
45216
45807
|
var _a10, _b9;
|
|
45217
45808
|
const mapping = {};
|
|
@@ -45255,7 +45846,7 @@ ${user}:`]
|
|
|
45255
45846
|
toolChoice,
|
|
45256
45847
|
responseFormat
|
|
45257
45848
|
}) {
|
|
45258
|
-
var _a10, _b9, _c, _d, _e, _f;
|
|
45849
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
45259
45850
|
const warnings = [];
|
|
45260
45851
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
45261
45852
|
if (topK != null) {
|
|
@@ -45459,6 +46050,10 @@ ${user}:`]
|
|
|
45459
46050
|
tools,
|
|
45460
46051
|
toolChoice
|
|
45461
46052
|
});
|
|
46053
|
+
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
46054
|
+
(tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
|
|
46055
|
+
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
46056
|
+
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
45462
46057
|
return {
|
|
45463
46058
|
webSearchToolName,
|
|
45464
46059
|
args: {
|
|
@@ -45469,7 +46064,8 @@ ${user}:`]
|
|
|
45469
46064
|
warnings: [...warnings, ...toolWarnings],
|
|
45470
46065
|
store,
|
|
45471
46066
|
toolNameMapping,
|
|
45472
|
-
providerOptionsName
|
|
46067
|
+
providerOptionsName,
|
|
46068
|
+
isShellProviderExecuted
|
|
45473
46069
|
};
|
|
45474
46070
|
}
|
|
45475
46071
|
async doGenerate(options) {
|
|
@@ -45479,7 +46075,8 @@ ${user}:`]
|
|
|
45479
46075
|
warnings,
|
|
45480
46076
|
webSearchToolName,
|
|
45481
46077
|
toolNameMapping,
|
|
45482
|
-
providerOptionsName
|
|
46078
|
+
providerOptionsName,
|
|
46079
|
+
isShellProviderExecuted
|
|
45483
46080
|
} = await this.getArgs(options);
|
|
45484
46081
|
const url2 = this.config.url({
|
|
45485
46082
|
path: "/responses",
|
|
@@ -45579,6 +46176,7 @@ ${user}:`]
|
|
|
45579
46176
|
commands: part.action.commands
|
|
45580
46177
|
}
|
|
45581
46178
|
}),
|
|
46179
|
+
...isShellProviderExecuted && { providerExecuted: true },
|
|
45582
46180
|
providerMetadata: {
|
|
45583
46181
|
[providerOptionsName]: {
|
|
45584
46182
|
itemId: part.id
|
|
@@ -45587,6 +46185,24 @@ ${user}:`]
|
|
|
45587
46185
|
});
|
|
45588
46186
|
break;
|
|
45589
46187
|
}
|
|
46188
|
+
case "shell_call_output": {
|
|
46189
|
+
content.push({
|
|
46190
|
+
type: "tool-result",
|
|
46191
|
+
toolCallId: part.call_id,
|
|
46192
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46193
|
+
result: {
|
|
46194
|
+
output: part.output.map((item) => ({
|
|
46195
|
+
stdout: item.stdout,
|
|
46196
|
+
stderr: item.stderr,
|
|
46197
|
+
outcome: item.outcome.type === "exit" ? {
|
|
46198
|
+
type: "exit",
|
|
46199
|
+
exitCode: item.outcome.exit_code
|
|
46200
|
+
} : { type: "timeout" }
|
|
46201
|
+
}))
|
|
46202
|
+
}
|
|
46203
|
+
});
|
|
46204
|
+
break;
|
|
46205
|
+
}
|
|
45590
46206
|
case "message": {
|
|
45591
46207
|
for (const contentPart of part.content) {
|
|
45592
46208
|
if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -45594,6 +46210,7 @@ ${user}:`]
|
|
|
45594
46210
|
}
|
|
45595
46211
|
const providerMetadata2 = {
|
|
45596
46212
|
itemId: part.id,
|
|
46213
|
+
...part.phase != null && { phase: part.phase },
|
|
45597
46214
|
...contentPart.annotations.length > 0 && {
|
|
45598
46215
|
annotations: contentPart.annotations
|
|
45599
46216
|
}
|
|
@@ -45876,7 +46493,8 @@ ${user}:`]
|
|
|
45876
46493
|
webSearchToolName,
|
|
45877
46494
|
toolNameMapping,
|
|
45878
46495
|
store,
|
|
45879
|
-
providerOptionsName
|
|
46496
|
+
providerOptionsName,
|
|
46497
|
+
isShellProviderExecuted
|
|
45880
46498
|
} = await this.getArgs(options);
|
|
45881
46499
|
const { responseHeaders, value: response } = await postJsonToApi$1({
|
|
45882
46500
|
url: this.config.url({
|
|
@@ -45907,6 +46525,7 @@ ${user}:`]
|
|
|
45907
46525
|
let responseId = null;
|
|
45908
46526
|
const ongoingToolCalls = {};
|
|
45909
46527
|
const ongoingAnnotations = [];
|
|
46528
|
+
let activeMessagePhase;
|
|
45910
46529
|
let hasFunctionCall = false;
|
|
45911
46530
|
const activeReasoning = {};
|
|
45912
46531
|
let serviceTier;
|
|
@@ -45917,7 +46536,7 @@ ${user}:`]
|
|
|
45917
46536
|
controller.enqueue({ type: "stream-start", warnings });
|
|
45918
46537
|
},
|
|
45919
46538
|
transform(chunk, controller) {
|
|
45920
|
-
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
46539
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
45921
46540
|
if (options.includeRawChunks) {
|
|
45922
46541
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
45923
46542
|
}
|
|
@@ -46055,14 +46674,19 @@ ${user}:`]
|
|
|
46055
46674
|
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46056
46675
|
toolCallId: value.item.call_id
|
|
46057
46676
|
};
|
|
46058
|
-
} else if (value.item.type === "
|
|
46677
|
+
} else if (value.item.type === "shell_call_output") ;
|
|
46678
|
+
else if (value.item.type === "message") {
|
|
46059
46679
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
46680
|
+
activeMessagePhase = (_a10 = value.item.phase) != null ? _a10 : void 0;
|
|
46060
46681
|
controller.enqueue({
|
|
46061
46682
|
type: "text-start",
|
|
46062
46683
|
id: value.item.id,
|
|
46063
46684
|
providerMetadata: {
|
|
46064
46685
|
[providerOptionsName]: {
|
|
46065
|
-
itemId: value.item.id
|
|
46686
|
+
itemId: value.item.id,
|
|
46687
|
+
...value.item.phase != null && {
|
|
46688
|
+
phase: value.item.phase
|
|
46689
|
+
}
|
|
46066
46690
|
}
|
|
46067
46691
|
}
|
|
46068
46692
|
});
|
|
@@ -46077,19 +46701,22 @@ ${user}:`]
|
|
|
46077
46701
|
providerMetadata: {
|
|
46078
46702
|
[providerOptionsName]: {
|
|
46079
46703
|
itemId: value.item.id,
|
|
46080
|
-
reasoningEncryptedContent: (
|
|
46704
|
+
reasoningEncryptedContent: (_b9 = value.item.encrypted_content) != null ? _b9 : null
|
|
46081
46705
|
}
|
|
46082
46706
|
}
|
|
46083
46707
|
});
|
|
46084
46708
|
}
|
|
46085
46709
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
46086
46710
|
if (value.item.type === "message") {
|
|
46711
|
+
const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
|
|
46712
|
+
activeMessagePhase = void 0;
|
|
46087
46713
|
controller.enqueue({
|
|
46088
46714
|
type: "text-end",
|
|
46089
46715
|
id: value.item.id,
|
|
46090
46716
|
providerMetadata: {
|
|
46091
46717
|
[providerOptionsName]: {
|
|
46092
46718
|
itemId: value.item.id,
|
|
46719
|
+
...phase != null && { phase },
|
|
46093
46720
|
...ongoingAnnotations.length > 0 && {
|
|
46094
46721
|
annotations: ongoingAnnotations
|
|
46095
46722
|
}
|
|
@@ -46154,13 +46781,13 @@ ${user}:`]
|
|
|
46154
46781
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
46155
46782
|
result: {
|
|
46156
46783
|
queries: value.item.queries,
|
|
46157
|
-
results: (
|
|
46784
|
+
results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
|
|
46158
46785
|
attributes: result.attributes,
|
|
46159
46786
|
fileId: result.file_id,
|
|
46160
46787
|
filename: result.filename,
|
|
46161
46788
|
score: result.score,
|
|
46162
46789
|
text: result.text
|
|
46163
|
-
}))) != null ?
|
|
46790
|
+
}))) != null ? _e : null
|
|
46164
46791
|
}
|
|
46165
46792
|
});
|
|
46166
46793
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -46184,10 +46811,10 @@ ${user}:`]
|
|
|
46184
46811
|
});
|
|
46185
46812
|
} else if (value.item.type === "mcp_call") {
|
|
46186
46813
|
ongoingToolCalls[value.output_index] = void 0;
|
|
46187
|
-
const approvalRequestId = (
|
|
46188
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
46814
|
+
const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
|
|
46815
|
+
const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
46189
46816
|
approvalRequestId
|
|
46190
|
-
)) != null ?
|
|
46817
|
+
)) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
|
|
46191
46818
|
const toolName = `mcp.${value.item.name}`;
|
|
46192
46819
|
controller.enqueue({
|
|
46193
46820
|
type: "tool-call",
|
|
@@ -46257,8 +46884,8 @@ ${user}:`]
|
|
|
46257
46884
|
ongoingToolCalls[value.output_index] = void 0;
|
|
46258
46885
|
} else if (value.item.type === "mcp_approval_request") {
|
|
46259
46886
|
ongoingToolCalls[value.output_index] = void 0;
|
|
46260
|
-
const dummyToolCallId = (
|
|
46261
|
-
const approvalRequestId = (
|
|
46887
|
+
const dummyToolCallId = (_k = (_j = (_i = self2.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId$1();
|
|
46888
|
+
const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
|
|
46262
46889
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
46263
46890
|
approvalRequestId,
|
|
46264
46891
|
dummyToolCallId
|
|
@@ -46308,10 +46935,31 @@ ${user}:`]
|
|
|
46308
46935
|
commands: value.item.action.commands
|
|
46309
46936
|
}
|
|
46310
46937
|
}),
|
|
46938
|
+
...isShellProviderExecuted && {
|
|
46939
|
+
providerExecuted: true
|
|
46940
|
+
},
|
|
46311
46941
|
providerMetadata: {
|
|
46312
46942
|
[providerOptionsName]: { itemId: value.item.id }
|
|
46313
46943
|
}
|
|
46314
46944
|
});
|
|
46945
|
+
} else if (value.item.type === "shell_call_output") {
|
|
46946
|
+
controller.enqueue({
|
|
46947
|
+
type: "tool-result",
|
|
46948
|
+
toolCallId: value.item.call_id,
|
|
46949
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46950
|
+
result: {
|
|
46951
|
+
output: value.item.output.map(
|
|
46952
|
+
(item) => ({
|
|
46953
|
+
stdout: item.stdout,
|
|
46954
|
+
stderr: item.stderr,
|
|
46955
|
+
outcome: item.outcome.type === "exit" ? {
|
|
46956
|
+
type: "exit",
|
|
46957
|
+
exitCode: item.outcome.exit_code
|
|
46958
|
+
} : { type: "timeout" }
|
|
46959
|
+
})
|
|
46960
|
+
)
|
|
46961
|
+
}
|
|
46962
|
+
});
|
|
46315
46963
|
} else if (value.item.type === "reasoning") {
|
|
46316
46964
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
46317
46965
|
const summaryPartIndices = Object.entries(
|
|
@@ -46326,7 +46974,7 @@ ${user}:`]
|
|
|
46326
46974
|
providerMetadata: {
|
|
46327
46975
|
[providerOptionsName]: {
|
|
46328
46976
|
itemId: value.item.id,
|
|
46329
|
-
reasoningEncryptedContent: (
|
|
46977
|
+
reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
|
|
46330
46978
|
}
|
|
46331
46979
|
}
|
|
46332
46980
|
});
|
|
@@ -46430,7 +47078,7 @@ ${user}:`]
|
|
|
46430
47078
|
id: value.item_id,
|
|
46431
47079
|
delta: value.delta
|
|
46432
47080
|
});
|
|
46433
|
-
if (((
|
|
47081
|
+
if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
|
|
46434
47082
|
logprobs.push(value.logprobs);
|
|
46435
47083
|
}
|
|
46436
47084
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -46459,7 +47107,7 @@ ${user}:`]
|
|
|
46459
47107
|
providerMetadata: {
|
|
46460
47108
|
[providerOptionsName]: {
|
|
46461
47109
|
itemId: value.item_id,
|
|
46462
|
-
reasoningEncryptedContent: (
|
|
47110
|
+
reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
|
|
46463
47111
|
}
|
|
46464
47112
|
}
|
|
46465
47113
|
});
|
|
@@ -46493,10 +47141,10 @@ ${user}:`]
|
|
|
46493
47141
|
} else if (isResponseFinishedChunk(value)) {
|
|
46494
47142
|
finishReason = {
|
|
46495
47143
|
unified: mapOpenAIResponseFinishReason({
|
|
46496
|
-
finishReason: (
|
|
47144
|
+
finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
|
|
46497
47145
|
hasFunctionCall
|
|
46498
47146
|
}),
|
|
46499
|
-
raw: (
|
|
47147
|
+
raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
|
|
46500
47148
|
};
|
|
46501
47149
|
usage = value.response.usage;
|
|
46502
47150
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -46508,7 +47156,7 @@ ${user}:`]
|
|
|
46508
47156
|
controller.enqueue({
|
|
46509
47157
|
type: "source",
|
|
46510
47158
|
sourceType: "url",
|
|
46511
|
-
id: (
|
|
47159
|
+
id: (_w = (_v = (_u = self2.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId$1(),
|
|
46512
47160
|
url: value.annotation.url,
|
|
46513
47161
|
title: value.annotation.title
|
|
46514
47162
|
});
|
|
@@ -46516,7 +47164,7 @@ ${user}:`]
|
|
|
46516
47164
|
controller.enqueue({
|
|
46517
47165
|
type: "source",
|
|
46518
47166
|
sourceType: "document",
|
|
46519
|
-
id: (
|
|
47167
|
+
id: (_z = (_y = (_x = self2.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId$1(),
|
|
46520
47168
|
mediaType: "text/plain",
|
|
46521
47169
|
title: value.annotation.filename,
|
|
46522
47170
|
filename: value.annotation.filename,
|
|
@@ -46532,7 +47180,7 @@ ${user}:`]
|
|
|
46532
47180
|
controller.enqueue({
|
|
46533
47181
|
type: "source",
|
|
46534
47182
|
sourceType: "document",
|
|
46535
|
-
id: (
|
|
47183
|
+
id: (_C = (_B = (_A = self2.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId$1(),
|
|
46536
47184
|
mediaType: "text/plain",
|
|
46537
47185
|
title: value.annotation.filename,
|
|
46538
47186
|
filename: value.annotation.filename,
|
|
@@ -46548,7 +47196,7 @@ ${user}:`]
|
|
|
46548
47196
|
controller.enqueue({
|
|
46549
47197
|
type: "source",
|
|
46550
47198
|
sourceType: "document",
|
|
46551
|
-
id: (
|
|
47199
|
+
id: (_F = (_E = (_D = self2.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId$1(),
|
|
46552
47200
|
mediaType: "application/octet-stream",
|
|
46553
47201
|
title: value.annotation.file_id,
|
|
46554
47202
|
filename: value.annotation.file_id,
|
|
@@ -46628,6 +47276,9 @@ ${user}:`]
|
|
|
46628
47276
|
}
|
|
46629
47277
|
function mapWebSearchOutput(action) {
|
|
46630
47278
|
var _a10;
|
|
47279
|
+
if (action == null) {
|
|
47280
|
+
return {};
|
|
47281
|
+
}
|
|
46631
47282
|
switch (action.type) {
|
|
46632
47283
|
case "search":
|
|
46633
47284
|
return {
|
|
@@ -46980,7 +47631,7 @@ ${user}:`]
|
|
|
46980
47631
|
};
|
|
46981
47632
|
}
|
|
46982
47633
|
};
|
|
46983
|
-
var VERSION$2 = "3.0.
|
|
47634
|
+
var VERSION$2 = "3.0.36";
|
|
46984
47635
|
function createOpenAI(options = {}) {
|
|
46985
47636
|
var _a10, _b9;
|
|
46986
47637
|
const baseURL = (_a10 = withoutTrailingSlash$1(
|
|
@@ -49489,10 +50140,10 @@ ${lines.join("\n")}
|
|
|
49489
50140
|
}
|
|
49490
50141
|
function createSkillTools(modules) {
|
|
49491
50142
|
const getSkillContent = tool({
|
|
49492
|
-
description: "
|
|
50143
|
+
description: "根据技能名称或文档路径获取该技能的完整文档内容。传入 skillName(如 calculator)或 path(如 ./calculator/SKILL.md)。支持 .md、.json、.xml 等各类文本格式文件。",
|
|
49493
50144
|
inputSchema: objectType({
|
|
49494
50145
|
skillName: stringType().optional().describe("技能名称,与目录名一致,如 calculator"),
|
|
49495
|
-
path: stringType().optional().describe("文档相对路径,如 ./calculator/SKILL.md 或 ./product-guide/reference/xxx.
|
|
50146
|
+
path: stringType().optional().describe("文档相对路径,如 ./calculator/SKILL.md 或 ./product-guide/reference/xxx.json")
|
|
49496
50147
|
}),
|
|
49497
50148
|
execute: (args) => {
|
|
49498
50149
|
const { skillName, path: pathArg } = args;
|