@mastra/mssql 0.0.0-fix-multi-modal-for-cloud-20251028082043 → 0.0.0-fix-persist-session-cache-option-mcp-server-20251030161352

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 CHANGED
@@ -1,11 +1,19 @@
1
1
  # @mastra/mssql
2
2
 
3
- ## 0.0.0-fix-multi-modal-for-cloud-20251028082043
3
+ ## 0.0.0-fix-persist-session-cache-option-mcp-server-20251030161352
4
4
 
5
5
  ### Major Changes
6
6
 
7
+ - Update handlers to use `listWorkflowRuns` instead of `getWorkflowRuns`. Fix type names from `StoragelistThreadsByResourceIdInput/Output` to `StorageListThreadsByResourceIdInput/Output`. ([#9507](https://github.com/mastra-ai/mastra/pull/9507))
8
+
9
+ - Add new list methods to storage API: `listMessages`, `listMessagesById`, `listThreadsByResourceId`, and `listWorkflowRuns`. Most methods are currently wrappers around existing methods. Full implementations will be added when migrating away from legacy methods. ([#9489](https://github.com/mastra-ai/mastra/pull/9489))
10
+
11
+ - Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
12
+
7
13
  - Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
8
14
 
15
+ - Remove legacy evals from Mastra ([#9491](https://github.com/mastra-ai/mastra/pull/9491))
16
+
9
17
  ### Minor Changes
10
18
 
11
19
  - Update peer dependencies to match core package version bump (1.0.0) ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
@@ -33,8 +41,8 @@
33
41
 
34
42
  ### Patch Changes
35
43
 
36
- - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
37
- - @mastra/core@0.0.0-fix-multi-modal-for-cloud-20251028082043
44
+ - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
45
+ - @mastra/core@0.0.0-fix-persist-session-cache-option-mcp-server-20251030161352
38
46
 
39
47
  ## 0.4.6
40
48
 
package/dist/index.cjs CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  var error = require('@mastra/core/error');
4
4
  var storage = require('@mastra/core/storage');
5
- var sql3 = require('mssql');
6
- var utils = require('@mastra/core/utils');
5
+ var sql2 = require('mssql');
7
6
  var agent = require('@mastra/core/agent');
7
+ var utils = require('@mastra/core/utils');
8
8
  var crypto = require('crypto');
9
9
  var scores = require('@mastra/core/scores');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
13
- var sql3__default = /*#__PURE__*/_interopDefault(sql3);
13
+ var sql2__default = /*#__PURE__*/_interopDefault(sql2);
14
14
 
15
15
  // src/storage/index.ts
16
16
  function getSchemaName(schema) {
@@ -86,153 +86,7 @@ function transformFromSqlRow({
86
86
  return result;
87
87
  }
88
88
 
89
- // src/storage/domains/legacy-evals/index.ts
90
- function transformEvalRow(row) {
91
- let testInfoValue = null, resultValue = null;
92
- if (row.test_info) {
93
- try {
94
- testInfoValue = typeof row.test_info === "string" ? JSON.parse(row.test_info) : row.test_info;
95
- } catch {
96
- }
97
- }
98
- if (row.result) {
99
- try {
100
- resultValue = typeof row.result === "string" ? JSON.parse(row.result) : row.result;
101
- } catch {
102
- }
103
- }
104
- return {
105
- agentName: row.agent_name,
106
- input: row.input,
107
- output: row.output,
108
- result: resultValue,
109
- metricName: row.metric_name,
110
- instructions: row.instructions,
111
- testInfo: testInfoValue,
112
- globalRunId: row.global_run_id,
113
- runId: row.run_id,
114
- createdAt: row.created_at
115
- };
116
- }
117
- var LegacyEvalsMSSQL = class extends storage.LegacyEvalsStorage {
118
- pool;
119
- schema;
120
- constructor({ pool, schema }) {
121
- super();
122
- this.pool = pool;
123
- this.schema = schema;
124
- }
125
- /** @deprecated use getEvals instead */
126
- async getEvalsByAgentName(agentName, type) {
127
- try {
128
- let query = `SELECT * FROM ${getTableName({ indexName: storage.TABLE_EVALS, schemaName: getSchemaName(this.schema) })} WHERE agent_name = @p1`;
129
- if (type === "test") {
130
- query += " AND test_info IS NOT NULL AND JSON_VALUE(test_info, '$.testPath') IS NOT NULL";
131
- } else if (type === "live") {
132
- query += " AND (test_info IS NULL OR JSON_VALUE(test_info, '$.testPath') IS NULL)";
133
- }
134
- query += " ORDER BY created_at DESC";
135
- const request = this.pool.request();
136
- request.input("p1", agentName);
137
- const result = await request.query(query);
138
- const rows = result.recordset;
139
- return typeof transformEvalRow === "function" ? rows?.map((row) => transformEvalRow(row)) ?? [] : rows ?? [];
140
- } catch (error) {
141
- if (error && error.number === 208 && error.message && error.message.includes("Invalid object name")) {
142
- return [];
143
- }
144
- this.logger?.error?.("Failed to get evals for the specified agent:", error);
145
- throw error;
146
- }
147
- }
148
- async getEvals(options = {}) {
149
- const { agentName, type, page = 0, perPage = 100, dateRange } = options;
150
- const fromDate = dateRange?.start;
151
- const toDate = dateRange?.end;
152
- const where = [];
153
- const params = {};
154
- if (agentName) {
155
- where.push("agent_name = @agentName");
156
- params["agentName"] = agentName;
157
- }
158
- if (type === "test") {
159
- where.push("test_info IS NOT NULL AND JSON_VALUE(test_info, '$.testPath') IS NOT NULL");
160
- } else if (type === "live") {
161
- where.push("(test_info IS NULL OR JSON_VALUE(test_info, '$.testPath') IS NULL)");
162
- }
163
- if (fromDate instanceof Date && !isNaN(fromDate.getTime())) {
164
- where.push(`[created_at] >= @fromDate`);
165
- params[`fromDate`] = fromDate.toISOString();
166
- }
167
- if (toDate instanceof Date && !isNaN(toDate.getTime())) {
168
- where.push(`[created_at] <= @toDate`);
169
- params[`toDate`] = toDate.toISOString();
170
- }
171
- const whereClause = where.length > 0 ? `WHERE ${where.join(" AND ")}` : "";
172
- const tableName = getTableName({ indexName: storage.TABLE_EVALS, schemaName: getSchemaName(this.schema) });
173
- const offset = page * perPage;
174
- const countQuery = `SELECT COUNT(*) as total FROM ${tableName} ${whereClause}`;
175
- const dataQuery = `SELECT * FROM ${tableName} ${whereClause} ORDER BY seq_id DESC OFFSET @offset ROWS FETCH NEXT @perPage ROWS ONLY`;
176
- try {
177
- const countReq = this.pool.request();
178
- Object.entries(params).forEach(([key, value]) => {
179
- if (value instanceof Date) {
180
- countReq.input(key, sql3__default.default.DateTime, value);
181
- } else {
182
- countReq.input(key, value);
183
- }
184
- });
185
- const countResult = await countReq.query(countQuery);
186
- const total = countResult.recordset[0]?.total || 0;
187
- if (total === 0) {
188
- return {
189
- evals: [],
190
- total: 0,
191
- page,
192
- perPage,
193
- hasMore: false
194
- };
195
- }
196
- const req = this.pool.request();
197
- Object.entries(params).forEach(([key, value]) => {
198
- if (value instanceof Date) {
199
- req.input(key, sql3__default.default.DateTime, value);
200
- } else {
201
- req.input(key, value);
202
- }
203
- });
204
- req.input("offset", offset);
205
- req.input("perPage", perPage);
206
- const result = await req.query(dataQuery);
207
- const rows = result.recordset;
208
- return {
209
- evals: rows?.map((row) => transformEvalRow(row)) ?? [],
210
- total,
211
- page,
212
- perPage,
213
- hasMore: offset + (rows?.length ?? 0) < total
214
- };
215
- } catch (error$1) {
216
- const mastraError = new error.MastraError(
217
- {
218
- id: "MASTRA_STORAGE_MSSQL_STORE_GET_EVALS_FAILED",
219
- domain: error.ErrorDomain.STORAGE,
220
- category: error.ErrorCategory.THIRD_PARTY,
221
- details: {
222
- agentName: agentName || "all",
223
- type: type || "all",
224
- page,
225
- perPage
226
- }
227
- },
228
- error$1
229
- );
230
- this.logger?.error?.(mastraError.toString());
231
- this.logger?.trackException?.(mastraError);
232
- throw mastraError;
233
- }
234
- }
235
- };
89
+ // src/storage/domains/memory/index.ts
236
90
  var MemoryMSSQL = class extends storage.MemoryStorage {
237
91
  pool;
238
92
  schema;
@@ -264,7 +118,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
264
118
  }
265
119
  async getThreadById({ threadId }) {
266
120
  try {
267
- const sql6 = `SELECT
121
+ const sql5 = `SELECT
268
122
  id,
269
123
  [resourceId],
270
124
  title,
@@ -275,7 +129,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
275
129
  WHERE id = @threadId`;
276
130
  const request = this.pool.request();
277
131
  request.input("threadId", threadId);
278
- const resultSet = await request.query(sql6);
132
+ const resultSet = await request.query(sql5);
279
133
  const thread = resultSet.recordset[0] || null;
280
134
  if (!thread) {
281
135
  return null;
@@ -381,12 +235,12 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
381
235
  req.input("title", thread.title);
382
236
  const metadata = thread.metadata ? JSON.stringify(thread.metadata) : null;
383
237
  if (metadata === null) {
384
- req.input("metadata", sql3__default.default.NVarChar, null);
238
+ req.input("metadata", sql2__default.default.NVarChar, null);
385
239
  } else {
386
240
  req.input("metadata", metadata);
387
241
  }
388
- req.input("createdAt", sql3__default.default.DateTime2, thread.createdAt);
389
- req.input("updatedAt", sql3__default.default.DateTime2, thread.updatedAt);
242
+ req.input("createdAt", sql2__default.default.DateTime2, thread.createdAt);
243
+ req.input("updatedAt", sql2__default.default.DateTime2, thread.updatedAt);
390
244
  await req.query(mergeSql);
391
245
  return thread;
392
246
  } catch (error$1) {
@@ -455,7 +309,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
455
309
  };
456
310
  try {
457
311
  const table = getTableName({ indexName: storage.TABLE_THREADS, schemaName: getSchemaName(this.schema) });
458
- const sql6 = `UPDATE ${table}
312
+ const sql5 = `UPDATE ${table}
459
313
  SET title = @title,
460
314
  metadata = @metadata,
461
315
  [updatedAt] = @updatedAt
@@ -466,7 +320,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
466
320
  req.input("title", title);
467
321
  req.input("metadata", JSON.stringify(mergedMetadata));
468
322
  req.input("updatedAt", /* @__PURE__ */ new Date());
469
- const result = await req.query(sql6);
323
+ const result = await req.query(sql5);
470
324
  let thread = result.recordset && result.recordset[0];
471
325
  if (thread && "seq_id" in thread) {
472
326
  const { seq_id, ...rest } = thread;
@@ -705,6 +559,20 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
705
559
  return [];
706
560
  }
707
561
  }
562
+ async listMessages(_args) {
563
+ throw new Error(
564
+ `listMessages is not yet implemented by this storage adapter (${this.constructor.name}). This method is currently being rolled out across all storage adapters. Please use getMessages or getMessagesPaginated as an alternative, or wait for the implementation.`
565
+ );
566
+ }
567
+ async listMessagesById({ messageIds }) {
568
+ return this.getMessagesById({ messageIds, format: "v2" });
569
+ }
570
+ async listThreadsByResourceId(args) {
571
+ const { resourceId, limit, offset, orderBy, sortDirection } = args;
572
+ const page = Math.floor(offset / limit);
573
+ const perPage = limit;
574
+ return this.getThreadsByResourceIdPaginated({ resourceId, page, perPage, orderBy, sortDirection });
575
+ }
708
576
  async getMessagesPaginated(args) {
709
577
  const { threadId, resourceId, format, selectBy } = args;
710
578
  const { page = 0, perPage: perPageInput, dateRange } = selectBy?.pagination || {};
@@ -835,7 +703,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
835
703
  "content",
836
704
  typeof message.content === "string" ? message.content : JSON.stringify(message.content)
837
705
  );
838
- request.input("createdAt", sql3__default.default.DateTime2, message.createdAt);
706
+ request.input("createdAt", sql2__default.default.DateTime2, message.createdAt);
839
707
  request.input("role", message.role);
840
708
  request.input("type", message.type || "v2");
841
709
  request.input("resourceId", message.resourceId);
@@ -854,7 +722,7 @@ var MemoryMSSQL = class extends storage.MemoryStorage {
854
722
  await request.query(mergeSql);
855
723
  }
856
724
  const threadReq = transaction.request();
857
- threadReq.input("updatedAt", sql3__default.default.DateTime2, /* @__PURE__ */ new Date());
725
+ threadReq.input("updatedAt", sql2__default.default.DateTime2, /* @__PURE__ */ new Date());
858
726
  threadReq.input("id", threadId);
859
727
  await threadReq.query(`UPDATE ${tableThreads} SET [updatedAt] = @updatedAt WHERE id = @id`);
860
728
  await transaction.commit();
@@ -1556,7 +1424,7 @@ var StoreOperationsMSSQL = class extends storage.StoreOperations {
1556
1424
  const value = record[col];
1557
1425
  const preparedValue = this.prepareValue(value, col, tableName);
1558
1426
  if (preparedValue instanceof Date) {
1559
- request.input(`param${i}`, sql3__default.default.DateTime2, preparedValue);
1427
+ request.input(`param${i}`, sql2__default.default.DateTime2, preparedValue);
1560
1428
  } else if (preparedValue === null || preparedValue === void 0) {
1561
1429
  request.input(`param${i}`, this.getMssqlType(tableName, col), null);
1562
1430
  } else {
@@ -1771,7 +1639,7 @@ ${columns}
1771
1639
  try {
1772
1640
  const keyEntries = Object.entries(keys).map(([key, value]) => [utils.parseSqlIdentifier(key, "column name"), value]);
1773
1641
  const conditions = keyEntries.map(([key], i) => `[${key}] = @param${i}`).join(" AND ");
1774
- const sql6 = `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions}`;
1642
+ const sql5 = `SELECT * FROM ${getTableName({ indexName: tableName, schemaName: getSchemaName(this.schemaName) })} WHERE ${conditions}`;
1775
1643
  const request = this.pool.request();
1776
1644
  keyEntries.forEach(([key, value], i) => {
1777
1645
  const preparedValue = this.prepareValue(value, key, tableName);
@@ -1781,7 +1649,7 @@ ${columns}
1781
1649
  request.input(`param${i}`, preparedValue);
1782
1650
  }
1783
1651
  });
1784
- const resultSet = await request.query(sql6);
1652
+ const resultSet = await request.query(sql5);
1785
1653
  const result = resultSet.recordset[0] || null;
1786
1654
  if (!result) {
1787
1655
  return null;
@@ -1880,23 +1748,23 @@ ${columns}
1880
1748
  const col = storage.TABLE_SCHEMAS[tableName]?.[columnName];
1881
1749
  switch (col?.type) {
1882
1750
  case "text":
1883
- return sql3__default.default.NVarChar;
1751
+ return sql2__default.default.NVarChar;
1884
1752
  case "timestamp":
1885
- return sql3__default.default.DateTime2;
1753
+ return sql2__default.default.DateTime2;
1886
1754
  case "uuid":
1887
- return sql3__default.default.UniqueIdentifier;
1755
+ return sql2__default.default.UniqueIdentifier;
1888
1756
  case "jsonb":
1889
- return sql3__default.default.NVarChar;
1757
+ return sql2__default.default.NVarChar;
1890
1758
  case "integer":
1891
- return sql3__default.default.Int;
1759
+ return sql2__default.default.Int;
1892
1760
  case "bigint":
1893
- return sql3__default.default.BigInt;
1761
+ return sql2__default.default.BigInt;
1894
1762
  case "float":
1895
- return sql3__default.default.Float;
1763
+ return sql2__default.default.Float;
1896
1764
  case "boolean":
1897
- return sql3__default.default.Bit;
1765
+ return sql2__default.default.Bit;
1898
1766
  default:
1899
- return sql3__default.default.NVarChar;
1767
+ return sql2__default.default.NVarChar;
1900
1768
  }
1901
1769
  }
1902
1770
  /**
@@ -2340,11 +2208,6 @@ ${columns}
2340
2208
  table: storage.TABLE_TRACES,
2341
2209
  columns: ["name", "seq_id DESC"]
2342
2210
  },
2343
- {
2344
- name: `${schemaPrefix}mastra_evals_agent_name_seqid_idx`,
2345
- table: storage.TABLE_EVALS,
2346
- columns: ["agent_name", "seq_id DESC"]
2347
- },
2348
2211
  {
2349
2212
  name: `${schemaPrefix}mastra_scores_trace_id_span_id_seqid_idx`,
2350
2213
  table: storage.TABLE_SCORERS,
@@ -2409,7 +2272,7 @@ function transformScoreRow(row) {
2409
2272
  metadata: storage.safelyParseJSON(row.metadata),
2410
2273
  output: storage.safelyParseJSON(row.output),
2411
2274
  additionalContext: storage.safelyParseJSON(row.additionalContext),
2412
- runtimeContext: storage.safelyParseJSON(row.runtimeContext),
2275
+ requestContext: storage.safelyParseJSON(row.requestContext),
2413
2276
  entity: storage.safelyParseJSON(row.entity),
2414
2277
  createdAt: row.createdAt,
2415
2278
  updatedAt: row.updatedAt
@@ -2476,7 +2339,7 @@ var ScoresMSSQL = class extends storage.ScoresStorage {
2476
2339
  input,
2477
2340
  output,
2478
2341
  additionalContext,
2479
- runtimeContext,
2342
+ requestContext,
2480
2343
  entity,
2481
2344
  ...rest
2482
2345
  } = validatedScore;
@@ -2491,7 +2354,7 @@ var ScoresMSSQL = class extends storage.ScoresStorage {
2491
2354
  analyzeStepResult: analyzeStepResult || null,
2492
2355
  metadata: metadata || null,
2493
2356
  additionalContext: additionalContext || null,
2494
- runtimeContext: runtimeContext || null,
2357
+ requestContext: requestContext || null,
2495
2358
  entity: entity || null,
2496
2359
  scorer: scorer || null,
2497
2360
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2780,13 +2643,13 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
2780
2643
  runId,
2781
2644
  stepId,
2782
2645
  result,
2783
- runtimeContext
2646
+ requestContext
2784
2647
  }) {
2785
2648
  const table = getTableName({ indexName: storage.TABLE_WORKFLOW_SNAPSHOT, schemaName: getSchemaName(this.schema) });
2786
2649
  const transaction = this.pool.transaction();
2787
2650
  try {
2788
2651
  await transaction.begin();
2789
- const selectRequest = new sql3__default.default.Request(transaction);
2652
+ const selectRequest = new sql2__default.default.Request(transaction);
2790
2653
  selectRequest.input("workflow_name", workflowName);
2791
2654
  selectRequest.input("run_id", runId);
2792
2655
  const existingSnapshotResult = await selectRequest.query(
@@ -2805,20 +2668,20 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
2805
2668
  waitingPaths: {},
2806
2669
  status: "pending",
2807
2670
  runId,
2808
- runtimeContext: {}
2671
+ requestContext: {}
2809
2672
  };
2810
2673
  } else {
2811
2674
  const existingSnapshot = existingSnapshotResult.recordset[0].snapshot;
2812
2675
  snapshot = typeof existingSnapshot === "string" ? JSON.parse(existingSnapshot) : existingSnapshot;
2813
2676
  }
2814
2677
  snapshot.context[stepId] = result;
2815
- snapshot.runtimeContext = { ...snapshot.runtimeContext, ...runtimeContext };
2816
- const upsertReq = new sql3__default.default.Request(transaction);
2678
+ snapshot.requestContext = { ...snapshot.requestContext, ...requestContext };
2679
+ const upsertReq = new sql2__default.default.Request(transaction);
2817
2680
  upsertReq.input("workflow_name", workflowName);
2818
2681
  upsertReq.input("run_id", runId);
2819
2682
  upsertReq.input("snapshot", JSON.stringify(snapshot));
2820
- upsertReq.input("createdAt", sql3__default.default.DateTime2, /* @__PURE__ */ new Date());
2821
- upsertReq.input("updatedAt", sql3__default.default.DateTime2, /* @__PURE__ */ new Date());
2683
+ upsertReq.input("createdAt", sql2__default.default.DateTime2, /* @__PURE__ */ new Date());
2684
+ upsertReq.input("updatedAt", sql2__default.default.DateTime2, /* @__PURE__ */ new Date());
2822
2685
  await upsertReq.query(
2823
2686
  `MERGE ${table} AS target
2824
2687
  USING (SELECT @workflow_name AS workflow_name, @run_id AS run_id) AS src
@@ -2858,7 +2721,7 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
2858
2721
  const transaction = this.pool.transaction();
2859
2722
  try {
2860
2723
  await transaction.begin();
2861
- const selectRequest = new sql3__default.default.Request(transaction);
2724
+ const selectRequest = new sql2__default.default.Request(transaction);
2862
2725
  selectRequest.input("workflow_name", workflowName);
2863
2726
  selectRequest.input("run_id", runId);
2864
2727
  const existingSnapshotResult = await selectRequest.query(
@@ -2886,11 +2749,11 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
2886
2749
  );
2887
2750
  }
2888
2751
  const updatedSnapshot = { ...snapshot, ...opts };
2889
- const updateRequest = new sql3__default.default.Request(transaction);
2752
+ const updateRequest = new sql2__default.default.Request(transaction);
2890
2753
  updateRequest.input("snapshot", JSON.stringify(updatedSnapshot));
2891
2754
  updateRequest.input("workflow_name", workflowName);
2892
2755
  updateRequest.input("run_id", runId);
2893
- updateRequest.input("updatedAt", sql3__default.default.DateTime2, /* @__PURE__ */ new Date());
2756
+ updateRequest.input("updatedAt", sql2__default.default.DateTime2, /* @__PURE__ */ new Date());
2894
2757
  await updateRequest.query(
2895
2758
  `UPDATE ${table} SET snapshot = @snapshot, [updatedAt] = @updatedAt WHERE workflow_name = @workflow_name AND run_id = @run_id`
2896
2759
  );
@@ -2929,8 +2792,8 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
2929
2792
  request.input("run_id", runId);
2930
2793
  request.input("resourceId", resourceId);
2931
2794
  request.input("snapshot", JSON.stringify(snapshot));
2932
- request.input("createdAt", sql3__default.default.DateTime2, new Date(now));
2933
- request.input("updatedAt", sql3__default.default.DateTime2, new Date(now));
2795
+ request.input("createdAt", sql2__default.default.DateTime2, new Date(now));
2796
+ request.input("updatedAt", sql2__default.default.DateTime2, new Date(now));
2934
2797
  const mergeSql = `MERGE INTO ${table} AS target
2935
2798
  USING (SELECT @workflow_name AS workflow_name, @run_id AS run_id) AS src
2936
2799
  ON target.workflow_name = src.workflow_name AND target.run_id = src.run_id
@@ -3065,7 +2928,7 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
3065
2928
  const request = this.pool.request();
3066
2929
  Object.entries(paramMap).forEach(([key, value]) => {
3067
2930
  if (value instanceof Date) {
3068
- request.input(key, sql3__default.default.DateTime, value);
2931
+ request.input(key, sql2__default.default.DateTime, value);
3069
2932
  } else {
3070
2933
  request.input(key, value);
3071
2934
  }
@@ -3098,6 +2961,9 @@ var WorkflowsMSSQL = class extends storage.WorkflowsStorage {
3098
2961
  );
3099
2962
  }
3100
2963
  }
2964
+ async listWorkflowRuns(args) {
2965
+ return this.getWorkflowRuns(args);
2966
+ }
3101
2967
  };
3102
2968
 
3103
2969
  // src/storage/index.ts
@@ -3122,7 +2988,7 @@ var MSSQLStore = class extends storage.MastraStorage {
3122
2988
  }
3123
2989
  }
3124
2990
  this.schema = config.schemaName || "dbo";
3125
- this.pool = "connectionString" in config ? new sql3__default.default.ConnectionPool(config.connectionString) : new sql3__default.default.ConnectionPool({
2991
+ this.pool = "connectionString" in config ? new sql2__default.default.ConnectionPool(config.connectionString) : new sql2__default.default.ConnectionPool({
3126
2992
  server: config.server,
3127
2993
  database: config.database,
3128
2994
  user: config.user,
@@ -3130,7 +2996,6 @@ var MSSQLStore = class extends storage.MastraStorage {
3130
2996
  port: config.port,
3131
2997
  options: config.options || { encrypt: true, trustServerCertificate: true }
3132
2998
  });
3133
- const legacyEvals = new LegacyEvalsMSSQL({ pool: this.pool, schema: this.schema });
3134
2999
  const operations = new StoreOperationsMSSQL({ pool: this.pool, schemaName: this.schema });
3135
3000
  const scores = new ScoresMSSQL({ pool: this.pool, operations, schema: this.schema });
3136
3001
  const workflows = new WorkflowsMSSQL({ pool: this.pool, operations, schema: this.schema });
@@ -3140,7 +3005,6 @@ var MSSQLStore = class extends storage.MastraStorage {
3140
3005
  operations,
3141
3006
  scores,
3142
3007
  workflows,
3143
- legacyEvals,
3144
3008
  memory,
3145
3009
  observability
3146
3010
  };
@@ -3199,13 +3063,6 @@ var MSSQLStore = class extends storage.MastraStorage {
3199
3063
  indexManagement: true
3200
3064
  };
3201
3065
  }
3202
- /** @deprecated use getEvals instead */
3203
- async getEvalsByAgentName(agentName, type) {
3204
- return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
3205
- }
3206
- async getEvals(options = {}) {
3207
- return this.stores.legacyEvals.getEvals(options);
3208
- }
3209
3066
  async createTable({
3210
3067
  tableName,
3211
3068
  schema
@@ -3306,9 +3163,9 @@ var MSSQLStore = class extends storage.MastraStorage {
3306
3163
  runId,
3307
3164
  stepId,
3308
3165
  result,
3309
- runtimeContext
3166
+ requestContext
3310
3167
  }) {
3311
- return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
3168
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, requestContext });
3312
3169
  }
3313
3170
  async updateWorkflowState({
3314
3171
  workflowName,