@mastra/lance 0.0.0-new-scorer-api-20250801075530 → 0.0.0-playground-studio-cloud-20251031080052

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 (42) hide show
  1. package/CHANGELOG.md +430 -3
  2. package/README.md +3 -3
  3. package/dist/index.cjs +182 -224
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +183 -225
  7. package/dist/index.js.map +1 -1
  8. package/dist/storage/domains/memory/index.d.ts +10 -1
  9. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  10. package/dist/storage/domains/operations/index.d.ts.map +1 -1
  11. package/dist/storage/domains/scores/index.d.ts +13 -2
  12. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  13. package/dist/storage/domains/utils.d.ts.map +1 -1
  14. package/dist/storage/domains/workflows/index.d.ts +21 -2
  15. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  16. package/dist/storage/index.d.ts +45 -20
  17. package/dist/storage/index.d.ts.map +1 -1
  18. package/dist/vector/index.d.ts +3 -3
  19. package/dist/vector/index.d.ts.map +1 -1
  20. package/package.json +22 -8
  21. package/dist/storage/domains/traces/index.d.ts +0 -34
  22. package/dist/storage/domains/traces/index.d.ts.map +0 -1
  23. package/eslint.config.js +0 -6
  24. package/src/index.ts +0 -2
  25. package/src/storage/domains/legacy-evals/index.ts +0 -156
  26. package/src/storage/domains/memory/index.ts +0 -947
  27. package/src/storage/domains/operations/index.ts +0 -489
  28. package/src/storage/domains/scores/index.ts +0 -221
  29. package/src/storage/domains/traces/index.ts +0 -212
  30. package/src/storage/domains/utils.ts +0 -158
  31. package/src/storage/domains/workflows/index.ts +0 -207
  32. package/src/storage/index.test.ts +0 -10
  33. package/src/storage/index.ts +0 -442
  34. package/src/vector/filter.test.ts +0 -295
  35. package/src/vector/filter.ts +0 -443
  36. package/src/vector/index.test.ts +0 -1493
  37. package/src/vector/index.ts +0 -941
  38. package/src/vector/types.ts +0 -16
  39. package/tsconfig.build.json +0 -9
  40. package/tsconfig.json +0 -5
  41. package/tsup.config.ts +0 -22
  42. package/vitest.config.ts +0 -11
package/dist/index.cjs CHANGED
@@ -5,6 +5,7 @@ var error = require('@mastra/core/error');
5
5
  var storage = require('@mastra/core/storage');
6
6
  var agent = require('@mastra/core/agent');
7
7
  var apacheArrow = require('apache-arrow');
8
+ var scores = require('@mastra/core/scores');
8
9
  var vector = require('@mastra/core/vector');
9
10
  var filter = require('@mastra/core/vector/filter');
10
11
 
@@ -61,9 +62,9 @@ var StoreLegacyEvalsLance = class extends storage.LegacyEvalsStorage {
61
62
  conditions.push(`agent_name = '${options.agentName}'`);
62
63
  }
63
64
  if (options.type === "live") {
64
- conditions.push("length(test_info) = 0");
65
+ conditions.push("test_info IS NULL");
65
66
  } else if (options.type === "test") {
66
- conditions.push("length(test_info) > 0");
67
+ conditions.push("test_info IS NOT NULL");
67
68
  }
68
69
  const startDate = options.dateRange?.start || options.fromDate;
69
70
  const endDate = options.dateRange?.end || options.toDate;
@@ -189,7 +190,6 @@ function processResultWithTypeConversion(rawResult, tableSchema) {
189
190
  } else if (fieldTypeStr.includes("float64") && ["createdAt", "updatedAt"].includes(key)) {
190
191
  processedResult[key] = new Date(processedResult[key]);
191
192
  }
192
- console.log(key, "processedResult", processedResult);
193
193
  }
194
194
  return processedResult;
195
195
  }
@@ -381,6 +381,20 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
381
381
  );
382
382
  }
383
383
  }
