@mastra/dynamodb 0.0.0-update-scorers-api-20250801170445 → 0.0.0-usechat-duplicate-20251016110554

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 (41) hide show
  1. package/CHANGELOG.md +1048 -0
  2. package/README.md +0 -4
  3. package/dist/entities/index.d.ts +15 -0
  4. package/dist/entities/index.d.ts.map +1 -1
  5. package/dist/entities/score.d.ts +15 -0
  6. package/dist/entities/score.d.ts.map +1 -1
  7. package/dist/index.cjs +222 -53
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +223 -54
  11. package/dist/index.js.map +1 -1
  12. package/dist/storage/domains/memory/index.d.ts +16 -4
  13. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  14. package/dist/storage/domains/operations/index.d.ts.map +1 -1
  15. package/dist/storage/domains/score/index.d.ts +11 -2
  16. package/dist/storage/domains/score/index.d.ts.map +1 -1
  17. package/dist/storage/domains/traces/index.d.ts +1 -1
  18. package/dist/storage/domains/workflows/index.d.ts +21 -2
  19. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  20. package/dist/storage/index.d.ts +47 -8
  21. package/dist/storage/index.d.ts.map +1 -1
  22. package/package.json +22 -12
  23. package/src/entities/eval.ts +0 -102
  24. package/src/entities/index.ts +0 -27
  25. package/src/entities/message.ts +0 -143
  26. package/src/entities/resource.ts +0 -57
  27. package/src/entities/score.ts +0 -317
  28. package/src/entities/thread.ts +0 -66
  29. package/src/entities/trace.ts +0 -129
  30. package/src/entities/utils.ts +0 -51
  31. package/src/entities/workflow-snapshot.ts +0 -56
  32. package/src/index.ts +0 -1
  33. package/src/storage/docker-compose.yml +0 -16
  34. package/src/storage/domains/legacy-evals/index.ts +0 -243
  35. package/src/storage/domains/memory/index.ts +0 -894
  36. package/src/storage/domains/operations/index.ts +0 -433
  37. package/src/storage/domains/score/index.ts +0 -288
  38. package/src/storage/domains/traces/index.ts +0 -286
  39. package/src/storage/domains/workflows/index.ts +0 -297
  40. package/src/storage/index.test.ts +0 -1420
  41. package/src/storage/index.ts +0 -483
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './storage';
1
+ export * from './storage/index.js';
2
2
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { DynamoDBClient, DescribeTableCommand } from '@aws-sdk/client-dynamodb';
2
2
  import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
3
3
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
4
- import { MastraStorage, StoreOperations, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, LegacyEvalsStorage, TABLE_RESOURCES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
4
+ import { MastraStorage, StoreOperations, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, ScoresStorage, LegacyEvalsStorage, TABLE_AI_SPANS, TABLE_RESOURCES, TABLE_SCORERS, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT, TABLE_MESSAGES, TABLE_THREADS } from '@mastra/core/storage';
5
5
  import { Entity, Service } from 'electrodb';
6
6
  import { MessageList } from '@mastra/core/agent';
7
+ import { saveScorePayloadSchema } from '@mastra/core/scores';
7
8
 
8
9
  // src/storage/index.ts
9
10
 
@@ -370,6 +371,10 @@ var scoreEntity = new Entity({
370
371
  type: "string",
371
372
  required: false
372
373
  },
374
+ spanId: {
375
+ type: "string",
376
+ required: false
377
+ },
373
378
  runId: {
374
379
  type: "string",
375
380
  required: true
@@ -656,6 +661,11 @@ var scoreEntity = new Entity({
656
661
  index: "gsi6",
657
662
  pk: { field: "gsi6pk", composite: ["entity", "threadId"] },
658
663
  sk: { field: "gsi6sk", composite: ["createdAt"] }
664
+ },
665
+ bySpan: {
666
+ index: "gsi7",
667
+ pk: { field: "gsi7pk", composite: ["entity", "traceId", "spanId"] },
668
+ sk: { field: "gsi7sk", composite: ["createdAt"] }
659
669
  }
660
670
  }
661
671
  });
@@ -1121,6 +1131,20 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1121
1131
  // transformed by the ElectroDB entity getters.
1122
1132
  };
1123
1133
  }
