@mastra/react 0.2.1 → 0.2.2-alpha.1
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/CHANGELOG.md +16 -0
- package/dist/{chunk-REDZDNFN-KUvJSx-S.js → chunk-REDZDNFN-C5a6GuK0.js} +2 -2
- package/dist/{chunk-REDZDNFN-KUvJSx-S.js.map → chunk-REDZDNFN-C5a6GuK0.js.map} +1 -1
- package/dist/{chunk-REDZDNFN-BUqjuqg7.cjs → chunk-REDZDNFN-vi5yKtN5.cjs} +2 -2
- package/dist/{chunk-REDZDNFN-BUqjuqg7.cjs.map → chunk-REDZDNFN-vi5yKtN5.cjs.map} +1 -1
- package/dist/{index-CZvmoC3g.cjs → index-DUTv-1fm.cjs} +122 -117
- package/dist/index-DUTv-1fm.cjs.map +1 -0
- package/dist/{index-DeFDfBHe.js → index-OZrcVzMn.js} +124 -119
- package/dist/index-OZrcVzMn.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/src/agent/hooks.d.ts +2 -2
- package/dist/{token-6GSAFR2W-XRCSVUPZ-Poxhi8x5.cjs → token-6GSAFR2W-XRCSVUPZ-CxcM_lpA.cjs} +3 -3
- package/dist/{token-6GSAFR2W-XRCSVUPZ-Poxhi8x5.cjs.map → token-6GSAFR2W-XRCSVUPZ-CxcM_lpA.cjs.map} +1 -1
- package/dist/{token-6GSAFR2W-XRCSVUPZ-CDj_xl7O.js → token-6GSAFR2W-XRCSVUPZ-oh_q0WOI.js} +3 -3
- package/dist/{token-6GSAFR2W-XRCSVUPZ-CDj_xl7O.js.map → token-6GSAFR2W-XRCSVUPZ-oh_q0WOI.js.map} +1 -1
- package/dist/{token-util-NEHG7TUY-U7CX7GS4-IAc7W_zi.cjs → token-util-NEHG7TUY-U7CX7GS4-CwzYo-I6.cjs} +2 -2
- package/dist/{token-util-NEHG7TUY-U7CX7GS4-IAc7W_zi.cjs.map → token-util-NEHG7TUY-U7CX7GS4-CwzYo-I6.cjs.map} +1 -1
- package/dist/{token-util-NEHG7TUY-U7CX7GS4-OABXDW2K.js → token-util-NEHG7TUY-U7CX7GS4-D2Go4cJt.js} +2 -2
- package/dist/{token-util-NEHG7TUY-U7CX7GS4-OABXDW2K.js.map → token-util-NEHG7TUY-U7CX7GS4-D2Go4cJt.js.map} +1 -1
- package/package.json +4 -4
- package/dist/index-CZvmoC3g.cjs.map +0 -1
- package/dist/index-DeFDfBHe.js.map +0 -1
|
@@ -1196,7 +1196,7 @@ var require_token_error = __commonJS$3({
|
|
|
1196
1196
|
var marker$4 = "vercel.ai.error";
|
|
1197
1197
|
var symbol$4 = Symbol.for(marker$4);
|
|
1198
1198
|
var _a$4;
|
|
1199
|
-
var _AISDKError$
|
|
1199
|
+
var _AISDKError$2 = class _AISDKError2 extends Error {
|
|
1200
1200
|
/**
|
|
1201
1201
|
* Creates an AI SDK Error.
|
|
1202
1202
|
*
|
|
@@ -1229,7 +1229,7 @@ var _AISDKError$3 = class _AISDKError2 extends Error {
|
|
|
1229
1229
|
}
|
|
1230
1230
|
};
|
|
1231
1231
|
_a$4 = symbol$4;
|
|
1232
|
-
var AISDKError$3 = _AISDKError$
|
|
1232
|
+
var AISDKError$3 = _AISDKError$2;
|
|
1233
1233
|
var name$1 = "AI_APICallError";
|
|
1234
1234
|
var marker2$1 = `vercel.ai.error.${name$1}`;
|
|
1235
1235
|
var symbol2$1 = Symbol.for(marker2$1);
|
|
@@ -3269,8 +3269,8 @@ var require_get_vercel_oidc_token = __commonJS$3({
|
|
|
3269
3269
|
}
|
|
3270
3270
|
try {
|
|
3271
3271
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
3272
|
-
await Promise.resolve().then(() => require('./token-util-NEHG7TUY-U7CX7GS4-
|
|
3273
|
-
await Promise.resolve().then(() => require('./token-6GSAFR2W-XRCSVUPZ-
|
|
3272
|
+
await Promise.resolve().then(() => require('./token-util-NEHG7TUY-U7CX7GS4-CwzYo-I6.cjs')),
|
|
3273
|
+
await Promise.resolve().then(() => require('./token-6GSAFR2W-XRCSVUPZ-CxcM_lpA.cjs'))
|
|
3274
3274
|
]);
|
|
3275
3275
|
if (!token || isExpired(getTokenPayload(token))) {
|
|
3276
3276
|
await refreshToken();
|
|
@@ -3331,8 +3331,8 @@ var import_oidc2 = __toESM$2(require_dist());
|
|
|
3331
3331
|
var marker$3 = "vercel.ai.gateway.error";
|
|
3332
3332
|
var symbol$3 = Symbol.for(marker$3);
|
|
3333
3333
|
var _a$3;
|
|
3334
|
-
var _b;
|
|
3335
|
-
var GatewayError = class _GatewayError extends (_b = Error, _a$3 = symbol$3, _b) {
|
|
3334
|
+
var _b$1;
|
|
3335
|
+
var GatewayError = class _GatewayError extends (_b$1 = Error, _a$3 = symbol$3, _b$1) {
|
|
3336
3336
|
constructor({
|
|
3337
3337
|
message,
|
|
3338
3338
|
statusCode = 500,
|
|
@@ -3438,8 +3438,8 @@ var name3$3 = "GatewayRateLimitError";
|
|
|
3438
3438
|
var marker4$3 = `vercel.ai.gateway.error.${name3$3}`;
|
|
3439
3439
|
var symbol4$3 = Symbol.for(marker4$3);
|
|
3440
3440
|
var _a4$3;
|
|
3441
|
-
var _b4;
|
|
3442
|
-
var GatewayRateLimitError = class extends (_b4 = GatewayError, _a4$3 = symbol4$3, _b4) {
|
|
3441
|
+
var _b4$1;
|
|
3442
|
+
var GatewayRateLimitError = class extends (_b4$1 = GatewayError, _a4$3 = symbol4$3, _b4$1) {
|
|
3443
3443
|
constructor({
|
|
3444
3444
|
message = "Rate limit exceeded",
|
|
3445
3445
|
statusCode = 429,
|
|
@@ -5996,7 +5996,7 @@ var require_secure_json_parse$1 = __commonJS$2({
|
|
|
5996
5996
|
var marker$2 = "vercel.ai.error";
|
|
5997
5997
|
var symbol$2 = Symbol.for(marker$2);
|
|
5998
5998
|
var _a$2;
|
|
5999
|
-
var _AISDKError$
|
|
5999
|
+
var _AISDKError$1 = class _AISDKError2 extends Error {
|
|
6000
6000
|
/**
|
|
6001
6001
|
* Creates an AI SDK Error.
|
|
6002
6002
|
*
|
|
@@ -6029,7 +6029,7 @@ var _AISDKError$2 = class _AISDKError2 extends Error {
|
|
|
6029
6029
|
}
|
|
6030
6030
|
};
|
|
6031
6031
|
_a$2 = symbol$2;
|
|
6032
|
-
var AISDKError$2 = _AISDKError$
|
|
6032
|
+
var AISDKError$2 = _AISDKError$1;
|
|
6033
6033
|
function getErrorMessage$1(error) {
|
|
6034
6034
|
if (error == null) {
|
|
6035
6035
|
return "unknown error";
|
|
@@ -6330,7 +6330,7 @@ function parseArrayDef$1(def, refs) {
|
|
|
6330
6330
|
const res = {
|
|
6331
6331
|
type: "array"
|
|
6332
6332
|
};
|
|
6333
|
-
if (def.type?._def && def.type?._def?.typeName !==
|
|
6333
|
+
if (def.type?._def && def.type?._def?.typeName !== z3.ZodFirstPartyTypeKind.ZodAny) {
|
|
6334
6334
|
res.items = parseDef$1(def.type._def, {
|
|
6335
6335
|
...refs,
|
|
6336
6336
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -6847,7 +6847,7 @@ function parseRecordDef$1(def, refs) {
|
|
|
6847
6847
|
if (refs.target === "openAi") {
|
|
6848
6848
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
6849
6849
|
}
|
|
6850
|
-
if (refs.target === "openApi3" && def.keyType?._def.typeName ===
|
|
6850
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
6851
6851
|
return {
|
|
6852
6852
|
type: "object",
|
|
6853
6853
|
required: def.keyType._def.values,
|
|
@@ -6871,20 +6871,20 @@ function parseRecordDef$1(def, refs) {
|
|
|
6871
6871
|
if (refs.target === "openApi3") {
|
|
6872
6872
|
return schema;
|
|
6873
6873
|
}
|
|
6874
|
-
if (def.keyType?._def.typeName ===
|
|
6874
|
+
if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
6875
6875
|
const { type, ...keyType } = parseStringDef$1(def.keyType._def, refs);
|
|
6876
6876
|
return {
|
|
6877
6877
|
...schema,
|
|
6878
6878
|
propertyNames: keyType
|
|
6879
6879
|
};
|
|
6880
|
-
} else if (def.keyType?._def.typeName ===
|
|
6880
|
+
} else if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
6881
6881
|
return {
|
|
6882
6882
|
...schema,
|
|
6883
6883
|
propertyNames: {
|
|
6884
6884
|
enum: def.keyType._def.values
|
|
6885
6885
|
}
|
|
6886
6886
|
};
|
|
6887
|
-
} else if (def.keyType?._def.typeName ===
|
|
6887
|
+
} else if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === z3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
6888
6888
|
const { type, ...keyType } = parseBrandedDef$1(def.keyType._def, refs);
|
|
6889
6889
|
return {
|
|
6890
6890
|
...schema,
|
|
@@ -7250,73 +7250,73 @@ var parseReadonlyDef$1 = (def, refs) => {
|
|
|
7250
7250
|
};
|
|
7251
7251
|
var selectParser$1 = (def, typeName, refs) => {
|
|
7252
7252
|
switch (typeName) {
|
|
7253
|
-
case
|
|
7253
|
+
case z3.ZodFirstPartyTypeKind.ZodString:
|
|
7254
7254
|
return parseStringDef$1(def, refs);
|
|
7255
|
-
case
|
|
7255
|
+
case z3.ZodFirstPartyTypeKind.ZodNumber:
|
|
7256
7256
|
return parseNumberDef$1(def, refs);
|
|
7257
|
-
case
|
|
7257
|
+
case z3.ZodFirstPartyTypeKind.ZodObject:
|
|
7258
7258
|
return parseObjectDef$1(def, refs);
|
|
7259
|
-
case
|
|
7259
|
+
case z3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
7260
7260
|
return parseBigintDef$1(def, refs);
|
|
7261
|
-
case
|
|
7261
|
+
case z3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
7262
7262
|
return parseBooleanDef$1();
|
|
7263
|
-
case
|
|
7263
|
+
case z3.ZodFirstPartyTypeKind.ZodDate:
|
|
7264
7264
|
return parseDateDef$1(def, refs);
|
|
7265
|
-
case
|
|
7265
|
+
case z3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
7266
7266
|
return parseUndefinedDef$1(refs);
|
|
7267
|
-
case
|
|
7267
|
+
case z3.ZodFirstPartyTypeKind.ZodNull:
|
|
7268
7268
|
return parseNullDef$1(refs);
|
|
7269
|
-
case
|
|
7269
|
+
case z3.ZodFirstPartyTypeKind.ZodArray:
|
|
7270
7270
|
return parseArrayDef$1(def, refs);
|
|
7271
|
-
case
|
|
7272
|
-
case
|
|
7271
|
+
case z3.ZodFirstPartyTypeKind.ZodUnion:
|
|
7272
|
+
case z3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
7273
7273
|
return parseUnionDef$1(def, refs);
|
|
7274
|
-
case
|
|
7274
|
+
case z3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
7275
7275
|
return parseIntersectionDef$1(def, refs);
|
|
7276
|
-
case
|
|
7276
|
+
case z3.ZodFirstPartyTypeKind.ZodTuple:
|
|
7277
7277
|
return parseTupleDef$1(def, refs);
|
|
7278
|
-
case
|
|
7278
|
+
case z3.ZodFirstPartyTypeKind.ZodRecord:
|
|
7279
7279
|
return parseRecordDef$1(def, refs);
|
|
7280
|
-
case
|
|
7280
|
+
case z3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
7281
7281
|
return parseLiteralDef$1(def, refs);
|
|
7282
|
-
case
|
|
7282
|
+
case z3.ZodFirstPartyTypeKind.ZodEnum:
|
|
7283
7283
|
return parseEnumDef$1(def);
|
|
7284
|
-
case
|
|
7284
|
+
case z3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
7285
7285
|
return parseNativeEnumDef$1(def);
|
|
7286
|
-
case
|
|
7286
|
+
case z3.ZodFirstPartyTypeKind.ZodNullable:
|
|
7287
7287
|
return parseNullableDef$1(def, refs);
|
|
7288
|
-
case
|
|
7288
|
+
case z3.ZodFirstPartyTypeKind.ZodOptional:
|
|
7289
7289
|
return parseOptionalDef$1(def, refs);
|
|
7290
|
-
case
|
|
7290
|
+
case z3.ZodFirstPartyTypeKind.ZodMap:
|
|
7291
7291
|
return parseMapDef$1(def, refs);
|
|
7292
|
-
case
|
|
7292
|
+
case z3.ZodFirstPartyTypeKind.ZodSet:
|
|
7293
7293
|
return parseSetDef$1(def, refs);
|
|
7294
|
-
case
|
|
7294
|
+
case z3.ZodFirstPartyTypeKind.ZodLazy:
|
|
7295
7295
|
return () => def.getter()._def;
|
|
7296
|
-
case
|
|
7296
|
+
case z3.ZodFirstPartyTypeKind.ZodPromise:
|
|
7297
7297
|
return parsePromiseDef$1(def, refs);
|
|
7298
|
-
case
|
|
7299
|
-
case
|
|
7298
|
+
case z3.ZodFirstPartyTypeKind.ZodNaN:
|
|
7299
|
+
case z3.ZodFirstPartyTypeKind.ZodNever:
|
|
7300
7300
|
return parseNeverDef$1(refs);
|
|
7301
|
-
case
|
|
7301
|
+
case z3.ZodFirstPartyTypeKind.ZodEffects:
|
|
7302
7302
|
return parseEffectsDef$1(def, refs);
|
|
7303
|
-
case
|
|
7303
|
+
case z3.ZodFirstPartyTypeKind.ZodAny:
|
|
7304
7304
|
return parseAnyDef$1(refs);
|
|
7305
|
-
case
|
|
7305
|
+
case z3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
7306
7306
|
return parseUnknownDef$1(refs);
|
|
7307
|
-
case
|
|
7307
|
+
case z3.ZodFirstPartyTypeKind.ZodDefault:
|
|
7308
7308
|
return parseDefaultDef$1(def, refs);
|
|
7309
|
-
case
|
|
7309
|
+
case z3.ZodFirstPartyTypeKind.ZodBranded:
|
|
7310
7310
|
return parseBrandedDef$1(def, refs);
|
|
7311
|
-
case
|
|
7311
|
+
case z3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
7312
7312
|
return parseReadonlyDef$1(def, refs);
|
|
7313
|
-
case
|
|
7313
|
+
case z3.ZodFirstPartyTypeKind.ZodCatch:
|
|
7314
7314
|
return parseCatchDef$1(def, refs);
|
|
7315
|
-
case
|
|
7315
|
+
case z3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
7316
7316
|
return parsePipelineDef$1(def, refs);
|
|
7317
|
-
case
|
|
7318
|
-
case
|
|
7319
|
-
case
|
|
7317
|
+
case z3.ZodFirstPartyTypeKind.ZodFunction:
|
|
7318
|
+
case z3.ZodFirstPartyTypeKind.ZodVoid:
|
|
7319
|
+
case z3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
7320
7320
|
return void 0;
|
|
7321
7321
|
default:
|
|
7322
7322
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
@@ -9804,8 +9804,8 @@ function trimStartOfStream$1() {
|
|
|
9804
9804
|
// src/errors/ai-sdk-error.ts
|
|
9805
9805
|
var marker$1 = "vercel.ai.error";
|
|
9806
9806
|
var symbol$1 = Symbol.for(marker$1);
|
|
9807
|
-
var _a$1;
|
|
9808
|
-
var
|
|
9807
|
+
var _a$1, _b;
|
|
9808
|
+
var AISDKError$1 = class _AISDKError extends (_b = Error, _a$1 = symbol$1, _b) {
|
|
9809
9809
|
/**
|
|
9810
9810
|
* Creates an AI SDK Error.
|
|
9811
9811
|
*
|
|
@@ -9837,15 +9837,13 @@ var _AISDKError$1 = class _AISDKError extends Error {
|
|
|
9837
9837
|
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
9838
9838
|
}
|
|
9839
9839
|
};
|
|
9840
|
-
_a$1 = symbol$1;
|
|
9841
|
-
var AISDKError$1 = _AISDKError$1;
|
|
9842
9840
|
|
|
9843
9841
|
// src/errors/invalid-argument-error.ts
|
|
9844
9842
|
var name3$1 = "AI_InvalidArgumentError";
|
|
9845
9843
|
var marker4$1 = `vercel.ai.error.${name3$1}`;
|
|
9846
9844
|
var symbol4$1 = Symbol.for(marker4$1);
|
|
9847
|
-
var _a4$1;
|
|
9848
|
-
var InvalidArgumentError$1 = class InvalidArgumentError extends AISDKError$1 {
|
|
9845
|
+
var _a4$1, _b4;
|
|
9846
|
+
var InvalidArgumentError$1 = class InvalidArgumentError extends (_b4 = AISDKError$1, _a4$1 = symbol4$1, _b4) {
|
|
9849
9847
|
constructor({
|
|
9850
9848
|
message,
|
|
9851
9849
|
cause,
|
|
@@ -9859,7 +9857,6 @@ var InvalidArgumentError$1 = class InvalidArgumentError extends AISDKError$1 {
|
|
|
9859
9857
|
return AISDKError$1.hasMarker(error, marker4$1);
|
|
9860
9858
|
}
|
|
9861
9859
|
};
|
|
9862
|
-
_a4$1 = symbol4$1;
|
|
9863
9860
|
|
|
9864
9861
|
// src/combine-headers.ts
|
|
9865
9862
|
var createIdGenerator$1 = ({
|
|
@@ -13664,10 +13661,15 @@ var MessageList$1 = class MessageList {
|
|
|
13664
13661
|
sealedPartCount = existingParts.length;
|
|
13665
13662
|
}
|
|
13666
13663
|
const incomingParts = messageV2.content.parts;
|
|
13664
|
+
let newParts;
|
|
13667
13665
|
if (incomingParts.length <= sealedPartCount) {
|
|
13668
|
-
|
|
13666
|
+
if (messagesAreEqual(existingMessage, messageV2)) {
|
|
13667
|
+
return this;
|
|
13668
|
+
}
|
|
13669
|
+
newParts = incomingParts;
|
|
13670
|
+
} else {
|
|
13671
|
+
newParts = incomingParts.slice(sealedPartCount);
|
|
13669
13672
|
}
|
|
13670
|
-
const newParts = incomingParts.slice(sealedPartCount);
|
|
13671
13673
|
if (newParts.length > 0) {
|
|
13672
13674
|
messageV2.id = this.generateMessageId?.({ idType: "message", source: "memory" }) ?? uuid.v4();
|
|
13673
13675
|
messageV2.content.parts = newParts;
|
|
@@ -20605,7 +20607,7 @@ function parseArrayDef(def, refs) {
|
|
|
20605
20607
|
const res = {
|
|
20606
20608
|
type: "array"
|
|
20607
20609
|
};
|
|
20608
|
-
if (def.type?._def && def.type?._def?.typeName !==
|
|
20610
|
+
if (def.type?._def && def.type?._def?.typeName !== z3.ZodFirstPartyTypeKind.ZodAny) {
|
|
20609
20611
|
res.items = parseDef(def.type._def, {
|
|
20610
20612
|
...refs,
|
|
20611
20613
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -21122,7 +21124,7 @@ function parseRecordDef(def, refs) {
|
|
|
21122
21124
|
if (refs.target === "openAi") {
|
|
21123
21125
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
21124
21126
|
}
|
|
21125
|
-
if (refs.target === "openApi3" && def.keyType?._def.typeName ===
|
|
21127
|
+
if (refs.target === "openApi3" && def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
21126
21128
|
return {
|
|
21127
21129
|
type: "object",
|
|
21128
21130
|
required: def.keyType._def.values,
|
|
@@ -21146,20 +21148,20 @@ function parseRecordDef(def, refs) {
|
|
|
21146
21148
|
if (refs.target === "openApi3") {
|
|
21147
21149
|
return schema;
|
|
21148
21150
|
}
|
|
21149
|
-
if (def.keyType?._def.typeName ===
|
|
21151
|
+
if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
|
|
21150
21152
|
const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
|
|
21151
21153
|
return {
|
|
21152
21154
|
...schema,
|
|
21153
21155
|
propertyNames: keyType
|
|
21154
21156
|
};
|
|
21155
|
-
} else if (def.keyType?._def.typeName ===
|
|
21157
|
+
} else if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
21156
21158
|
return {
|
|
21157
21159
|
...schema,
|
|
21158
21160
|
propertyNames: {
|
|
21159
21161
|
enum: def.keyType._def.values
|
|
21160
21162
|
}
|
|
21161
21163
|
};
|
|
21162
|
-
} else if (def.keyType?._def.typeName ===
|
|
21164
|
+
} else if (def.keyType?._def.typeName === z3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === z3.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
|
|
21163
21165
|
const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs);
|
|
21164
21166
|
return {
|
|
21165
21167
|
...schema,
|
|
@@ -21525,73 +21527,73 @@ var parseReadonlyDef = (def, refs) => {
|
|
|
21525
21527
|
};
|
|
21526
21528
|
var selectParser = (def, typeName, refs) => {
|
|
21527
21529
|
switch (typeName) {
|
|
21528
|
-
case
|
|
21530
|
+
case z3.ZodFirstPartyTypeKind.ZodString:
|
|
21529
21531
|
return parseStringDef(def, refs);
|
|
21530
|
-
case
|
|
21532
|
+
case z3.ZodFirstPartyTypeKind.ZodNumber:
|
|
21531
21533
|
return parseNumberDef(def, refs);
|
|
21532
|
-
case
|
|
21534
|
+
case z3.ZodFirstPartyTypeKind.ZodObject:
|
|
21533
21535
|
return parseObjectDef(def, refs);
|
|
21534
|
-
case
|
|
21536
|
+
case z3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
21535
21537
|
return parseBigintDef(def, refs);
|
|
21536
|
-
case
|
|
21538
|
+
case z3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
21537
21539
|
return parseBooleanDef();
|
|
21538
|
-
case
|
|
21540
|
+
case z3.ZodFirstPartyTypeKind.ZodDate:
|
|
21539
21541
|
return parseDateDef(def, refs);
|
|
21540
|
-
case
|
|
21542
|
+
case z3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
21541
21543
|
return parseUndefinedDef(refs);
|
|
21542
|
-
case
|
|
21544
|
+
case z3.ZodFirstPartyTypeKind.ZodNull:
|
|
21543
21545
|
return parseNullDef(refs);
|
|
21544
|
-
case
|
|
21546
|
+
case z3.ZodFirstPartyTypeKind.ZodArray:
|
|
21545
21547
|
return parseArrayDef(def, refs);
|
|
21546
|
-
case
|
|
21547
|
-
case
|
|
21548
|
+
case z3.ZodFirstPartyTypeKind.ZodUnion:
|
|
21549
|
+
case z3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
21548
21550
|
return parseUnionDef(def, refs);
|
|
21549
|
-
case
|
|
21551
|
+
case z3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
21550
21552
|
return parseIntersectionDef(def, refs);
|
|
21551
|
-
case
|
|
21553
|
+
case z3.ZodFirstPartyTypeKind.ZodTuple:
|
|
21552
21554
|
return parseTupleDef(def, refs);
|
|
21553
|
-
case
|
|
21555
|
+
case z3.ZodFirstPartyTypeKind.ZodRecord:
|
|
21554
21556
|
return parseRecordDef(def, refs);
|
|
21555
|
-
case
|
|
21557
|
+
case z3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
21556
21558
|
return parseLiteralDef(def, refs);
|
|
21557
|
-
case
|
|
21559
|
+
case z3.ZodFirstPartyTypeKind.ZodEnum:
|
|
21558
21560
|
return parseEnumDef(def);
|
|
21559
|
-
case
|
|
21561
|
+
case z3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
21560
21562
|
return parseNativeEnumDef(def);
|
|
21561
|
-
case
|
|
21563
|
+
case z3.ZodFirstPartyTypeKind.ZodNullable:
|
|
21562
21564
|
return parseNullableDef(def, refs);
|
|
21563
|
-
case
|
|
21565
|
+
case z3.ZodFirstPartyTypeKind.ZodOptional:
|
|
21564
21566
|
return parseOptionalDef(def, refs);
|
|
21565
|
-
case
|
|
21567
|
+
case z3.ZodFirstPartyTypeKind.ZodMap:
|
|
21566
21568
|
return parseMapDef(def, refs);
|
|
21567
|
-
case
|
|
21569
|
+
case z3.ZodFirstPartyTypeKind.ZodSet:
|
|
21568
21570
|
return parseSetDef(def, refs);
|
|
21569
|
-
case
|
|
21571
|
+
case z3.ZodFirstPartyTypeKind.ZodLazy:
|
|
21570
21572
|
return () => def.getter()._def;
|
|
21571
|
-
case
|
|
21573
|
+
case z3.ZodFirstPartyTypeKind.ZodPromise:
|
|
21572
21574
|
return parsePromiseDef(def, refs);
|
|
21573
|
-
case
|
|
21574
|
-
case
|
|
21575
|
+
case z3.ZodFirstPartyTypeKind.ZodNaN:
|
|
21576
|
+
case z3.ZodFirstPartyTypeKind.ZodNever:
|
|
21575
21577
|
return parseNeverDef(refs);
|
|
21576
|
-
case
|
|
21578
|
+
case z3.ZodFirstPartyTypeKind.ZodEffects:
|
|
21577
21579
|
return parseEffectsDef(def, refs);
|
|
21578
|
-
case
|
|
21580
|
+
case z3.ZodFirstPartyTypeKind.ZodAny:
|
|
21579
21581
|
return parseAnyDef(refs);
|
|
21580
|
-
case
|
|
21582
|
+
case z3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
21581
21583
|
return parseUnknownDef(refs);
|
|
21582
|
-
case
|
|
21584
|
+
case z3.ZodFirstPartyTypeKind.ZodDefault:
|
|
21583
21585
|
return parseDefaultDef(def, refs);
|
|
21584
|
-
case
|
|
21586
|
+
case z3.ZodFirstPartyTypeKind.ZodBranded:
|
|
21585
21587
|
return parseBrandedDef(def, refs);
|
|
21586
|
-
case
|
|
21588
|
+
case z3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
21587
21589
|
return parseReadonlyDef(def, refs);
|
|
21588
|
-
case
|
|
21590
|
+
case z3.ZodFirstPartyTypeKind.ZodCatch:
|
|
21589
21591
|
return parseCatchDef(def, refs);
|
|
21590
|
-
case
|
|
21592
|
+
case z3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
21591
21593
|
return parsePipelineDef(def, refs);
|
|
21592
|
-
case
|
|
21593
|
-
case
|
|
21594
|
-
case
|
|
21594
|
+
case z3.ZodFirstPartyTypeKind.ZodFunction:
|
|
21595
|
+
case z3.ZodFirstPartyTypeKind.ZodVoid:
|
|
21596
|
+
case z3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
21595
21597
|
return void 0;
|
|
21596
21598
|
default:
|
|
21597
21599
|
return /* @__PURE__ */ ((_) => void 0)();
|
|
@@ -26572,30 +26574,33 @@ const fromCoreUserMessageToUIMessage = (coreUserMessage) => {
|
|
|
26572
26574
|
};
|
|
26573
26575
|
};
|
|
26574
26576
|
|
|
26575
|
-
const
|
|
26576
|
-
const
|
|
26577
|
-
|
|
26578
|
-
|
|
26579
|
-
|
|
26580
|
-
|
|
26581
|
-
|
|
26582
|
-
return suspensionData.runId;
|
|
26583
|
-
}
|
|
26577
|
+
const extractRunIdFromMessages = (messages) => {
|
|
26578
|
+
for (const message of messages) {
|
|
26579
|
+
const pendingToolApprovals = message.metadata?.pendingToolApprovals;
|
|
26580
|
+
if (pendingToolApprovals && typeof pendingToolApprovals === "object") {
|
|
26581
|
+
const suspensionData = Object.values(pendingToolApprovals)[0];
|
|
26582
|
+
if (suspensionData?.runId) {
|
|
26583
|
+
return suspensionData.runId;
|
|
26584
26584
|
}
|
|
26585
26585
|
}
|
|
26586
|
-
|
|
26587
|
-
|
|
26588
|
-
|
|
26589
|
-
|
|
26590
|
-
const _currentRunId = react.useRef(
|
|
26586
|
+
}
|
|
26587
|
+
return void 0;
|
|
26588
|
+
};
|
|
26589
|
+
const useChat = ({ agentId, resourceId, initialMessages }) => {
|
|
26590
|
+
const _currentRunId = react.useRef(void 0);
|
|
26591
26591
|
const _onChunk = react.useRef(void 0);
|
|
26592
26592
|
const _networkRunId = react.useRef(void 0);
|
|
26593
26593
|
const _onNetworkChunk = react.useRef(void 0);
|
|
26594
|
-
const [messages, setMessages] = react.useState(
|
|
26594
|
+
const [messages, setMessages] = react.useState([]);
|
|
26595
26595
|
const [toolCallApprovals, setToolCallApprovals] = react.useState({});
|
|
26596
26596
|
const [networkToolCallApprovals, setNetworkToolCallApprovals] = react.useState({});
|
|
26597
26597
|
const baseClient = useMastraClient();
|
|
26598
26598
|
const [isRunning, setIsRunning] = react.useState(false);
|
|
26599
|
+
react.useEffect(() => {
|
|
26600
|
+
const formattedMessages = resolveInitialMessages(initialMessages || []);
|
|
26601
|
+
setMessages(formattedMessages);
|
|
26602
|
+
_currentRunId.current = extractRunIdFromMessages(formattedMessages);
|
|
26603
|
+
}, [initialMessages]);
|
|
26599
26604
|
const generate = async ({
|
|
26600
26605
|
coreUserMessages,
|
|
26601
26606
|
requestContext,
|
|
@@ -27746,4 +27751,4 @@ exports.useCreateWorkflowRun = useCreateWorkflowRun;
|
|
|
27746
27751
|
exports.useEntity = useEntity;
|
|
27747
27752
|
exports.useMastraClient = useMastraClient;
|
|
27748
27753
|
exports.useStreamWorkflow = useStreamWorkflow;
|
|
27749
|
-
//# sourceMappingURL=index-
|
|
27754
|
+
//# sourceMappingURL=index-DUTv-1fm.cjs.map
|