384
+ normalizeMessage(message) {
385
+ const { thread_id, ...rest } = message;
386
+ return {
387
+ ...rest,
388
+ threadId: thread_id,
389
+ content: typeof message.content === "string" ? (() => {
390
+ try {
391
+ return JSON.parse(message.content);
392
+ } catch {
393
+ return message.content;
394
+ }
395
+ })() : message.content
396
+ };
397
+ }
384
398
  async getMessages({
385
399
  threadId,
386
400
  resourceId,
@@ -389,6 +403,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
389
403
  threadConfig
390
404
  }) {
391
405
  try {
406
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
392
407
  if (threadConfig) {
393
408
  throw new Error("ThreadConfig is not supported by LanceDB storage");
394
409
  }
@@ -421,21 +436,7 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
421
436
  allRecords,
422
437
  await getTableSchema({ tableName: storage.TABLE_MESSAGES, client: this.client })
423
438
  );
424
- const normalized = messages.map((msg) => {
425
- const { thread_id, ...rest } = msg;
426
- return {
427
- ...rest,
428
- threadId: thread_id,
429
- content: typeof msg.content === "string" ? (() => {
430
- try {
431
- return JSON.parse(msg.content);
432
- } catch {
433
- return msg.content;
434
- }
435
- })() : msg.content
436
- };
437
- });
438
- const list = new agent.MessageList({ threadId, resourceId }).add(normalized, "memory");
439
+ const list = new agent.MessageList({ threadId, resourceId }).add(messages.map(this.normalizeMessage), "memory");
439
440
  if (format === "v2") return list.get.all.v2();
440
441
  return list.get.all.v1();
441
442
  } catch (error$1) {
@@ -443,7 +444,41 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
443
444
  {
444
445
  id: "LANCE_STORE_GET_MESSAGES_FAILED",
445
446
  domain: error.ErrorDomain.STORAGE,
446
- category: error.ErrorCategory.THIRD_PARTY
447
+ category: error.ErrorCategory.THIRD_PARTY,
448
+ details: {
449
+ threadId,
450
+ resourceId: resourceId ?? ""
451
+ }
452
+ },
453
+ error$1
454
+ );
455
+ }
456
+ }
457
+ async getMessagesById({
458
+ messageIds,
459
+ format
460
+ }) {
461
+ if (messageIds.length === 0) return [];
462
+ try {
463
+ const table = await this.client.openTable(storage.TABLE_MESSAGES);
464
+ const quotedIds = messageIds.map((id) => `'${id}'`).join(", ");
465
+ const allRecords = await table.query().where(`id IN (${quotedIds})`).toArray();
466
+ const messages = processResultWithTypeConversion(
467
+ allRecords,
468
+ await getTableSchema({ tableName: storage.TABLE_MESSAGES, client: this.client })
469
+ );
470
+ const list = new agent.MessageList().add(messages.map(this.normalizeMessage), "memory");
471
+ if (format === `v1`) return list.get.all.v1();
472
+ return list.get.all.v2();
473
+ } catch (error$1) {
474
+ throw new error.MastraError(
475
+ {
476
+ id: "LANCE_STORE_GET_MESSAGES_BY_ID_FAILED",
477
+ domain: error.ErrorDomain.STORAGE,
478
+ category: error.ErrorCategory.THIRD_PARTY,
479
+ details: {
480
+ messageIds: JSON.stringify(messageIds)
481
+ }
447
482
  },
448
483
  error$1
449
484
  );
@@ -584,13 +619,11 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
584
619
  return Array.from(allIndices).sort((a, b) => a - b).map((index) => records[index]);
585
620
  }
586
621
  async getMessagesPaginated(args) {
622
+ const { threadId, resourceId, selectBy, format = "v1" } = args;
623
+ const page = selectBy?.pagination?.page ?? 0;
624
+ const perPage = selectBy?.pagination?.perPage ?? 10;
587
625
  try {
588
- const { threadId, resourceId, selectBy, format = "v1" } = args;
589
- if (!threadId) {
590
- throw new Error("Thread ID is required for getMessagesPaginated");
591
- }
592
- const page = selectBy?.pagination?.page ?? 0;
593
- const perPage = selectBy?.pagination?.perPage ?? 10;
626
+ if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
594
627
  const dateRange = selectBy?.pagination?.dateRange;
595
628
  const fromDate = dateRange?.start;
596
629
  const toDate = dateRange?.end;
@@ -692,14 +725,21 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
692
725
  hasMore: total > (page + 1) * perPage
693
726
  };
694
727
  } catch (error$1) {
695
- throw new error.MastraError(
728
+ const mastraError = new error.MastraError(
696
729
  {
697
730
  id: "LANCE_STORE_GET_MESSAGES_PAGINATED_FAILED",
698
731
  domain: error.ErrorDomain.STORAGE,
699
- category: error.ErrorCategory.THIRD_PARTY
732
+ category: error.ErrorCategory.THIRD_PARTY,
733
+ details: {
734
+ threadId,
735
+ resourceId: resourceId ?? ""
736
+ }
700
737
  },
701
738
  error$1
702
739
  );
740
+ this.logger?.trackException?.(mastraError);
741
+ this.logger?.error?.(mastraError.toString());
742
+ return { messages: [], total: 0, page, perPage, hasMore: false };
703
743
  }
704
744
  }
705
745
  /**
@@ -1226,7 +1266,7 @@ var StoreOperationsLance = class extends storage.StoreOperations {
1226
1266
  processedRecord[key] = JSON.stringify(processedRecord[key]);
1227
1267
  }
1228
1268
  }
1229
- console.log(await table.schema());
1269
+ console.info(await table.schema());
1230
1270
  await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([processedRecord]);
1231
1271
  } catch (error$1) {
1232
1272
  throw new error.MastraError(
@@ -1276,7 +1316,6 @@ var StoreOperationsLance = class extends storage.StoreOperations {
1276
1316
  }
1277
1317
  return processedRecord;
1278
1318
  });
1279
- console.log(processedRecords);
1280
1319
  await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(processedRecords);
1281
1320
  } catch (error$1) {
1282
1321
  throw new error.MastraError(
@@ -1360,12 +1399,27 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1360
1399
  this.client = client;
1361
1400
  }
1362
1401
  async saveScore(score) {
1402
+ let validatedScore;
1363
1403
  try {
1404
+ validatedScore = scores.saveScorePayloadSchema.parse(score);
1405
+ } catch (error$1) {
1406
+ throw new error.MastraError(
1407
+ {
1408
+ id: "LANCE_STORAGE_SAVE_SCORE_FAILED",
1409
+ text: "Failed to save score in LanceStorage",
1410
+ domain: error.ErrorDomain.STORAGE,
1411
+ category: error.ErrorCategory.THIRD_PARTY
1412
+ },
1413
+ error$1
1414
+ );
1415
+ }
1416
+ try {
1417
+ const id = crypto.randomUUID();
1364
1418
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1365
1419
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1366
1420
  const allowedFields = new Set(schema.fields.map((f) => f.name));
1367
1421
  const filteredScore = {};
1368
- Object.keys(score).forEach((key) => {
1422
+ Object.keys(validatedScore).forEach((key) => {
1369
1423
  if (allowedFields.has(key)) {
1370
1424
  filteredScore[key] = score[key];
1371
1425
  }
@@ -1375,7 +1429,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1375
1429
  filteredScore[key] = JSON.stringify(filteredScore[key]);
1376
1430
  }
1377
1431
  }
1378
- console.log("Saving score to LanceStorage:", filteredScore);
1432
+ filteredScore.id = id;
1379
1433
  await table.add([filteredScore], { mode: "append" });
1380
1434
  return { score };
1381
1435
  } catch (error$1) {
@@ -1414,18 +1468,35 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1414
1468
  }
1415
1469
  async getScoresByScorerId({
1416
1470
  scorerId,
1417
- pagination
1471
+ pagination,
1472
+ entityId,
1473
+ entityType,
1474
+ source
1418
1475
  }) {
1419
1476
  try {
1420
1477
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1421
1478
  const { page = 0, perPage = 10 } = pagination || {};
1422
1479
  const offset = page * perPage;
1423
- const query = table.query().where(`\`scorerId\` = '${scorerId}'`).limit(perPage);
1480
+ let query = table.query().where(`\`scorerId\` = '${scorerId}'`);
1481
+ if (source) {
1482
+ query = query.where(`\`source\` = '${source}'`);
1483
+ }
1484
+ if (entityId) {
1485
+ query = query.where(`\`entityId\` = '${entityId}'`);
1486
+ }
1487
+ if (entityType) {
1488
+ query = query.where(`\`entityType\` = '${entityType}'`);
1489
+ }
1490
+ query = query.limit(perPage);
1424
1491
  if (offset > 0) query.offset(offset);
1425
1492
  const records = await query.toArray();
1426
1493
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1427
1494
  const scores = processResultWithTypeConversion(records, schema);
1428
- const allRecords = await table.query().where(`\`scorerId\` = '${scorerId}'`).toArray();
1495
+ let totalQuery = table.query().where(`\`scorerId\` = '${scorerId}'`);
1496
+ if (source) {
1497
+ totalQuery = totalQuery.where(`\`source\` = '${source}'`);
1498
+ }
1499
+ const allRecords = await totalQuery.toArray();
1429
1500
  const total = allRecords.length;
1430
1501
  return {
1431
1502
  pagination: {
@@ -1524,198 +1595,44 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1524
1595
  );
1525
1596
  }
1526
1597
  }
1527
- };
1528
- var StoreTracesLance = class extends storage.TracesStorage {
1529
- client;
1530
- operations;
1531
- constructor({ client, operations }) {
1532
- super();
1533
- this.client = client;
1534
- this.operations = operations;
1535
- }
1536
- async saveTrace({ trace }) {
1537
- try {
1538
- const table = await this.client.openTable(storage.TABLE_TRACES);
1539
- const record = {
1540
- ...trace,
1541
- attributes: JSON.stringify(trace.attributes),
1542
- status: JSON.stringify(trace.status),
1543
- events: JSON.stringify(trace.events),
1544
- links: JSON.stringify(trace.links),
1545
- other: JSON.stringify(trace.other)
1546
- };
1547
- await table.add([record], { mode: "append" });
1548
- return trace;
1549
- } catch (error$1) {
1550
- throw new error.MastraError(
1551
- {
1552
- id: "LANCE_STORE_SAVE_TRACE_FAILED",
1553
- domain: error.ErrorDomain.STORAGE,
1554
- category: error.ErrorCategory.THIRD_PARTY
1555
- },
1556
- error$1
1557
- );
1558
- }
1559
- }
1560
- async getTraceById({ traceId }) {
1561
- try {
1562
- const table = await this.client.openTable(storage.TABLE_TRACES);
1563
- const query = table.query().where(`id = '${traceId}'`);
1564
- const records = await query.toArray();
1565
- return records[0];
1566
- } catch (error$1) {
1567
- throw new error.MastraError(
1568
- {
1569
- id: "LANCE_STORE_GET_TRACE_BY_ID_FAILED",
1570
- domain: error.ErrorDomain.STORAGE,
1571
- category: error.ErrorCategory.THIRD_PARTY
1572
- },
1573
- error$1
1574
- );
1575
- }
1576
- }
1577
- async getTraces({
1578
- name,
1579
- scope,
1580
- page = 1,
1581
- perPage = 10,
1582
- attributes
1598
+ async getScoresBySpan({
1599
+ traceId,
1600
+ spanId,
1601
+ pagination
1583
1602
  }) {
1584
1603
  try {
1585
- const table = await this.client.openTable(storage.TABLE_TRACES);
1586
- const query = table.query();
1587
- if (name) {
1588
- query.where(`name = '${name}'`);
1589
- }
1590
- if (scope) {
1591
- query.where(`scope = '${scope}'`);
1592
- }
1593
- if (attributes) {
1594
- query.where(`attributes = '${JSON.stringify(attributes)}'`);
1595
- }
1596
- const offset = (page - 1) * perPage;
1597
- query.limit(perPage);
1598
- if (offset > 0) {
1599
- query.offset(offset);
1600
- }
1601
- const records = await query.toArray();
1602
- return records.map((record) => {
1603
- const processed = {
1604
- ...record,
1605
- attributes: record.attributes ? JSON.parse(record.attributes) : {},
1606
- status: record.status ? JSON.parse(record.status) : {},
1607
- events: record.events ? JSON.parse(record.events) : [],
1608
- links: record.links ? JSON.parse(record.links) : [],
1609
- other: record.other ? JSON.parse(record.other) : {},
1610
- startTime: new Date(record.startTime),
1611
- endTime: new Date(record.endTime),
1612
- createdAt: new Date(record.createdAt)
1613
- };
1614
- if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
1615
- processed.parentSpanId = "";
1616
- } else {
1617
- processed.parentSpanId = String(processed.parentSpanId);
1618
- }
1619
- return processed;
1620
- });
1621
- } catch (error$1) {
1622
- throw new error.MastraError(
1623
- {
1624
- id: "LANCE_STORE_GET_TRACES_FAILED",
1625
- domain: error.ErrorDomain.STORAGE,
1626
- category: error.ErrorCategory.THIRD_PARTY,
1627
- details: { name: name ?? "", scope: scope ?? "" }
1628
- },
1629
- error$1
1630
- );
1631
- }
1632
- }
1633
- async getTracesPaginated(args) {
1634
- try {
1635
- const table = await this.client.openTable(storage.TABLE_TRACES);
1636
- const query = table.query();
1637
- const conditions = [];
1638
- if (args.name) {
1639
- conditions.push(`name = '${args.name}'`);
1640
- }
1641
- if (args.scope) {
1642
- conditions.push(`scope = '${args.scope}'`);
1643
- }
1644
- if (args.attributes) {
1645
- const attributesStr = JSON.stringify(args.attributes);
1646
- conditions.push(`attributes LIKE '%${attributesStr.replace(/"/g, '\\"')}%'`);
1647
- }
1648
- if (args.dateRange?.start) {
1649
- conditions.push(`\`createdAt\` >= ${args.dateRange.start.getTime()}`);
1650
- }
1651
- if (args.dateRange?.end) {
1652
- conditions.push(`\`createdAt\` <= ${args.dateRange.end.getTime()}`);
1653
- }
1654
- if (conditions.length > 0) {
1655
- const whereClause = conditions.join(" AND ");
1656
- query.where(whereClause);
1657
- }
1658
- let total = 0;
1659
- if (conditions.length > 0) {
1660
- const countQuery = table.query().where(conditions.join(" AND "));
1661
- const allRecords = await countQuery.toArray();
1662
- total = allRecords.length;
1663
- } else {
1664
- total = await table.countRows();
1665
- }
1666
- const page = args.page || 0;
1667
- const perPage = args.perPage || 10;
1604
+ const table = await this.client.openTable(storage.TABLE_SCORERS);
1605
+ const { page = 0, perPage = 10 } = pagination || {};
1668
1606
  const offset = page * perPage;
1669
- query.limit(perPage);
1670
- if (offset > 0) {
1671
- query.offset(offset);
1672
- }
1607
+ const query = table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`).limit(perPage);
1608
+ if (offset > 0) query.offset(offset);
1673
1609
  const records = await query.toArray();
1674
- const traces = records.map((record) => {
1675
- const processed = {
1676
- ...record,
1677
- attributes: record.attributes ? JSON.parse(record.attributes) : {},
1678
- status: record.status ? JSON.parse(record.status) : {},
1679
- events: record.events ? JSON.parse(record.events) : [],
1680
- links: record.links ? JSON.parse(record.links) : [],
1681
- other: record.other ? JSON.parse(record.other) : {},
1682
- startTime: new Date(record.startTime),
1683
- endTime: new Date(record.endTime),
1684
- createdAt: new Date(record.createdAt)
1685
- };
1686
- if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
1687
- processed.parentSpanId = "";
1688
- } else {
1689
- processed.parentSpanId = String(processed.parentSpanId);
1690
- }
1691
- return processed;
1692
- });
1610
+ const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1611
+ const scores = processResultWithTypeConversion(records, schema);
1612
+ const allRecords = await table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`).toArray();
1613
+ const total = allRecords.length;
1693
1614
  return {
1694
- traces,
1695
- total,
1696
- page,
1697
- perPage,
1698
- hasMore: total > (page + 1) * perPage
1615
+ pagination: {
1616
+ page,
1617
+ perPage,
1618
+ total,
1619
+ hasMore: offset + scores.length < total
1620
+ },
1621
+ scores
1699
1622
  };
1700
1623
  } catch (error$1) {
1701
1624
  throw new error.MastraError(
1702
1625
  {
1703
- id: "LANCE_STORE_GET_TRACES_PAGINATED_FAILED",
1626
+ id: "LANCE_STORAGE_GET_SCORES_BY_SPAN_FAILED",
1627
+ text: "Failed to get scores by traceId and spanId in LanceStorage",
1704
1628
  domain: error.ErrorDomain.STORAGE,
1705
1629
  category: error.ErrorCategory.THIRD_PARTY,
1706
- details: { name: args.name ?? "", scope: args.scope ?? "" }
1630
+ details: { error: error$1?.message }
1707
1631
  },
1708
1632
  error$1
1709
1633
  );
1710
1634
  }
1711
1635
  }
1712
- async batchTraceInsert({ records }) {
1713
- this.logger.debug("Batch inserting traces", { count: records.length });
1714
- await this.operations.batchInsert({
1715
- tableName: storage.TABLE_TRACES,
1716
- records
1717
- });
1718
- }
1719
1636
  };
1720
1637
  function parseWorkflowRun(row) {
1721
1638
  let parsedSnapshot = row.snapshot;
@@ -1741,9 +1658,26 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1741
1658
  super();
1742
1659
  this.client = client;
1743
1660
  }
1661
+ updateWorkflowResults({
1662
+ // workflowName,
1663
+ // runId,
1664
+ // stepId,
1665
+ // result,
1666
+ // runtimeContext,
1667
+ }) {
1668
+ throw new Error("Method not implemented.");
1669
+ }
1670
+ updateWorkflowState({
1671
+ // workflowName,
1672
+ // runId,
1673
+ // opts,
1674
+ }) {
1675
+ throw new Error("Method not implemented.");
1676
+ }
1744
1677
  async persistWorkflowSnapshot({
1745
1678
  workflowName,
1746
1679
  runId,
1680
+ resourceId,
1747
1681
  snapshot
1748
1682
  }) {
1749
1683
  try {
@@ -1760,6 +1694,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1760
1694
  const record = {
1761
1695
  workflow_name: workflowName,
1762
1696
  run_id: runId,
1697
+ resourceId,
1763
1698
  snapshot: JSON.stringify(snapshot),
1764
1699
  createdAt,
1765
1700
  updatedAt: now
@@ -1905,7 +1840,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
1905
1840
  instance.stores = {
1906
1841
  operations: new StoreOperationsLance({ client: instance.lanceClient }),
1907
1842
  workflows: new StoreWorkflowsLance({ client: instance.lanceClient }),
1908
- traces: new StoreTracesLance({ client: instance.lanceClient, operations }),
1909
1843
  scores: new StoreScoresLance({ client: instance.lanceClient }),
1910
1844
  memory: new StoreMemoryLance({ client: instance.lanceClient, operations }),
1911
1845
  legacyEvals: new StoreLegacyEvalsLance({ client: instance.lanceClient })
@@ -1934,7 +1868,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
1934
1868
  this.stores = {
1935
1869
  operations: new StoreOperationsLance({ client: this.lanceClient }),
1936
1870
  workflows: new StoreWorkflowsLance({ client: this.lanceClient }),
1937
- traces: new StoreTracesLance({ client: this.lanceClient, operations }),
1938
1871
  scores: new StoreScoresLance({ client: this.lanceClient }),
1939
1872
  legacyEvals: new StoreLegacyEvalsLance({ client: this.lanceClient }),
1940
1873
  memory: new StoreMemoryLance({ client: this.lanceClient, operations })
@@ -1998,7 +1931,8 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
1998
1931
  resourceWorkingMemory: true,
1999
1932
  hasColumn: true,
2000
1933
  createTable: true,
2001
- deleteMessages: false
1934
+ deleteMessages: false,
1935
+ getScoresBySpan: true
2002
1936
  };
2003
1937
  }
2004
1938
  async getResourceById({ resourceId }) {
@@ -2071,6 +2005,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2071
2005
  }) {
2072
2006
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format, threadConfig });
2073
2007
  }
2008
+ async getMessagesById({
2009
+ messageIds,
2010
+ format
2011
+ }) {
2012
+ return this.stores.memory.getMessagesById({ messageIds, format });
2013
+ }
2074
2014
  async saveMessages(args) {
2075
2015
  return this.stores.memory.saveMessages(args);
2076
2016
  }
@@ -2083,15 +2023,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2083
2023
  async updateMessages(_args) {
2084
2024
  return this.stores.memory.updateMessages(_args);
2085
2025
  }
2086
- async getTraceById(args) {
2087
- return this.stores.traces.getTraceById(args);
2088
- }
2089
- async getTraces(args) {
2090
- return this.stores.traces.getTraces(args);
2091
- }
2092
- async getTracesPaginated(args) {
2093
- return this.stores.traces.getTracesPaginated(args);
2094
- }
2095
2026
  async getEvalsByAgentName(agentName, type) {
2096
2027
  return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
2097
2028
  }
@@ -2104,12 +2035,29 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2104
2035
  async getWorkflowRunById(args) {
2105
2036
  return this.stores.workflows.getWorkflowRunById(args);
2106
2037
  }
2038
+ async updateWorkflowResults({
2039
+ workflowName,
2040
+ runId,
2041
+ stepId,
2042
+ result,
2043
+ runtimeContext
2044
+ }) {
2045
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
2046
+ }
2047
+ async updateWorkflowState({
2048
+ workflowName,
2049
+ runId,
2050
+ opts
2051
+ }) {
2052
+ return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
2053
+ }
2107
2054
  async persistWorkflowSnapshot({
2108
2055
  workflowName,
2109
2056
  runId,
2057
+ resourceId,
2110
2058
  snapshot
2111
2059
  }) {
2112
- return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
2060
+ return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
2113
2061
  }
2114
2062
  async loadWorkflowSnapshot({
2115
2063
  workflowName,
@@ -2122,9 +2070,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2122
2070
  }
2123
2071
  async getScoresByScorerId({
2124
2072
  scorerId,
2073
+ source,
2074
+ entityId,
2075
+ entityType,
2125
2076
  pagination
2126
2077
  }) {
2127
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
2078
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
2128
2079
  }
2129
2080
  async saveScore(_score) {
2130
2081
  return this.stores.scores.saveScore(_score);
@@ -2142,6 +2093,13 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2142
2093
  }) {
2143
2094
  return this.stores.scores.getScoresByEntityId({ entityId, entityType, pagination });
2144
2095
  }
2096
+ async getScoresBySpan({
2097
+ traceId,
2098
+ spanId,
2099
+ pagination
2100
+ }) {
2101
+ return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
2102
+ }
2145
2103
  };
2146
2104
  var LanceFilterTranslator = class extends filter.BaseFilterTranslator {
2147
2105
  translate(filter) {