1134
+ // Helper function to transform and sort threads
1135
+ transformAndSortThreads(rawThreads, orderBy, sortDirection) {
1136
+ return rawThreads.map((data) => ({
1137
+ ...data,
1138
+ // Convert date strings back to Date objects for consistency
1139
+ createdAt: typeof data.createdAt === "string" ? new Date(data.createdAt) : data.createdAt,
1140
+ updatedAt: typeof data.updatedAt === "string" ? new Date(data.updatedAt) : data.updatedAt
1141
+ })).sort((a, b) => {
1142
+ const fieldA = orderBy === "createdAt" ? a.createdAt : a.updatedAt;
1143
+ const fieldB = orderBy === "createdAt" ? b.createdAt : b.updatedAt;
1144
+ const comparison = fieldA.getTime() - fieldB.getTime();
1145
+ return sortDirection === "DESC" ? -comparison : comparison;
1146
+ });
1147
+ }
1124
1148
  async getThreadById({ threadId }) {
1125
1149
  this.logger.debug("Getting thread by ID", { threadId });
1126
1150
  try {
@@ -1149,21 +1173,20 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1149
1173
  );
1150
1174
  }
1151
1175
  }
1152
- async getThreadsByResourceId({ resourceId }) {
1153
- this.logger.debug("Getting threads by resource ID", { resourceId });
1176
+ /**
1177
+ * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
1178
+ */
1179
+ async getThreadsByResourceId(args) {
1180
+ const resourceId = args.resourceId;
1181
+ const orderBy = this.castThreadOrderBy(args.orderBy);
1182
+ const sortDirection = this.castThreadSortDirection(args.sortDirection);
1183
+ this.logger.debug("Getting threads by resource ID", { resourceId, orderBy, sortDirection });
1154
1184
  try {
1155
1185
  const result = await this.service.entities.thread.query.byResource({ entity: "thread", resourceId }).go();
1156
1186
  if (!result.data.length) {
1157
1187
  return [];
1158
1188
  }
1159
- return result.data.map((data) => ({
1160
- ...data,
1161
- // Convert date strings back to Date objects for consistency
1162
- createdAt: typeof data.createdAt === "string" ? new Date(data.createdAt) : data.createdAt,
1163
- updatedAt: typeof data.updatedAt === "string" ? new Date(data.updatedAt) : data.updatedAt
1164
- // metadata: data.metadata ? JSON.parse(data.metadata) : undefined, // REMOVED by AI
1165
- // metadata is already transformed by the entity's getter
1166
- }));
1189
+ return this.transformAndSortThreads(result.data, orderBy, sortDirection);
1167
1190
  } catch (error) {
1168
1191
  throw new MastraError(
1169
1192
  {
@@ -1185,7 +1208,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1185
1208
  resourceId: thread.resourceId,
1186
1209
  title: thread.title || `Thread ${thread.id}`,
1187
1210
  createdAt: thread.createdAt?.toISOString() || now.toISOString(),
1188
- updatedAt: now.toISOString(),
1211
+ updatedAt: thread.updatedAt?.toISOString() || now.toISOString(),
1189
1212
  metadata: thread.metadata ? JSON.stringify(thread.metadata) : void 0
1190
1213
  };
1191
1214
  try {
@@ -1292,6 +1315,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1292
1315
  }) {
1293
1316
  this.logger.debug("Getting messages", { threadId, selectBy });
1294
1317
  try {
1318
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1295
1319
  const messages = [];
1296
1320
  const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1297
1321
  if (selectBy?.include?.length) {
@@ -1340,7 +1364,37 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1340
1364
  id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_FAILED",
1341
1365
  domain: ErrorDomain.STORAGE,
1342
1366
  category: ErrorCategory.THIRD_PARTY,
1343
- details: { threadId }
1367
+ details: { threadId, resourceId: resourceId ?? "" }
1368
+ },
1369
+ error
1370
+ );
1371
+ }
1372
+ }
1373
+ async getMessagesById({
1374
+ messageIds,
1375
+ format
1376
+ }) {
1377
+ this.logger.debug("Getting messages by ID", { messageIds });
1378
+ if (messageIds.length === 0) return [];
1379
+ try {
1380
+ const results = await Promise.all(
1381
+ messageIds.map((id) => this.service.entities.message.query.primary({ entity: "message", id }).go())
1382
+ );
1383
+ const data = results.map((result) => result.data).flat(1);
1384
+ let parsedMessages = data.map((data2) => this.parseMessageData(data2)).filter((msg) => "content" in msg);
1385
+ const uniqueMessages = parsedMessages.filter(
1386
+ (message, index, self) => index === self.findIndex((m) => m.id === message.id)
1387
+ );
1388
+ const list = new MessageList().add(uniqueMessages, "memory");
1389
+ if (format === `v1`) return list.get.all.v1();
1390
+ return list.get.all.v2();
1391
+ } catch (error) {
1392
+ throw new MastraError(
1393
+ {
1394
+ id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_BY_ID_FAILED",
1395
+ domain: ErrorDomain.STORAGE,
1396
+ category: ErrorCategory.THIRD_PARTY,
1397
+ details: { messageIds: JSON.stringify(messageIds) }
1344
1398
  },
1345
1399
  error
1346
1400
  );
@@ -1420,11 +1474,19 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1420
1474
  }
1421
1475
  async getThreadsByResourceIdPaginated(args) {
1422
1476
  const { resourceId, page = 0, perPage = 100 } = args;
1423
- this.logger.debug("Getting threads by resource ID with pagination", { resourceId, page, perPage });
1477
+ const orderBy = this.castThreadOrderBy(args.orderBy);
1478
+ const sortDirection = this.castThreadSortDirection(args.sortDirection);
1479
+ this.logger.debug("Getting threads by resource ID with pagination", {
1480
+ resourceId,
1481
+ page,
1482
+ perPage,
1483
+ orderBy,
1484
+ sortDirection
1485
+ });
1424
1486
  try {
1425
1487
  const query = this.service.entities.thread.query.byResource({ entity: "thread", resourceId });
1426
1488
  const results = await query.go();
1427
- const allThreads = results.data;
1489
+ const allThreads = this.transformAndSortThreads(results.data, orderBy, sortDirection);
1428
1490
  const startIndex = page * perPage;
1429
1491
  const endIndex = startIndex + perPage;
1430
1492
  const paginatedThreads = allThreads.slice(startIndex, endIndex);
@@ -1457,6 +1519,7 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1457
1519
  const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
1458
1520
  this.logger.debug("Getting messages with pagination", { threadId, page, perPage, fromDate, toDate, limit });
1459
1521
  try {
1522
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1460
1523
  let messages = [];
1461
1524
  if (selectBy?.include?.length) {
1462
1525
  const includeMessages = await this._getIncludedMessages(threadId, selectBy);
@@ -1512,19 +1575,23 @@ var MemoryStorageDynamoDB = class extends MemoryStorage {
1512
1575
  hasMore
1513
1576
  };
1514
1577
  } catch (error) {
1515
- throw new MastraError(
1578
+ const mastraError = new MastraError(
1516
1579
  {
1517
1580
  id: "STORAGE_DYNAMODB_STORE_GET_MESSAGES_PAGINATED_FAILED",
1518
1581
  domain: ErrorDomain.STORAGE,
1519
1582
  category: ErrorCategory.THIRD_PARTY,
1520
- details: { threadId }
1583
+ details: { threadId, resourceId: resourceId ?? "" }
1521
1584
  },
1522
1585
  error
1523
1586
  );
1587
+ this.logger?.trackException?.(mastraError);
1588
+ this.logger?.error?.(mastraError.toString());
1589
+ return { messages: [], total: 0, page, perPage, hasMore: false };
1524
1590
  }
1525
1591
  }
1526
1592
  // Helper method to get included messages with context
1527
1593
  async _getIncludedMessages(threadId, selectBy) {
1594
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
1528
1595
  if (!selectBy?.include?.length) {
1529
1596
  return [];
1530
1597
  }
@@ -1791,7 +1858,8 @@ var StoreOperationsDynamoDB = class extends StoreOperations {
1791
1858
  [TABLE_EVALS]: "eval",
1792
1859
  [TABLE_SCORERS]: "score",
1793
1860
  [TABLE_TRACES]: "trace",
1794
- [TABLE_RESOURCES]: "resource"
1861
+ [TABLE_RESOURCES]: "resource",
1862
+ [TABLE_AI_SPANS]: "ai_span"
1795
1863
  };
1796
1864
  return mapping[tableName] || null;
1797
1865
  }
@@ -2118,34 +2186,47 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2118
2186
  }
2119
2187
  }
2120
2188
  async saveScore(score) {
2121
- this.logger.debug("Saving score", { scorerId: score.scorerId, runId: score.runId });
2189
+ let validatedScore;
2190
+ try {
2191
+ validatedScore = saveScorePayloadSchema.parse(score);
2192
+ } catch (error) {
2193
+ throw new MastraError(
2194
+ {
2195
+ id: "STORAGE_DYNAMODB_STORE_SAVE_SCORE_FAILED",
2196
+ domain: ErrorDomain.STORAGE,
2197
+ category: ErrorCategory.THIRD_PARTY
2198
+ },
2199
+ error
2200
+ );
2201
+ }
2122
2202
  const now = /* @__PURE__ */ new Date();
2123
2203
  const scoreId = `score-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
2124
2204
  const scoreData = {
2125
2205
  entity: "score",
2126
2206
  id: scoreId,
2127
- scorerId: score.scorerId,
2128
- traceId: score.traceId || "",
2129
- runId: score.runId,
2130
- scorer: typeof score.scorer === "string" ? score.scorer : JSON.stringify(score.scorer),
2131
- preprocessStepResult: typeof score.preprocessStepResult === "string" ? score.preprocessStepResult : JSON.stringify(score.preprocessStepResult),
2132
- analyzeStepResult: typeof score.analyzeStepResult === "string" ? score.analyzeStepResult : JSON.stringify(score.analyzeStepResult),
2133
- score: score.score,
2134
- reason: score.reason,
2135
- preprocessPrompt: score.preprocessPrompt,
2136
- generateScorePrompt: score.generateScorePrompt,
2137
- analyzePrompt: score.analyzePrompt,
2138
- reasonPrompt: score.reasonPrompt,
2139
- input: typeof score.input === "string" ? score.input : JSON.stringify(score.input),
2140
- output: typeof score.output === "string" ? score.output : JSON.stringify(score.output),
2141
- additionalContext: typeof score.additionalContext === "string" ? score.additionalContext : JSON.stringify(score.additionalContext),
2142
- runtimeContext: typeof score.runtimeContext === "string" ? score.runtimeContext : JSON.stringify(score.runtimeContext),
2143
- entityType: score.entityType,
2144
- entityData: typeof score.entity === "string" ? score.entity : JSON.stringify(score.entity),
2145
- entityId: score.entityId,
2146
- source: score.source,
2147
- resourceId: score.resourceId || "",
2148
- threadId: score.threadId || "",
2207
+ scorerId: validatedScore.scorerId,
2208
+ traceId: validatedScore.traceId || "",
2209
+ spanId: validatedScore.spanId || "",
2210
+ runId: validatedScore.runId,
2211
+ scorer: typeof validatedScore.scorer === "string" ? validatedScore.scorer : JSON.stringify(validatedScore.scorer),
2212
+ preprocessStepResult: typeof validatedScore.preprocessStepResult === "string" ? validatedScore.preprocessStepResult : JSON.stringify(validatedScore.preprocessStepResult),
2213
+ analyzeStepResult: typeof validatedScore.analyzeStepResult === "string" ? validatedScore.analyzeStepResult : JSON.stringify(validatedScore.analyzeStepResult),
2214
+ score: validatedScore.score,
2215
+ reason: validatedScore.reason,
2216
+ preprocessPrompt: validatedScore.preprocessPrompt,
2217
+ generateScorePrompt: validatedScore.generateScorePrompt,
2218
+ generateReasonPrompt: validatedScore.generateReasonPrompt,
2219
+ analyzePrompt: validatedScore.analyzePrompt,
2220
+ input: typeof validatedScore.input === "string" ? validatedScore.input : JSON.stringify(validatedScore.input),
2221
+ output: typeof validatedScore.output === "string" ? validatedScore.output : JSON.stringify(validatedScore.output),
2222
+ additionalContext: typeof validatedScore.additionalContext === "string" ? validatedScore.additionalContext : JSON.stringify(validatedScore.additionalContext),
2223
+ runtimeContext: typeof validatedScore.runtimeContext === "string" ? validatedScore.runtimeContext : JSON.stringify(validatedScore.runtimeContext),
2224
+ entityType: validatedScore.entityType,
2225
+ entityData: typeof validatedScore.entity === "string" ? validatedScore.entity : JSON.stringify(validatedScore.entity),
2226
+ entityId: validatedScore.entityId,
2227
+ source: validatedScore.source,
2228
+ resourceId: validatedScore.resourceId || "",
2229
+ threadId: validatedScore.threadId || "",
2149
2230
  createdAt: now.toISOString(),
2150
2231
  updatedAt: now.toISOString()
2151
2232
  };
@@ -2174,9 +2255,9 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2174
2255
  scorerId,
2175
2256
  pagination,
2176
2257
  entityId,
2177
- entityType
2258
+ entityType,
2259
+ source
2178
2260
  }) {
2179
- this.logger.debug("Getting scores by scorer ID", { scorerId, pagination, entityId, entityType });
2180
2261
  try {
2181
2262
  const query = this.service.entities.score.query.byScorer({ entity: "score", scorerId });
2182
2263
  const results = await query.go();
@@ -2187,6 +2268,9 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2187
2268
  if (entityType) {
2188
2269
  allScores = allScores.filter((score) => score.entityType === entityType);
2189
2270
  }
2271
+ if (source) {
2272
+ allScores = allScores.filter((score) => score.source === source);
2273
+ }
2190
2274
  allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2191
2275
  const startIndex = pagination.page * pagination.perPage;
2192
2276
  const endIndex = startIndex + pagination.perPage;
@@ -2212,6 +2296,7 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2212
2296
  scorerId: scorerId || "",
2213
2297
  entityId: entityId || "",
2214
2298
  entityType: entityType || "",
2299
+ source: source || "",
2215
2300
  page: pagination.page,
2216
2301
  perPage: pagination.perPage
2217
2302
  }
@@ -2294,6 +2379,43 @@ var ScoresStorageDynamoDB = class extends ScoresStorage {
2294
2379
  );
2295
2380
  }
2296
2381
  }
2382
+ async getScoresBySpan({
2383
+ traceId,
2384
+ spanId,
2385
+ pagination
2386
+ }) {
2387
+ this.logger.debug("Getting scores by span", { traceId, spanId, pagination });
2388
+ try {
2389
+ const query = this.service.entities.score.query.bySpan({ entity: "score", traceId, spanId });
2390
+ const results = await query.go();
2391
+ const allScores = results.data.map((data) => this.parseScoreData(data));
2392
+ allScores.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2393
+ const startIndex = pagination.page * pagination.perPage;
2394
+ const endIndex = startIndex + pagination.perPage;
2395
+ const paginatedScores = allScores.slice(startIndex, endIndex);
2396
+ const total = allScores.length;
2397
+ const hasMore = endIndex < total;
2398
+ return {
2399
+ scores: paginatedScores,
2400
+ pagination: {
2401
+ total,
2402
+ page: pagination.page,
2403
+ perPage: pagination.perPage,
2404
+ hasMore
2405
+ }
2406
+ };
2407
+ } catch (error) {
2408
+ throw new MastraError(
2409
+ {
2410
+ id: "STORAGE_DYNAMODB_STORE_GET_SCORES_BY_SPAN_FAILED",
2411
+ domain: ErrorDomain.STORAGE,
2412
+ category: ErrorCategory.THIRD_PARTY,
2413
+ details: { traceId, spanId, page: pagination.page, perPage: pagination.perPage }
2414
+ },
2415
+ error
2416
+ );
2417
+ }
2418
+ }
2297
2419
  };
2298
2420
  var TracesStorageDynamoDB = class extends TracesStorage {
2299
2421
  service;
@@ -2544,15 +2666,31 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2544
2666
  super();
2545
2667
  this.service = service;
2546
2668
  }
2669
+ updateWorkflowResults({
2670
+ // workflowName,
2671
+ // runId,
2672
+ // stepId,
2673
+ // result,
2674
+ // runtimeContext,
2675
+ }) {
2676
+ throw new Error("Method not implemented.");
2677
+ }
2678
+ updateWorkflowState({
2679
+ // workflowName,
2680
+ // runId,
2681
+ // opts,
2682
+ }) {
2683
+ throw new Error("Method not implemented.");
2684
+ }
2547
2685
  // Workflow operations
2548
2686
  async persistWorkflowSnapshot({
2549
2687
  workflowName,
2550
2688
  runId,
2689
+ resourceId,
2551
2690
  snapshot
2552
2691
  }) {
2553
2692
  this.logger.debug("Persisting workflow snapshot", { workflowName, runId });
2554
2693
  try {
2555
- const resourceId = "resourceId" in snapshot ? snapshot.resourceId : void 0;
2556
2694
  const now = (/* @__PURE__ */ new Date()).toISOString();
2557
2695
  const data = {
2558
2696
  entity: "workflow_snapshot",
@@ -2678,8 +2816,6 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2678
2816
  async getWorkflowRunById(args) {
2679
2817
  const { runId, workflowName } = args;
2680
2818
  this.logger.debug("Getting workflow run by ID", { runId, workflowName });
2681
- console.log("workflowName", workflowName);
2682
- console.log("runId", runId);
2683
2819
  try {
2684
2820
  if (workflowName) {
2685
2821
  this.logger.debug("WorkflowName provided, using direct GET operation.");
@@ -2689,7 +2825,6 @@ var WorkflowStorageDynamoDB = class extends WorkflowsStorage {
2689
2825
  workflow_name: workflowName,
2690
2826
  run_id: runId
2691
2827
  }).go();
2692
- console.log("result", result2);
2693
2828
  if (!result2.data) {
2694
2829
  return null;
2695
2830
  }
@@ -2794,7 +2929,8 @@ var DynamoDBStore = class extends MastraStorage {
2794
2929
  resourceWorkingMemory: true,
2795
2930
  hasColumn: false,
2796
2931
  createTable: false,
2797
- deleteMessages: false
2932
+ deleteMessages: false,
2933
+ getScoresBySpan: true
2798
2934
  };
2799
2935
  }
2800
2936
  /**
@@ -2889,8 +3025,8 @@ var DynamoDBStore = class extends MastraStorage {
2889
3025
  async getThreadById({ threadId }) {
2890
3026
  return this.stores.memory.getThreadById({ threadId });
2891
3027
  }
2892
- async getThreadsByResourceId({ resourceId }) {
2893
- return this.stores.memory.getThreadsByResourceId({ resourceId });
3028
+ async getThreadsByResourceId(args) {
3029
+ return this.stores.memory.getThreadsByResourceId(args);
2894
3030
  }
2895
3031
  async saveThread({ thread }) {
2896
3032
  return this.stores.memory.saveThread({ thread });
@@ -2913,6 +3049,12 @@ var DynamoDBStore = class extends MastraStorage {
2913
3049
  }) {
2914
3050
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format });
2915
3051
  }
3052
+ async getMessagesById({
3053
+ messageIds,
3054
+ format
3055
+ }) {
3056
+ return this.stores.memory.getMessagesById({ messageIds, format });
3057
+ }
2916
3058
  async saveMessages(args) {
2917
3059
  return this.stores.memory.saveMessages(args);
2918
3060
  }
@@ -2936,12 +3078,29 @@ var DynamoDBStore = class extends MastraStorage {
2936
3078
  return this.stores.traces.getTracesPaginated(_args);
2937
3079
  }
2938
3080
  // Workflow operations
3081
+ async updateWorkflowResults({
3082
+ workflowName,
3083
+ runId,
3084
+ stepId,
3085
+ result,
3086
+ runtimeContext
3087
+ }) {
3088
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
3089
+ }
3090
+ async updateWorkflowState({
3091
+ workflowName,
3092
+ runId,
3093
+ opts
3094
+ }) {
3095
+ return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
3096
+ }
2939
3097
  async persistWorkflowSnapshot({
2940
3098
  workflowName,
2941
3099
  runId,
3100
+ resourceId,
2942
3101
  snapshot
2943
3102
  }) {
2944
- return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
3103
+ return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
2945
3104
  }
2946
3105
  async loadWorkflowSnapshot({
2947
3106
  workflowName,
@@ -3022,10 +3181,20 @@ var DynamoDBStore = class extends MastraStorage {
3022
3181
  });
3023
3182
  }
3024
3183
  async getScoresByScorerId({
3025
- scorerId: _scorerId,
3026
- pagination: _pagination
3184
+ scorerId,
3185
+ source,
3186
+ entityId,
3187
+ entityType,
3188
+ pagination
3189
+ }) {
3190
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, entityId, entityType, pagination });
3191
+ }
3192
+ async getScoresBySpan({
3193
+ traceId,
3194
+ spanId,
3195
+ pagination
3027
3196
  }) {
3028
- return this.stores.scores.getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination });
3197
+ return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
3029
3198
  }
3030
3199
  };
3031
3200