@mastra/lance 0.0.0-scorers-api-v2-20250801171841 → 0.0.0-scorers-ui-refactored-20250916094952

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 (39) hide show
  1. package/CHANGELOG.md +282 -3
  2. package/README.md +3 -3
  3. package/dist/index.cjs +132 -30
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +132 -30
  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/scores/index.d.ts +5 -2
  11. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  12. package/dist/storage/domains/traces/index.d.ts +1 -1
  13. package/dist/storage/domains/workflows/index.d.ts +21 -2
  14. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  15. package/dist/storage/index.d.ts +34 -4
  16. package/dist/storage/index.d.ts.map +1 -1
  17. package/dist/vector/index.d.ts +3 -3
  18. package/dist/vector/index.d.ts.map +1 -1
  19. package/package.json +21 -7
  20. package/eslint.config.js +0 -6
  21. package/src/index.ts +0 -2
  22. package/src/storage/domains/legacy-evals/index.ts +0 -156
  23. package/src/storage/domains/memory/index.ts +0 -947
  24. package/src/storage/domains/operations/index.ts +0 -489
  25. package/src/storage/domains/scores/index.ts +0 -221
  26. package/src/storage/domains/traces/index.ts +0 -212
  27. package/src/storage/domains/utils.ts +0 -158
  28. package/src/storage/domains/workflows/index.ts +0 -207
  29. package/src/storage/index.test.ts +0 -10
  30. package/src/storage/index.ts +0 -442
  31. package/src/vector/filter.test.ts +0 -295
  32. package/src/vector/filter.ts +0 -443
  33. package/src/vector/index.test.ts +0 -1493
  34. package/src/vector/index.ts +0 -941
  35. package/src/vector/types.ts +0 -16
  36. package/tsconfig.build.json +0 -9
  37. package/tsconfig.json +0 -5
  38. package/tsup.config.ts +0 -22
  39. package/vitest.config.ts +0 -11
package/CHANGELOG.md CHANGED
@@ -1,11 +1,290 @@
1
1
  # @mastra/lance
2
2
 
