@mastra/lance 0.0.0-fix-writer-workflow-resumestream-20251022161252 → 0.0.0-fix-memory-search-fetch-20251027160505
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -3
- package/dist/index.cjs +2 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -206
- package/dist/index.js.map +1 -1
- package/dist/storage/index.d.ts +2 -16
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/storage/domains/traces/index.d.ts +0 -34
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
# @mastra/lance
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-memory-search-fetch-20251027160505
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- Update peer dependencies to match core package version bump (1.0.0) ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
6
14
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
15
|
+
- dependencies updates: ([#8693](https://github.com/mastra-ai/mastra/pull/8693))
|
|
16
|
+
- Updated dependency [`@lancedb/lancedb@^0.22.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.22.2) (from `^0.21.2`, in `dependencies`)
|
|
17
|
+
|
|
18
|
+
- Fix eval filtering to use NULL checks instead of length function for compatibility with LanceDB 0.22.x ([#9191](https://github.com/mastra-ai/mastra/pull/9191))
|
|
19
|
+
|
|
20
|
+
- 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), [`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), [`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)]:
|
|
21
|
+
- @mastra/core@0.0.0-fix-memory-search-fetch-20251027160505
|
|
9
22
|
|
|
10
23
|
## 0.3.6
|
|
11
24
|
|
package/dist/index.cjs
CHANGED
|
@@ -62,9 +62,9 @@ var StoreLegacyEvalsLance = class extends storage.LegacyEvalsStorage {
|
|
|
62
62
|
conditions.push(`agent_name = '${options.agentName}'`);
|
|
63
63
|
}
|
|
64
64
|
if (options.type === "live") {
|
|
65
|
-
conditions.push("
|
|
65
|
+
conditions.push("test_info IS NULL");
|
|
66
66
|
} else if (options.type === "test") {
|
|
67
|
-
conditions.push("
|
|
67
|
+
conditions.push("test_info IS NOT NULL");
|
|
68
68
|
}
|
|
69
69
|
const startDate = options.dateRange?.start || options.fromDate;
|
|
70
70
|
const endDate = options.dateRange?.end || options.toDate;
|
|
@@ -1634,198 +1634,6 @@ var StoreScoresLance = class extends storage.ScoresStorage {
|
|
|
1634
1634
|
}
|
|
1635
1635
|
}
|
|
1636
1636
|
};
|
|
1637
|
-
var StoreTracesLance = class extends storage.TracesStorage {
|
|
1638
|
-
client;
|
|
1639
|
-
operations;
|
|
1640
|
-
constructor({ client, operations }) {
|
|
1641
|
-
super();
|
|
1642
|
-
this.client = client;
|
|
1643
|
-
this.operations = operations;
|
|
1644
|
-
}
|
|
1645
|
-
async saveTrace({ trace }) {
|
|
1646
|
-
try {
|
|
1647
|
-
const table = await this.client.openTable(storage.TABLE_TRACES);
|
|
1648
|
-
const record = {
|
|
1649
|
-
...trace,
|
|
1650
|
-
attributes: JSON.stringify(trace.attributes),
|
|
1651
|
-
status: JSON.stringify(trace.status),
|
|
1652
|
-
events: JSON.stringify(trace.events),
|
|
1653
|
-
links: JSON.stringify(trace.links),
|
|
1654
|
-
other: JSON.stringify(trace.other)
|
|
1655
|
-
};
|
|
1656
|
-
await table.add([record], { mode: "append" });
|
|
1657
|
-
return trace;
|
|
1658
|
-
} catch (error$1) {
|
|
1659
|
-
throw new error.MastraError(
|
|
1660
|
-
{
|
|
1661
|
-
id: "LANCE_STORE_SAVE_TRACE_FAILED",
|
|
1662
|
-
domain: error.ErrorDomain.STORAGE,
|
|
1663
|
-
category: error.ErrorCategory.THIRD_PARTY
|
|
1664
|
-
},
|
|
1665
|
-
error$1
|
|
1666
|
-
);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
async getTraceById({ traceId }) {
|
|
1670
|
-
try {
|
|
1671
|
-
const table = await this.client.openTable(storage.TABLE_TRACES);
|
|
1672
|
-
const query = table.query().where(`id = '${traceId}'`);
|
|
1673
|
-
const records = await query.toArray();
|
|
1674
|
-
return records[0];
|
|
1675
|
-
} catch (error$1) {
|
|
1676
|
-
throw new error.MastraError(
|
|
1677
|
-
{
|
|
1678
|
-
id: "LANCE_STORE_GET_TRACE_BY_ID_FAILED",
|
|
1679
|
-
domain: error.ErrorDomain.STORAGE,
|
|
1680
|
-
category: error.ErrorCategory.THIRD_PARTY
|
|
1681
|
-
},
|
|
1682
|
-
error$1
|
|
1683
|
-
);
|
|
1684
|
-
}
|
|
1685
|
-
}
|
|
1686
|
-
async getTraces({
|
|
1687
|
-
name,
|
|
1688
|
-
scope,
|
|
1689
|
-
page = 1,
|
|
1690
|
-
perPage = 10,
|
|
1691
|
-
attributes
|
|
1692
|
-
}) {
|
|
1693
|
-
try {
|
|
1694
|
-
const table = await this.client.openTable(storage.TABLE_TRACES);
|
|
1695
|
-
const query = table.query();
|
|
1696
|
-
if (name) {
|
|
1697
|
-
query.where(`name = '${name}'`);
|
|
1698
|
-
}
|
|
1699
|
-
if (scope) {
|
|
1700
|
-
query.where(`scope = '${scope}'`);
|
|
1701
|
-
}
|
|
1702
|
-
if (attributes) {
|
|
1703
|
-
query.where(`attributes = '${JSON.stringify(attributes)}'`);
|
|
1704
|
-
}
|
|
1705
|
-
const offset = (page - 1) * perPage;
|
|
1706
|
-
query.limit(perPage);
|
|
1707
|
-
if (offset > 0) {
|
|
1708
|
-
query.offset(offset);
|
|
1709
|
-
}
|
|
1710
|
-
const records = await query.toArray();
|
|
1711
|
-
return records.map((record) => {
|
|
1712
|
-
const processed = {
|
|
1713
|
-
...record,
|
|
1714
|
-
attributes: record.attributes ? JSON.parse(record.attributes) : {},
|
|
1715
|
-
status: record.status ? JSON.parse(record.status) : {},
|
|
1716
|
-
events: record.events ? JSON.parse(record.events) : [],
|
|
1717
|
-
links: record.links ? JSON.parse(record.links) : [],
|
|
1718
|
-
other: record.other ? JSON.parse(record.other) : {},
|
|
1719
|
-
startTime: new Date(record.startTime),
|
|
1720
|
-
endTime: new Date(record.endTime),
|
|
1721
|
-
createdAt: new Date(record.createdAt)
|
|
1722
|
-
};
|
|
1723
|
-
if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
|
|
1724
|
-
processed.parentSpanId = "";
|
|
1725
|
-
} else {
|
|
1726
|
-
processed.parentSpanId = String(processed.parentSpanId);
|
|
1727
|
-
}
|
|
1728
|
-
return processed;
|
|
1729
|
-
});
|
|
1730
|
-
} catch (error$1) {
|
|
1731
|
-
throw new error.MastraError(
|
|
1732
|
-
{
|
|
1733
|
-
id: "LANCE_STORE_GET_TRACES_FAILED",
|
|
1734
|
-
domain: error.ErrorDomain.STORAGE,
|
|
1735
|
-
category: error.ErrorCategory.THIRD_PARTY,
|
|
1736
|
-
details: { name: name ?? "", scope: scope ?? "" }
|
|
1737
|
-
},
|
|
1738
|
-
error$1
|
|
1739
|
-
);
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
async getTracesPaginated(args) {
|
|
1743
|
-
try {
|
|
1744
|
-
const table = await this.client.openTable(storage.TABLE_TRACES);
|
|
1745
|
-
const query = table.query();
|
|
1746
|
-
const conditions = [];
|
|
1747
|
-
if (args.name) {
|
|
1748
|
-
conditions.push(`name = '${args.name}'`);
|
|
1749
|
-
}
|
|
1750
|
-
if (args.scope) {
|
|
1751
|
-
conditions.push(`scope = '${args.scope}'`);
|
|
1752
|
-
}
|
|
1753
|
-
if (args.attributes) {
|
|
1754
|
-
const attributesStr = JSON.stringify(args.attributes);
|
|
1755
|
-
conditions.push(`attributes LIKE '%${attributesStr.replace(/"/g, '\\"')}%'`);
|
|
1756
|
-
}
|
|
1757
|
-
if (args.dateRange?.start) {
|
|
1758
|
-
conditions.push(`\`createdAt\` >= ${args.dateRange.start.getTime()}`);
|
|
1759
|
-
}
|
|
1760
|
-
if (args.dateRange?.end) {
|
|
1761
|
-
conditions.push(`\`createdAt\` <= ${args.dateRange.end.getTime()}`);
|
|
1762
|
-
}
|
|
1763
|
-
if (conditions.length > 0) {
|
|
1764
|
-
const whereClause = conditions.join(" AND ");
|
|
1765
|
-
query.where(whereClause);
|
|
1766
|
-
}
|
|
1767
|
-
let total = 0;
|
|
1768
|
-
if (conditions.length > 0) {
|
|
1769
|
-
const countQuery = table.query().where(conditions.join(" AND "));
|
|
1770
|
-
const allRecords = await countQuery.toArray();
|
|
1771
|
-
total = allRecords.length;
|
|
1772
|
-
} else {
|
|
1773
|
-
total = await table.countRows();
|
|
1774
|
-
}
|
|
1775
|
-
const page = args.page || 0;
|
|
1776
|
-
const perPage = args.perPage || 10;
|
|
1777
|
-
const offset = page * perPage;
|
|
1778
|
-
query.limit(perPage);
|
|
1779
|
-
if (offset > 0) {
|
|
1780
|
-
query.offset(offset);
|
|
1781
|
-
}
|
|
1782
|
-
const records = await query.toArray();
|
|
1783
|
-
const traces = records.map((record) => {
|
|
1784
|
-
const processed = {
|
|
1785
|
-
...record,
|
|
1786
|
-
attributes: record.attributes ? JSON.parse(record.attributes) : {},
|
|
1787
|
-
status: record.status ? JSON.parse(record.status) : {},
|
|
1788
|
-
events: record.events ? JSON.parse(record.events) : [],
|
|
1789
|
-
links: record.links ? JSON.parse(record.links) : [],
|
|
1790
|
-
other: record.other ? JSON.parse(record.other) : {},
|
|
1791
|
-
startTime: new Date(record.startTime),
|
|
1792
|
-
endTime: new Date(record.endTime),
|
|
1793
|
-
createdAt: new Date(record.createdAt)
|
|
1794
|
-
};
|
|
1795
|
-
if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
|
|
1796
|
-
processed.parentSpanId = "";
|
|
1797
|
-
} else {
|
|
1798
|
-
processed.parentSpanId = String(processed.parentSpanId);
|
|
1799
|
-
}
|
|
1800
|
-
return processed;
|
|
1801
|
-
});
|
|
1802
|
-
return {
|
|
1803
|
-
traces,
|
|
1804
|
-
total,
|
|
1805
|
-
page,
|
|
1806
|
-
perPage,
|
|
1807
|
-
hasMore: total > (page + 1) * perPage
|
|
1808
|
-
};
|
|
1809
|
-
} catch (error$1) {
|
|
1810
|
-
throw new error.MastraError(
|
|
1811
|
-
{
|
|
1812
|
-
id: "LANCE_STORE_GET_TRACES_PAGINATED_FAILED",
|
|
1813
|
-
domain: error.ErrorDomain.STORAGE,
|
|
1814
|
-
category: error.ErrorCategory.THIRD_PARTY,
|
|
1815
|
-
details: { name: args.name ?? "", scope: args.scope ?? "" }
|
|
1816
|
-
},
|
|
1817
|
-
error$1
|
|
1818
|
-
);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
async batchTraceInsert({ records }) {
|
|
1822
|
-
this.logger.debug("Batch inserting traces", { count: records.length });
|
|
1823
|
-
await this.operations.batchInsert({
|
|
1824
|
-
tableName: storage.TABLE_TRACES,
|
|
1825
|
-
records
|
|
1826
|
-
});
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
1637
|
function parseWorkflowRun(row) {
|
|
1830
1638
|
let parsedSnapshot = row.snapshot;
|
|
1831
1639
|
if (typeof parsedSnapshot === "string") {
|
|
@@ -2032,7 +1840,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2032
1840
|
instance.stores = {
|
|
2033
1841
|
operations: new StoreOperationsLance({ client: instance.lanceClient }),
|
|
2034
1842
|
workflows: new StoreWorkflowsLance({ client: instance.lanceClient }),
|
|
2035
|
-
traces: new StoreTracesLance({ client: instance.lanceClient, operations }),
|
|
2036
1843
|
scores: new StoreScoresLance({ client: instance.lanceClient }),
|
|
2037
1844
|
memory: new StoreMemoryLance({ client: instance.lanceClient, operations }),
|
|
2038
1845
|
legacyEvals: new StoreLegacyEvalsLance({ client: instance.lanceClient })
|
|
@@ -2061,7 +1868,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2061
1868
|
this.stores = {
|
|
2062
1869
|
operations: new StoreOperationsLance({ client: this.lanceClient }),
|
|
2063
1870
|
workflows: new StoreWorkflowsLance({ client: this.lanceClient }),
|
|
2064
|
-
traces: new StoreTracesLance({ client: this.lanceClient, operations }),
|
|
2065
1871
|
scores: new StoreScoresLance({ client: this.lanceClient }),
|
|
2066
1872
|
legacyEvals: new StoreLegacyEvalsLance({ client: this.lanceClient }),
|
|
2067
1873
|
memory: new StoreMemoryLance({ client: this.lanceClient, operations })
|
|
@@ -2217,15 +2023,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2217
2023
|
async updateMessages(_args) {
|
|
2218
2024
|
return this.stores.memory.updateMessages(_args);
|
|
2219
2025
|
}
|
|
2220
|
-
async getTraceById(args) {
|
|
2221
|
-
return this.stores.traces.getTraceById(args);
|
|
2222
|
-
}
|
|
2223
|
-
async getTraces(args) {
|
|
2224
|
-
return this.stores.traces.getTraces(args);
|
|
2225
|
-
}
|
|
2226
|
-
async getTracesPaginated(args) {
|
|
2227
|
-
return this.stores.traces.getTracesPaginated(args);
|
|
2228
|
-
}
|
|
2229
2026
|
async getEvalsByAgentName(agentName, type) {
|
|
2230
2027
|
return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
|
|
2231
2028
|
}
|