@mastra/lance 0.0.0-fix-memory-search-fetch-20251027160505 → 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 +11 -3
- package/dist/index.cjs +25 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -129
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +10 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +3 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +3 -18
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -25
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
# @mastra/lance
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
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))
|
|
@@ -17,8 +25,8 @@
|
|
|
17
25
|
|
|
18
26
|
- 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
27
|
|
|
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-
|
|
28
|
+
- 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)]:
|
|
29
|
+
- @mastra/core@0.0.0-fix-persist-session-cache-option-mcp-server-20251030161352
|
|
22
30
|
|
|
23
31
|
## 0.3.6
|
|
24
32
|
|
package/dist/index.cjs
CHANGED
|
@@ -10,126 +10,10 @@ var vector = require('@mastra/core/vector');
|
|
|
10
10
|
var filter = require('@mastra/core/vector/filter');
|
|
11
11
|
|
|
12
12
|
// src/storage/index.ts
|
|
13
|
-
var StoreLegacyEvalsLance = class extends storage.LegacyEvalsStorage {
|
|
14
|
-
client;
|
|
15
|
-
constructor({ client }) {
|
|
16
|
-
super();
|
|
17
|
-
this.client = client;
|
|
18
|
-
}
|
|
19
|
-
async getEvalsByAgentName(agentName, type) {
|
|
20
|
-
try {
|
|
21
|
-
const table = await this.client.openTable(storage.TABLE_EVALS);
|
|
22
|
-
const query = table.query().where(`agent_name = '${agentName}'`);
|
|
23
|
-
const records = await query.toArray();
|
|
24
|
-
let filteredRecords = records;
|
|
25
|
-
if (type === "live") {
|
|
26
|
-
filteredRecords = records.filter((record) => record.test_info === null);
|
|
27
|
-
} else if (type === "test") {
|
|
28
|
-
filteredRecords = records.filter((record) => record.test_info !== null);
|
|
29
|
-
}
|
|
30
|
-
return filteredRecords.map((record) => {
|
|
31
|
-
return {
|
|
32
|
-
id: record.id,
|
|
33
|
-
input: record.input,
|
|
34
|
-
output: record.output,
|
|
35
|
-
agentName: record.agent_name,
|
|
36
|
-
metricName: record.metric_name,
|
|
37
|
-
result: JSON.parse(record.result),
|
|
38
|
-
instructions: record.instructions,
|
|
39
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
40
|
-
globalRunId: record.global_run_id,
|
|
41
|
-
runId: record.run_id,
|
|
42
|
-
createdAt: new Date(record.created_at).toString()
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
} catch (error$1) {
|
|
46
|
-
throw new error.MastraError(
|
|
47
|
-
{
|
|
48
|
-
id: "LANCE_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
|
|
49
|
-
domain: error.ErrorDomain.STORAGE,
|
|
50
|
-
category: error.ErrorCategory.THIRD_PARTY,
|
|
51
|
-
details: { agentName }
|
|
52
|
-
},
|
|
53
|
-
error$1
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async getEvals(options) {
|
|
58
|
-
try {
|
|
59
|
-
const table = await this.client.openTable(storage.TABLE_EVALS);
|
|
60
|
-
const conditions = [];
|
|
61
|
-
if (options.agentName) {
|
|
62
|
-
conditions.push(`agent_name = '${options.agentName}'`);
|
|
63
|
-
}
|
|
64
|
-
if (options.type === "live") {
|
|
65
|
-
conditions.push("test_info IS NULL");
|
|
66
|
-
} else if (options.type === "test") {
|
|
67
|
-
conditions.push("test_info IS NOT NULL");
|
|
68
|
-
}
|
|
69
|
-
const startDate = options.dateRange?.start || options.fromDate;
|
|
70
|
-
const endDate = options.dateRange?.end || options.toDate;
|
|
71
|
-
if (startDate) {
|
|
72
|
-
conditions.push(`\`created_at\` >= ${startDate.getTime()}`);
|
|
73
|
-
}
|
|
74
|
-
if (endDate) {
|
|
75
|
-
conditions.push(`\`created_at\` <= ${endDate.getTime()}`);
|
|
76
|
-
}
|
|
77
|
-
let total = 0;
|
|
78
|
-
if (conditions.length > 0) {
|
|
79
|
-
total = await table.countRows(conditions.join(" AND "));
|
|
80
|
-
} else {
|
|
81
|
-
total = await table.countRows();
|
|
82
|
-
}
|
|
83
|
-
const query = table.query();
|
|
84
|
-
if (conditions.length > 0) {
|
|
85
|
-
const whereClause = conditions.join(" AND ");
|
|
86
|
-
query.where(whereClause);
|
|
87
|
-
}
|
|
88
|
-
const records = await query.toArray();
|
|
89
|
-
const evals = records.sort((a, b) => b.created_at - a.created_at).map((record) => {
|
|
90
|
-
return {
|
|
91
|
-
id: record.id,
|
|
92
|
-
input: record.input,
|
|
93
|
-
output: record.output,
|
|
94
|
-
agentName: record.agent_name,
|
|
95
|
-
metricName: record.metric_name,
|
|
96
|
-
result: JSON.parse(record.result),
|
|
97
|
-
instructions: record.instructions,
|
|
98
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
99
|
-
globalRunId: record.global_run_id,
|
|
100
|
-
runId: record.run_id,
|
|
101
|
-
createdAt: new Date(record.created_at).toISOString()
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
const page = options.page || 0;
|
|
105
|
-
const perPage = options.perPage || 10;
|
|
106
|
-
const pagedEvals = evals.slice(page * perPage, (page + 1) * perPage);
|
|
107
|
-
return {
|
|
108
|
-
evals: pagedEvals,
|
|
109
|
-
total,
|
|
110
|
-
page,
|
|
111
|
-
perPage,
|
|
112
|
-
hasMore: total > (page + 1) * perPage
|
|
113
|
-
};
|
|
114
|
-
} catch (error$1) {
|
|
115
|
-
throw new error.MastraError(
|
|
116
|
-
{
|
|
117
|
-
id: "LANCE_STORE_GET_EVALS_FAILED",
|
|
118
|
-
domain: error.ErrorDomain.STORAGE,
|
|
119
|
-
category: error.ErrorCategory.THIRD_PARTY,
|
|
120
|
-
details: { agentName: options.agentName ?? "" }
|
|
121
|
-
},
|
|
122
|
-
error$1
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
13
|
function getPrimaryKeys(tableName) {
|
|
128
14
|
let primaryId = ["id"];
|
|
129
15
|
if (tableName === storage.TABLE_WORKFLOW_SNAPSHOT) {
|
|
130
16
|
primaryId = ["workflow_name", "run_id"];
|
|
131
|
-
} else if (tableName === storage.TABLE_EVALS) {
|
|
132
|
-
primaryId = ["agent_name", "metric_name", "run_id"];
|
|
133
17
|
}
|
|
134
18
|
return primaryId;
|
|
135
19
|
}
|
|
@@ -484,6 +368,24 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
|
|
|
484
368
|
);
|
|
485
369
|
}
|
|
486
370
|
}
|
|
371
|
+
async listMessages(_args) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`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.`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
async listMessagesById({ messageIds }) {
|
|
377
|
+
return this.getMessagesById({ messageIds, format: "v2" });
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* @todo When migrating from getThreadsByResourceIdPaginated to this method,
|
|
381
|
+
* implement orderBy and sortDirection support for full sorting capabilities
|
|
382
|
+
*/
|
|
383
|
+
async listThreadsByResourceId(args) {
|
|
384
|
+
const { resourceId, limit, offset } = args;
|
|
385
|
+
const page = Math.floor(offset / limit);
|
|
386
|
+
const perPage = limit;
|
|
387
|
+
return this.getThreadsByResourceIdPaginated({ resourceId, page, perPage });
|
|
388
|
+
}
|
|
487
389
|
async saveMessages(args) {
|
|
488
390
|
try {
|
|
489
391
|
const { messages, format = "v1" } = args;
|
|
@@ -1663,7 +1565,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1663
1565
|
// runId,
|
|
1664
1566
|
// stepId,
|
|
1665
1567
|
// result,
|
|
1666
|
-
//
|
|
1568
|
+
// requestContext,
|
|
1667
1569
|
}) {
|
|
1668
1570
|
throw new Error("Method not implemented.");
|
|
1669
1571
|
}
|
|
@@ -1804,6 +1706,9 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
|
|
|
1804
1706
|
);
|
|
1805
1707
|
}
|
|
1806
1708
|
}
|
|
1709
|
+
async listWorkflowRuns(args) {
|
|
1710
|
+
return this.getWorkflowRuns(args);
|
|
1711
|
+
}
|
|
1807
1712
|
};
|
|
1808
1713
|
|
|
1809
1714
|
// src/storage/index.ts
|
|
@@ -1841,8 +1746,7 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1841
1746
|
operations: new StoreOperationsLance({ client: instance.lanceClient }),
|
|
1842
1747
|
workflows: new StoreWorkflowsLance({ client: instance.lanceClient }),
|
|
1843
1748
|
scores: new StoreScoresLance({ client: instance.lanceClient }),
|
|
1844
|
-
memory: new StoreMemoryLance({ client: instance.lanceClient, operations })
|
|
1845
|
-
legacyEvals: new StoreLegacyEvalsLance({ client: instance.lanceClient })
|
|
1749
|
+
memory: new StoreMemoryLance({ client: instance.lanceClient, operations })
|
|
1846
1750
|
};
|
|
1847
1751
|
return instance;
|
|
1848
1752
|
} catch (e) {
|
|
@@ -1869,7 +1773,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
1869
1773
|
operations: new StoreOperationsLance({ client: this.lanceClient }),
|
|
1870
1774
|
workflows: new StoreWorkflowsLance({ client: this.lanceClient }),
|
|
1871
1775
|
scores: new StoreScoresLance({ client: this.lanceClient }),
|
|
1872
|
-
legacyEvals: new StoreLegacyEvalsLance({ client: this.lanceClient }),
|
|
1873
1776
|
memory: new StoreMemoryLance({ client: this.lanceClient, operations })
|
|
1874
1777
|
};
|
|
1875
1778
|
}
|
|
@@ -2023,12 +1926,6 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2023
1926
|
async updateMessages(_args) {
|
|
2024
1927
|
return this.stores.memory.updateMessages(_args);
|
|
2025
1928
|
}
|
|
2026
|
-
async getEvalsByAgentName(agentName, type) {
|
|
2027
|
-
return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
|
|
2028
|
-
}
|
|
2029
|
-
async getEvals(options) {
|
|
2030
|
-
return this.stores.legacyEvals.getEvals(options);
|
|
2031
|
-
}
|
|
2032
1929
|
async getWorkflowRuns(args) {
|
|
2033
1930
|
return this.stores.workflows.getWorkflowRuns(args);
|
|
2034
1931
|
}
|
|
@@ -2040,9 +1937,9 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
|
|
|
2040
1937
|
runId,
|
|
2041
1938
|
stepId,
|
|
2042
1939
|
result,
|
|
2043
|
-
|
|
1940
|
+
requestContext
|
|
2044
1941
|
}) {
|
|
2045
|
-
return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result,
|
|
1942
|
+
return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, requestContext });
|
|
2046
1943
|
}
|
|
2047
1944
|
async updateWorkflowState({
|
|
2048
1945
|
workflowName,
|