3
- ## 0.0.0-scorers-api-v2-20250801171841
3
+ ## 0.0.0-scorers-ui-refactored-20250916094952
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [c6f12c7]
8
- - @mastra/core@0.0.0-scorers-api-v2-20250801171841
7
+ - Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
8
+
9
+ - Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`60c9cec`](https://github.com/mastra-ai/mastra/commit/60c9cec7048a79a87440f7840c383875bd710d93), [`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4), [`897995e`](https://github.com/mastra-ai/mastra/commit/897995e630d572fe2891e7ede817938cabb43251), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11)]:
10
+ - @mastra/core@0.0.0-scorers-ui-refactored-20250916094952
11
+
12
+ ## 0.3.1-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
17
+
18
+ - Updated dependencies [[`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4)]:
19
+ - @mastra/core@0.16.4-alpha.1
20
+
21
+ ## 0.3.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 376913a: Update peerdeps of @mastra/core
26
+
27
+ ### Patch Changes
28
+
29
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
30
+ - Updated dependencies [8fbf79e]
31
+ - Updated dependencies [fd83526]
32
+ - Updated dependencies [d0b90ab]
33
+ - Updated dependencies [6f5eb7a]
34
+ - Updated dependencies [a01cf14]
35
+ - Updated dependencies [a9e50ee]
36
+ - Updated dependencies [5397eb4]
37
+ - Updated dependencies [c9f4e4a]
38
+ - Updated dependencies [0acbc80]
39
+ - @mastra/core@0.16.0
40
+
41
+ ## 0.3.0-alpha.1
42
+
43
+ ### Minor Changes
44
+
45
+ - 376913a: Update peerdeps of @mastra/core
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [8fbf79e]
50
+ - @mastra/core@0.16.0-alpha.1
51
+
52
+ ## 0.2.12-alpha.0
53
+
54
+ ### Patch Changes
55
+
56
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
57
+ - Updated dependencies [fd83526]
58
+ - Updated dependencies [d0b90ab]
59
+ - Updated dependencies [6f5eb7a]
60
+ - Updated dependencies [a01cf14]
61
+ - Updated dependencies [a9e50ee]
62
+ - Updated dependencies [5397eb4]
63
+ - Updated dependencies [c9f4e4a]
64
+ - Updated dependencies [0acbc80]
65
+ - @mastra/core@0.16.0-alpha.0
66
+
67
+ ## 0.2.11
68
+
69
+ ### Patch Changes
70
+
71
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
72
+ - f0dfcac: updated core peerdep
73
+ - Updated dependencies [ab48c97]
74
+ - Updated dependencies [85ef90b]
75
+ - Updated dependencies [aedbbfa]
76
+ - Updated dependencies [ff89505]
77
+ - Updated dependencies [637f323]
78
+ - Updated dependencies [de3cbc6]
79
+ - Updated dependencies [c19bcf7]
80
+ - Updated dependencies [4474d04]
81
+ - Updated dependencies [183dc95]
82
+ - Updated dependencies [a1111e2]
83
+ - Updated dependencies [b42a961]
84
+ - Updated dependencies [61debef]
85
+ - Updated dependencies [9beaeff]
86
+ - Updated dependencies [29de0e1]
87
+ - Updated dependencies [f643c65]
88
+ - Updated dependencies [00c74e7]
89
+ - Updated dependencies [fef7375]
90
+ - Updated dependencies [e3d8fea]
91
+ - Updated dependencies [45e4d39]
92
+ - Updated dependencies [9eee594]
93
+ - Updated dependencies [7149d8d]
94
+ - Updated dependencies [822c2e8]
95
+ - Updated dependencies [979912c]
96
+ - Updated dependencies [7dcf4c0]
97
+ - Updated dependencies [4106a58]
98
+ - Updated dependencies [ad78bfc]
99
+ - Updated dependencies [0302f50]
100
+ - Updated dependencies [6ac697e]
101
+ - Updated dependencies [74db265]
102
+ - Updated dependencies [0ce418a]
103
+ - Updated dependencies [af90672]
104
+ - Updated dependencies [8387952]
105
+ - Updated dependencies [7f3b8da]
106
+ - Updated dependencies [905352b]
107
+ - Updated dependencies [599d04c]
108
+ - Updated dependencies [56041d0]
109
+ - Updated dependencies [3412597]
110
+ - Updated dependencies [5eca5d2]
111
+ - Updated dependencies [f2cda47]
112
+ - Updated dependencies [5de1555]
113
+ - Updated dependencies [cfd377a]
114
+ - Updated dependencies [1ed5a3e]
115
+ - @mastra/core@0.15.3
116
+
117
+ ## 0.2.11-alpha.1
118
+
119
+ ### Patch Changes
120
+
121
+ - [#7394](https://github.com/mastra-ai/mastra/pull/7394) [`f0dfcac`](https://github.com/mastra-ai/mastra/commit/f0dfcac4458bdf789b975e2d63e984f5d1e7c4d3) Thanks [@NikAiyer](https://github.com/NikAiyer)! - updated core peerdep
122
+
123
+ - Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
124
+ - @mastra/core@0.15.3-alpha.7
125
+
126
+ ## 0.2.11-alpha.0
127
+
128
+ ### Patch Changes
129
+
130
+ - [#7343](https://github.com/mastra-ai/mastra/pull/7343) [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e) Thanks [@LekoArts](https://github.com/LekoArts)! - Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
131
+
132
+ - Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
133
+ - @mastra/core@0.15.3-alpha.5
134
+
135
+ ## 0.2.10
136
+
137
+ ### Patch Changes
138
+
139
+ - [`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdpes for @mastra/core
140
+
141
+ - Updated dependencies []:
142
+ - @mastra/core@0.15.2
143
+
144
+ ## 0.2.9
145
+
146
+ ### Patch Changes
147
+
148
+ - [`95b2aa9`](https://github.com/mastra-ai/mastra/commit/95b2aa908230919e67efcac0d69005a2d5745298) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdeps @mastra/core
149
+
150
+ - Updated dependencies []:
151
+ - @mastra/core@0.15.1
152
+
153
+ ## 0.2.8
154
+
155
+ ### Patch Changes
156
+
157
+ - [#6994](https://github.com/mastra-ai/mastra/pull/6994) [`0594a70`](https://github.com/mastra-ai/mastra/commit/0594a70ac948d306c7f38765b171c9535e6c78d4) Thanks [@wardpeet](https://github.com/wardpeet)! - Improve type resolving for storage adapters
158
+
159
+ - Updated dependencies [[`0778757`](https://github.com/mastra-ai/mastra/commit/07787570e4addbd501522037bd2542c3d9e26822), [`943a7f3`](https://github.com/mastra-ai/mastra/commit/943a7f3dbc6a8ab3f9b7bc7c8a1c5b319c3d7f56), [`bf504a8`](https://github.com/mastra-ai/mastra/commit/bf504a833051f6f321d832cc7d631f3cb86d657b), [`be49354`](https://github.com/mastra-ai/mastra/commit/be493546dca540101923ec700feb31f9a13939f2), [`d591ab3`](https://github.com/mastra-ai/mastra/commit/d591ab3ecc985c1870c0db347f8d7a20f7360536), [`ba82abe`](https://github.com/mastra-ai/mastra/commit/ba82abe76e869316bb5a9c95e8ea3946f3436fae), [`727f7e5`](https://github.com/mastra-ai/mastra/commit/727f7e5086e62e0dfe3356fb6dcd8bcb420af246), [`e6f5046`](https://github.com/mastra-ai/mastra/commit/e6f50467aff317e67e8bd74c485c3fbe2a5a6db1), [`82d9f64`](https://github.com/mastra-ai/mastra/commit/82d9f647fbe4f0177320e7c05073fce88599aa95), [`2e58325`](https://github.com/mastra-ai/mastra/commit/2e58325beb170f5b92f856e27d915cd26917e5e6), [`1191ce9`](https://github.com/mastra-ai/mastra/commit/1191ce946b40ed291e7877a349f8388e3cff7e5c), [`4189486`](https://github.com/mastra-ai/mastra/commit/4189486c6718fda78347bdf4ce4d3fc33b2236e1), [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01), [`9613558`](https://github.com/mastra-ai/mastra/commit/9613558e6475f4710e05d1be7553a32ee7bddc20)]:
160
+ - @mastra/core@0.15.0
161
+
162
+ ## 0.2.8-alpha.0
163
+
164
+ ### Patch Changes
165
+
166
+ - [#6994](https://github.com/mastra-ai/mastra/pull/6994) [`0594a70`](https://github.com/mastra-ai/mastra/commit/0594a70ac948d306c7f38765b171c9535e6c78d4) Thanks [@wardpeet](https://github.com/wardpeet)! - Improve type resolving for storage adapters
167
+
168
+ - Updated dependencies [[`943a7f3`](https://github.com/mastra-ai/mastra/commit/943a7f3dbc6a8ab3f9b7bc7c8a1c5b319c3d7f56), [`be49354`](https://github.com/mastra-ai/mastra/commit/be493546dca540101923ec700feb31f9a13939f2), [`d591ab3`](https://github.com/mastra-ai/mastra/commit/d591ab3ecc985c1870c0db347f8d7a20f7360536), [`ba82abe`](https://github.com/mastra-ai/mastra/commit/ba82abe76e869316bb5a9c95e8ea3946f3436fae), [`727f7e5`](https://github.com/mastra-ai/mastra/commit/727f7e5086e62e0dfe3356fb6dcd8bcb420af246), [`82d9f64`](https://github.com/mastra-ai/mastra/commit/82d9f647fbe4f0177320e7c05073fce88599aa95), [`4189486`](https://github.com/mastra-ai/mastra/commit/4189486c6718fda78347bdf4ce4d3fc33b2236e1), [`ca8ec2f`](https://github.com/mastra-ai/mastra/commit/ca8ec2f61884b9dfec5fc0d5f4f29d281ad13c01)]:
169
+ - @mastra/core@0.14.2-alpha.1
170
+
171
+ ## 0.2.7
172
+
173
+ ### Patch Changes
174
+
175
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
176
+
177
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`0f00e17`](https://github.com/mastra-ai/mastra/commit/0f00e172953ccdccadb35ed3d70f5e4d89115869), [`217cd7a`](https://github.com/mastra-ai/mastra/commit/217cd7a4ce171e9a575c41bb8c83300f4db03236), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
178
+ - @mastra/core@0.14.1
179
+
180
+ ## 0.2.7-alpha.0
181
+
182
+ ### Patch Changes
183
+
184
+ - [#6700](https://github.com/mastra-ai/mastra/pull/6700) [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02) Thanks [@gpanakkal](https://github.com/gpanakkal)! - Add `getMessagesById` method to `MastraStorage` adapters
185
+
186
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
187
+ - @mastra/core@0.14.1-alpha.0
188
+
189
+ ## 0.2.6
190
+
191
+ ### Patch Changes
192
+
193
+ - 03997ae: Update peerdeps
194
+ - Updated dependencies [227c7e6]
195
+ - Updated dependencies [12cae67]
196
+ - Updated dependencies [fd3a3eb]
197
+ - Updated dependencies [6faaee5]
198
+ - Updated dependencies [4232b14]
199
+ - Updated dependencies [a89de7e]
200
+ - Updated dependencies [5a37d0c]
201
+ - Updated dependencies [4bde0cb]
202
+ - Updated dependencies [cf4f357]
203
+ - Updated dependencies [ad888a2]
204
+ - Updated dependencies [481751d]
205
+ - Updated dependencies [2454423]
206
+ - Updated dependencies [194e395]
207
+ - Updated dependencies [a722c0b]
208
+ - Updated dependencies [c30bca8]
209
+ - Updated dependencies [3b5fec7]
210
+ - Updated dependencies [a8f129d]
211
+ - @mastra/core@0.14.0
212
+
213
+ ## 0.2.6-alpha.0
214
+
215
+ ### Patch Changes
216
+
217
+ - 03997ae: Update peerdeps
218
+ - @mastra/core@0.14.0-alpha.7
219
+
220
+ ## 0.2.5
221
+
222
+ ### Patch Changes
223
+
224
+ - cc9035c: dependencies updates:
225
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
226
+ - b32c50d: Filter scores by source
227
+ - Updated dependencies [d5330bf]
228
+ - Updated dependencies [2e74797]
229
+ - Updated dependencies [8388649]
230
+ - Updated dependencies [a239d41]
231
+ - Updated dependencies [dd94a26]
232
+ - Updated dependencies [3ba6772]
233
+ - Updated dependencies [b5cf2a3]
234
+ - Updated dependencies [2fff911]
235
+ - Updated dependencies [b32c50d]
236
+ - Updated dependencies [63449d0]
237
+ - Updated dependencies [121a3f8]
238
+ - Updated dependencies [ec510e7]
239
+ - @mastra/core@0.13.2
240
+
241
+ ## 0.2.5-alpha.0
242
+
243
+ ### Patch Changes
244
+
245
+ - cc9035c: dependencies updates:
246
+ - Updated dependency [`@lancedb/lancedb@^0.21.2` ↗︎](https://www.npmjs.com/package/@lancedb/lancedb/v/0.21.2) (from `^0.18.2`, in `dependencies`)
247
+ - b32c50d: Filter scores by source
248
+ - Updated dependencies [d5330bf]
249
+ - Updated dependencies [a239d41]
250
+ - Updated dependencies [b32c50d]
251
+ - Updated dependencies [121a3f8]
252
+ - Updated dependencies [ec510e7]
253
+ - @mastra/core@0.13.2-alpha.2
254
+
255
+ ## 0.2.4
256
+
257
+ ### Patch Changes
258
+
259
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
260
+ - Updated dependencies [cb36de0]
261
+ - Updated dependencies [d0496e6]
262
+ - Updated dependencies [a82b851]
263
+ - Updated dependencies [ea0c5f2]
264
+ - Updated dependencies [41a0a0e]
265
+ - Updated dependencies [2871020]
266
+ - Updated dependencies [94f4812]
267
+ - Updated dependencies [e202b82]
268
+ - Updated dependencies [e00f6a0]
269
+ - Updated dependencies [4a406ec]
270
+ - Updated dependencies [b0e43c1]
271
+ - Updated dependencies [5d377e5]
272
+ - Updated dependencies [1fb812e]
273
+ - Updated dependencies [35c5798]
274
+ - @mastra/core@0.13.0
275
+
276
+ ## 0.2.4-alpha.0
277
+
278
+ ### Patch Changes
279
+
280
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
281
+ - Updated dependencies [cb36de0]
282
+ - Updated dependencies [a82b851]
283
+ - Updated dependencies [41a0a0e]
284
+ - Updated dependencies [2871020]
285
+ - Updated dependencies [4a406ec]
286
+ - Updated dependencies [5d377e5]
287
+ - @mastra/core@0.13.0-alpha.2
9
288
 
10
289
  ## 0.2.3
11
290
 
package/README.md CHANGED
@@ -124,7 +124,7 @@ const messages = await storage.getMessages({
124
124
  ### Creating Threads
125
125
 
126
126
  ```typescript
127
- import type { StorageThreadType } from '@mastra/core';
127
+ import type { StorageThreadType } from '@mastra/core/storage';
128
128
 
129
129
  // Create a new thread
130
130
  const thread: StorageThreadType = {
@@ -142,7 +142,7 @@ const savedThread = await storage.saveThread({ thread });
142
142
  ### Working with Messages
143
143
 
144
144
  ```typescript
145
- import type { MessageType } from '@mastra/core';
145
+ import type { MessageType } from '@mastra/core/memory';
146
146
 
147
147
  // Create messages
148
148
  const messages: MessageType[] = [
@@ -193,7 +193,7 @@ const retrievedMessages = await storage.getMessages({
193
193
  Mastra's workflow system uses LanceDB to persist workflow state for continuity across runs:
194
194
 
195
195
  ```typescript
196
- import type { WorkflowRunState } from '@mastra/core';
196
+ import type { WorkflowRunState } from '@mastra/core/storage';
197
197
 
198
198
  // Persist a workflow snapshot
199
199
  await storage.persistWorkflowSnapshot({
package/dist/index.cjs CHANGED
@@ -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
  /**
@@ -1361,6 +1401,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1361
1401
  }
1362
1402
  async saveScore(score) {
1363
1403
  try {
1404
+ const id = crypto.randomUUID();
1364
1405
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1365
1406
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1366
1407
  const allowedFields = new Set(schema.fields.map((f) => f.name));
@@ -1375,7 +1416,7 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1375
1416
  filteredScore[key] = JSON.stringify(filteredScore[key]);
1376
1417
  }
1377
1418
  }
1378
- console.log("Saving score to LanceStorage:", filteredScore);
1419
+ filteredScore.id = id;
1379
1420
  await table.add([filteredScore], { mode: "append" });
1380
1421
  return { score };
1381
1422
  } catch (error$1) {
@@ -1414,18 +1455,35 @@ var StoreScoresLance = class extends storage.ScoresStorage {
1414
1455
  }
1415
1456
  async getScoresByScorerId({
1416
1457
  scorerId,
1417
- pagination
1458
+ pagination,
1459
+ entityId,
1460
+ entityType,
1461
+ source
1418
1462
  }) {
1419
1463
  try {
1420
1464
  const table = await this.client.openTable(storage.TABLE_SCORERS);
1421
1465
  const { page = 0, perPage = 10 } = pagination || {};
1422
1466
  const offset = page * perPage;
1423
- const query = table.query().where(`\`scorerId\` = '${scorerId}'`).limit(perPage);
1467
+ let query = table.query().where(`\`scorerId\` = '${scorerId}'`);
1468
+ if (source) {
1469
+ query = query.where(`\`source\` = '${source}'`);
1470
+ }
1471
+ if (entityId) {
1472
+ query = query.where(`\`entityId\` = '${entityId}'`);
1473
+ }
1474
+ if (entityType) {
1475
+ query = query.where(`\`entityType\` = '${entityType}'`);
1476
+ }
1477
+ query = query.limit(perPage);
1424
1478
  if (offset > 0) query.offset(offset);
1425
1479
  const records = await query.toArray();
1426
1480
  const schema = await getTableSchema({ tableName: storage.TABLE_SCORERS, client: this.client });
1427
1481
  const scores = processResultWithTypeConversion(records, schema);
1428
- const allRecords = await table.query().where(`\`scorerId\` = '${scorerId}'`).toArray();
1482
+ let totalQuery = table.query().where(`\`scorerId\` = '${scorerId}'`);
1483
+ if (source) {
1484
+ totalQuery = totalQuery.where(`\`source\` = '${source}'`);
1485
+ }
1486
+ const allRecords = await totalQuery.toArray();
1429
1487
  const total = allRecords.length;
1430
1488
  return {
1431
1489
  pagination: {
@@ -1741,9 +1799,26 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1741
1799
  super();
1742
1800
  this.client = client;
1743
1801
  }
1802
+ updateWorkflowResults({
1803
+ // workflowName,
1804
+ // runId,
1805
+ // stepId,
1806
+ // result,
1807
+ // runtimeContext,
1808
+ }) {
1809
+ throw new Error("Method not implemented.");
1810
+ }
1811
+ updateWorkflowState({
1812
+ // workflowName,
1813
+ // runId,
1814
+ // opts,
1815
+ }) {
1816
+ throw new Error("Method not implemented.");
1817
+ }
1744
1818
  async persistWorkflowSnapshot({
1745
1819
  workflowName,
1746
1820
  runId,
1821
+ resourceId,
1747
1822
  snapshot
1748
1823
  }) {
1749
1824
  try {
@@ -1760,6 +1835,7 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1760
1835
  const record = {
1761
1836
  workflow_name: workflowName,
1762
1837
  run_id: runId,
1838
+ resourceId,
1763
1839
  snapshot: JSON.stringify(snapshot),
1764
1840
  createdAt,
1765
1841
  updatedAt: now
@@ -2071,6 +2147,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2071
2147
  }) {
2072
2148
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format, threadConfig });
2073
2149
  }
2150
+ async getMessagesById({
2151
+ messageIds,
2152
+ format
2153
+ }) {
2154
+ return this.stores.memory.getMessagesById({ messageIds, format });
2155
+ }
2074
2156
  async saveMessages(args) {
2075
2157
  return this.stores.memory.saveMessages(args);
2076
2158
  }
@@ -2104,12 +2186,29 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2104
2186
  async getWorkflowRunById(args) {
2105
2187
  return this.stores.workflows.getWorkflowRunById(args);
2106
2188
  }
2189
+ async updateWorkflowResults({
2190
+ workflowName,
2191
+ runId,
2192
+ stepId,
2193
+ result,
2194
+ runtimeContext
2195
+ }) {
2196
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
2197
+ }
2198
+ async updateWorkflowState({
2199
+ workflowName,
2200
+ runId,
2201
+ opts
2202
+ }) {
2203
+ return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
2204
+ }
2107
2205
  async persistWorkflowSnapshot({
2108
2206
  workflowName,
2109
2207
  runId,
2208
+ resourceId,
2110
2209
  snapshot
2111
2210
  }) {
2112
- return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
2211
+ return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
2113
2212
  }
2114
2213
  async loadWorkflowSnapshot({
2115
2214
  workflowName,
@@ -2122,9 +2221,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2122
2221
  }
2123
2222
  async getScoresByScorerId({
2124
2223
  scorerId,
2224
+ source,
2225
+ entityId,
2226
+ entityType,
2125
2227
  pagination
2126
2228
  }) {
2127
- return this.stores.scores.getScoresByScorerId({ scorerId, pagination });
2229
+ return this.stores.scores.getScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
2128
2230
  }
2129
2231
  async saveScore(_score) {
2130
2232
  return this.stores.scores.saveScore(_score);