@mastra/ai-sdk 1.0.0-beta.1 → 1.0.0-beta.10

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +316 -0
  2. package/README.md +60 -0
  3. package/dist/__tests__/__fixtures__/network.stream.d.ts +2329 -0
  4. package/dist/__tests__/__fixtures__/network.stream.d.ts.map +1 -0
  5. package/dist/_types/@ai-sdk_provider/dist/index.d.ts +1719 -0
  6. package/dist/chat-route.d.ts +90 -3
  7. package/dist/chat-route.d.ts.map +1 -1
  8. package/dist/chunk-DES3K4SD.cjs +17 -0
  9. package/dist/chunk-DES3K4SD.cjs.map +1 -0
  10. package/dist/chunk-KYQEM4AK.js +294 -0
  11. package/dist/chunk-KYQEM4AK.js.map +1 -0
  12. package/dist/chunk-TD7TJ4N5.cjs +297 -0
  13. package/dist/chunk-TD7TJ4N5.cjs.map +1 -0
  14. package/dist/chunk-VUNV25KB.js +14 -0
  15. package/dist/chunk-VUNV25KB.js.map +1 -0
  16. package/dist/convert-messages.d.ts +83 -3
  17. package/dist/convert-messages.d.ts.map +1 -1
  18. package/dist/convert-streams.d.ts +64 -1
  19. package/dist/convert-streams.d.ts.map +1 -1
  20. package/dist/helpers.d.ts +9 -3
  21. package/dist/helpers.d.ts.map +1 -1
  22. package/dist/index.cjs +3864 -118
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +8 -6
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3840 -117
  27. package/dist/index.js.map +1 -1
  28. package/dist/middleware.d.ts +157 -0
  29. package/dist/middleware.d.ts.map +1 -0
  30. package/dist/network-route.d.ts +63 -2
  31. package/dist/network-route.d.ts.map +1 -1
  32. package/dist/token-5ZTQBFQ6.cjs +63 -0
  33. package/dist/token-5ZTQBFQ6.cjs.map +1 -0
  34. package/dist/token-UOO4N54I.js +61 -0
  35. package/dist/token-UOO4N54I.js.map +1 -0
  36. package/dist/token-util-DUN56AZR.cjs +9 -0
  37. package/dist/token-util-DUN56AZR.cjs.map +1 -0
  38. package/dist/token-util-JCUK3SCT.js +7 -0
  39. package/dist/token-util-JCUK3SCT.js.map +1 -0
  40. package/dist/transformers.d.ts +136 -10
  41. package/dist/transformers.d.ts.map +1 -1
  42. package/dist/ui.cjs +0 -1
  43. package/dist/ui.cjs.map +1 -1
  44. package/dist/ui.js +0 -1
  45. package/dist/ui.js.map +1 -1
  46. package/dist/utils.d.ts +2 -1
  47. package/dist/utils.d.ts.map +1 -1
  48. package/dist/workflow-route.d.ts +68 -1
  49. package/dist/workflow-route.d.ts.map +1 -1
  50. package/package.json +9 -7
