@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.es.dev.js
CHANGED
|
@@ -171,7 +171,7 @@ function requireScope() {
|
|
|
171
171
|
(function(exports) {
|
|
172
172
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
173
173
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
|
|
174
|
-
const code_1 = requireCode$1();
|
|
174
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
175
175
|
class ValueError extends Error {
|
|
176
176
|
constructor(name16) {
|
|
177
177
|
super(`CodeGen: "code" for ${name16} not defined`);
|
|
@@ -317,9 +317,9 @@ function requireCodegen() {
|
|
|
317
317
|
(function(exports) {
|
|
318
318
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
319
319
|
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
|
|
320
|
-
const code_1 = requireCode$1();
|
|
321
|
-
const scope_1 = requireScope();
|
|
322
|
-
var code_2 = requireCode$1();
|
|
320
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
321
|
+
const scope_1 = /* @__PURE__ */ requireScope();
|
|
322
|
+
var code_2 = /* @__PURE__ */ requireCode$1();
|
|
323
323
|
Object.defineProperty(exports, "_", { enumerable: true, get: function() {
|
|
324
324
|
return code_2._;
|
|
325
325
|
} });
|
|
@@ -344,7 +344,7 @@ function requireCodegen() {
|
|
|
344
344
|
Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
|
|
345
345
|
return code_2.Name;
|
|
346
346
|
} });
|
|
347
|
-
var scope_2 = requireScope();
|
|
347
|
+
var scope_2 = /* @__PURE__ */ requireScope();
|
|
348
348
|
Object.defineProperty(exports, "Scope", { enumerable: true, get: function() {
|
|
349
349
|
return scope_2.Scope;
|
|
350
350
|
} });
|
|
@@ -1038,8 +1038,8 @@ function requireUtil() {
|
|
|
1038
1038
|
hasRequiredUtil = 1;
|
|
1039
1039
|
Object.defineProperty(util$1, "__esModule", { value: true });
|
|
1040
1040
|
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;
|
|
1041
|
-
const codegen_1 = requireCodegen();
|
|
1042
|
-
const code_1 = requireCode$1();
|
|
1041
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1042
|
+
const code_1 = /* @__PURE__ */ requireCode$1();
|
|
1043
1043
|
function toHash(arr) {
|
|
1044
1044
|
const hash = {};
|
|
1045
1045
|
for (const item of arr)
|
|
@@ -1204,7 +1204,7 @@ function requireNames() {
|
|
|
1204
1204
|
if (hasRequiredNames) return names;
|
|
1205
1205
|
hasRequiredNames = 1;
|
|
1206
1206
|
Object.defineProperty(names, "__esModule", { value: true });
|
|
1207
|
-
const codegen_1 = requireCodegen();
|
|
1207
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1208
1208
|
const names$1 = {
|
|
1209
1209
|
// validation function arguments
|
|
1210
1210
|
data: new codegen_1.Name("data"),
|
|
@@ -1244,9 +1244,9 @@ function requireErrors() {
|
|
|
1244
1244
|
(function(exports) {
|
|
1245
1245
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1246
1246
|
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
|
|
1247
|
-
const codegen_1 = requireCodegen();
|
|
1248
|
-
const util_1 = requireUtil();
|
|
1249
|
-
const names_1 = requireNames();
|
|
1247
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1248
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1249
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1250
1250
|
exports.keywordError = {
|
|
1251
1251
|
message: ({ keyword: keyword2 }) => (0, codegen_1.str)`must pass "${keyword2}" keyword validation`
|
|
1252
1252
|
};
|
|
@@ -1366,9 +1366,9 @@ function requireBoolSchema() {
|
|
|
1366
1366
|
hasRequiredBoolSchema = 1;
|
|
1367
1367
|
Object.defineProperty(boolSchema, "__esModule", { value: true });
|
|
1368
1368
|
boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
|
|
1369
|
-
const errors_1 = requireErrors();
|
|
1370
|
-
const codegen_1 = requireCodegen();
|
|
1371
|
-
const names_1 = requireNames();
|
|
1369
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1370
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1371
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1372
1372
|
const boolError = {
|
|
1373
1373
|
message: "boolean schema is false"
|
|
1374
1374
|
};
|
|
@@ -1471,11 +1471,11 @@ function requireDataType() {
|
|
|
1471
1471
|
hasRequiredDataType = 1;
|
|
1472
1472
|
Object.defineProperty(dataType, "__esModule", { value: true });
|
|
1473
1473
|
dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
|
|
1474
|
-
const rules_1 = requireRules();
|
|
1475
|
-
const applicability_1 = requireApplicability();
|
|
1476
|
-
const errors_1 = requireErrors();
|
|
1477
|
-
const codegen_1 = requireCodegen();
|
|
1478
|
-
const util_1 = requireUtil();
|
|
1474
|
+
const rules_1 = /* @__PURE__ */ requireRules();
|
|
1475
|
+
const applicability_1 = /* @__PURE__ */ requireApplicability();
|
|
1476
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1477
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1478
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1479
1479
|
var DataType;
|
|
1480
1480
|
(function(DataType2) {
|
|
1481
1481
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
@@ -1655,8 +1655,8 @@ function requireDefaults() {
|
|
|
1655
1655
|
hasRequiredDefaults = 1;
|
|
1656
1656
|
Object.defineProperty(defaults, "__esModule", { value: true });
|
|
1657
1657
|
defaults.assignDefaults = void 0;
|
|
1658
|
-
const codegen_1 = requireCodegen();
|
|
1659
|
-
const util_1 = requireUtil();
|
|
1658
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1659
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1660
1660
|
function assignDefaults(it, ty) {
|
|
1661
1661
|
const { properties: properties2, items: items2 } = it.schema;
|
|
1662
1662
|
if (ty === "object" && properties2) {
|
|
@@ -1693,10 +1693,10 @@ function requireCode() {
|
|
|
1693
1693
|
hasRequiredCode = 1;
|
|
1694
1694
|
Object.defineProperty(code, "__esModule", { value: true });
|
|
1695
1695
|
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;
|
|
1696
|
-
const codegen_1 = requireCodegen();
|
|
1697
|
-
const util_1 = requireUtil();
|
|
1698
|
-
const names_1 = requireNames();
|
|
1699
|
-
const util_2 = requireUtil();
|
|
1696
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1697
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1698
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1699
|
+
const util_2 = /* @__PURE__ */ requireUtil();
|
|
1700
1700
|
function checkReportMissingProp(cxt, prop) {
|
|
1701
1701
|
const { gen, data, it } = cxt;
|
|
1702
1702
|
gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
|
|
@@ -1825,10 +1825,10 @@ function requireKeyword() {
|
|
|
1825
1825
|
hasRequiredKeyword = 1;
|
|
1826
1826
|
Object.defineProperty(keyword, "__esModule", { value: true });
|
|
1827
1827
|
keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
|
|
1828
|
-
const codegen_1 = requireCodegen();
|
|
1829
|
-
const names_1 = requireNames();
|
|
1830
|
-
const code_1 = requireCode();
|
|
1831
|
-
const errors_1 = requireErrors();
|
|
1828
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1829
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
1830
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
1831
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
1832
1832
|
function macroKeywordCode(cxt, def) {
|
|
1833
1833
|
const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
|
|
1834
1834
|
const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
|
|
@@ -1943,8 +1943,8 @@ function requireSubschema() {
|
|
|
1943
1943
|
hasRequiredSubschema = 1;
|
|
1944
1944
|
Object.defineProperty(subschema, "__esModule", { value: true });
|
|
1945
1945
|
subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
|
|
1946
|
-
const codegen_1 = requireCodegen();
|
|
1947
|
-
const util_1 = requireUtil();
|
|
1946
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
1947
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
1948
1948
|
function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
1949
1949
|
if (keyword2 !== void 0 && schema !== void 0) {
|
|
1950
1950
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
@@ -2149,7 +2149,7 @@ function requireResolve() {
|
|
|
2149
2149
|
hasRequiredResolve = 1;
|
|
2150
2150
|
Object.defineProperty(resolve$1, "__esModule", { value: true });
|
|
2151
2151
|
resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
|
|
2152
|
-
const util_1 = requireUtil();
|
|
2152
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2153
2153
|
const equal2 = requireFastDeepEqual();
|
|
2154
2154
|
const traverse = requireJsonSchemaTraverse();
|
|
2155
2155
|
const SIMPLE_INLINED = /* @__PURE__ */ new Set([
|
|
@@ -2304,18 +2304,18 @@ function requireValidate() {
|
|
|
2304
2304
|
hasRequiredValidate = 1;
|
|
2305
2305
|
Object.defineProperty(validate, "__esModule", { value: true });
|
|
2306
2306
|
validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
|
|
2307
|
-
const boolSchema_1 = requireBoolSchema();
|
|
2308
|
-
const dataType_1 = requireDataType();
|
|
2309
|
-
const applicability_1 = requireApplicability();
|
|
2310
|
-
const dataType_2 = requireDataType();
|
|
2311
|
-
const defaults_1 = requireDefaults();
|
|
2312
|
-
const keyword_1 = requireKeyword();
|
|
2313
|
-
const subschema_1 = requireSubschema();
|
|
2314
|
-
const codegen_1 = requireCodegen();
|
|
2315
|
-
const names_1 = requireNames();
|
|
2316
|
-
const resolve_1 = requireResolve();
|
|
2317
|
-
const util_1 = requireUtil();
|
|
2318
|
-
const errors_1 = requireErrors();
|
|
2307
|
+
const boolSchema_1 = /* @__PURE__ */ requireBoolSchema();
|
|
2308
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
2309
|
+
const applicability_1 = /* @__PURE__ */ requireApplicability();
|
|
2310
|
+
const dataType_2 = /* @__PURE__ */ requireDataType();
|
|
2311
|
+
const defaults_1 = /* @__PURE__ */ requireDefaults();
|
|
2312
|
+
const keyword_1 = /* @__PURE__ */ requireKeyword();
|
|
2313
|
+
const subschema_1 = /* @__PURE__ */ requireSubschema();
|
|
2314
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
2315
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
2316
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2317
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2318
|
+
const errors_1 = /* @__PURE__ */ requireErrors();
|
|
2319
2319
|
function validateFunctionCode(it) {
|
|
2320
2320
|
if (isSchemaObj(it)) {
|
|
2321
2321
|
checkKeywords(it);
|
|
@@ -2826,7 +2826,7 @@ function requireRef_error() {
|
|
|
2826
2826
|
if (hasRequiredRef_error) return ref_error;
|
|
2827
2827
|
hasRequiredRef_error = 1;
|
|
2828
2828
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
2829
|
-
const resolve_1 = requireResolve();
|
|
2829
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2830
2830
|
class MissingRefError extends Error {
|
|
2831
2831
|
constructor(resolver, baseId, ref2, msg) {
|
|
2832
2832
|
super(msg || `can't resolve reference ${ref2} from id ${baseId}`);
|
|
@@ -2844,12 +2844,12 @@ function requireCompile() {
|
|
|
2844
2844
|
hasRequiredCompile = 1;
|
|
2845
2845
|
Object.defineProperty(compile, "__esModule", { value: true });
|
|
2846
2846
|
compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
|
|
2847
|
-
const codegen_1 = requireCodegen();
|
|
2848
|
-
const validation_error_1 = requireValidation_error();
|
|
2849
|
-
const names_1 = requireNames();
|
|
2850
|
-
const resolve_1 = requireResolve();
|
|
2851
|
-
const util_1 = requireUtil();
|
|
2852
|
-
const validate_1 = requireValidate();
|
|
2847
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
2848
|
+
const validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
2849
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
2850
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
2851
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
2852
|
+
const validate_1 = /* @__PURE__ */ requireValidate();
|
|
2853
2853
|
class SchemaEnv {
|
|
2854
2854
|
constructor(env) {
|
|
2855
2855
|
var _a10;
|
|
@@ -3815,11 +3815,11 @@ function requireCore$1() {
|
|
|
3815
3815
|
(function(exports) {
|
|
3816
3816
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3817
3817
|
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
3818
|
-
var validate_1 = requireValidate();
|
|
3818
|
+
var validate_1 = /* @__PURE__ */ requireValidate();
|
|
3819
3819
|
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
|
|
3820
3820
|
return validate_1.KeywordCxt;
|
|
3821
3821
|
} });
|
|
3822
|
-
var codegen_1 = requireCodegen();
|
|
3822
|
+
var codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
3823
3823
|
Object.defineProperty(exports, "_", { enumerable: true, get: function() {
|
|
3824
3824
|
return codegen_1._;
|
|
3825
3825
|
} });
|
|
@@ -3838,16 +3838,16 @@ function requireCore$1() {
|
|
|
3838
3838
|
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
|
|
3839
3839
|
return codegen_1.CodeGen;
|
|
3840
3840
|
} });
|
|
3841
|
-
const validation_error_1 = requireValidation_error();
|
|
3842
|
-
const ref_error_1 = requireRef_error();
|
|
3843
|
-
const rules_1 = requireRules();
|
|
3844
|
-
const compile_1 = requireCompile();
|
|
3845
|
-
const codegen_2 = requireCodegen();
|
|
3846
|
-
const resolve_1 = requireResolve();
|
|
3847
|
-
const dataType_1 = requireDataType();
|
|
3848
|
-
const util_1 = requireUtil();
|
|
3841
|
+
const validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
3842
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
3843
|
+
const rules_1 = /* @__PURE__ */ requireRules();
|
|
3844
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
3845
|
+
const codegen_2 = /* @__PURE__ */ requireCodegen();
|
|
3846
|
+
const resolve_1 = /* @__PURE__ */ requireResolve();
|
|
3847
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
3848
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
3849
3849
|
const $dataRefSchema = require$$9;
|
|
3850
|
-
const uri_1 = requireUri();
|
|
3850
|
+
const uri_1 = /* @__PURE__ */ requireUri();
|
|
3851
3851
|
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
3852
3852
|
defaultRegExp.code = "new RegExp";
|
|
3853
3853
|
const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
@@ -4444,12 +4444,12 @@ function requireRef() {
|
|
|
4444
4444
|
hasRequiredRef = 1;
|
|
4445
4445
|
Object.defineProperty(ref, "__esModule", { value: true });
|
|
4446
4446
|
ref.callRef = ref.getValidate = void 0;
|
|
4447
|
-
const ref_error_1 = requireRef_error();
|
|
4448
|
-
const code_1 = requireCode();
|
|
4449
|
-
const codegen_1 = requireCodegen();
|
|
4450
|
-
const names_1 = requireNames();
|
|
4451
|
-
const compile_1 = requireCompile();
|
|
4452
|
-
const util_1 = requireUtil();
|
|
4447
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
4448
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4449
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4450
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
4451
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
4452
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4453
4453
|
const def = {
|
|
4454
4454
|
keyword: "$ref",
|
|
4455
4455
|
schemaType: "string",
|
|
@@ -4564,8 +4564,8 @@ function requireCore() {
|
|
|
4564
4564
|
if (hasRequiredCore) return core;
|
|
4565
4565
|
hasRequiredCore = 1;
|
|
4566
4566
|
Object.defineProperty(core, "__esModule", { value: true });
|
|
4567
|
-
const id_1 = requireId();
|
|
4568
|
-
const ref_1 = requireRef();
|
|
4567
|
+
const id_1 = /* @__PURE__ */ requireId();
|
|
4568
|
+
const ref_1 = /* @__PURE__ */ requireRef();
|
|
4569
4569
|
const core$12 = [
|
|
4570
4570
|
"$schema",
|
|
4571
4571
|
"$id",
|
|
@@ -4586,7 +4586,7 @@ function requireLimitNumber() {
|
|
|
4586
4586
|
if (hasRequiredLimitNumber) return limitNumber;
|
|
4587
4587
|
hasRequiredLimitNumber = 1;
|
|
4588
4588
|
Object.defineProperty(limitNumber, "__esModule", { value: true });
|
|
4589
|
-
const codegen_1 = requireCodegen();
|
|
4589
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4590
4590
|
const ops = codegen_1.operators;
|
|
4591
4591
|
const KWDs = {
|
|
4592
4592
|
maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
@@ -4618,7 +4618,7 @@ function requireMultipleOf() {
|
|
|
4618
4618
|
if (hasRequiredMultipleOf) return multipleOf;
|
|
4619
4619
|
hasRequiredMultipleOf = 1;
|
|
4620
4620
|
Object.defineProperty(multipleOf, "__esModule", { value: true });
|
|
4621
|
-
const codegen_1 = requireCodegen();
|
|
4621
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4622
4622
|
const error = {
|
|
4623
4623
|
message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
|
|
4624
4624
|
params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
|
|
@@ -4672,9 +4672,9 @@ function requireLimitLength() {
|
|
|
4672
4672
|
if (hasRequiredLimitLength) return limitLength;
|
|
4673
4673
|
hasRequiredLimitLength = 1;
|
|
4674
4674
|
Object.defineProperty(limitLength, "__esModule", { value: true });
|
|
4675
|
-
const codegen_1 = requireCodegen();
|
|
4676
|
-
const util_1 = requireUtil();
|
|
4677
|
-
const ucs2length_1 = requireUcs2length();
|
|
4675
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4676
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4677
|
+
const ucs2length_1 = /* @__PURE__ */ requireUcs2length();
|
|
4678
4678
|
const error = {
|
|
4679
4679
|
message({ keyword: keyword2, schemaCode }) {
|
|
4680
4680
|
const comp = keyword2 === "maxLength" ? "more" : "fewer";
|
|
@@ -4704,8 +4704,9 @@ function requirePattern() {
|
|
|
4704
4704
|
if (hasRequiredPattern) return pattern;
|
|
4705
4705
|
hasRequiredPattern = 1;
|
|
4706
4706
|
Object.defineProperty(pattern, "__esModule", { value: true });
|
|
4707
|
-
const code_1 = requireCode();
|
|
4708
|
-
const
|
|
4707
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4708
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4709
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4709
4710
|
const error = {
|
|
4710
4711
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
|
|
4711
4712
|
params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
|
|
@@ -4717,10 +4718,18 @@ function requirePattern() {
|
|
|
4717
4718
|
$data: true,
|
|
4718
4719
|
error,
|
|
4719
4720
|
code(cxt) {
|
|
4720
|
-
const { data, $data, schema, schemaCode, it } = cxt;
|
|
4721
|
+
const { gen, data, $data, schema, schemaCode, it } = cxt;
|
|
4721
4722
|
const u = it.opts.unicodeRegExp ? "u" : "";
|
|
4722
|
-
|
|
4723
|
-
|
|
4723
|
+
if ($data) {
|
|
4724
|
+
const { regExp } = it.opts.code;
|
|
4725
|
+
const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
|
|
4726
|
+
const valid = gen.let("valid");
|
|
4727
|
+
gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
|
|
4728
|
+
cxt.fail$data((0, codegen_1._)`!${valid}`);
|
|
4729
|
+
} else {
|
|
4730
|
+
const regExp = (0, code_1.usePattern)(cxt, schema);
|
|
4731
|
+
cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
|
|
4732
|
+
}
|
|
4724
4733
|
}
|
|
4725
4734
|
};
|
|
4726
4735
|
pattern.default = def;
|
|
@@ -4732,7 +4741,7 @@ function requireLimitProperties() {
|
|
|
4732
4741
|
if (hasRequiredLimitProperties) return limitProperties;
|
|
4733
4742
|
hasRequiredLimitProperties = 1;
|
|
4734
4743
|
Object.defineProperty(limitProperties, "__esModule", { value: true });
|
|
4735
|
-
const codegen_1 = requireCodegen();
|
|
4744
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4736
4745
|
const error = {
|
|
4737
4746
|
message({ keyword: keyword2, schemaCode }) {
|
|
4738
4747
|
const comp = keyword2 === "maxProperties" ? "more" : "fewer";
|
|
@@ -4761,9 +4770,9 @@ function requireRequired() {
|
|
|
4761
4770
|
if (hasRequiredRequired) return required$1;
|
|
4762
4771
|
hasRequiredRequired = 1;
|
|
4763
4772
|
Object.defineProperty(required$1, "__esModule", { value: true });
|
|
4764
|
-
const code_1 = requireCode();
|
|
4765
|
-
const codegen_1 = requireCodegen();
|
|
4766
|
-
const util_1 = requireUtil();
|
|
4773
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
4774
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4775
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4767
4776
|
const error = {
|
|
4768
4777
|
message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
|
|
4769
4778
|
params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
|
|
@@ -4843,7 +4852,7 @@ function requireLimitItems() {
|
|
|
4843
4852
|
if (hasRequiredLimitItems) return limitItems;
|
|
4844
4853
|
hasRequiredLimitItems = 1;
|
|
4845
4854
|
Object.defineProperty(limitItems, "__esModule", { value: true });
|
|
4846
|
-
const codegen_1 = requireCodegen();
|
|
4855
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4847
4856
|
const error = {
|
|
4848
4857
|
message({ keyword: keyword2, schemaCode }) {
|
|
4849
4858
|
const comp = keyword2 === "maxItems" ? "more" : "fewer";
|
|
@@ -4883,10 +4892,10 @@ function requireUniqueItems() {
|
|
|
4883
4892
|
if (hasRequiredUniqueItems) return uniqueItems;
|
|
4884
4893
|
hasRequiredUniqueItems = 1;
|
|
4885
4894
|
Object.defineProperty(uniqueItems, "__esModule", { value: true });
|
|
4886
|
-
const dataType_1 = requireDataType();
|
|
4887
|
-
const codegen_1 = requireCodegen();
|
|
4888
|
-
const util_1 = requireUtil();
|
|
4889
|
-
const equal_1 = requireEqual();
|
|
4895
|
+
const dataType_1 = /* @__PURE__ */ requireDataType();
|
|
4896
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4897
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4898
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4890
4899
|
const error = {
|
|
4891
4900
|
message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
|
|
4892
4901
|
params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
|
|
@@ -4950,9 +4959,9 @@ function require_const() {
|
|
|
4950
4959
|
if (hasRequired_const) return _const;
|
|
4951
4960
|
hasRequired_const = 1;
|
|
4952
4961
|
Object.defineProperty(_const, "__esModule", { value: true });
|
|
4953
|
-
const codegen_1 = requireCodegen();
|
|
4954
|
-
const util_1 = requireUtil();
|
|
4955
|
-
const equal_1 = requireEqual();
|
|
4962
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4963
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4964
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4956
4965
|
const error = {
|
|
4957
4966
|
message: "must be equal to constant",
|
|
4958
4967
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
|
|
@@ -4979,9 +4988,9 @@ function require_enum() {
|
|
|
4979
4988
|
if (hasRequired_enum) return _enum$1;
|
|
4980
4989
|
hasRequired_enum = 1;
|
|
4981
4990
|
Object.defineProperty(_enum$1, "__esModule", { value: true });
|
|
4982
|
-
const codegen_1 = requireCodegen();
|
|
4983
|
-
const util_1 = requireUtil();
|
|
4984
|
-
const equal_1 = requireEqual();
|
|
4991
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
4992
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
4993
|
+
const equal_1 = /* @__PURE__ */ requireEqual();
|
|
4985
4994
|
const error = {
|
|
4986
4995
|
message: "must be equal to one of the allowed values",
|
|
4987
4996
|
params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
|
|
@@ -5027,16 +5036,16 @@ function requireValidation() {
|
|
|
5027
5036
|
if (hasRequiredValidation) return validation;
|
|
5028
5037
|
hasRequiredValidation = 1;
|
|
5029
5038
|
Object.defineProperty(validation, "__esModule", { value: true });
|
|
5030
|
-
const limitNumber_1 = requireLimitNumber();
|
|
5031
|
-
const multipleOf_1 = requireMultipleOf();
|
|
5032
|
-
const limitLength_1 = requireLimitLength();
|
|
5033
|
-
const pattern_1 = requirePattern();
|
|
5034
|
-
const limitProperties_1 = requireLimitProperties();
|
|
5035
|
-
const required_1 = requireRequired();
|
|
5036
|
-
const limitItems_1 = requireLimitItems();
|
|
5037
|
-
const uniqueItems_1 = requireUniqueItems();
|
|
5038
|
-
const const_1 = require_const();
|
|
5039
|
-
const enum_1 = require_enum();
|
|
5039
|
+
const limitNumber_1 = /* @__PURE__ */ requireLimitNumber();
|
|
5040
|
+
const multipleOf_1 = /* @__PURE__ */ requireMultipleOf();
|
|
5041
|
+
const limitLength_1 = /* @__PURE__ */ requireLimitLength();
|
|
5042
|
+
const pattern_1 = /* @__PURE__ */ requirePattern();
|
|
5043
|
+
const limitProperties_1 = /* @__PURE__ */ requireLimitProperties();
|
|
5044
|
+
const required_1 = /* @__PURE__ */ requireRequired();
|
|
5045
|
+
const limitItems_1 = /* @__PURE__ */ requireLimitItems();
|
|
5046
|
+
const uniqueItems_1 = /* @__PURE__ */ requireUniqueItems();
|
|
5047
|
+
const const_1 = /* @__PURE__ */ require_const();
|
|
5048
|
+
const enum_1 = /* @__PURE__ */ require_enum();
|
|
5040
5049
|
const validation$1 = [
|
|
5041
5050
|
// number
|
|
5042
5051
|
limitNumber_1.default,
|
|
@@ -5067,8 +5076,8 @@ function requireAdditionalItems() {
|
|
|
5067
5076
|
hasRequiredAdditionalItems = 1;
|
|
5068
5077
|
Object.defineProperty(additionalItems, "__esModule", { value: true });
|
|
5069
5078
|
additionalItems.validateAdditionalItems = void 0;
|
|
5070
|
-
const codegen_1 = requireCodegen();
|
|
5071
|
-
const util_1 = requireUtil();
|
|
5079
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5080
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5072
5081
|
const error = {
|
|
5073
5082
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
5074
5083
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
@@ -5121,9 +5130,9 @@ function requireItems() {
|
|
|
5121
5130
|
hasRequiredItems = 1;
|
|
5122
5131
|
Object.defineProperty(items, "__esModule", { value: true });
|
|
5123
5132
|
items.validateTuple = void 0;
|
|
5124
|
-
const codegen_1 = requireCodegen();
|
|
5125
|
-
const util_1 = requireUtil();
|
|
5126
|
-
const code_1 = requireCode();
|
|
5133
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5134
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5135
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5127
5136
|
const def = {
|
|
5128
5137
|
keyword: "items",
|
|
5129
5138
|
type: "array",
|
|
@@ -5176,7 +5185,7 @@ function requirePrefixItems() {
|
|
|
5176
5185
|
if (hasRequiredPrefixItems) return prefixItems;
|
|
5177
5186
|
hasRequiredPrefixItems = 1;
|
|
5178
5187
|
Object.defineProperty(prefixItems, "__esModule", { value: true });
|
|
5179
|
-
const items_1 = requireItems();
|
|
5188
|
+
const items_1 = /* @__PURE__ */ requireItems();
|
|
5180
5189
|
const def = {
|
|
5181
5190
|
keyword: "prefixItems",
|
|
5182
5191
|
type: "array",
|
|
@@ -5193,10 +5202,10 @@ function requireItems2020() {
|
|
|
5193
5202
|
if (hasRequiredItems2020) return items2020;
|
|
5194
5203
|
hasRequiredItems2020 = 1;
|
|
5195
5204
|
Object.defineProperty(items2020, "__esModule", { value: true });
|
|
5196
|
-
const codegen_1 = requireCodegen();
|
|
5197
|
-
const util_1 = requireUtil();
|
|
5198
|
-
const code_1 = requireCode();
|
|
5199
|
-
const additionalItems_1 = requireAdditionalItems();
|
|
5205
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5206
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5207
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5208
|
+
const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
|
|
5200
5209
|
const error = {
|
|
5201
5210
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
5202
5211
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
@@ -5228,8 +5237,8 @@ function requireContains() {
|
|
|
5228
5237
|
if (hasRequiredContains) return contains;
|
|
5229
5238
|
hasRequiredContains = 1;
|
|
5230
5239
|
Object.defineProperty(contains, "__esModule", { value: true });
|
|
5231
|
-
const codegen_1 = requireCodegen();
|
|
5232
|
-
const util_1 = requireUtil();
|
|
5240
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5241
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5233
5242
|
const error = {
|
|
5234
5243
|
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)`,
|
|
5235
5244
|
params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
|
|
@@ -5324,9 +5333,9 @@ function requireDependencies() {
|
|
|
5324
5333
|
(function(exports) {
|
|
5325
5334
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5326
5335
|
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
|
|
5327
|
-
const codegen_1 = requireCodegen();
|
|
5328
|
-
const util_1 = requireUtil();
|
|
5329
|
-
const code_1 = requireCode();
|
|
5336
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5337
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5338
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5330
5339
|
exports.error = {
|
|
5331
5340
|
message: ({ params: { property, depsCount, deps } }) => {
|
|
5332
5341
|
const property_ies = depsCount === 1 ? "property" : "properties";
|
|
@@ -5418,8 +5427,8 @@ function requirePropertyNames() {
|
|
|
5418
5427
|
if (hasRequiredPropertyNames) return propertyNames;
|
|
5419
5428
|
hasRequiredPropertyNames = 1;
|
|
5420
5429
|
Object.defineProperty(propertyNames, "__esModule", { value: true });
|
|
5421
|
-
const codegen_1 = requireCodegen();
|
|
5422
|
-
const util_1 = requireUtil();
|
|
5430
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5431
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5423
5432
|
const error = {
|
|
5424
5433
|
message: "property name must be valid",
|
|
5425
5434
|
params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
|
|
@@ -5461,10 +5470,10 @@ function requireAdditionalProperties() {
|
|
|
5461
5470
|
if (hasRequiredAdditionalProperties) return additionalProperties;
|
|
5462
5471
|
hasRequiredAdditionalProperties = 1;
|
|
5463
5472
|
Object.defineProperty(additionalProperties, "__esModule", { value: true });
|
|
5464
|
-
const code_1 = requireCode();
|
|
5465
|
-
const codegen_1 = requireCodegen();
|
|
5466
|
-
const names_1 = requireNames();
|
|
5467
|
-
const util_1 = requireUtil();
|
|
5473
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5474
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5475
|
+
const names_1 = /* @__PURE__ */ requireNames();
|
|
5476
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5468
5477
|
const error = {
|
|
5469
5478
|
message: "must NOT have additional properties",
|
|
5470
5479
|
params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
|
|
@@ -5567,10 +5576,10 @@ function requireProperties() {
|
|
|
5567
5576
|
if (hasRequiredProperties) return properties$1;
|
|
5568
5577
|
hasRequiredProperties = 1;
|
|
5569
5578
|
Object.defineProperty(properties$1, "__esModule", { value: true });
|
|
5570
|
-
const validate_1 = requireValidate();
|
|
5571
|
-
const code_1 = requireCode();
|
|
5572
|
-
const util_1 = requireUtil();
|
|
5573
|
-
const additionalProperties_1 = requireAdditionalProperties();
|
|
5579
|
+
const validate_1 = /* @__PURE__ */ requireValidate();
|
|
5580
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5581
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5582
|
+
const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
|
|
5574
5583
|
const def = {
|
|
5575
5584
|
keyword: "properties",
|
|
5576
5585
|
type: "object",
|
|
@@ -5625,10 +5634,10 @@ function requirePatternProperties() {
|
|
|
5625
5634
|
if (hasRequiredPatternProperties) return patternProperties;
|
|
5626
5635
|
hasRequiredPatternProperties = 1;
|
|
5627
5636
|
Object.defineProperty(patternProperties, "__esModule", { value: true });
|
|
5628
|
-
const code_1 = requireCode();
|
|
5629
|
-
const codegen_1 = requireCodegen();
|
|
5630
|
-
const util_1 = requireUtil();
|
|
5631
|
-
const util_2 = requireUtil();
|
|
5637
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5638
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5639
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5640
|
+
const util_2 = /* @__PURE__ */ requireUtil();
|
|
5632
5641
|
const def = {
|
|
5633
5642
|
keyword: "patternProperties",
|
|
5634
5643
|
type: "object",
|
|
@@ -5699,7 +5708,7 @@ function requireNot() {
|
|
|
5699
5708
|
if (hasRequiredNot) return not;
|
|
5700
5709
|
hasRequiredNot = 1;
|
|
5701
5710
|
Object.defineProperty(not, "__esModule", { value: true });
|
|
5702
|
-
const util_1 = requireUtil();
|
|
5711
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5703
5712
|
const def = {
|
|
5704
5713
|
keyword: "not",
|
|
5705
5714
|
schemaType: ["object", "boolean"],
|
|
@@ -5730,7 +5739,7 @@ function requireAnyOf() {
|
|
|
5730
5739
|
if (hasRequiredAnyOf) return anyOf;
|
|
5731
5740
|
hasRequiredAnyOf = 1;
|
|
5732
5741
|
Object.defineProperty(anyOf, "__esModule", { value: true });
|
|
5733
|
-
const code_1 = requireCode();
|
|
5742
|
+
const code_1 = /* @__PURE__ */ requireCode();
|
|
5734
5743
|
const def = {
|
|
5735
5744
|
keyword: "anyOf",
|
|
5736
5745
|
schemaType: "array",
|
|
@@ -5747,8 +5756,8 @@ function requireOneOf() {
|
|
|
5747
5756
|
if (hasRequiredOneOf) return oneOf;
|
|
5748
5757
|
hasRequiredOneOf = 1;
|
|
5749
5758
|
Object.defineProperty(oneOf, "__esModule", { value: true });
|
|
5750
|
-
const codegen_1 = requireCodegen();
|
|
5751
|
-
const util_1 = requireUtil();
|
|
5759
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5760
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5752
5761
|
const error = {
|
|
5753
5762
|
message: "must match exactly one schema in oneOf",
|
|
5754
5763
|
params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
|
|
@@ -5805,7 +5814,7 @@ function requireAllOf() {
|
|
|
5805
5814
|
if (hasRequiredAllOf) return allOf;
|
|
5806
5815
|
hasRequiredAllOf = 1;
|
|
5807
5816
|
Object.defineProperty(allOf, "__esModule", { value: true });
|
|
5808
|
-
const util_1 = requireUtil();
|
|
5817
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5809
5818
|
const def = {
|
|
5810
5819
|
keyword: "allOf",
|
|
5811
5820
|
schemaType: "array",
|
|
@@ -5832,8 +5841,8 @@ function require_if() {
|
|
|
5832
5841
|
if (hasRequired_if) return _if;
|
|
5833
5842
|
hasRequired_if = 1;
|
|
5834
5843
|
Object.defineProperty(_if, "__esModule", { value: true });
|
|
5835
|
-
const codegen_1 = requireCodegen();
|
|
5836
|
-
const util_1 = requireUtil();
|
|
5844
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5845
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5837
5846
|
const error = {
|
|
5838
5847
|
message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
|
|
5839
5848
|
params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
|
|
@@ -5901,7 +5910,7 @@ function requireThenElse() {
|
|
|
5901
5910
|
if (hasRequiredThenElse) return thenElse;
|
|
5902
5911
|
hasRequiredThenElse = 1;
|
|
5903
5912
|
Object.defineProperty(thenElse, "__esModule", { value: true });
|
|
5904
|
-
const util_1 = requireUtil();
|
|
5913
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
5905
5914
|
const def = {
|
|
5906
5915
|
keyword: ["then", "else"],
|
|
5907
5916
|
schemaType: ["object", "boolean"],
|
|
@@ -5918,22 +5927,22 @@ function requireApplicator() {
|
|
|
5918
5927
|
if (hasRequiredApplicator) return applicator;
|
|
5919
5928
|
hasRequiredApplicator = 1;
|
|
5920
5929
|
Object.defineProperty(applicator, "__esModule", { value: true });
|
|
5921
|
-
const additionalItems_1 = requireAdditionalItems();
|
|
5922
|
-
const prefixItems_1 = requirePrefixItems();
|
|
5923
|
-
const items_1 = requireItems();
|
|
5924
|
-
const items2020_1 = requireItems2020();
|
|
5925
|
-
const contains_1 = requireContains();
|
|
5926
|
-
const dependencies_1 = requireDependencies();
|
|
5927
|
-
const propertyNames_1 = requirePropertyNames();
|
|
5928
|
-
const additionalProperties_1 = requireAdditionalProperties();
|
|
5929
|
-
const properties_1 = requireProperties();
|
|
5930
|
-
const patternProperties_1 = requirePatternProperties();
|
|
5931
|
-
const not_1 = requireNot();
|
|
5932
|
-
const anyOf_1 = requireAnyOf();
|
|
5933
|
-
const oneOf_1 = requireOneOf();
|
|
5934
|
-
const allOf_1 = requireAllOf();
|
|
5935
|
-
const if_1 = require_if();
|
|
5936
|
-
const thenElse_1 = requireThenElse();
|
|
5930
|
+
const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
|
|
5931
|
+
const prefixItems_1 = /* @__PURE__ */ requirePrefixItems();
|
|
5932
|
+
const items_1 = /* @__PURE__ */ requireItems();
|
|
5933
|
+
const items2020_1 = /* @__PURE__ */ requireItems2020();
|
|
5934
|
+
const contains_1 = /* @__PURE__ */ requireContains();
|
|
5935
|
+
const dependencies_1 = /* @__PURE__ */ requireDependencies();
|
|
5936
|
+
const propertyNames_1 = /* @__PURE__ */ requirePropertyNames();
|
|
5937
|
+
const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
|
|
5938
|
+
const properties_1 = /* @__PURE__ */ requireProperties();
|
|
5939
|
+
const patternProperties_1 = /* @__PURE__ */ requirePatternProperties();
|
|
5940
|
+
const not_1 = /* @__PURE__ */ requireNot();
|
|
5941
|
+
const anyOf_1 = /* @__PURE__ */ requireAnyOf();
|
|
5942
|
+
const oneOf_1 = /* @__PURE__ */ requireOneOf();
|
|
5943
|
+
const allOf_1 = /* @__PURE__ */ requireAllOf();
|
|
5944
|
+
const if_1 = /* @__PURE__ */ require_if();
|
|
5945
|
+
const thenElse_1 = /* @__PURE__ */ requireThenElse();
|
|
5937
5946
|
function getApplicator(draft2020 = false) {
|
|
5938
5947
|
const applicator2 = [
|
|
5939
5948
|
// any
|
|
@@ -5967,7 +5976,7 @@ function requireFormat$1() {
|
|
|
5967
5976
|
if (hasRequiredFormat$1) return format;
|
|
5968
5977
|
hasRequiredFormat$1 = 1;
|
|
5969
5978
|
Object.defineProperty(format, "__esModule", { value: true });
|
|
5970
|
-
const codegen_1 = requireCodegen();
|
|
5979
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
5971
5980
|
const error = {
|
|
5972
5981
|
message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
|
|
5973
5982
|
params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
|
|
@@ -6056,7 +6065,7 @@ function requireFormat() {
|
|
|
6056
6065
|
if (hasRequiredFormat) return format$1;
|
|
6057
6066
|
hasRequiredFormat = 1;
|
|
6058
6067
|
Object.defineProperty(format$1, "__esModule", { value: true });
|
|
6059
|
-
const format_1 = requireFormat$1();
|
|
6068
|
+
const format_1 = /* @__PURE__ */ requireFormat$1();
|
|
6060
6069
|
const format2 = [format_1.default];
|
|
6061
6070
|
format$1.default = format2;
|
|
6062
6071
|
return format$1;
|
|
@@ -6089,11 +6098,11 @@ function requireDraft7() {
|
|
|
6089
6098
|
if (hasRequiredDraft7) return draft7;
|
|
6090
6099
|
hasRequiredDraft7 = 1;
|
|
6091
6100
|
Object.defineProperty(draft7, "__esModule", { value: true });
|
|
6092
|
-
const core_1 = requireCore();
|
|
6093
|
-
const validation_1 = requireValidation();
|
|
6094
|
-
const applicator_1 = requireApplicator();
|
|
6095
|
-
const format_1 = requireFormat();
|
|
6096
|
-
const metadata_1 = requireMetadata();
|
|
6101
|
+
const core_1 = /* @__PURE__ */ requireCore();
|
|
6102
|
+
const validation_1 = /* @__PURE__ */ requireValidation();
|
|
6103
|
+
const applicator_1 = /* @__PURE__ */ requireApplicator();
|
|
6104
|
+
const format_1 = /* @__PURE__ */ requireFormat();
|
|
6105
|
+
const metadata_1 = /* @__PURE__ */ requireMetadata();
|
|
6097
6106
|
const draft7Vocabularies = [
|
|
6098
6107
|
core_1.default,
|
|
6099
6108
|
validation_1.default,
|
|
@@ -6125,11 +6134,11 @@ function requireDiscriminator() {
|
|
|
6125
6134
|
if (hasRequiredDiscriminator) return discriminator;
|
|
6126
6135
|
hasRequiredDiscriminator = 1;
|
|
6127
6136
|
Object.defineProperty(discriminator, "__esModule", { value: true });
|
|
6128
|
-
const codegen_1 = requireCodegen();
|
|
6129
|
-
const types_1 = requireTypes();
|
|
6130
|
-
const compile_1 = requireCompile();
|
|
6131
|
-
const ref_error_1 = requireRef_error();
|
|
6132
|
-
const util_1 = requireUtil();
|
|
6137
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
6138
|
+
const types_1 = /* @__PURE__ */ requireTypes();
|
|
6139
|
+
const compile_1 = /* @__PURE__ */ requireCompile();
|
|
6140
|
+
const ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
6141
|
+
const util_1 = /* @__PURE__ */ requireUtil();
|
|
6133
6142
|
const error = {
|
|
6134
6143
|
message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
|
|
6135
6144
|
params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
|
|
@@ -6246,9 +6255,9 @@ function requireAjv() {
|
|
|
6246
6255
|
(function(module, exports) {
|
|
6247
6256
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6248
6257
|
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
|
|
6249
|
-
const core_1 = requireCore$1();
|
|
6250
|
-
const draft7_1 = requireDraft7();
|
|
6251
|
-
const discriminator_1 = requireDiscriminator();
|
|
6258
|
+
const core_1 = /* @__PURE__ */ requireCore$1();
|
|
6259
|
+
const draft7_1 = /* @__PURE__ */ requireDraft7();
|
|
6260
|
+
const discriminator_1 = /* @__PURE__ */ requireDiscriminator();
|
|
6252
6261
|
const draft7MetaSchema = require$$3;
|
|
6253
6262
|
const META_SUPPORT_DATA = ["/properties"];
|
|
6254
6263
|
const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
@@ -6276,11 +6285,11 @@ function requireAjv() {
|
|
|
6276
6285
|
module.exports.Ajv = Ajv2;
|
|
6277
6286
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6278
6287
|
exports.default = Ajv2;
|
|
6279
|
-
var validate_1 = requireValidate();
|
|
6288
|
+
var validate_1 = /* @__PURE__ */ requireValidate();
|
|
6280
6289
|
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
|
|
6281
6290
|
return validate_1.KeywordCxt;
|
|
6282
6291
|
} });
|
|
6283
|
-
var codegen_1 = requireCodegen();
|
|
6292
|
+
var codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
6284
6293
|
Object.defineProperty(exports, "_", { enumerable: true, get: function() {
|
|
6285
6294
|
return codegen_1._;
|
|
6286
6295
|
} });
|
|
@@ -6299,18 +6308,18 @@ function requireAjv() {
|
|
|
6299
6308
|
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
|
|
6300
6309
|
return codegen_1.CodeGen;
|
|
6301
6310
|
} });
|
|
6302
|
-
var validation_error_1 = requireValidation_error();
|
|
6311
|
+
var validation_error_1 = /* @__PURE__ */ requireValidation_error();
|
|
6303
6312
|
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
|
|
6304
6313
|
return validation_error_1.default;
|
|
6305
6314
|
} });
|
|
6306
|
-
var ref_error_1 = requireRef_error();
|
|
6315
|
+
var ref_error_1 = /* @__PURE__ */ requireRef_error();
|
|
6307
6316
|
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
|
|
6308
6317
|
return ref_error_1.default;
|
|
6309
6318
|
} });
|
|
6310
6319
|
})(ajv, ajv.exports);
|
|
6311
6320
|
return ajv.exports;
|
|
6312
6321
|
}
|
|
6313
|
-
var ajvExports = requireAjv();
|
|
6322
|
+
var ajvExports = /* @__PURE__ */ requireAjv();
|
|
6314
6323
|
const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports);
|
|
6315
6324
|
var util;
|
|
6316
6325
|
(function(util2) {
|
|
@@ -18621,8 +18630,8 @@ function requireLimit() {
|
|
|
18621
18630
|
(function(exports) {
|
|
18622
18631
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18623
18632
|
exports.formatLimitDefinition = void 0;
|
|
18624
|
-
const ajv_1 = requireAjv();
|
|
18625
|
-
const codegen_1 = requireCodegen();
|
|
18633
|
+
const ajv_1 = /* @__PURE__ */ requireAjv();
|
|
18634
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
18626
18635
|
const ops = codegen_1.operators;
|
|
18627
18636
|
const KWDs = {
|
|
18628
18637
|
formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
|
|
@@ -18695,7 +18704,7 @@ function requireDist() {
|
|
|
18695
18704
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18696
18705
|
const formats_1 = requireFormats();
|
|
18697
18706
|
const limit_1 = requireLimit();
|
|
18698
|
-
const codegen_1 = requireCodegen();
|
|
18707
|
+
const codegen_1 = /* @__PURE__ */ requireCodegen();
|
|
18699
18708
|
const fullName = new codegen_1.Name("fullFormats");
|
|
18700
18709
|
const fastName = new codegen_1.Name("fastFormats");
|
|
18701
18710
|
const formatsPlugin = (ajv2, opts = { keywords: true }) => {
|
|
@@ -31193,17 +31202,14 @@ var GatewayVideoModel = class {
|
|
|
31193
31202
|
var _a92;
|
|
31194
31203
|
const resolvedHeaders = await resolve(this.config.headers());
|
|
31195
31204
|
try {
|
|
31196
|
-
const {
|
|
31197
|
-
responseHeaders,
|
|
31198
|
-
value: responseBody,
|
|
31199
|
-
rawValue
|
|
31200
|
-
} = await postJsonToApi$1({
|
|
31205
|
+
const { responseHeaders, value: responseBody } = await postJsonToApi$1({
|
|
31201
31206
|
url: this.getUrl(),
|
|
31202
31207
|
headers: combineHeaders$1(
|
|
31203
31208
|
resolvedHeaders,
|
|
31204
31209
|
headers != null ? headers : {},
|
|
31205
31210
|
this.getModelConfigHeaders(),
|
|
31206
|
-
await resolve(this.config.o11yHeaders)
|
|
31211
|
+
await resolve(this.config.o11yHeaders),
|
|
31212
|
+
{ accept: "text/event-stream" }
|
|
31207
31213
|
),
|
|
31208
31214
|
body: {
|
|
31209
31215
|
prompt,
|
|
@@ -31216,9 +31222,70 @@ var GatewayVideoModel = class {
|
|
|
31216
31222
|
...providerOptions && { providerOptions },
|
|
31217
31223
|
...image && { image: maybeEncodeVideoFile(image) }
|
|
31218
31224
|
},
|
|
31219
|
-
successfulResponseHandler:
|
|
31220
|
-
|
|
31221
|
-
|
|
31225
|
+
successfulResponseHandler: async ({
|
|
31226
|
+
response,
|
|
31227
|
+
url: url2,
|
|
31228
|
+
requestBodyValues
|
|
31229
|
+
}) => {
|
|
31230
|
+
if (response.body == null) {
|
|
31231
|
+
throw new APICallError$1({
|
|
31232
|
+
message: "SSE response body is empty",
|
|
31233
|
+
url: url2,
|
|
31234
|
+
requestBodyValues,
|
|
31235
|
+
statusCode: response.status
|
|
31236
|
+
});
|
|
31237
|
+
}
|
|
31238
|
+
const eventStream = parseJsonEventStream$1({
|
|
31239
|
+
stream: response.body,
|
|
31240
|
+
schema: gatewayVideoEventSchema
|
|
31241
|
+
});
|
|
31242
|
+
const reader = eventStream.getReader();
|
|
31243
|
+
const { done, value: parseResult } = await reader.read();
|
|
31244
|
+
reader.releaseLock();
|
|
31245
|
+
if (done || !parseResult) {
|
|
31246
|
+
throw new APICallError$1({
|
|
31247
|
+
message: "SSE stream ended without a data event",
|
|
31248
|
+
url: url2,
|
|
31249
|
+
requestBodyValues,
|
|
31250
|
+
statusCode: response.status
|
|
31251
|
+
});
|
|
31252
|
+
}
|
|
31253
|
+
if (!parseResult.success) {
|
|
31254
|
+
throw new APICallError$1({
|
|
31255
|
+
message: "Failed to parse video SSE event",
|
|
31256
|
+
cause: parseResult.error,
|
|
31257
|
+
url: url2,
|
|
31258
|
+
requestBodyValues,
|
|
31259
|
+
statusCode: response.status
|
|
31260
|
+
});
|
|
31261
|
+
}
|
|
31262
|
+
const event = parseResult.value;
|
|
31263
|
+
if (event.type === "error") {
|
|
31264
|
+
throw new APICallError$1({
|
|
31265
|
+
message: event.message,
|
|
31266
|
+
statusCode: event.statusCode,
|
|
31267
|
+
url: url2,
|
|
31268
|
+
requestBodyValues,
|
|
31269
|
+
responseHeaders: Object.fromEntries([...response.headers]),
|
|
31270
|
+
responseBody: JSON.stringify(event),
|
|
31271
|
+
data: {
|
|
31272
|
+
error: {
|
|
31273
|
+
message: event.message,
|
|
31274
|
+
type: event.errorType,
|
|
31275
|
+
param: event.param
|
|
31276
|
+
}
|
|
31277
|
+
}
|
|
31278
|
+
});
|
|
31279
|
+
}
|
|
31280
|
+
return {
|
|
31281
|
+
value: {
|
|
31282
|
+
videos: event.videos,
|
|
31283
|
+
warnings: event.warnings,
|
|
31284
|
+
providerMetadata: event.providerMetadata
|
|
31285
|
+
},
|
|
31286
|
+
responseHeaders: Object.fromEntries([...response.headers])
|
|
31287
|
+
};
|
|
31288
|
+
},
|
|
31222
31289
|
failedResponseHandler: createJsonErrorResponseHandler$1({
|
|
31223
31290
|
errorSchema: any(),
|
|
31224
31291
|
errorToMessage: (data) => data
|
|
@@ -31290,11 +31357,21 @@ var gatewayVideoWarningSchema = discriminatedUnion("type", [
|
|
|
31290
31357
|
message: string()
|
|
31291
31358
|
})
|
|
31292
31359
|
]);
|
|
31293
|
-
var
|
|
31294
|
-
|
|
31295
|
-
|
|
31296
|
-
|
|
31297
|
-
|
|
31360
|
+
var gatewayVideoEventSchema = discriminatedUnion("type", [
|
|
31361
|
+
object$2({
|
|
31362
|
+
type: literal("result"),
|
|
31363
|
+
videos: array$1(gatewayVideoDataSchema),
|
|
31364
|
+
warnings: array$1(gatewayVideoWarningSchema).optional(),
|
|
31365
|
+
providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
|
|
31366
|
+
}),
|
|
31367
|
+
object$2({
|
|
31368
|
+
type: literal("error"),
|
|
31369
|
+
message: string(),
|
|
31370
|
+
errorType: string(),
|
|
31371
|
+
statusCode: number$1(),
|
|
31372
|
+
param: unknown().nullable()
|
|
31373
|
+
})
|
|
31374
|
+
]);
|
|
31298
31375
|
var parallelSearchInputSchema = lazySchema(
|
|
31299
31376
|
() => zodSchema(
|
|
31300
31377
|
objectType({
|
|
@@ -31471,7 +31548,7 @@ async function getVercelRequestId() {
|
|
|
31471
31548
|
var _a92;
|
|
31472
31549
|
return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
|
|
31473
31550
|
}
|
|
31474
|
-
var VERSION$6 = "3.0.
|
|
31551
|
+
var VERSION$6 = "3.0.58";
|
|
31475
31552
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
31476
31553
|
function createGatewayProvider(options = {}) {
|
|
31477
31554
|
var _a92, _b9;
|
|
@@ -31514,13 +31591,18 @@ function createGatewayProvider(options = {}) {
|
|
|
31514
31591
|
settingValue: void 0,
|
|
31515
31592
|
environmentVariableName: "VERCEL_REGION"
|
|
31516
31593
|
});
|
|
31594
|
+
const projectId = loadOptionalSetting({
|
|
31595
|
+
settingValue: void 0,
|
|
31596
|
+
environmentVariableName: "VERCEL_PROJECT_ID"
|
|
31597
|
+
});
|
|
31517
31598
|
return async () => {
|
|
31518
31599
|
const requestId = await getVercelRequestId();
|
|
31519
31600
|
return {
|
|
31520
31601
|
...deploymentId && { "ai-o11y-deployment-id": deploymentId },
|
|
31521
31602
|
...environment && { "ai-o11y-environment": environment },
|
|
31522
31603
|
...region && { "ai-o11y-region": region },
|
|
31523
|
-
...requestId && { "ai-o11y-request-id": requestId }
|
|
31604
|
+
...requestId && { "ai-o11y-request-id": requestId },
|
|
31605
|
+
...projectId && { "ai-o11y-project-id": projectId }
|
|
31524
31606
|
};
|
|
31525
31607
|
};
|
|
31526
31608
|
};
|
|
@@ -32599,6 +32681,17 @@ var RetryError = class extends AISDKError$1 {
|
|
|
32599
32681
|
}
|
|
32600
32682
|
};
|
|
32601
32683
|
_a19 = symbol19;
|
|
32684
|
+
function asArray(value) {
|
|
32685
|
+
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
32686
|
+
}
|
|
32687
|
+
async function notify(options) {
|
|
32688
|
+
for (const callback of asArray(options.callbacks)) {
|
|
32689
|
+
try {
|
|
32690
|
+
await callback(options.event);
|
|
32691
|
+
} catch (_ignored) {
|
|
32692
|
+
}
|
|
32693
|
+
}
|
|
32694
|
+
}
|
|
32602
32695
|
function formatWarning({
|
|
32603
32696
|
warning,
|
|
32604
32697
|
provider,
|
|
@@ -32899,7 +32992,7 @@ function detectMediaType({
|
|
|
32899
32992
|
}
|
|
32900
32993
|
return void 0;
|
|
32901
32994
|
}
|
|
32902
|
-
var VERSION$4 = "6.0.
|
|
32995
|
+
var VERSION$4 = "6.0.104";
|
|
32903
32996
|
var download = async ({
|
|
32904
32997
|
url: url2,
|
|
32905
32998
|
maxBytes,
|
|
@@ -33007,9 +33100,6 @@ function convertDataContentToBase64String(content) {
|
|
|
33007
33100
|
}
|
|
33008
33101
|
return convertUint8ArrayToBase64$1(content);
|
|
33009
33102
|
}
|
|
33010
|
-
function asArray(value) {
|
|
33011
|
-
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
|
33012
|
-
}
|
|
33013
33103
|
async function convertToLanguageModelPrompt({
|
|
33014
33104
|
prompt,
|
|
33015
33105
|
supportedUrls,
|
|
@@ -34324,6 +34414,10 @@ function collectToolApprovals({
|
|
|
34324
34414
|
}
|
|
34325
34415
|
return { approvedToolApprovals, deniedToolApprovals };
|
|
34326
34416
|
}
|
|
34417
|
+
function now() {
|
|
34418
|
+
var _a21, _b9;
|
|
34419
|
+
return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
|
|
34420
|
+
}
|
|
34327
34421
|
async function executeToolCall({
|
|
34328
34422
|
toolCall,
|
|
34329
34423
|
tools,
|
|
@@ -34332,13 +34426,27 @@ async function executeToolCall({
|
|
|
34332
34426
|
messages,
|
|
34333
34427
|
abortSignal,
|
|
34334
34428
|
experimental_context,
|
|
34335
|
-
|
|
34429
|
+
stepNumber,
|
|
34430
|
+
model,
|
|
34431
|
+
onPreliminaryToolResult,
|
|
34432
|
+
onToolCallStart,
|
|
34433
|
+
onToolCallFinish
|
|
34336
34434
|
}) {
|
|
34337
34435
|
const { toolName, toolCallId, input } = toolCall;
|
|
34338
34436
|
const tool2 = tools == null ? void 0 : tools[toolName];
|
|
34339
34437
|
if ((tool2 == null ? void 0 : tool2.execute) == null) {
|
|
34340
34438
|
return void 0;
|
|
34341
34439
|
}
|
|
34440
|
+
const baseCallbackEvent = {
|
|
34441
|
+
stepNumber,
|
|
34442
|
+
model,
|
|
34443
|
+
toolCall,
|
|
34444
|
+
messages,
|
|
34445
|
+
abortSignal,
|
|
34446
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
34447
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
34448
|
+
experimental_context
|
|
34449
|
+
};
|
|
34342
34450
|
return recordSpan({
|
|
34343
34451
|
name: "ai.toolCall",
|
|
34344
34452
|
attributes: selectTelemetryAttributes({
|
|
@@ -34358,6 +34466,8 @@ async function executeToolCall({
|
|
|
34358
34466
|
tracer,
|
|
34359
34467
|
fn: async (span) => {
|
|
34360
34468
|
let output;
|
|
34469
|
+
await notify({ event: baseCallbackEvent, callbacks: onToolCallStart });
|
|
34470
|
+
const startTime = now();
|
|
34361
34471
|
try {
|
|
34362
34472
|
const stream = executeTool({
|
|
34363
34473
|
execute: tool2.execute.bind(tool2),
|
|
@@ -34382,6 +34492,16 @@ async function executeToolCall({
|
|
|
34382
34492
|
}
|
|
34383
34493
|
}
|
|
34384
34494
|
} catch (error) {
|
|
34495
|
+
const durationMs2 = now() - startTime;
|
|
34496
|
+
await notify({
|
|
34497
|
+
event: {
|
|
34498
|
+
...baseCallbackEvent,
|
|
34499
|
+
success: false,
|
|
34500
|
+
error,
|
|
34501
|
+
durationMs: durationMs2
|
|
34502
|
+
},
|
|
34503
|
+
callbacks: onToolCallFinish
|
|
34504
|
+
});
|
|
34385
34505
|
recordErrorOnSpan(span, error);
|
|
34386
34506
|
return {
|
|
34387
34507
|
type: "tool-error",
|
|
@@ -34393,6 +34513,16 @@ async function executeToolCall({
|
|
|
34393
34513
|
...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
|
|
34394
34514
|
};
|
|
34395
34515
|
}
|
|
34516
|
+
const durationMs = now() - startTime;
|
|
34517
|
+
await notify({
|
|
34518
|
+
event: {
|
|
34519
|
+
...baseCallbackEvent,
|
|
34520
|
+
success: true,
|
|
34521
|
+
output,
|
|
34522
|
+
durationMs
|
|
34523
|
+
},
|
|
34524
|
+
callbacks: onToolCallFinish
|
|
34525
|
+
});
|
|
34396
34526
|
try {
|
|
34397
34527
|
span.setAttributes(
|
|
34398
34528
|
await selectTelemetryAttributes({
|
|
@@ -35256,6 +35386,11 @@ async function doParseToolCall({
|
|
|
35256
35386
|
}
|
|
35257
35387
|
var DefaultStepResult = class {
|
|
35258
35388
|
constructor({
|
|
35389
|
+
stepNumber,
|
|
35390
|
+
model,
|
|
35391
|
+
functionId,
|
|
35392
|
+
metadata: metadata2,
|
|
35393
|
+
experimental_context,
|
|
35259
35394
|
content,
|
|
35260
35395
|
finishReason,
|
|
35261
35396
|
rawFinishReason,
|
|
@@ -35265,6 +35400,11 @@ var DefaultStepResult = class {
|
|
|
35265
35400
|
response,
|
|
35266
35401
|
providerMetadata
|
|
35267
35402
|
}) {
|
|
35403
|
+
this.stepNumber = stepNumber;
|
|
35404
|
+
this.model = model;
|
|
35405
|
+
this.functionId = functionId;
|
|
35406
|
+
this.metadata = metadata2;
|
|
35407
|
+
this.experimental_context = experimental_context;
|
|
35268
35408
|
this.content = content;
|
|
35269
35409
|
this.finishReason = finishReason;
|
|
35270
35410
|
this.rawFinishReason = rawFinishReason;
|
|
@@ -35506,6 +35646,10 @@ async function generateText({
|
|
|
35506
35646
|
experimental_context,
|
|
35507
35647
|
experimental_include: include,
|
|
35508
35648
|
_internal: { generateId: generateId2 = originalGenerateId } = {},
|
|
35649
|
+
experimental_onStart: onStart,
|
|
35650
|
+
experimental_onStepStart: onStepStart,
|
|
35651
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
35652
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
35509
35653
|
onStepFinish,
|
|
35510
35654
|
onFinish,
|
|
35511
35655
|
...settings
|
|
@@ -35535,11 +35679,43 @@ async function generateText({
|
|
|
35535
35679
|
headers: headersWithUserAgent,
|
|
35536
35680
|
settings: { ...callSettings, maxRetries }
|
|
35537
35681
|
});
|
|
35682
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
35538
35683
|
const initialPrompt = await standardizePrompt({
|
|
35539
35684
|
system,
|
|
35540
35685
|
prompt,
|
|
35541
35686
|
messages
|
|
35542
35687
|
});
|
|
35688
|
+
await notify({
|
|
35689
|
+
event: {
|
|
35690
|
+
model: modelInfo,
|
|
35691
|
+
system,
|
|
35692
|
+
prompt,
|
|
35693
|
+
messages,
|
|
35694
|
+
tools,
|
|
35695
|
+
toolChoice,
|
|
35696
|
+
activeTools,
|
|
35697
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
35698
|
+
temperature: callSettings.temperature,
|
|
35699
|
+
topP: callSettings.topP,
|
|
35700
|
+
topK: callSettings.topK,
|
|
35701
|
+
presencePenalty: callSettings.presencePenalty,
|
|
35702
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
35703
|
+
stopSequences: callSettings.stopSequences,
|
|
35704
|
+
seed: callSettings.seed,
|
|
35705
|
+
maxRetries,
|
|
35706
|
+
timeout,
|
|
35707
|
+
headers,
|
|
35708
|
+
providerOptions,
|
|
35709
|
+
stopWhen,
|
|
35710
|
+
output,
|
|
35711
|
+
abortSignal,
|
|
35712
|
+
include,
|
|
35713
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
35714
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
35715
|
+
experimental_context
|
|
35716
|
+
},
|
|
35717
|
+
callbacks: onStart
|
|
35718
|
+
});
|
|
35543
35719
|
const tracer = getTracer(telemetry);
|
|
35544
35720
|
try {
|
|
35545
35721
|
return await recordSpan({
|
|
@@ -35563,7 +35739,7 @@ async function generateText({
|
|
|
35563
35739
|
}),
|
|
35564
35740
|
tracer,
|
|
35565
35741
|
fn: async (span) => {
|
|
35566
|
-
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
35742
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
35567
35743
|
const initialMessages = initialPrompt.messages;
|
|
35568
35744
|
const responseMessages = [];
|
|
35569
35745
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -35580,7 +35756,11 @@ async function generateText({
|
|
|
35580
35756
|
telemetry,
|
|
35581
35757
|
messages: initialMessages,
|
|
35582
35758
|
abortSignal: mergedAbortSignal,
|
|
35583
|
-
experimental_context
|
|
35759
|
+
experimental_context,
|
|
35760
|
+
stepNumber: 0,
|
|
35761
|
+
model: modelInfo,
|
|
35762
|
+
onToolCallStart,
|
|
35763
|
+
onToolCallFinish
|
|
35584
35764
|
});
|
|
35585
35765
|
const toolContent = [];
|
|
35586
35766
|
for (const output2 of toolOutputs) {
|
|
@@ -35660,6 +35840,10 @@ async function generateText({
|
|
|
35660
35840
|
const stepModel = resolveLanguageModel(
|
|
35661
35841
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
35662
35842
|
);
|
|
35843
|
+
const stepModelInfo = {
|
|
35844
|
+
provider: stepModel.provider,
|
|
35845
|
+
modelId: stepModel.modelId
|
|
35846
|
+
};
|
|
35663
35847
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
35664
35848
|
prompt: {
|
|
35665
35849
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -35669,10 +35853,40 @@ async function generateText({
|
|
|
35669
35853
|
download: download2
|
|
35670
35854
|
});
|
|
35671
35855
|
experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
|
|
35856
|
+
const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
|
|
35672
35857
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
35673
35858
|
tools,
|
|
35674
|
-
toolChoice: (
|
|
35675
|
-
activeTools:
|
|
35859
|
+
toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
|
|
35860
|
+
activeTools: stepActiveTools
|
|
35861
|
+
});
|
|
35862
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
35863
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
35864
|
+
const stepProviderOptions = mergeObjects(
|
|
35865
|
+
providerOptions,
|
|
35866
|
+
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
35867
|
+
);
|
|
35868
|
+
await notify({
|
|
35869
|
+
event: {
|
|
35870
|
+
stepNumber: steps.length,
|
|
35871
|
+
model: stepModelInfo,
|
|
35872
|
+
system: stepSystem,
|
|
35873
|
+
messages: stepMessages,
|
|
35874
|
+
tools,
|
|
35875
|
+
toolChoice: stepToolChoice,
|
|
35876
|
+
activeTools: stepActiveTools,
|
|
35877
|
+
steps: [...steps],
|
|
35878
|
+
providerOptions: stepProviderOptions,
|
|
35879
|
+
timeout,
|
|
35880
|
+
headers,
|
|
35881
|
+
stopWhen,
|
|
35882
|
+
output,
|
|
35883
|
+
abortSignal,
|
|
35884
|
+
include,
|
|
35885
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
35886
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
35887
|
+
experimental_context
|
|
35888
|
+
},
|
|
35889
|
+
callbacks: onStepStart
|
|
35676
35890
|
});
|
|
35677
35891
|
currentModelResponse = await retry(
|
|
35678
35892
|
() => {
|
|
@@ -35716,10 +35930,6 @@ async function generateText({
|
|
|
35716
35930
|
tracer,
|
|
35717
35931
|
fn: async (span2) => {
|
|
35718
35932
|
var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
35719
|
-
const stepProviderOptions = mergeObjects(
|
|
35720
|
-
providerOptions,
|
|
35721
|
-
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
35722
|
-
);
|
|
35723
35933
|
const result = await stepModel.doGenerate({
|
|
35724
35934
|
...callSettings2,
|
|
35725
35935
|
tools: stepTools,
|
|
@@ -35851,7 +36061,11 @@ async function generateText({
|
|
|
35851
36061
|
telemetry,
|
|
35852
36062
|
messages: stepInputMessages,
|
|
35853
36063
|
abortSignal: mergedAbortSignal,
|
|
35854
|
-
experimental_context
|
|
36064
|
+
experimental_context,
|
|
36065
|
+
stepNumber: steps.length,
|
|
36066
|
+
model: stepModelInfo,
|
|
36067
|
+
onToolCallStart,
|
|
36068
|
+
onToolCallFinish
|
|
35855
36069
|
})
|
|
35856
36070
|
);
|
|
35857
36071
|
}
|
|
@@ -35888,15 +36102,21 @@ async function generateText({
|
|
|
35888
36102
|
tools
|
|
35889
36103
|
})
|
|
35890
36104
|
);
|
|
35891
|
-
const stepRequest = ((
|
|
36105
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
|
|
35892
36106
|
const stepResponse = {
|
|
35893
36107
|
...currentModelResponse.response,
|
|
35894
36108
|
// deep clone msgs to avoid mutating past messages in multi-step:
|
|
35895
36109
|
messages: structuredClone(responseMessages),
|
|
35896
36110
|
// Conditionally include response body:
|
|
35897
|
-
body: ((
|
|
36111
|
+
body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
|
|
35898
36112
|
};
|
|
36113
|
+
const stepNumber = steps.length;
|
|
35899
36114
|
const currentStepResult = new DefaultStepResult({
|
|
36115
|
+
stepNumber,
|
|
36116
|
+
model: stepModelInfo,
|
|
36117
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
36118
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
36119
|
+
experimental_context,
|
|
35900
36120
|
content: stepContent,
|
|
35901
36121
|
finishReason: currentModelResponse.finishReason.unified,
|
|
35902
36122
|
rawFinishReason: currentModelResponse.finishReason.raw,
|
|
@@ -35907,12 +36127,12 @@ async function generateText({
|
|
|
35907
36127
|
response: stepResponse
|
|
35908
36128
|
});
|
|
35909
36129
|
logWarnings({
|
|
35910
|
-
warnings: (
|
|
35911
|
-
provider:
|
|
35912
|
-
model:
|
|
36130
|
+
warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
|
|
36131
|
+
provider: stepModelInfo.provider,
|
|
36132
|
+
model: stepModelInfo.modelId
|
|
35913
36133
|
});
|
|
35914
36134
|
steps.push(currentStepResult);
|
|
35915
|
-
await (
|
|
36135
|
+
await notify({ event: currentStepResult, callbacks: onStepFinish });
|
|
35916
36136
|
} finally {
|
|
35917
36137
|
if (stepTimeoutId != null) {
|
|
35918
36138
|
clearTimeout(stepTimeoutId);
|
|
@@ -35964,30 +36184,37 @@ async function generateText({
|
|
|
35964
36184
|
cachedInputTokens: void 0
|
|
35965
36185
|
}
|
|
35966
36186
|
);
|
|
35967
|
-
await (
|
|
35968
|
-
|
|
35969
|
-
|
|
35970
|
-
|
|
35971
|
-
|
|
35972
|
-
|
|
35973
|
-
|
|
35974
|
-
|
|
35975
|
-
|
|
35976
|
-
|
|
35977
|
-
|
|
35978
|
-
|
|
35979
|
-
|
|
35980
|
-
|
|
35981
|
-
|
|
35982
|
-
|
|
35983
|
-
|
|
35984
|
-
|
|
35985
|
-
|
|
35986
|
-
|
|
35987
|
-
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
36187
|
+
await notify({
|
|
36188
|
+
event: {
|
|
36189
|
+
stepNumber: lastStep.stepNumber,
|
|
36190
|
+
model: lastStep.model,
|
|
36191
|
+
functionId: lastStep.functionId,
|
|
36192
|
+
metadata: lastStep.metadata,
|
|
36193
|
+
experimental_context: lastStep.experimental_context,
|
|
36194
|
+
finishReason: lastStep.finishReason,
|
|
36195
|
+
rawFinishReason: lastStep.rawFinishReason,
|
|
36196
|
+
usage: lastStep.usage,
|
|
36197
|
+
content: lastStep.content,
|
|
36198
|
+
text: lastStep.text,
|
|
36199
|
+
reasoningText: lastStep.reasoningText,
|
|
36200
|
+
reasoning: lastStep.reasoning,
|
|
36201
|
+
files: lastStep.files,
|
|
36202
|
+
sources: lastStep.sources,
|
|
36203
|
+
toolCalls: lastStep.toolCalls,
|
|
36204
|
+
staticToolCalls: lastStep.staticToolCalls,
|
|
36205
|
+
dynamicToolCalls: lastStep.dynamicToolCalls,
|
|
36206
|
+
toolResults: lastStep.toolResults,
|
|
36207
|
+
staticToolResults: lastStep.staticToolResults,
|
|
36208
|
+
dynamicToolResults: lastStep.dynamicToolResults,
|
|
36209
|
+
request: lastStep.request,
|
|
36210
|
+
response: lastStep.response,
|
|
36211
|
+
warnings: lastStep.warnings,
|
|
36212
|
+
providerMetadata: lastStep.providerMetadata,
|
|
36213
|
+
steps,
|
|
36214
|
+
totalUsage
|
|
36215
|
+
},
|
|
36216
|
+
callbacks: onFinish
|
|
36217
|
+
});
|
|
35991
36218
|
let resolvedOutput;
|
|
35992
36219
|
if (lastStep.finishReason === "stop") {
|
|
35993
36220
|
const outputSpecification = output != null ? output : text();
|
|
@@ -36018,7 +36245,11 @@ async function executeTools({
|
|
|
36018
36245
|
telemetry,
|
|
36019
36246
|
messages,
|
|
36020
36247
|
abortSignal,
|
|
36021
|
-
experimental_context
|
|
36248
|
+
experimental_context,
|
|
36249
|
+
stepNumber,
|
|
36250
|
+
model,
|
|
36251
|
+
onToolCallStart,
|
|
36252
|
+
onToolCallFinish
|
|
36022
36253
|
}) {
|
|
36023
36254
|
const toolOutputs = await Promise.all(
|
|
36024
36255
|
toolCalls.map(
|
|
@@ -36029,7 +36260,11 @@ async function executeTools({
|
|
|
36029
36260
|
telemetry,
|
|
36030
36261
|
messages,
|
|
36031
36262
|
abortSignal,
|
|
36032
|
-
experimental_context
|
|
36263
|
+
experimental_context,
|
|
36264
|
+
stepNumber,
|
|
36265
|
+
model,
|
|
36266
|
+
onToolCallStart,
|
|
36267
|
+
onToolCallFinish
|
|
36033
36268
|
})
|
|
36034
36269
|
)
|
|
36035
36270
|
);
|
|
@@ -36722,7 +36957,9 @@ function processUIMessageStream({
|
|
|
36722
36957
|
break;
|
|
36723
36958
|
}
|
|
36724
36959
|
case "tool-input-error": {
|
|
36725
|
-
|
|
36960
|
+
const existingPart = state.message.parts.filter(isToolUIPart).find((p) => p.toolCallId === chunk.toolCallId);
|
|
36961
|
+
const isDynamic = existingPart != null ? existingPart.type === "dynamic-tool" : !!chunk.dynamic;
|
|
36962
|
+
if (isDynamic) {
|
|
36726
36963
|
updateDynamicToolPart({
|
|
36727
36964
|
toolCallId: chunk.toolCallId,
|
|
36728
36965
|
toolName: chunk.toolName,
|
|
@@ -37190,10 +37427,6 @@ function createStitchableStream() {
|
|
|
37190
37427
|
terminate
|
|
37191
37428
|
};
|
|
37192
37429
|
}
|
|
37193
|
-
function now() {
|
|
37194
|
-
var _a21, _b9;
|
|
37195
|
-
return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
|
|
37196
|
-
}
|
|
37197
37430
|
function runToolsTransformation({
|
|
37198
37431
|
tools,
|
|
37199
37432
|
generatorStream,
|
|
@@ -37204,7 +37437,11 @@ function runToolsTransformation({
|
|
|
37204
37437
|
abortSignal,
|
|
37205
37438
|
repairToolCall,
|
|
37206
37439
|
experimental_context,
|
|
37207
|
-
generateId: generateId2
|
|
37440
|
+
generateId: generateId2,
|
|
37441
|
+
stepNumber,
|
|
37442
|
+
model,
|
|
37443
|
+
onToolCallStart,
|
|
37444
|
+
onToolCallFinish
|
|
37208
37445
|
}) {
|
|
37209
37446
|
let toolResultsStreamController = null;
|
|
37210
37447
|
const toolResultsStream = new ReadableStream({
|
|
@@ -37346,6 +37583,10 @@ function runToolsTransformation({
|
|
|
37346
37583
|
messages,
|
|
37347
37584
|
abortSignal,
|
|
37348
37585
|
experimental_context,
|
|
37586
|
+
stepNumber,
|
|
37587
|
+
model,
|
|
37588
|
+
onToolCallStart,
|
|
37589
|
+
onToolCallFinish,
|
|
37349
37590
|
onPreliminaryToolResult: (result) => {
|
|
37350
37591
|
toolResultsStreamController.enqueue(result);
|
|
37351
37592
|
}
|
|
@@ -37462,6 +37703,10 @@ function streamText({
|
|
|
37462
37703
|
onFinish,
|
|
37463
37704
|
onAbort,
|
|
37464
37705
|
onStepFinish,
|
|
37706
|
+
experimental_onStart: onStart,
|
|
37707
|
+
experimental_onStepStart: onStepStart,
|
|
37708
|
+
experimental_onToolCallStart: onToolCallStart,
|
|
37709
|
+
experimental_onToolCallFinish: onToolCallFinish,
|
|
37465
37710
|
experimental_context,
|
|
37466
37711
|
experimental_include: include,
|
|
37467
37712
|
_internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
|
|
@@ -37501,11 +37746,18 @@ function streamText({
|
|
|
37501
37746
|
providerOptions,
|
|
37502
37747
|
prepareStep,
|
|
37503
37748
|
includeRawChunks,
|
|
37749
|
+
timeout,
|
|
37750
|
+
stopWhen,
|
|
37751
|
+
originalAbortSignal: abortSignal,
|
|
37504
37752
|
onChunk,
|
|
37505
37753
|
onError,
|
|
37506
37754
|
onFinish,
|
|
37507
37755
|
onAbort,
|
|
37508
37756
|
onStepFinish,
|
|
37757
|
+
onStart,
|
|
37758
|
+
onStepStart,
|
|
37759
|
+
onToolCallStart,
|
|
37760
|
+
onToolCallFinish,
|
|
37509
37761
|
now: now2,
|
|
37510
37762
|
generateId: generateId2,
|
|
37511
37763
|
experimental_context,
|
|
@@ -37602,11 +37854,18 @@ var DefaultStreamTextResult = class {
|
|
|
37602
37854
|
includeRawChunks,
|
|
37603
37855
|
now: now2,
|
|
37604
37856
|
generateId: generateId2,
|
|
37857
|
+
timeout,
|
|
37858
|
+
stopWhen,
|
|
37859
|
+
originalAbortSignal,
|
|
37605
37860
|
onChunk,
|
|
37606
37861
|
onError,
|
|
37607
37862
|
onFinish,
|
|
37608
37863
|
onAbort,
|
|
37609
37864
|
onStepFinish,
|
|
37865
|
+
onStart,
|
|
37866
|
+
onStepStart,
|
|
37867
|
+
onToolCallStart,
|
|
37868
|
+
onToolCallFinish,
|
|
37610
37869
|
experimental_context,
|
|
37611
37870
|
download: download2,
|
|
37612
37871
|
include
|
|
@@ -37749,6 +38008,10 @@ var DefaultStreamTextResult = class {
|
|
|
37749
38008
|
tools
|
|
37750
38009
|
});
|
|
37751
38010
|
const currentStepResult = new DefaultStepResult({
|
|
38011
|
+
stepNumber: recordedSteps.length,
|
|
38012
|
+
model: modelInfo,
|
|
38013
|
+
...callbackTelemetryProps,
|
|
38014
|
+
experimental_context,
|
|
37752
38015
|
content: recordedContent,
|
|
37753
38016
|
finishReason: part.finishReason,
|
|
37754
38017
|
rawFinishReason: part.rawFinishReason,
|
|
@@ -37761,11 +38024,11 @@ var DefaultStreamTextResult = class {
|
|
|
37761
38024
|
},
|
|
37762
38025
|
providerMetadata: part.providerMetadata
|
|
37763
38026
|
});
|
|
37764
|
-
await (
|
|
38027
|
+
await notify({ event: currentStepResult, callbacks: onStepFinish });
|
|
37765
38028
|
logWarnings({
|
|
37766
38029
|
warnings: recordedWarnings,
|
|
37767
|
-
provider:
|
|
37768
|
-
model:
|
|
38030
|
+
provider: modelInfo.provider,
|
|
38031
|
+
model: modelInfo.modelId
|
|
37769
38032
|
});
|
|
37770
38033
|
recordedSteps.push(currentStepResult);
|
|
37771
38034
|
recordedResponseMessages.push(...stepMessages);
|
|
@@ -37796,30 +38059,37 @@ var DefaultStreamTextResult = class {
|
|
|
37796
38059
|
self2._totalUsage.resolve(totalUsage);
|
|
37797
38060
|
self2._steps.resolve(recordedSteps);
|
|
37798
38061
|
const finalStep = recordedSteps[recordedSteps.length - 1];
|
|
37799
|
-
await (
|
|
37800
|
-
|
|
37801
|
-
|
|
37802
|
-
|
|
37803
|
-
|
|
37804
|
-
|
|
37805
|
-
|
|
37806
|
-
|
|
37807
|
-
|
|
37808
|
-
|
|
37809
|
-
|
|
37810
|
-
|
|
37811
|
-
|
|
37812
|
-
|
|
37813
|
-
|
|
37814
|
-
|
|
37815
|
-
|
|
37816
|
-
|
|
37817
|
-
|
|
37818
|
-
|
|
37819
|
-
|
|
37820
|
-
|
|
37821
|
-
|
|
37822
|
-
|
|
38062
|
+
await notify({
|
|
38063
|
+
event: {
|
|
38064
|
+
stepNumber: finalStep.stepNumber,
|
|
38065
|
+
model: finalStep.model,
|
|
38066
|
+
functionId: finalStep.functionId,
|
|
38067
|
+
metadata: finalStep.metadata,
|
|
38068
|
+
experimental_context: finalStep.experimental_context,
|
|
38069
|
+
finishReason: finalStep.finishReason,
|
|
38070
|
+
rawFinishReason: finalStep.rawFinishReason,
|
|
38071
|
+
totalUsage,
|
|
38072
|
+
usage: finalStep.usage,
|
|
38073
|
+
content: finalStep.content,
|
|
38074
|
+
text: finalStep.text,
|
|
38075
|
+
reasoningText: finalStep.reasoningText,
|
|
38076
|
+
reasoning: finalStep.reasoning,
|
|
38077
|
+
files: finalStep.files,
|
|
38078
|
+
sources: finalStep.sources,
|
|
38079
|
+
toolCalls: finalStep.toolCalls,
|
|
38080
|
+
staticToolCalls: finalStep.staticToolCalls,
|
|
38081
|
+
dynamicToolCalls: finalStep.dynamicToolCalls,
|
|
38082
|
+
toolResults: finalStep.toolResults,
|
|
38083
|
+
staticToolResults: finalStep.staticToolResults,
|
|
38084
|
+
dynamicToolResults: finalStep.dynamicToolResults,
|
|
38085
|
+
request: finalStep.request,
|
|
38086
|
+
response: finalStep.response,
|
|
38087
|
+
warnings: finalStep.warnings,
|
|
38088
|
+
providerMetadata: finalStep.providerMetadata,
|
|
38089
|
+
steps: recordedSteps
|
|
38090
|
+
},
|
|
38091
|
+
callbacks: onFinish
|
|
38092
|
+
});
|
|
37823
38093
|
rootSpan.setAttributes(
|
|
37824
38094
|
await selectTelemetryAttributes({
|
|
37825
38095
|
telemetry,
|
|
@@ -37920,6 +38190,11 @@ var DefaultStreamTextResult = class {
|
|
|
37920
38190
|
settings: { ...callSettings, maxRetries }
|
|
37921
38191
|
});
|
|
37922
38192
|
const self2 = this;
|
|
38193
|
+
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
38194
|
+
const callbackTelemetryProps = {
|
|
38195
|
+
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
38196
|
+
metadata: telemetry == null ? void 0 : telemetry.metadata
|
|
38197
|
+
};
|
|
37923
38198
|
recordSpan({
|
|
37924
38199
|
name: "ai.streamText",
|
|
37925
38200
|
attributes: selectTelemetryAttributes({
|
|
@@ -37942,6 +38217,36 @@ var DefaultStreamTextResult = class {
|
|
|
37942
38217
|
prompt,
|
|
37943
38218
|
messages
|
|
37944
38219
|
});
|
|
38220
|
+
await notify({
|
|
38221
|
+
event: {
|
|
38222
|
+
model: modelInfo,
|
|
38223
|
+
system,
|
|
38224
|
+
prompt,
|
|
38225
|
+
messages,
|
|
38226
|
+
tools,
|
|
38227
|
+
toolChoice,
|
|
38228
|
+
activeTools,
|
|
38229
|
+
maxOutputTokens: callSettings.maxOutputTokens,
|
|
38230
|
+
temperature: callSettings.temperature,
|
|
38231
|
+
topP: callSettings.topP,
|
|
38232
|
+
topK: callSettings.topK,
|
|
38233
|
+
presencePenalty: callSettings.presencePenalty,
|
|
38234
|
+
frequencyPenalty: callSettings.frequencyPenalty,
|
|
38235
|
+
stopSequences: callSettings.stopSequences,
|
|
38236
|
+
seed: callSettings.seed,
|
|
38237
|
+
maxRetries,
|
|
38238
|
+
timeout,
|
|
38239
|
+
headers,
|
|
38240
|
+
providerOptions,
|
|
38241
|
+
stopWhen,
|
|
38242
|
+
output,
|
|
38243
|
+
abortSignal: originalAbortSignal,
|
|
38244
|
+
include,
|
|
38245
|
+
...callbackTelemetryProps,
|
|
38246
|
+
experimental_context
|
|
38247
|
+
},
|
|
38248
|
+
callbacks: onStart
|
|
38249
|
+
});
|
|
37945
38250
|
const initialMessages = initialPrompt.messages;
|
|
37946
38251
|
const initialResponseMessages = [];
|
|
37947
38252
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -37988,6 +38293,10 @@ var DefaultStreamTextResult = class {
|
|
|
37988
38293
|
messages: initialMessages,
|
|
37989
38294
|
abortSignal,
|
|
37990
38295
|
experimental_context,
|
|
38296
|
+
stepNumber: recordedSteps.length,
|
|
38297
|
+
model: modelInfo,
|
|
38298
|
+
onToolCallStart,
|
|
38299
|
+
onToolCallFinish,
|
|
37991
38300
|
onPreliminaryToolResult: (result2) => {
|
|
37992
38301
|
toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
|
|
37993
38302
|
}
|
|
@@ -38054,7 +38363,7 @@ var DefaultStreamTextResult = class {
|
|
|
38054
38363
|
responseMessages,
|
|
38055
38364
|
usage
|
|
38056
38365
|
}) {
|
|
38057
|
-
var _a21, _b9, _c, _d, _e, _f, _g;
|
|
38366
|
+
var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
38058
38367
|
const includeRawChunks2 = self2.includeRawChunks;
|
|
38059
38368
|
const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
|
|
38060
38369
|
let chunkTimeoutId = void 0;
|
|
@@ -38093,6 +38402,10 @@ var DefaultStreamTextResult = class {
|
|
|
38093
38402
|
const stepModel = resolveLanguageModel(
|
|
38094
38403
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
38095
38404
|
);
|
|
38405
|
+
const stepModelInfo = {
|
|
38406
|
+
provider: stepModel.provider,
|
|
38407
|
+
modelId: stepModel.modelId
|
|
38408
|
+
};
|
|
38096
38409
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
38097
38410
|
prompt: {
|
|
38098
38411
|
system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
|
|
@@ -38101,16 +38414,41 @@ var DefaultStreamTextResult = class {
|
|
|
38101
38414
|
supportedUrls: await stepModel.supportedUrls,
|
|
38102
38415
|
download: download2
|
|
38103
38416
|
});
|
|
38417
|
+
const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
|
|
38104
38418
|
const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
|
|
38105
38419
|
tools,
|
|
38106
|
-
toolChoice: (
|
|
38107
|
-
activeTools:
|
|
38420
|
+
toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
|
|
38421
|
+
activeTools: stepActiveTools
|
|
38108
38422
|
});
|
|
38109
38423
|
experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
|
|
38424
|
+
const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
|
|
38425
|
+
const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
|
|
38110
38426
|
const stepProviderOptions = mergeObjects(
|
|
38111
38427
|
providerOptions,
|
|
38112
38428
|
prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
|
|
38113
38429
|
);
|
|
38430
|
+
await notify({
|
|
38431
|
+
event: {
|
|
38432
|
+
stepNumber: recordedSteps.length,
|
|
38433
|
+
model: stepModelInfo,
|
|
38434
|
+
system: stepSystem,
|
|
38435
|
+
messages: stepMessages,
|
|
38436
|
+
tools,
|
|
38437
|
+
toolChoice: stepToolChoice,
|
|
38438
|
+
activeTools: stepActiveTools,
|
|
38439
|
+
steps: [...recordedSteps],
|
|
38440
|
+
providerOptions: stepProviderOptions,
|
|
38441
|
+
timeout,
|
|
38442
|
+
headers,
|
|
38443
|
+
stopWhen,
|
|
38444
|
+
output,
|
|
38445
|
+
abortSignal: originalAbortSignal,
|
|
38446
|
+
include,
|
|
38447
|
+
...callbackTelemetryProps,
|
|
38448
|
+
experimental_context
|
|
38449
|
+
},
|
|
38450
|
+
callbacks: onStepStart
|
|
38451
|
+
});
|
|
38114
38452
|
const {
|
|
38115
38453
|
result: { stream: stream2, response, request },
|
|
38116
38454
|
doStreamSpan,
|
|
@@ -38182,9 +38520,13 @@ var DefaultStreamTextResult = class {
|
|
|
38182
38520
|
repairToolCall,
|
|
38183
38521
|
abortSignal,
|
|
38184
38522
|
experimental_context,
|
|
38185
|
-
generateId: generateId2
|
|
38523
|
+
generateId: generateId2,
|
|
38524
|
+
stepNumber: recordedSteps.length,
|
|
38525
|
+
model: stepModelInfo,
|
|
38526
|
+
onToolCallStart,
|
|
38527
|
+
onToolCallFinish
|
|
38186
38528
|
});
|
|
38187
|
-
const stepRequest = ((
|
|
38529
|
+
const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
|
|
38188
38530
|
const stepToolCalls = [];
|
|
38189
38531
|
const stepToolOutputs = [];
|
|
38190
38532
|
let warnings;
|
|
@@ -38197,7 +38539,7 @@ var DefaultStreamTextResult = class {
|
|
|
38197
38539
|
let stepResponse = {
|
|
38198
38540
|
id: generateId2(),
|
|
38199
38541
|
timestamp: /* @__PURE__ */ new Date(),
|
|
38200
|
-
modelId:
|
|
38542
|
+
modelId: modelInfo.modelId
|
|
38201
38543
|
};
|
|
38202
38544
|
let activeText = "";
|
|
38203
38545
|
self2.addStream(
|
|
@@ -42021,7 +42363,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
42021
42363
|
for (const toolCallDelta of delta.tool_calls) {
|
|
42022
42364
|
const index = toolCallDelta.index;
|
|
42023
42365
|
if (toolCalls[index] == null) {
|
|
42024
|
-
if (toolCallDelta.type !== "function") {
|
|
42366
|
+
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
42025
42367
|
throw new InvalidResponseDataError$1({
|
|
42026
42368
|
data: toolCallDelta,
|
|
42027
42369
|
message: `Expected 'function' type.`
|
|
@@ -42711,9 +43053,11 @@ var modelMaxImagesPerCall = {
|
|
|
42711
43053
|
"dall-e-2": 10,
|
|
42712
43054
|
"gpt-image-1": 10,
|
|
42713
43055
|
"gpt-image-1-mini": 10,
|
|
42714
|
-
"gpt-image-1.5": 10
|
|
43056
|
+
"gpt-image-1.5": 10,
|
|
43057
|
+
"chatgpt-image-latest": 10
|
|
42715
43058
|
};
|
|
42716
43059
|
var defaultResponseFormatPrefixes = [
|
|
43060
|
+
"chatgpt-image-",
|
|
42717
43061
|
"gpt-image-1-mini",
|
|
42718
43062
|
"gpt-image-1.5",
|
|
42719
43063
|
"gpt-image-1"
|
|
@@ -42812,15 +43156,20 @@ var OpenAIImageModel = class {
|
|
|
42812
43156
|
},
|
|
42813
43157
|
providerMetadata: {
|
|
42814
43158
|
openai: {
|
|
42815
|
-
images: response2.data.map((item) => {
|
|
42816
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43159
|
+
images: response2.data.map((item, index) => {
|
|
43160
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
42817
43161
|
return {
|
|
42818
43162
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
42819
43163
|
created: (_a22 = response2.created) != null ? _a22 : void 0,
|
|
42820
43164
|
size: (_b22 = response2.size) != null ? _b22 : void 0,
|
|
42821
43165
|
quality: (_c2 = response2.quality) != null ? _c2 : void 0,
|
|
42822
43166
|
background: (_d2 = response2.background) != null ? _d2 : void 0,
|
|
42823
|
-
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
|
|
43167
|
+
outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
|
|
43168
|
+
...distributeTokenDetails(
|
|
43169
|
+
(_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43170
|
+
index,
|
|
43171
|
+
response2.data.length
|
|
43172
|
+
)
|
|
42824
43173
|
};
|
|
42825
43174
|
})
|
|
42826
43175
|
}
|
|
@@ -42863,15 +43212,20 @@ var OpenAIImageModel = class {
|
|
|
42863
43212
|
},
|
|
42864
43213
|
providerMetadata: {
|
|
42865
43214
|
openai: {
|
|
42866
|
-
images: response.data.map((item) => {
|
|
42867
|
-
var _a22, _b22, _c2, _d2, _e2;
|
|
43215
|
+
images: response.data.map((item, index) => {
|
|
43216
|
+
var _a22, _b22, _c2, _d2, _e2, _f2;
|
|
42868
43217
|
return {
|
|
42869
43218
|
...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
|
|
42870
43219
|
created: (_a22 = response.created) != null ? _a22 : void 0,
|
|
42871
43220
|
size: (_b22 = response.size) != null ? _b22 : void 0,
|
|
42872
43221
|
quality: (_c2 = response.quality) != null ? _c2 : void 0,
|
|
42873
43222
|
background: (_d2 = response.background) != null ? _d2 : void 0,
|
|
42874
|
-
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
|
|
43223
|
+
outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
|
|
43224
|
+
...distributeTokenDetails(
|
|
43225
|
+
(_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
|
|
43226
|
+
index,
|
|
43227
|
+
response.data.length
|
|
43228
|
+
)
|
|
42875
43229
|
};
|
|
42876
43230
|
})
|
|
42877
43231
|
}
|
|
@@ -42879,6 +43233,23 @@ var OpenAIImageModel = class {
|
|
|
42879
43233
|
};
|
|
42880
43234
|
}
|
|
42881
43235
|
};
|
|
43236
|
+
function distributeTokenDetails(details, index, total) {
|
|
43237
|
+
if (details == null) {
|
|
43238
|
+
return {};
|
|
43239
|
+
}
|
|
43240
|
+
const result = {};
|
|
43241
|
+
if (details.image_tokens != null) {
|
|
43242
|
+
const base = Math.floor(details.image_tokens / total);
|
|
43243
|
+
const remainder = details.image_tokens - base * (total - 1);
|
|
43244
|
+
result.imageTokens = index === total - 1 ? remainder : base;
|
|
43245
|
+
}
|
|
43246
|
+
if (details.text_tokens != null) {
|
|
43247
|
+
const base = Math.floor(details.text_tokens / total);
|
|
43248
|
+
const remainder = details.text_tokens - base * (total - 1);
|
|
43249
|
+
result.textTokens = index === total - 1 ? remainder : base;
|
|
43250
|
+
}
|
|
43251
|
+
return result;
|
|
43252
|
+
}
|
|
42882
43253
|
async function fileToBlob(file) {
|
|
42883
43254
|
if (!file) return void 0;
|
|
42884
43255
|
if (file.type === "url") {
|
|
@@ -43089,6 +43460,67 @@ var shellOutputSchema = lazySchema(
|
|
|
43089
43460
|
})
|
|
43090
43461
|
)
|
|
43091
43462
|
);
|
|
43463
|
+
var shellSkillsSchema = array$1(
|
|
43464
|
+
discriminatedUnion("type", [
|
|
43465
|
+
object$2({
|
|
43466
|
+
type: literal("skillReference"),
|
|
43467
|
+
skillId: string(),
|
|
43468
|
+
version: string().optional()
|
|
43469
|
+
}),
|
|
43470
|
+
object$2({
|
|
43471
|
+
type: literal("inline"),
|
|
43472
|
+
name: string(),
|
|
43473
|
+
description: string(),
|
|
43474
|
+
source: object$2({
|
|
43475
|
+
type: literal("base64"),
|
|
43476
|
+
mediaType: literal("application/zip"),
|
|
43477
|
+
data: string()
|
|
43478
|
+
})
|
|
43479
|
+
})
|
|
43480
|
+
])
|
|
43481
|
+
).optional();
|
|
43482
|
+
var shellArgsSchema = lazySchema(
|
|
43483
|
+
() => zodSchema(
|
|
43484
|
+
object$2({
|
|
43485
|
+
environment: union([
|
|
43486
|
+
object$2({
|
|
43487
|
+
type: literal("containerAuto"),
|
|
43488
|
+
fileIds: array$1(string()).optional(),
|
|
43489
|
+
memoryLimit: _enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
43490
|
+
networkPolicy: discriminatedUnion("type", [
|
|
43491
|
+
object$2({ type: literal("disabled") }),
|
|
43492
|
+
object$2({
|
|
43493
|
+
type: literal("allowlist"),
|
|
43494
|
+
allowedDomains: array$1(string()),
|
|
43495
|
+
domainSecrets: array$1(
|
|
43496
|
+
object$2({
|
|
43497
|
+
domain: string(),
|
|
43498
|
+
name: string(),
|
|
43499
|
+
value: string()
|
|
43500
|
+
})
|
|
43501
|
+
).optional()
|
|
43502
|
+
})
|
|
43503
|
+
]).optional(),
|
|
43504
|
+
skills: shellSkillsSchema
|
|
43505
|
+
}),
|
|
43506
|
+
object$2({
|
|
43507
|
+
type: literal("containerReference"),
|
|
43508
|
+
containerId: string()
|
|
43509
|
+
}),
|
|
43510
|
+
object$2({
|
|
43511
|
+
type: literal("local").optional(),
|
|
43512
|
+
skills: array$1(
|
|
43513
|
+
object$2({
|
|
43514
|
+
name: string(),
|
|
43515
|
+
description: string(),
|
|
43516
|
+
path: string()
|
|
43517
|
+
})
|
|
43518
|
+
).optional()
|
|
43519
|
+
})
|
|
43520
|
+
]).optional()
|
|
43521
|
+
})
|
|
43522
|
+
)
|
|
43523
|
+
);
|
|
43092
43524
|
var shell = createProviderToolFactoryWithOutputSchema({
|
|
43093
43525
|
id: "openai.shell",
|
|
43094
43526
|
inputSchema: shellInputSchema,
|
|
@@ -43128,7 +43560,7 @@ var webSearchOutputSchema = lazySchema(
|
|
|
43128
43560
|
url: string().nullish(),
|
|
43129
43561
|
pattern: string().nullish()
|
|
43130
43562
|
})
|
|
43131
|
-
]),
|
|
43563
|
+
]).optional(),
|
|
43132
43564
|
sources: array$1(
|
|
43133
43565
|
discriminatedUnion("type", [
|
|
43134
43566
|
object$2({ type: literal("url"), url: string() }),
|
|
@@ -43178,7 +43610,7 @@ var webSearchPreviewOutputSchema = lazySchema(
|
|
|
43178
43610
|
url: string().nullish(),
|
|
43179
43611
|
pattern: string().nullish()
|
|
43180
43612
|
})
|
|
43181
|
-
])
|
|
43613
|
+
]).optional()
|
|
43182
43614
|
})
|
|
43183
43615
|
)
|
|
43184
43616
|
);
|
|
@@ -43395,7 +43827,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
43395
43827
|
hasShellTool = false,
|
|
43396
43828
|
hasApplyPatchTool = false
|
|
43397
43829
|
}) {
|
|
43398
|
-
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l
|
|
43830
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
43399
43831
|
const input = [];
|
|
43400
43832
|
const warnings = [];
|
|
43401
43833
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -43476,7 +43908,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
43476
43908
|
for (const part of content) {
|
|
43477
43909
|
switch (part.type) {
|
|
43478
43910
|
case "text": {
|
|
43479
|
-
const
|
|
43911
|
+
const providerOpts = (_a10 = part.providerOptions) == null ? void 0 : _a10[providerOptionsName];
|
|
43912
|
+
const id2 = providerOpts == null ? void 0 : providerOpts.itemId;
|
|
43913
|
+
const phase = providerOpts == null ? void 0 : providerOpts.phase;
|
|
43480
43914
|
if (hasConversation && id2 != null) {
|
|
43481
43915
|
break;
|
|
43482
43916
|
}
|
|
@@ -43487,12 +43921,13 @@ async function convertToOpenAIResponsesInput({
|
|
|
43487
43921
|
input.push({
|
|
43488
43922
|
role: "assistant",
|
|
43489
43923
|
content: [{ type: "output_text", text: part.text }],
|
|
43490
|
-
id: id2
|
|
43924
|
+
id: id2,
|
|
43925
|
+
...phase != null && { phase }
|
|
43491
43926
|
});
|
|
43492
43927
|
break;
|
|
43493
43928
|
}
|
|
43494
43929
|
case "tool-call": {
|
|
43495
|
-
const id2 = (
|
|
43930
|
+
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;
|
|
43496
43931
|
if (hasConversation && id2 != null) {
|
|
43497
43932
|
break;
|
|
43498
43933
|
}
|
|
@@ -43578,8 +44013,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
43578
44013
|
if (hasConversation) {
|
|
43579
44014
|
break;
|
|
43580
44015
|
}
|
|
44016
|
+
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
44017
|
+
part.toolName
|
|
44018
|
+
);
|
|
44019
|
+
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
44020
|
+
if (part.output.type === "json") {
|
|
44021
|
+
const parsedOutput = await validateTypes$1({
|
|
44022
|
+
value: part.output.value,
|
|
44023
|
+
schema: shellOutputSchema
|
|
44024
|
+
});
|
|
44025
|
+
input.push({
|
|
44026
|
+
type: "shell_call_output",
|
|
44027
|
+
call_id: part.toolCallId,
|
|
44028
|
+
output: parsedOutput.output.map((item) => ({
|
|
44029
|
+
stdout: item.stdout,
|
|
44030
|
+
stderr: item.stderr,
|
|
44031
|
+
outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
|
|
44032
|
+
type: "exit",
|
|
44033
|
+
exit_code: item.outcome.exitCode
|
|
44034
|
+
}
|
|
44035
|
+
}))
|
|
44036
|
+
});
|
|
44037
|
+
}
|
|
44038
|
+
break;
|
|
44039
|
+
}
|
|
43581
44040
|
if (store) {
|
|
43582
|
-
const itemId = (
|
|
44041
|
+
const itemId = (_i = (_h = (_g = part.providerOptions) == null ? void 0 : _g[providerOptionsName]) == null ? void 0 : _h.itemId) != null ? _i : part.toolCallId;
|
|
43583
44042
|
input.push({ type: "item_reference", id: itemId });
|
|
43584
44043
|
} else {
|
|
43585
44044
|
warnings.push({
|
|
@@ -43639,10 +44098,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
43639
44098
|
}
|
|
43640
44099
|
}
|
|
43641
44100
|
} else {
|
|
43642
|
-
|
|
43643
|
-
|
|
43644
|
-
|
|
43645
|
-
|
|
44101
|
+
const encryptedContent = providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent;
|
|
44102
|
+
if (encryptedContent != null) {
|
|
44103
|
+
const summaryParts = [];
|
|
44104
|
+
if (part.text.length > 0) {
|
|
44105
|
+
summaryParts.push({
|
|
44106
|
+
type: "summary_text",
|
|
44107
|
+
text: part.text
|
|
44108
|
+
});
|
|
44109
|
+
}
|
|
44110
|
+
input.push({
|
|
44111
|
+
type: "reasoning",
|
|
44112
|
+
encrypted_content: encryptedContent,
|
|
44113
|
+
summary: summaryParts
|
|
44114
|
+
});
|
|
44115
|
+
} else {
|
|
44116
|
+
warnings.push({
|
|
44117
|
+
type: "other",
|
|
44118
|
+
message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
44119
|
+
});
|
|
44120
|
+
}
|
|
43646
44121
|
}
|
|
43647
44122
|
break;
|
|
43648
44123
|
}
|
|
@@ -43673,7 +44148,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
43673
44148
|
}
|
|
43674
44149
|
const output = part.output;
|
|
43675
44150
|
if (output.type === "execution-denied") {
|
|
43676
|
-
const approvalId = (
|
|
44151
|
+
const approvalId = (_k = (_j = output.providerOptions) == null ? void 0 : _j.openai) == null ? void 0 : _k.approvalId;
|
|
43677
44152
|
if (approvalId) {
|
|
43678
44153
|
continue;
|
|
43679
44154
|
}
|
|
@@ -43732,7 +44207,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
43732
44207
|
contentValue = output.value;
|
|
43733
44208
|
break;
|
|
43734
44209
|
case "execution-denied":
|
|
43735
|
-
contentValue = (
|
|
44210
|
+
contentValue = (_l = output.reason) != null ? _l : "Tool execution denied.";
|
|
43736
44211
|
break;
|
|
43737
44212
|
case "json":
|
|
43738
44213
|
case "error-json":
|
|
@@ -43859,7 +44334,8 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
43859
44334
|
item: discriminatedUnion("type", [
|
|
43860
44335
|
object$2({
|
|
43861
44336
|
type: literal("message"),
|
|
43862
|
-
id: string()
|
|
44337
|
+
id: string(),
|
|
44338
|
+
phase: _enum(["commentary", "final_answer"]).nullish()
|
|
43863
44339
|
}),
|
|
43864
44340
|
object$2({
|
|
43865
44341
|
type: literal("reasoning"),
|
|
@@ -43948,6 +44424,25 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
43948
44424
|
action: object$2({
|
|
43949
44425
|
commands: array$1(string())
|
|
43950
44426
|
})
|
|
44427
|
+
}),
|
|
44428
|
+
object$2({
|
|
44429
|
+
type: literal("shell_call_output"),
|
|
44430
|
+
id: string(),
|
|
44431
|
+
call_id: string(),
|
|
44432
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
44433
|
+
output: array$1(
|
|
44434
|
+
object$2({
|
|
44435
|
+
stdout: string(),
|
|
44436
|
+
stderr: string(),
|
|
44437
|
+
outcome: discriminatedUnion("type", [
|
|
44438
|
+
object$2({ type: literal("timeout") }),
|
|
44439
|
+
object$2({
|
|
44440
|
+
type: literal("exit"),
|
|
44441
|
+
exit_code: number$1()
|
|
44442
|
+
})
|
|
44443
|
+
])
|
|
44444
|
+
})
|
|
44445
|
+
)
|
|
43951
44446
|
})
|
|
43952
44447
|
])
|
|
43953
44448
|
}),
|
|
@@ -43957,7 +44452,8 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
43957
44452
|
item: discriminatedUnion("type", [
|
|
43958
44453
|
object$2({
|
|
43959
44454
|
type: literal("message"),
|
|
43960
|
-
id: string()
|
|
44455
|
+
id: string(),
|
|
44456
|
+
phase: _enum(["commentary", "final_answer"]).nullish()
|
|
43961
44457
|
}),
|
|
43962
44458
|
object$2({
|
|
43963
44459
|
type: literal("reasoning"),
|
|
@@ -44013,7 +44509,7 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
44013
44509
|
url: string().nullish(),
|
|
44014
44510
|
pattern: string().nullish()
|
|
44015
44511
|
})
|
|
44016
|
-
])
|
|
44512
|
+
]).nullish()
|
|
44017
44513
|
}),
|
|
44018
44514
|
object$2({
|
|
44019
44515
|
type: literal("file_search_call"),
|
|
@@ -44127,6 +44623,25 @@ var openaiResponsesChunkSchema = lazySchema(
|
|
|
44127
44623
|
action: object$2({
|
|
44128
44624
|
commands: array$1(string())
|
|
44129
44625
|
})
|
|
44626
|
+
}),
|
|
44627
|
+
object$2({
|
|
44628
|
+
type: literal("shell_call_output"),
|
|
44629
|
+
id: string(),
|
|
44630
|
+
call_id: string(),
|
|
44631
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
44632
|
+
output: array$1(
|
|
44633
|
+
object$2({
|
|
44634
|
+
stdout: string(),
|
|
44635
|
+
stderr: string(),
|
|
44636
|
+
outcome: discriminatedUnion("type", [
|
|
44637
|
+
object$2({ type: literal("timeout") }),
|
|
44638
|
+
object$2({
|
|
44639
|
+
type: literal("exit"),
|
|
44640
|
+
exit_code: number$1()
|
|
44641
|
+
})
|
|
44642
|
+
])
|
|
44643
|
+
})
|
|
44644
|
+
)
|
|
44130
44645
|
})
|
|
44131
44646
|
])
|
|
44132
44647
|
}),
|
|
@@ -44250,6 +44765,7 @@ var openaiResponsesResponseSchema = lazySchema(
|
|
|
44250
44765
|
type: literal("message"),
|
|
44251
44766
|
role: literal("assistant"),
|
|
44252
44767
|
id: string(),
|
|
44768
|
+
phase: _enum(["commentary", "final_answer"]).nullish(),
|
|
44253
44769
|
content: array$1(
|
|
44254
44770
|
object$2({
|
|
44255
44771
|
type: literal("output_text"),
|
|
@@ -44310,7 +44826,10 @@ var openaiResponsesResponseSchema = lazySchema(
|
|
|
44310
44826
|
sources: array$1(
|
|
44311
44827
|
discriminatedUnion("type", [
|
|
44312
44828
|
object$2({ type: literal("url"), url: string() }),
|
|
44313
|
-
object$2({
|
|
44829
|
+
object$2({
|
|
44830
|
+
type: literal("api"),
|
|
44831
|
+
name: string()
|
|
44832
|
+
})
|
|
44314
44833
|
])
|
|
44315
44834
|
).nullish()
|
|
44316
44835
|
}),
|
|
@@ -44323,7 +44842,7 @@ var openaiResponsesResponseSchema = lazySchema(
|
|
|
44323
44842
|
url: string().nullish(),
|
|
44324
44843
|
pattern: string().nullish()
|
|
44325
44844
|
})
|
|
44326
|
-
])
|
|
44845
|
+
]).nullish()
|
|
44327
44846
|
}),
|
|
44328
44847
|
object$2({
|
|
44329
44848
|
type: literal("file_search_call"),
|
|
@@ -44472,6 +44991,25 @@ var openaiResponsesResponseSchema = lazySchema(
|
|
|
44472
44991
|
action: object$2({
|
|
44473
44992
|
commands: array$1(string())
|
|
44474
44993
|
})
|
|
44994
|
+
}),
|
|
44995
|
+
object$2({
|
|
44996
|
+
type: literal("shell_call_output"),
|
|
44997
|
+
id: string(),
|
|
44998
|
+
call_id: string(),
|
|
44999
|
+
status: _enum(["in_progress", "completed", "incomplete"]),
|
|
45000
|
+
output: array$1(
|
|
45001
|
+
object$2({
|
|
45002
|
+
stdout: string(),
|
|
45003
|
+
stderr: string(),
|
|
45004
|
+
outcome: discriminatedUnion("type", [
|
|
45005
|
+
object$2({ type: literal("timeout") }),
|
|
45006
|
+
object$2({
|
|
45007
|
+
type: literal("exit"),
|
|
45008
|
+
exit_code: number$1()
|
|
45009
|
+
})
|
|
45010
|
+
])
|
|
45011
|
+
})
|
|
45012
|
+
)
|
|
44475
45013
|
})
|
|
44476
45014
|
])
|
|
44477
45015
|
).optional(),
|
|
@@ -44688,8 +45226,15 @@ async function prepareResponsesTools({
|
|
|
44688
45226
|
break;
|
|
44689
45227
|
}
|
|
44690
45228
|
case "openai.shell": {
|
|
45229
|
+
const args = await validateTypes$1({
|
|
45230
|
+
value: tool2.args,
|
|
45231
|
+
schema: shellArgsSchema
|
|
45232
|
+
});
|
|
44691
45233
|
openaiTools2.push({
|
|
44692
|
-
type: "shell"
|
|
45234
|
+
type: "shell",
|
|
45235
|
+
...args.environment && {
|
|
45236
|
+
environment: mapShellEnvironment(args.environment)
|
|
45237
|
+
}
|
|
44693
45238
|
});
|
|
44694
45239
|
break;
|
|
44695
45240
|
}
|
|
@@ -44819,6 +45364,52 @@ async function prepareResponsesTools({
|
|
|
44819
45364
|
}
|
|
44820
45365
|
}
|
|
44821
45366
|
}
|
|
45367
|
+
function mapShellEnvironment(environment) {
|
|
45368
|
+
if (environment.type === "containerReference") {
|
|
45369
|
+
const env2 = environment;
|
|
45370
|
+
return {
|
|
45371
|
+
type: "container_reference",
|
|
45372
|
+
container_id: env2.containerId
|
|
45373
|
+
};
|
|
45374
|
+
}
|
|
45375
|
+
if (environment.type === "containerAuto") {
|
|
45376
|
+
const env2 = environment;
|
|
45377
|
+
return {
|
|
45378
|
+
type: "container_auto",
|
|
45379
|
+
file_ids: env2.fileIds,
|
|
45380
|
+
memory_limit: env2.memoryLimit,
|
|
45381
|
+
network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
|
|
45382
|
+
type: "allowlist",
|
|
45383
|
+
allowed_domains: env2.networkPolicy.allowedDomains,
|
|
45384
|
+
domain_secrets: env2.networkPolicy.domainSecrets
|
|
45385
|
+
},
|
|
45386
|
+
skills: mapShellSkills(env2.skills)
|
|
45387
|
+
};
|
|
45388
|
+
}
|
|
45389
|
+
const env = environment;
|
|
45390
|
+
return {
|
|
45391
|
+
type: "local",
|
|
45392
|
+
skills: env.skills
|
|
45393
|
+
};
|
|
45394
|
+
}
|
|
45395
|
+
function mapShellSkills(skills) {
|
|
45396
|
+
return skills == null ? void 0 : skills.map(
|
|
45397
|
+
(skill) => skill.type === "skillReference" ? {
|
|
45398
|
+
type: "skill_reference",
|
|
45399
|
+
skill_id: skill.skillId,
|
|
45400
|
+
version: skill.version
|
|
45401
|
+
} : {
|
|
45402
|
+
type: "inline",
|
|
45403
|
+
name: skill.name,
|
|
45404
|
+
description: skill.description,
|
|
45405
|
+
source: {
|
|
45406
|
+
type: "base64",
|
|
45407
|
+
media_type: skill.source.mediaType,
|
|
45408
|
+
data: skill.source.data
|
|
45409
|
+
}
|
|
45410
|
+
}
|
|
45411
|
+
);
|
|
45412
|
+
}
|
|
44822
45413
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
44823
45414
|
var _a10, _b9;
|
|
44824
45415
|
const mapping = {};
|
|
@@ -44862,7 +45453,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
44862
45453
|
toolChoice,
|
|
44863
45454
|
responseFormat
|
|
44864
45455
|
}) {
|
|
44865
|
-
var _a10, _b9, _c, _d, _e, _f;
|
|
45456
|
+
var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
|
|
44866
45457
|
const warnings = [];
|
|
44867
45458
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
44868
45459
|
if (topK != null) {
|
|
@@ -45066,6 +45657,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45066
45657
|
tools,
|
|
45067
45658
|
toolChoice
|
|
45068
45659
|
});
|
|
45660
|
+
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
45661
|
+
(tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
|
|
45662
|
+
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
45663
|
+
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
45069
45664
|
return {
|
|
45070
45665
|
webSearchToolName,
|
|
45071
45666
|
args: {
|
|
@@ -45076,7 +45671,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45076
45671
|
warnings: [...warnings, ...toolWarnings],
|
|
45077
45672
|
store,
|
|
45078
45673
|
toolNameMapping,
|
|
45079
|
-
providerOptionsName
|
|
45674
|
+
providerOptionsName,
|
|
45675
|
+
isShellProviderExecuted
|
|
45080
45676
|
};
|
|
45081
45677
|
}
|
|
45082
45678
|
async doGenerate(options) {
|
|
@@ -45086,7 +45682,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45086
45682
|
warnings,
|
|
45087
45683
|
webSearchToolName,
|
|
45088
45684
|
toolNameMapping,
|
|
45089
|
-
providerOptionsName
|
|
45685
|
+
providerOptionsName,
|
|
45686
|
+
isShellProviderExecuted
|
|
45090
45687
|
} = await this.getArgs(options);
|
|
45091
45688
|
const url2 = this.config.url({
|
|
45092
45689
|
path: "/responses",
|
|
@@ -45186,6 +45783,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45186
45783
|
commands: part.action.commands
|
|
45187
45784
|
}
|
|
45188
45785
|
}),
|
|
45786
|
+
...isShellProviderExecuted && { providerExecuted: true },
|
|
45189
45787
|
providerMetadata: {
|
|
45190
45788
|
[providerOptionsName]: {
|
|
45191
45789
|
itemId: part.id
|
|
@@ -45194,6 +45792,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45194
45792
|
});
|
|
45195
45793
|
break;
|
|
45196
45794
|
}
|
|
45795
|
+
case "shell_call_output": {
|
|
45796
|
+
content.push({
|
|
45797
|
+
type: "tool-result",
|
|
45798
|
+
toolCallId: part.call_id,
|
|
45799
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
45800
|
+
result: {
|
|
45801
|
+
output: part.output.map((item) => ({
|
|
45802
|
+
stdout: item.stdout,
|
|
45803
|
+
stderr: item.stderr,
|
|
45804
|
+
outcome: item.outcome.type === "exit" ? {
|
|
45805
|
+
type: "exit",
|
|
45806
|
+
exitCode: item.outcome.exit_code
|
|
45807
|
+
} : { type: "timeout" }
|
|
45808
|
+
}))
|
|
45809
|
+
}
|
|
45810
|
+
});
|
|
45811
|
+
break;
|
|
45812
|
+
}
|
|
45197
45813
|
case "message": {
|
|
45198
45814
|
for (const contentPart of part.content) {
|
|
45199
45815
|
if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -45201,6 +45817,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45201
45817
|
}
|
|
45202
45818
|
const providerMetadata2 = {
|
|
45203
45819
|
itemId: part.id,
|
|
45820
|
+
...part.phase != null && { phase: part.phase },
|
|
45204
45821
|
...contentPart.annotations.length > 0 && {
|
|
45205
45822
|
annotations: contentPart.annotations
|
|
45206
45823
|
}
|
|
@@ -45483,7 +46100,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45483
46100
|
webSearchToolName,
|
|
45484
46101
|
toolNameMapping,
|
|
45485
46102
|
store,
|
|
45486
|
-
providerOptionsName
|
|
46103
|
+
providerOptionsName,
|
|
46104
|
+
isShellProviderExecuted
|
|
45487
46105
|
} = await this.getArgs(options);
|
|
45488
46106
|
const { responseHeaders, value: response } = await postJsonToApi$1({
|
|
45489
46107
|
url: this.config.url({
|
|
@@ -45514,6 +46132,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45514
46132
|
let responseId = null;
|
|
45515
46133
|
const ongoingToolCalls = {};
|
|
45516
46134
|
const ongoingAnnotations = [];
|
|
46135
|
+
let activeMessagePhase;
|
|
45517
46136
|
let hasFunctionCall = false;
|
|
45518
46137
|
const activeReasoning = {};
|
|
45519
46138
|
let serviceTier;
|
|
@@ -45524,7 +46143,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45524
46143
|
controller.enqueue({ type: "stream-start", warnings });
|
|
45525
46144
|
},
|
|
45526
46145
|
transform(chunk, controller) {
|
|
45527
|
-
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;
|
|
46146
|
+
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;
|
|
45528
46147
|
if (options.includeRawChunks) {
|
|
45529
46148
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
45530
46149
|
}
|
|
@@ -45662,14 +46281,19 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45662
46281
|
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
45663
46282
|
toolCallId: value.item.call_id
|
|
45664
46283
|
};
|
|
45665
|
-
} else if (value.item.type === "
|
|
46284
|
+
} else if (value.item.type === "shell_call_output") ;
|
|
46285
|
+
else if (value.item.type === "message") {
|
|
45666
46286
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
46287
|
+
activeMessagePhase = (_a10 = value.item.phase) != null ? _a10 : void 0;
|
|
45667
46288
|
controller.enqueue({
|
|
45668
46289
|
type: "text-start",
|
|
45669
46290
|
id: value.item.id,
|
|
45670
46291
|
providerMetadata: {
|
|
45671
46292
|
[providerOptionsName]: {
|
|
45672
|
-
itemId: value.item.id
|
|
46293
|
+
itemId: value.item.id,
|
|
46294
|
+
...value.item.phase != null && {
|
|
46295
|
+
phase: value.item.phase
|
|
46296
|
+
}
|
|
45673
46297
|
}
|
|
45674
46298
|
}
|
|
45675
46299
|
});
|
|
@@ -45684,19 +46308,22 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45684
46308
|
providerMetadata: {
|
|
45685
46309
|
[providerOptionsName]: {
|
|
45686
46310
|
itemId: value.item.id,
|
|
45687
|
-
reasoningEncryptedContent: (
|
|
46311
|
+
reasoningEncryptedContent: (_b9 = value.item.encrypted_content) != null ? _b9 : null
|
|
45688
46312
|
}
|
|
45689
46313
|
}
|
|
45690
46314
|
});
|
|
45691
46315
|
}
|
|
45692
46316
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
45693
46317
|
if (value.item.type === "message") {
|
|
46318
|
+
const phase = (_c = value.item.phase) != null ? _c : activeMessagePhase;
|
|
46319
|
+
activeMessagePhase = void 0;
|
|
45694
46320
|
controller.enqueue({
|
|
45695
46321
|
type: "text-end",
|
|
45696
46322
|
id: value.item.id,
|
|
45697
46323
|
providerMetadata: {
|
|
45698
46324
|
[providerOptionsName]: {
|
|
45699
46325
|
itemId: value.item.id,
|
|
46326
|
+
...phase != null && { phase },
|
|
45700
46327
|
...ongoingAnnotations.length > 0 && {
|
|
45701
46328
|
annotations: ongoingAnnotations
|
|
45702
46329
|
}
|
|
@@ -45761,13 +46388,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45761
46388
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
45762
46389
|
result: {
|
|
45763
46390
|
queries: value.item.queries,
|
|
45764
|
-
results: (
|
|
46391
|
+
results: (_e = (_d = value.item.results) == null ? void 0 : _d.map((result) => ({
|
|
45765
46392
|
attributes: result.attributes,
|
|
45766
46393
|
fileId: result.file_id,
|
|
45767
46394
|
filename: result.filename,
|
|
45768
46395
|
score: result.score,
|
|
45769
46396
|
text: result.text
|
|
45770
|
-
}))) != null ?
|
|
46397
|
+
}))) != null ? _e : null
|
|
45771
46398
|
}
|
|
45772
46399
|
});
|
|
45773
46400
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -45791,10 +46418,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45791
46418
|
});
|
|
45792
46419
|
} else if (value.item.type === "mcp_call") {
|
|
45793
46420
|
ongoingToolCalls[value.output_index] = void 0;
|
|
45794
|
-
const approvalRequestId = (
|
|
45795
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
46421
|
+
const approvalRequestId = (_f = value.item.approval_request_id) != null ? _f : void 0;
|
|
46422
|
+
const aliasedToolCallId = approvalRequestId != null ? (_h = (_g = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
45796
46423
|
approvalRequestId
|
|
45797
|
-
)) != null ?
|
|
46424
|
+
)) != null ? _g : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _h : value.item.id : value.item.id;
|
|
45798
46425
|
const toolName = `mcp.${value.item.name}`;
|
|
45799
46426
|
controller.enqueue({
|
|
45800
46427
|
type: "tool-call",
|
|
@@ -45864,8 +46491,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45864
46491
|
ongoingToolCalls[value.output_index] = void 0;
|
|
45865
46492
|
} else if (value.item.type === "mcp_approval_request") {
|
|
45866
46493
|
ongoingToolCalls[value.output_index] = void 0;
|
|
45867
|
-
const dummyToolCallId = (
|
|
45868
|
-
const approvalRequestId = (
|
|
46494
|
+
const dummyToolCallId = (_k = (_j = (_i = self2.config).generateId) == null ? void 0 : _j.call(_i)) != null ? _k : generateId$1();
|
|
46495
|
+
const approvalRequestId = (_l = value.item.approval_request_id) != null ? _l : value.item.id;
|
|
45869
46496
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
45870
46497
|
approvalRequestId,
|
|
45871
46498
|
dummyToolCallId
|
|
@@ -45915,10 +46542,31 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45915
46542
|
commands: value.item.action.commands
|
|
45916
46543
|
}
|
|
45917
46544
|
}),
|
|
46545
|
+
...isShellProviderExecuted && {
|
|
46546
|
+
providerExecuted: true
|
|
46547
|
+
},
|
|
45918
46548
|
providerMetadata: {
|
|
45919
46549
|
[providerOptionsName]: { itemId: value.item.id }
|
|
45920
46550
|
}
|
|
45921
46551
|
});
|
|
46552
|
+
} else if (value.item.type === "shell_call_output") {
|
|
46553
|
+
controller.enqueue({
|
|
46554
|
+
type: "tool-result",
|
|
46555
|
+
toolCallId: value.item.call_id,
|
|
46556
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
46557
|
+
result: {
|
|
46558
|
+
output: value.item.output.map(
|
|
46559
|
+
(item) => ({
|
|
46560
|
+
stdout: item.stdout,
|
|
46561
|
+
stderr: item.stderr,
|
|
46562
|
+
outcome: item.outcome.type === "exit" ? {
|
|
46563
|
+
type: "exit",
|
|
46564
|
+
exitCode: item.outcome.exit_code
|
|
46565
|
+
} : { type: "timeout" }
|
|
46566
|
+
})
|
|
46567
|
+
)
|
|
46568
|
+
}
|
|
46569
|
+
});
|
|
45922
46570
|
} else if (value.item.type === "reasoning") {
|
|
45923
46571
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
45924
46572
|
const summaryPartIndices = Object.entries(
|
|
@@ -45933,7 +46581,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
45933
46581
|
providerMetadata: {
|
|
45934
46582
|
[providerOptionsName]: {
|
|
45935
46583
|
itemId: value.item.id,
|
|
45936
|
-
reasoningEncryptedContent: (
|
|
46584
|
+
reasoningEncryptedContent: (_m = value.item.encrypted_content) != null ? _m : null
|
|
45937
46585
|
}
|
|
45938
46586
|
}
|
|
45939
46587
|
});
|
|
@@ -46037,7 +46685,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46037
46685
|
id: value.item_id,
|
|
46038
46686
|
delta: value.delta
|
|
46039
46687
|
});
|
|
46040
|
-
if (((
|
|
46688
|
+
if (((_o = (_n = options.providerOptions) == null ? void 0 : _n[providerOptionsName]) == null ? void 0 : _o.logprobs) && value.logprobs) {
|
|
46041
46689
|
logprobs.push(value.logprobs);
|
|
46042
46690
|
}
|
|
46043
46691
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -46066,7 +46714,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46066
46714
|
providerMetadata: {
|
|
46067
46715
|
[providerOptionsName]: {
|
|
46068
46716
|
itemId: value.item_id,
|
|
46069
|
-
reasoningEncryptedContent: (
|
|
46717
|
+
reasoningEncryptedContent: (_q = (_p = activeReasoning[value.item_id]) == null ? void 0 : _p.encryptedContent) != null ? _q : null
|
|
46070
46718
|
}
|
|
46071
46719
|
}
|
|
46072
46720
|
});
|
|
@@ -46100,10 +46748,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46100
46748
|
} else if (isResponseFinishedChunk(value)) {
|
|
46101
46749
|
finishReason = {
|
|
46102
46750
|
unified: mapOpenAIResponseFinishReason({
|
|
46103
|
-
finishReason: (
|
|
46751
|
+
finishReason: (_r = value.response.incomplete_details) == null ? void 0 : _r.reason,
|
|
46104
46752
|
hasFunctionCall
|
|
46105
46753
|
}),
|
|
46106
|
-
raw: (
|
|
46754
|
+
raw: (_t = (_s = value.response.incomplete_details) == null ? void 0 : _s.reason) != null ? _t : void 0
|
|
46107
46755
|
};
|
|
46108
46756
|
usage = value.response.usage;
|
|
46109
46757
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -46115,7 +46763,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46115
46763
|
controller.enqueue({
|
|
46116
46764
|
type: "source",
|
|
46117
46765
|
sourceType: "url",
|
|
46118
|
-
id: (
|
|
46766
|
+
id: (_w = (_v = (_u = self2.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : generateId$1(),
|
|
46119
46767
|
url: value.annotation.url,
|
|
46120
46768
|
title: value.annotation.title
|
|
46121
46769
|
});
|
|
@@ -46123,7 +46771,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46123
46771
|
controller.enqueue({
|
|
46124
46772
|
type: "source",
|
|
46125
46773
|
sourceType: "document",
|
|
46126
|
-
id: (
|
|
46774
|
+
id: (_z = (_y = (_x = self2.config).generateId) == null ? void 0 : _y.call(_x)) != null ? _z : generateId$1(),
|
|
46127
46775
|
mediaType: "text/plain",
|
|
46128
46776
|
title: value.annotation.filename,
|
|
46129
46777
|
filename: value.annotation.filename,
|
|
@@ -46139,7 +46787,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46139
46787
|
controller.enqueue({
|
|
46140
46788
|
type: "source",
|
|
46141
46789
|
sourceType: "document",
|
|
46142
|
-
id: (
|
|
46790
|
+
id: (_C = (_B = (_A = self2.config).generateId) == null ? void 0 : _B.call(_A)) != null ? _C : generateId$1(),
|
|
46143
46791
|
mediaType: "text/plain",
|
|
46144
46792
|
title: value.annotation.filename,
|
|
46145
46793
|
filename: value.annotation.filename,
|
|
@@ -46155,7 +46803,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
46155
46803
|
controller.enqueue({
|
|
46156
46804
|
type: "source",
|
|
46157
46805
|
sourceType: "document",
|
|
46158
|
-
id: (
|
|
46806
|
+
id: (_F = (_E = (_D = self2.config).generateId) == null ? void 0 : _E.call(_D)) != null ? _F : generateId$1(),
|
|
46159
46807
|
mediaType: "application/octet-stream",
|
|
46160
46808
|
title: value.annotation.file_id,
|
|
46161
46809
|
filename: value.annotation.file_id,
|
|
@@ -46235,6 +46883,9 @@ function isErrorChunk(chunk) {
|
|
|
46235
46883
|
}
|
|
46236
46884
|
function mapWebSearchOutput(action) {
|
|
46237
46885
|
var _a10;
|
|
46886
|
+
if (action == null) {
|
|
46887
|
+
return {};
|
|
46888
|
+
}
|
|
46238
46889
|
switch (action.type) {
|
|
46239
46890
|
case "search":
|
|
46240
46891
|
return {
|
|
@@ -46587,7 +47238,7 @@ var OpenAITranscriptionModel = class {
|
|
|
46587
47238
|
};
|
|
46588
47239
|
}
|
|
46589
47240
|
};
|
|
46590
|
-
var VERSION$2 = "3.0.
|
|
47241
|
+
var VERSION$2 = "3.0.36";
|
|
46591
47242
|
function createOpenAI(options = {}) {
|
|
46592
47243
|
var _a10, _b9;
|
|
46593
47244
|
const baseURL = (_a10 = withoutTrailingSlash$1(
|
|
@@ -49096,10 +49747,10 @@ function getMainSkillPathByName(modules, name16) {
|
|
|
49096
49747
|
}
|
|
49097
49748
|
function createSkillTools(modules) {
|
|
49098
49749
|
const getSkillContent = tool({
|
|
49099
|
-
description: "
|
|
49750
|
+
description: "根据技能名称或文档路径获取该技能的完整文档内容。传入 skillName(如 calculator)或 path(如 ./calculator/SKILL.md)。支持 .md、.json、.xml 等各类文本格式文件。",
|
|
49100
49751
|
inputSchema: objectType({
|
|
49101
49752
|
skillName: stringType().optional().describe("技能名称,与目录名一致,如 calculator"),
|
|
49102
|
-
path: stringType().optional().describe("文档相对路径,如 ./calculator/SKILL.md 或 ./product-guide/reference/xxx.
|
|
49753
|
+
path: stringType().optional().describe("文档相对路径,如 ./calculator/SKILL.md 或 ./product-guide/reference/xxx.json")
|
|
49103
49754
|
}),
|
|
49104
49755
|
execute: (args) => {
|
|
49105
49756
|
const { skillName, path: pathArg } = args;
|