@@ -0,0 +1,297 @@
1
+ 'use strict';
2
+
3
+ var chunkDES3K4SD_cjs = require('./chunk-DES3K4SD.cjs');
4
+
5
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-error.js
6
+ var require_token_error = chunkDES3K4SD_cjs.__commonJS({
7
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-error.js"(exports, module) {
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var token_error_exports = {};
26
+ __export(token_error_exports, {
27
+ VercelOidcTokenError: () => VercelOidcTokenError
28
+ });
29
+ module.exports = __toCommonJS(token_error_exports);
30
+ var VercelOidcTokenError = class extends Error {
31
+ constructor(message, cause) {
32
+ super(message);
33
+ this.name = "VercelOidcTokenError";
34
+ this.cause = cause;
35
+ }
36
+ toString() {
37
+ if (this.cause) {
38
+ return `${this.name}: ${this.message}: ${this.cause}`;
39
+ }
40
+ return `${this.name}: ${this.message}`;
41
+ }
42
+ };
43
+ }
44
+ });
45
+
46
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-io.js
47
+ var require_token_io = chunkDES3K4SD_cjs.__commonJS({
48
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-io.js"(exports, module) {
49
+ var __create = Object.create;
50
+ var __defProp = Object.defineProperty;
51
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
52
+ var __getOwnPropNames = Object.getOwnPropertyNames;
53
+ var __getProtoOf = Object.getPrototypeOf;
54
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
55
+ var __export = (target, all) => {
56
+ for (var name in all)
57
+ __defProp(target, name, { get: all[name], enumerable: true });
58
+ };
59
+ var __copyProps = (to, from, except, desc) => {
60
+ if (from && typeof from === "object" || typeof from === "function") {
61
+ for (let key of __getOwnPropNames(from))
62
+ if (!__hasOwnProp.call(to, key) && key !== except)
63
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
64
+ }
65
+ return to;
66
+ };
67
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
68
+ // If the importer is in node compatibility mode or this is not an ESM
69
+ // file that has been converted to a CommonJS file using a Babel-
70
+ // compatible transform (i.e. "__esModule" has not been set), then set
71
+ // "default" to the CommonJS "module.exports" for node compatibility.
72
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
73
+ mod
74
+ ));
75
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
76
+ var token_io_exports = {};
77
+ __export(token_io_exports, {
78
+ findRootDir: () => findRootDir,
79
+ getUserDataDir: () => getUserDataDir
80
+ });
81
+ module.exports = __toCommonJS(token_io_exports);
82
+ var import_path = __toESM(chunkDES3K4SD_cjs.__require("path"));
83
+ var import_fs = __toESM(chunkDES3K4SD_cjs.__require("fs"));
84
+ var import_os = __toESM(chunkDES3K4SD_cjs.__require("os"));
85
+ var import_token_error = require_token_error();
86
+ function findRootDir() {
87
+ try {
88
+ let dir = process.cwd();
89
+ while (dir !== import_path.default.dirname(dir)) {
90
+ const pkgPath = import_path.default.join(dir, ".vercel");
91
+ if (import_fs.default.existsSync(pkgPath)) {
92
+ return dir;
93
+ }
94
+ dir = import_path.default.dirname(dir);
95
+ }
96
+ } catch (e) {
97
+ throw new import_token_error.VercelOidcTokenError(
98
+ "Token refresh only supported in node server environments"
99
+ );
100
+ }
101
+ throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
102
+ }
103
+ function getUserDataDir() {
104
+ if (process.env.XDG_DATA_HOME) {
105
+ return process.env.XDG_DATA_HOME;
106
+ }
107
+ switch (import_os.default.platform()) {
108
+ case "darwin":
109
+ return import_path.default.join(import_os.default.homedir(), "Library/Application Support");
110
+ case "linux":
111
+ return import_path.default.join(import_os.default.homedir(), ".local/share");
112
+ case "win32":
113
+ if (process.env.LOCALAPPDATA) {
114
+ return process.env.LOCALAPPDATA;
115
+ }
116
+ return null;
117
+ default:
118
+ return null;
119
+ }
120
+ }
121
+ }
122
+ });
123
+
124
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-util.js
125
+ var require_token_util = chunkDES3K4SD_cjs.__commonJS({
126
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-util.js"(exports, module) {
127
+ var __create = Object.create;
128
+ var __defProp = Object.defineProperty;
129
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
130
+ var __getOwnPropNames = Object.getOwnPropertyNames;
131
+ var __getProtoOf = Object.getPrototypeOf;
132
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
133
+ var __export = (target, all) => {
134
+ for (var name in all)
135
+ __defProp(target, name, { get: all[name], enumerable: true });
136
+ };
137
+ var __copyProps = (to, from, except, desc) => {
138
+ if (from && typeof from === "object" || typeof from === "function") {
139
+ for (let key of __getOwnPropNames(from))
140
+ if (!__hasOwnProp.call(to, key) && key !== except)
141
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
142
+ }
143
+ return to;
144
+ };
145
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
146
+ // If the importer is in node compatibility mode or this is not an ESM
147
+ // file that has been converted to a CommonJS file using a Babel-
148
+ // compatible transform (i.e. "__esModule" has not been set), then set
149
+ // "default" to the CommonJS "module.exports" for node compatibility.
150
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
151
+ mod
152
+ ));
153
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
154
+ var token_util_exports = {};
155
+ __export(token_util_exports, {
156
+ assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
157
+ findProjectInfo: () => findProjectInfo,
158
+ getTokenPayload: () => getTokenPayload,
159
+ getVercelCliToken: () => getVercelCliToken,
160
+ getVercelDataDir: () => getVercelDataDir,
161
+ getVercelOidcToken: () => getVercelOidcToken,
162
+ isExpired: () => isExpired,
163
+ loadToken: () => loadToken,
164
+ saveToken: () => saveToken
165
+ });
166
+ module.exports = __toCommonJS(token_util_exports);
167
+ var path = __toESM(chunkDES3K4SD_cjs.__require("path"));
168
+ var fs = __toESM(chunkDES3K4SD_cjs.__require("fs"));
169
+ var import_token_error = require_token_error();
170
+ var import_token_io = require_token_io();
171
+ function getVercelDataDir() {
172
+ const vercelFolder = "com.vercel.cli";
173
+ const dataDir = (0, import_token_io.getUserDataDir)();
174
+ if (!dataDir) {
175
+ return null;
176
+ }
177
+ return path.join(dataDir, vercelFolder);
178
+ }
179
+ function getVercelCliToken() {
180
+ const dataDir = getVercelDataDir();
181
+ if (!dataDir) {
182
+ return null;
183
+ }
184
+ const tokenPath = path.join(dataDir, "auth.json");
185
+ if (!fs.existsSync(tokenPath)) {
186
+ return null;
187
+ }
188
+ const token = fs.readFileSync(tokenPath, "utf8");
189
+ if (!token) {
190
+ return null;
191
+ }
192
+ return JSON.parse(token).token;
193
+ }
194
+ async function getVercelOidcToken(authToken, projectId, teamId) {
195
+ try {
196
+ const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
197
+ const res = await fetch(url, {
198
+ method: "POST",
199
+ headers: {
200
+ Authorization: `Bearer ${authToken}`
201
+ }
202
+ });
203
+ if (!res.ok) {
204
+ throw new import_token_error.VercelOidcTokenError(
205
+ `Failed to refresh OIDC token: ${res.statusText}`
206
+ );
207
+ }
208
+ const tokenRes = await res.json();
209
+ assertVercelOidcTokenResponse(tokenRes);
210
+ return tokenRes;
211
+ } catch (e) {
212
+ throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);
213
+ }
214
+ }
215
+ function assertVercelOidcTokenResponse(res) {
216
+ if (!res || typeof res !== "object") {
217
+ throw new TypeError("Expected an object");
218
+ }
219
+ if (!("token" in res) || typeof res.token !== "string") {
220
+ throw new TypeError("Expected a string-valued token property");
221
+ }
222
+ }
223
+ function findProjectInfo() {
224
+ const dir = (0, import_token_io.findRootDir)();
225
+ if (!dir) {
226
+ throw new import_token_error.VercelOidcTokenError("Unable to find root directory");
227
+ }
228
+ try {
229
+ const prjPath = path.join(dir, ".vercel", "project.json");
230
+ if (!fs.existsSync(prjPath)) {
231
+ throw new import_token_error.VercelOidcTokenError("project.json not found");
232
+ }
233
+ const prj = JSON.parse(fs.readFileSync(prjPath, "utf8"));
234
+ if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
235
+ throw new TypeError("Expected a string-valued projectId property");
236
+ }
237
+ return { projectId: prj.projectId, teamId: prj.orgId };
238
+ } catch (e) {
239
+ throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);
240
+ }
241
+ }
242
+ function saveToken(token, projectId) {
243
+ try {
244
+ const dir = (0, import_token_io.getUserDataDir)();
245
+ if (!dir) {
246
+ throw new import_token_error.VercelOidcTokenError("Unable to find user data directory");
247
+ }
248
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
249
+ const tokenJson = JSON.stringify(token);
250
+ fs.mkdirSync(path.dirname(tokenPath), { mode: 432, recursive: true });
251
+ fs.writeFileSync(tokenPath, tokenJson);
252
+ fs.chmodSync(tokenPath, 432);
253
+ return;
254
+ } catch (e) {
255
+ throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);
256
+ }
257
+ }
258
+ function loadToken(projectId) {
259
+ try {
260
+ const dir = (0, import_token_io.getUserDataDir)();
261
+ if (!dir) {
262
+ return null;
263
+ }
264
+ const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
265
+ if (!fs.existsSync(tokenPath)) {
266
+ return null;
267
+ }
268
+ const token = JSON.parse(fs.readFileSync(tokenPath, "utf8"));
269
+ assertVercelOidcTokenResponse(token);
270
+ return token;
271
+ } catch (e) {
272
+ throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);
273
+ }
274
+ }
275
+ function getTokenPayload(token) {
276
+ const tokenParts = token.split(".");
277
+ if (tokenParts.length !== 3) {
278
+ throw new import_token_error.VercelOidcTokenError("Invalid token");
279
+ }
280
+ const base64 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
281
+ const padded = base64.padEnd(
282
+ base64.length + (4 - base64.length % 4) % 4,
283
+ "="
284
+ );
285
+ return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
286
+ }
287
+ var TIME_15_MINUTES_IN_MS = 15 * 60 * 1e3;
288
+ function isExpired(token) {
289
+ return token.exp * 1e3 < Date.now() + TIME_15_MINUTES_IN_MS;
290
+ }
291
+ }
292
+ });
293
+
294
+ exports.require_token_error = require_token_error;
295
+ exports.require_token_util = require_token_util;
296
+ //# sourceMappingURL=chunk-TD7TJ4N5.cjs.map
297
+ //# sourceMappingURL=chunk-TD7TJ4N5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-error.js","../../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-io.js","../../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/token-util.js"],"names":["__commonJS","__require"],"mappings":";;;;;AAAA,IAAA,mBAAA,GAAAA,4BAAA,CAAA;AAAA,EAAA,2FAAA,CAAA,OAAA,EAAA,MAAA,EAAA;AACA,IAAA,IAAI,YAAY,MAAA,CAAO,cAAA;AACvB,IAAA,IAAI,mBAAmB,MAAA,CAAO,wBAAA;AAC9B,IAAA,IAAI,oBAAoB,MAAA,CAAO,mBAAA;AAC/B,IAAA,IAAI,YAAA,GAAe,OAAO,SAAA,CAAU,cAAA;AACpC,IAAA,IAAI,QAAA,GAAW,CAAC,MAAA,EAAQ,GAAA,KAAQ;AAC9B,MAAA,KAAA,IAAS,IAAA,IAAQ,GAAA;AACf,QAAA,SAAA,CAAU,MAAA,EAAQ,MAAM,EAAE,GAAA,EAAK,IAAI,IAAI,CAAA,EAAG,UAAA,EAAY,IAAA,EAAM,CAAA;AAAA,IAChE,CAAA;AACA,IAAA,IAAI,WAAA,GAAc,CAAC,EAAA,EAAI,IAAA,EAAM,QAAQ,IAAA,KAAS;AAC5C,MAAA,IAAI,QAAQ,OAAO,IAAA,KAAS,QAAA,IAAY,OAAO,SAAS,UAAA,EAAY;AAClE,QAAA,KAAA,IAAS,GAAA,IAAO,kBAAkB,IAAI,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5.cjs","sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_error_exports = {};\n__export(token_error_exports, {\n VercelOidcTokenError: () => VercelOidcTokenError\n});\nmodule.exports = __toCommonJS(token_error_exports);\nclass VercelOidcTokenError extends Error {\n constructor(message, cause) {\n super(message);\n this.name = \"VercelOidcTokenError\";\n this.cause = cause;\n }\n toString() {\n if (this.cause) {\n return `${this.name}: ${this.message}: ${this.cause}`;\n }\n return `${this.name}: ${this.message}`;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n VercelOidcTokenError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_io_exports = {};\n__export(token_io_exports, {\n findRootDir: () => findRootDir,\n getUserDataDir: () => getUserDataDir\n});\nmodule.exports = __toCommonJS(token_io_exports);\nvar import_path = __toESM(require(\"path\"));\nvar import_fs = __toESM(require(\"fs\"));\nvar import_os = __toESM(require(\"os\"));\nvar import_token_error = require(\"./token-error\");\nfunction findRootDir() {\n try {\n let dir = process.cwd();\n while (dir !== import_path.default.dirname(dir)) {\n const pkgPath = import_path.default.join(dir, \".vercel\");\n if (import_fs.default.existsSync(pkgPath)) {\n return dir;\n }\n dir = import_path.default.dirname(dir);\n }\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(\n \"Token refresh only supported in node server environments\"\n );\n }\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n}\nfunction getUserDataDir() {\n if (process.env.XDG_DATA_HOME) {\n return process.env.XDG_DATA_HOME;\n }\n switch (import_os.default.platform()) {\n case \"darwin\":\n return import_path.default.join(import_os.default.homedir(), \"Library/Application Support\");\n case \"linux\":\n return import_path.default.join(import_os.default.homedir(), \".local/share\");\n case \"win32\":\n if (process.env.LOCALAPPDATA) {\n return process.env.LOCALAPPDATA;\n }\n return null;\n default:\n return null;\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n findRootDir,\n getUserDataDir\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_util_exports = {};\n__export(token_util_exports, {\n assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,\n findProjectInfo: () => findProjectInfo,\n getTokenPayload: () => getTokenPayload,\n getVercelCliToken: () => getVercelCliToken,\n getVercelDataDir: () => getVercelDataDir,\n getVercelOidcToken: () => getVercelOidcToken,\n isExpired: () => isExpired,\n loadToken: () => loadToken,\n saveToken: () => saveToken\n});\nmodule.exports = __toCommonJS(token_util_exports);\nvar path = __toESM(require(\"path\"));\nvar fs = __toESM(require(\"fs\"));\nvar import_token_error = require(\"./token-error\");\nvar import_token_io = require(\"./token-io\");\nfunction getVercelDataDir() {\n const vercelFolder = \"com.vercel.cli\";\n const dataDir = (0, import_token_io.getUserDataDir)();\n if (!dataDir) {\n return null;\n }\n return path.join(dataDir, vercelFolder);\n}\nfunction getVercelCliToken() {\n const dataDir = getVercelDataDir();\n if (!dataDir) {\n return null;\n }\n const tokenPath = path.join(dataDir, \"auth.json\");\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = fs.readFileSync(tokenPath, \"utf8\");\n if (!token) {\n return null;\n }\n return JSON.parse(token).token;\n}\nasync function getVercelOidcToken(authToken, projectId, teamId) {\n try {\n const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : \"\"}`;\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${authToken}`\n }\n });\n if (!res.ok) {\n throw new import_token_error.VercelOidcTokenError(\n `Failed to refresh OIDC token: ${res.statusText}`\n );\n }\n const tokenRes = await res.json();\n assertVercelOidcTokenResponse(tokenRes);\n return tokenRes;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token`, e);\n }\n}\nfunction assertVercelOidcTokenResponse(res) {\n if (!res || typeof res !== \"object\") {\n throw new TypeError(\"Expected an object\");\n }\n if (!(\"token\" in res) || typeof res.token !== \"string\") {\n throw new TypeError(\"Expected a string-valued token property\");\n }\n}\nfunction findProjectInfo() {\n const dir = (0, import_token_io.findRootDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find root directory\");\n }\n try {\n const prjPath = path.join(dir, \".vercel\", \"project.json\");\n if (!fs.existsSync(prjPath)) {\n throw new import_token_error.VercelOidcTokenError(\"project.json not found\");\n }\n const prj = JSON.parse(fs.readFileSync(prjPath, \"utf8\"));\n if (typeof prj.projectId !== \"string\" && typeof prj.orgId !== \"string\") {\n throw new TypeError(\"Expected a string-valued projectId property\");\n }\n return { projectId: prj.projectId, teamId: prj.orgId };\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Unable to find project ID`, e);\n }\n}\nfunction saveToken(token, projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n throw new import_token_error.VercelOidcTokenError(\"Unable to find user data directory\");\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n const tokenJson = JSON.stringify(token);\n fs.mkdirSync(path.dirname(tokenPath), { mode: 432, recursive: true });\n fs.writeFileSync(tokenPath, tokenJson);\n fs.chmodSync(tokenPath, 432);\n return;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to save token`, e);\n }\n}\nfunction loadToken(projectId) {\n try {\n const dir = (0, import_token_io.getUserDataDir)();\n if (!dir) {\n return null;\n }\n const tokenPath = path.join(dir, \"com.vercel.token\", `${projectId}.json`);\n if (!fs.existsSync(tokenPath)) {\n return null;\n }\n const token = JSON.parse(fs.readFileSync(tokenPath, \"utf8\"));\n assertVercelOidcTokenResponse(token);\n return token;\n } catch (e) {\n throw new import_token_error.VercelOidcTokenError(`Failed to load token`, e);\n }\n}\nfunction getTokenPayload(token) {\n const tokenParts = token.split(\".\");\n if (tokenParts.length !== 3) {\n throw new import_token_error.VercelOidcTokenError(\"Invalid token\");\n }\n const base64 = tokenParts[1].replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = base64.padEnd(\n base64.length + (4 - base64.length % 4) % 4,\n \"=\"\n );\n return JSON.parse(Buffer.from(padded, \"base64\").toString(\"utf8\"));\n}\nconst TIME_15_MINUTES_IN_MS = 15 * 60 * 1e3;\nfunction isExpired(token) {\n return token.exp * 1e3 < Date.now() + TIME_15_MINUTES_IN_MS;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n assertVercelOidcTokenResponse,\n findProjectInfo,\n getTokenPayload,\n getVercelCliToken,\n getVercelDataDir,\n getVercelOidcToken,\n isExpired,\n loadToken,\n saveToken\n});\n"]}
@@ -0,0 +1,14 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
+ }) : x)(function(x) {
5
+ if (typeof require !== "undefined") return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+ var __commonJS = (cb, mod) => function __require2() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+
12
+ export { __commonJS, __require };
13
+ //# sourceMappingURL=chunk-VUNV25KB.js.map
14
+ //# sourceMappingURL=chunk-VUNV25KB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-VUNV25KB.js"}
@@ -1,10 +1,90 @@
1
1
  import type { MessageListInput } from '@mastra/core/agent/message-list';
2
2
  /**
3
- * Converts messages to AI SDK V5 UI format
3
+ * Converts messages from various input formats to AI SDK V5 UI message format.
4
+ *
5
+ * This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V5 UIMessage format, which is suitable for use with AI SDK V5 UI components like `useChat()`.
6
+ *
7
+ * @param messages - Messages to convert. Accepts:
8
+ * - `string` - A single text message (treated as user role)
9
+ * - `string[]` - Multiple text messages
10
+ * - `MessageInput` - A single message object in any supported format:
11
+ * - AI SDK V5 UIMessage or ModelMessage
12
+ * - AI SDK V4 UIMessage or CoreMessage
13
+ * - MastraDBMessage (internal storage format)
14
+ * - MastraMessageV1 (legacy format)
15
+ * - `MessageInput[]` - Array of message objects
16
+ *
17
+ * @returns An array of AI SDK V5 UIMessage objects with:
18
+ * - `id` - Unique message identifier
19
+ * - `role` - 'user' | 'assistant' | 'system'
20
+ * - `parts` - Array of UI parts (text, tool results, files, reasoning, etc.)
21
+ * - `metadata` - Optional metadata including createdAt, threadId, resourceId
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { toAISdkV5Messages } from '@mastra/ai-sdk';
26
+ *
27
+ * // Convert simple text messages
28
+ * const messages = toAISdkV5Messages(['Hello', 'How can I help?']);
29
+ *
30
+ * // Convert AI SDK V4 messages to V5 format
31
+ * const v4Messages = [
32
+ * { id: '1', role: 'user', content: 'Hello', parts: [{ type: 'text', text: 'Hello' }] },
33
+ * { id: '2', role: 'assistant', content: 'Hi!', parts: [{ type: 'text', text: 'Hi!' }] }
34
+ * ];
35
+ * const v5Messages = toAISdkV5Messages(v4Messages);
36
+ *
37
+ * // Use with useChat or similar AI SDK V5 hooks
38
+ * const { messages: chatMessages } = useChat({
39
+ * initialMessages: toAISdkV5Messages(storedMessages)
40
+ * });
41
+ * ```
4
42
  */
5
- export declare function toAISdkV5Messages(messages: MessageListInput): import("ai").UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>[];
43
+ export declare function toAISdkV5Messages(messages: MessageListInput): import("@internal/ai-sdk-v5").UIMessage<unknown, import("@internal/ai-sdk-v5").UIDataTypes, import("@internal/ai-sdk-v5").UITools>[];
6
44
  /**
7
- * Converts messages to AI SDK V4 UI format
45
+ * Converts messages from various input formats to AI SDK V4 UI message format.
46
+ *
47
+ * This function accepts messages in multiple formats (strings, AI SDK V4/V5 messages, Mastra DB messages, etc.) and normalizes them to the AI SDK V4 UIMessage format, which is suitable for use with AI SDK V4 UI components.
48
+ *
49
+ * @param messages - Messages to convert. Accepts:
50
+ * - `string` - A single text message (treated as user role)
51
+ * - `string[]` - Multiple text messages
52
+ * - `MessageInput` - A single message object in any supported format:
53
+ * - AI SDK V5 UIMessage or ModelMessage
54
+ * - AI SDK V4 UIMessage or CoreMessage
55
+ * - MastraDBMessage (internal storage format)
56
+ * - MastraMessageV1 (legacy format)
57
+ * - `MessageInput[]` - Array of message objects
58
+ *
59
+ * @returns An array of AI SDK V4 UIMessage objects with:
60
+ * - `id` - Unique message identifier
61
+ * - `role` - 'user' | 'assistant' | 'system'
62
+ * - `content` - Text content of the message
63
+ * - `parts` - Array of UI parts (text, tool-invocation, file, reasoning, etc.)
64
+ * - `createdAt` - Message creation timestamp
65
+ * - `toolInvocations` - Optional array of tool invocations (for assistant messages)
66
+ * - `experimental_attachments` - Optional file attachments
67
+ * - `metadata` - Optional custom metadata
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * import { toAISdkV4Messages } from '@mastra/ai-sdk';
72
+ *
73
+ * // Convert simple text messages
74
+ * const messages = toAISdkV4Messages(['Hello', 'How can I help?']);
75
+ *
76
+ * // Convert AI SDK V5 messages to V4 format for legacy compatibility
77
+ * const v5Messages = [
78
+ * { id: '1', role: 'user', parts: [{ type: 'text', text: 'Hello' }] },
79
+ * { id: '2', role: 'assistant', parts: [{ type: 'text', text: 'Hi!' }] }
80
+ * ];
81
+ * const v4Messages = toAISdkV4Messages(v5Messages);
82
+ *
83
+ * // Use with AI SDK V4 useChat hook
84
+ * const { messages: chatMessages } = useChat({
85
+ * initialMessages: toAISdkV4Messages(storedMessages)
86
+ * });
87
+ * ```
8
88
  */
9
89
  export declare function toAISdkV4Messages(messages: MessageListInput): import("@mastra/core/agent").UIMessageWithMetadata[];
10
90
  //# sourceMappingURL=convert-messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-messages.d.ts","sourceRoot":"","sources":["../src/convert-messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,qFAE3D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,wDAE3D"}
1
+ {"version":3,"file":"convert-messages.d.ts","sourceRoot":"","sources":["../src/convert-messages.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,wIAE3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,wDAE3D"}
@@ -1,12 +1,69 @@
1
1
  import type { MastraModelOutput, OutputSchema, MastraAgentNetworkStream, WorkflowRunOutput } from '@mastra/core/stream';
2
2
  import type { MastraWorkflowStream, Step, WorkflowResult } from '@mastra/core/workflows';
3
- import type { InferUIMessageChunk, UIMessage } from 'ai';
3
+ import type { InferUIMessageChunk, UIMessage, UIMessageStreamOptions } from 'ai';
4
4
  import type { ZodObject, ZodType } from 'zod';
5
+ /**
6
+ * Converts Mastra streams (workflow, agent network, or agent) to AI SDK v5 compatible streams.
7
+ *
8
+ * This function transforms various Mastra stream types into ReadableStream objects that are compatible with the AI SDK v5, enabling seamless integration with AI SDK's streaming capabilities.
9
+ *
10
+ *
11
+ * @param {MastraWorkflowStream | WorkflowRunOutput | MastraAgentNetworkStream | MastraModelOutput} stream
12
+ * The Mastra stream to convert. Can be one of:
13
+ * - MastraWorkflowStream: A workflow execution stream
14
+ * - WorkflowRunOutput: The output of a workflow run
15
+ * - MastraAgentNetworkStream: An agent network execution stream
16
+ * - MastraModelOutput: An agent model output stream
17
+ *
18
+ * @param {Object} options - Conversion options
19
+ * @param {'workflow' | 'network' | 'agent'} options.from - The type of stream being converted. Defaults to 'agent'
20
+ * @param {string} [options.lastMessageId] - (Agent only) The ID of the last message in the conversation
21
+ * @param {boolean} [options.sendStart=true] - (Agent only) Whether to send start events. Defaults to true
22
+ * @param {boolean} [options.sendFinish=true] - (Agent only) Whether to send finish events. Defaults to true
23
+ * @param {boolean} [options.sendReasoning] - (Agent only) Whether to include reasoning in the output
24
+ * @param {boolean} [options.sendSources] - (Agent only) Whether to include sources in the output
25
+ * @param {Function} [options.messageMetadata] - (Agent only) A function that receives the current stream part and returns metadata to attach to start and finish chunks
26
+ * @param {Function} [options.onError] - (Agent only) A function to handle errors during stream conversion. Receives the error and should return a string representation
27
+ *
28
+ * @returns {ReadableStream<InferUIMessageChunk<UIMessage>>} A ReadableStream compatible with AI SDK v5
29
+ *
30
+ * @example
31
+ * // Convert a workflow stream
32
+ * const workflowStream = await workflowRun.stream(...);
33
+ * const aiSDKStream = toAISdkV5Stream(workflowStream, { from: 'workflow' });
34
+ *
35
+ * @example
36
+ * // Convert an agent network stream
37
+ * const networkStream = await agentNetwork.network(...);
38
+ * const aiSDKStream = toAISdkV5Stream(networkStream, { from: 'network' });
39
+ *
40
+ * @example
41
+ * // Convert an agent stream with custom options
42
+ * const agentStream = await agent.stream(...);
43
+ * const aiSDKStream = toAISdkV5Stream(agentStream, {
44
+ * from: 'agent',
45
+ * lastMessageId: 'msg-123',
46
+ * sendReasoning: true,
47
+ * sendSources: true
48
+ * });
49
+ *
50
+ * @example
51
+ * // Convert an agent stream with messageMetadata
52
+ * const aiSDKStream = toAISdkV5Stream(agentStream, {
53
+ * from: 'agent',
54
+ * messageMetadata: ({ part }) => ({
55
+ * timestamp: Date.now(),
56
+ * partType: part.type
57
+ * })
58
+ * });
59
+ */
5
60
  export declare function toAISdkV5Stream<TOutput extends ZodType<any>, TInput extends ZodType<any>, TSteps extends Step<string, any, any, any, any, any>[], TState extends ZodObject<any>>(stream: MastraWorkflowStream<TState, TInput, TOutput, TSteps>, options: {
6
61
  from: 'workflow';
62
+ includeTextStreamParts?: boolean;
7
63
  }): ReadableStream<InferUIMessageChunk<UIMessage>>;
8
64
  export declare function toAISdkV5Stream<TOutput extends ZodType<any>, TInput extends ZodType<any>, TSteps extends Step<string, any, any, any, any, any>[], TState extends ZodObject<any>>(stream: WorkflowRunOutput<WorkflowResult<TState, TInput, TOutput, TSteps>>, options: {
9
65
  from: 'workflow';
66
+ includeTextStreamParts?: boolean;
10
67
  }): ReadableStream<InferUIMessageChunk<UIMessage>>;
11
68
  export declare function toAISdkV5Stream(stream: MastraAgentNetworkStream, options: {
12
69
  from: 'network';
@@ -14,5 +71,11 @@ export declare function toAISdkV5Stream(stream: MastraAgentNetworkStream, option
14
71
  export declare function toAISdkV5Stream<TOutput extends OutputSchema>(stream: MastraModelOutput<TOutput>, options: {
15
72
  from: 'agent';
16
73
  lastMessageId?: string;
74
+ sendStart?: boolean;
75
+ sendFinish?: boolean;
76
+ sendReasoning?: boolean;
77
+ sendSources?: boolean;
78
+ messageMetadata?: UIMessageStreamOptions<UIMessage>['messageMetadata'];
79
+ onError?: UIMessageStreamOptions<UIMessage>['onError'];
17
80
  }): ReadableStream<InferUIMessageChunk<UIMessage>>;
18
81
  //# sourceMappingURL=convert-streams.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-streams.d.ts","sourceRoot":"","sources":["../src/convert-streams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,YAAY,EACZ,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAS9C,wBAAgB,eAAe,CAC7B,OAAO,SAAS,OAAO,CAAC,GAAG,CAAC,EAC5B,MAAM,SAAS,OAAO,CAAC,GAAG,CAAC,EAC3B,MAAM,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EACtD,MAAM,SAAS,SAAS,CAAC,GAAG,CAAC,EAE7B,MAAM,EAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAC7D,OAAO,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAC5B,cAAc,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,wBAAgB,eAAe,CAC7B,OAAO,SAAS,OAAO,CAAC,GAAG,CAAC,EAC5B,MAAM,SAAS,OAAO,CAAC,GAAG,CAAC,EAC3B,MAAM,SAAS,IAAI,CAAC,MAAM,E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AClC,OAAO,EAAE;IACP,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACvE,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC;CACxD,GACA,cAAc,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC"}
package/dist/helpers.d.ts CHANGED
@@ -1,6 +1,12 @@
1
- import type { PartialSchemaOutput, OutputSchema, DataChunkType, ChunkType } from '@mastra/core/stream';
2
- import type { InferUIMessageChunk, ObjectStreamPart, TextStreamPart, ToolSet, UIMessage } from 'ai';
3
- export type OutputChunkType<OUTPUT extends OutputSchema = undefined> = TextStreamPart<ToolSet> | ObjectStreamPart<PartialSchemaOutput<OUTPUT>> | undefined;
1
+ import type { PartialSchemaOutput, OutputSchema, DataChunkType, ChunkType, MastraFinishReason } from '@mastra/core/stream';
2
+ import type { InferUIMessageChunk, ObjectStreamPart, TextStreamPart, ToolSet, UIMessage, FinishReason } from 'ai';
3
+ /**
4
+ * Maps Mastra's extended finish reasons to AI SDK-compatible values.
5
+ * 'tripwire' and 'retry' are Mastra-specific reasons for processor scenarios,
6
+ * which are mapped to 'other' for AI SDK compatibility.
7
+ */
8
+ export declare function toAISDKFinishReason(reason: MastraFinishReason): FinishReason;
9
+ export type OutputChunkType<OUTPUT extends OutputSchema = undefined> = TextStreamPart<ToolSet> | ObjectStreamPart<PartialSchemaOutput<OUTPUT>> | DataChunkType | undefined;
4
10
  export type ToolAgentChunkType = {
5
11
  type: 'tool-agent';
6
12
  toolCallId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"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