@mastra/lance 0.0.0-memory-system-message-error-20250813233316 → 0.0.0-message-file-url-handling-fix-20250904234524

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 CHANGED
@@ -1,17 +1,188 @@
1
1
  # @mastra/lance
2
2
 
3
- ## 0.0.0-memory-system-message-error-20250813233316
3
+ ## 0.0.0-message-file-url-handling-fix-20250904234524
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [49281f5]
8
- - Updated dependencies [2256977]
9
- - Updated dependencies [c597dc5]
10
- - Updated dependencies [a6841fa]
7
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
8
+ - Updated dependencies [fd83526]
9
+ - Updated dependencies [d0b90ab]
10
+ - Updated dependencies [6f5eb7a]
11
+ - Updated dependencies [a01cf14]
12
+ - Updated dependencies [a9e50ee]
13
+ - Updated dependencies [5397eb4]
14
+ - Updated dependencies [c9f4e4a]
15
+ - Updated dependencies [b586a0b]
16
+ - Updated dependencies [0acbc80]
17
+ - @mastra/core@0.0.0-message-file-url-handling-fix-20250904234524
18
+
19
+ ## 0.2.12-alpha.0
20
+
21
+ ### Patch Changes
22
+
23
+ - 6f5eb7a: Throw if an empty or whitespace-only threadId is passed when getting messages
24
+ - Updated dependencies [fd83526]
25
+ - Updated dependencies [d0b90ab]
26
+ - Updated dependencies [6f5eb7a]
27
+ - Updated dependencies [a01cf14]
28
+ - Updated dependencies [a9e50ee]
29
+ - Updated dependencies [5397eb4]
30
+ - Updated dependencies [c9f4e4a]
31
+ - Updated dependencies [0acbc80]
32
+ - @mastra/core@0.16.0-alpha.0
33
+
34
+ ## 0.2.11
35
+
36
+ ### Patch Changes
37
+
38
+ - de3cbc6: Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
39
+ - f0dfcac: updated core peerdep
40
+ - Updated dependencies [ab48c97]
41
+ - Updated dependencies [85ef90b]
42
+ - Updated dependencies [aedbbfa]
43
+ - Updated dependencies [ff89505]
44
+ - Updated dependencies [637f323]
45
+ - Updated dependencies [de3cbc6]
46
+ - Updated dependencies [c19bcf7]
47
+ - Updated dependencies [4474d04]
48
+ - Updated dependencies [183dc95]
49
+ - Updated dependencies [a1111e2]
50
+ - Updated dependencies [b42a961]
51
+ - Updated dependencies [61debef]
52
+ - Updated dependencies [9beaeff]
53
+ - Updated dependencies [29de0e1]
54
+ - Updated dependencies [f643c65]
55
+ - Updated dependencies [00c74e7]
56
+ - Updated dependencies [fef7375]
57
+ - Updated dependencies [e3d8fea]
58
+ - Updated dependencies [45e4d39]
59
+ - Updated dependencies [9eee594]
60
+ - Updated dependencies [7149d8d]
61
+ - Updated dependencies [822c2e8]
62
+ - Updated dependencies [979912c]
63
+ - Updated dependencies [7dcf4c0]
64
+ - Updated dependencies [4106a58]
65
+ - Updated dependencies [ad78bfc]
66
+ - Updated dependencies [0302f50]
67
+ - Updated dependencies [6ac697e]
68
+ - Updated dependencies [74db265]
69
+ - Updated dependencies [0ce418a]
70
+ - Updated dependencies [af90672]
71
+ - Updated dependencies [8387952]
72
+ - Updated dependencies [7f3b8da]
73
+ - Updated dependencies [905352b]
74
+ - Updated dependencies [599d04c]
75
+ - Updated dependencies [56041d0]
76
+ - Updated dependencies [3412597]
77
+ - Updated dependencies [5eca5d2]
78
+ - Updated dependencies [f2cda47]
79
+ - Updated dependencies [5de1555]
80
+ - Updated dependencies [cfd377a]
81
+ - Updated dependencies [1ed5a3e]
82
+ - @mastra/core@0.15.3
83
+
84
+ ## 0.2.11-alpha.1
85
+
86
+ ### Patch Changes
87
+
88
+ - [#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
89
+
90
+ - Updated dependencies [[`7149d8d`](https://github.com/mastra-ai/mastra/commit/7149d8d4bdc1edf0008e0ca9b7925eb0b8b60dbe)]:
91
+ - @mastra/core@0.15.3-alpha.7
92
+
93
+ ## 0.2.11-alpha.0
94
+
95
+ ### Patch Changes
96
+
97
+ - [#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`.
98
+
99
+ - Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
100
+ - @mastra/core@0.15.3-alpha.5
101
+
102
+ ## 0.2.10
103
+
104
+ ### Patch Changes
105
+
106
+ - [`c6113ed`](https://github.com/mastra-ai/mastra/commit/c6113ed7f9df297e130d94436ceee310273d6430) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdpes for @mastra/core
107
+
108
+ - Updated dependencies []:
109
+ - @mastra/core@0.15.2
110
+
111
+ ## 0.2.9
112
+
113
+ ### Patch Changes
114
+
115
+ - [`95b2aa9`](https://github.com/mastra-ai/mastra/commit/95b2aa908230919e67efcac0d69005a2d5745298) Thanks [@wardpeet](https://github.com/wardpeet)! - Fix peerdeps @mastra/core
116
+
117
+ - Updated dependencies []:
118
+ - @mastra/core@0.15.1
119
+
120
+ ## 0.2.8
121
+
122
+ ### Patch Changes
123
+
124
+ - [#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
125
+
126
+ - 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)]:
127
+ - @mastra/core@0.15.0
128
+
129
+ ## 0.2.8-alpha.0
130
+
131
+ ### Patch Changes
132
+
133
+ - [#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
134
+
135
+ - 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)]:
136
+ - @mastra/core@0.14.2-alpha.1
137
+
138
+ ## 0.2.7
139
+
140
+ ### Patch Changes
141
+
142
+ - [#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
143
+
144
+ - 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)]:
145
+ - @mastra/core@0.14.1
146
+
147
+ ## 0.2.7-alpha.0
148
+
149
+ ### Patch Changes
150
+
151
+ - [#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
152
+
153
+ - Updated dependencies [[`6e7e120`](https://github.com/mastra-ai/mastra/commit/6e7e1207d6e8d8b838f9024f90bd10df1181ba27), [`a5a23d9`](https://github.com/mastra-ai/mastra/commit/a5a23d981920d458dc6078919992a5338931ef02)]:
154
+ - @mastra/core@0.14.1-alpha.0
155
+
156
+ ## 0.2.6
157
+
158
+ ### Patch Changes
159
+
160
+ - 03997ae: Update peerdeps
161
+ - Updated dependencies [227c7e6]
162
+ - Updated dependencies [12cae67]
163
+ - Updated dependencies [fd3a3eb]
164
+ - Updated dependencies [6faaee5]
165
+ - Updated dependencies [4232b14]
166
+ - Updated dependencies [a89de7e]
167
+ - Updated dependencies [5a37d0c]
168
+ - Updated dependencies [4bde0cb]
169
+ - Updated dependencies [cf4f357]
170
+ - Updated dependencies [ad888a2]
171
+ - Updated dependencies [481751d]
172
+ - Updated dependencies [2454423]
173
+ - Updated dependencies [194e395]
174
+ - Updated dependencies [a722c0b]
11
175
  - Updated dependencies [c30bca8]
12
- - Updated dependencies [83d180b]
13
176
  - Updated dependencies [3b5fec7]
14
- - @mastra/core@0.0.0-memory-system-message-error-20250813233316
177
+ - Updated dependencies [a8f129d]
178
+ - @mastra/core@0.14.0
179
+
180
+ ## 0.2.6-alpha.0
181
+
182
+ ### Patch Changes
183
+
184
+ - 03997ae: Update peerdeps
185
+ - @mastra/core@0.14.0-alpha.7
15
186
 
16
187
  ## 0.2.5
17
188
 
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
  /**
@@ -1759,6 +1799,22 @@ var StoreWorkflowsLance = class extends storage.WorkflowsStorage {
1759
1799
  super();
1760
1800
  this.client = client;
1761
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
+ }
1762
1818
  async persistWorkflowSnapshot({
1763
1819
  workflowName,
1764
1820
  runId,
@@ -2089,6 +2145,12 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2089
2145
  }) {
2090
2146
  return this.stores.memory.getMessages({ threadId, resourceId, selectBy, format, threadConfig });
2091
2147
  }
2148
+ async getMessagesById({
2149
+ messageIds,
2150
+ format
2151
+ }) {
2152
+ return this.stores.memory.getMessagesById({ messageIds, format });
2153
+ }
2092
2154
  async saveMessages(args) {
2093
2155
  return this.stores.memory.saveMessages(args);
2094
2156
  }
@@ -2122,6 +2184,22 @@ var LanceStorage = class _LanceStorage extends storage.MastraStorage {
2122
2184
  async getWorkflowRunById(args) {
2123
2185
  return this.stores.workflows.getWorkflowRunById(args);
2124
2186
  }
2187
+ async updateWorkflowResults({
2188
+ workflowName,
2189
+ runId,
2190
+ stepId,
2191
+ result,
2192
+ runtimeContext
2193
+ }) {
2194
+ return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext });
2195
+ }
2196
+ async updateWorkflowState({
2197
+ workflowName,
2198
+ runId,
2199
+ opts
2200
+ }) {
2201
+ return this.stores.workflows.updateWorkflowState({ workflowName, runId, opts });
2202
+ }
2125
2203
  async persistWorkflowSnapshot({
2126
2204
  workflowName,
2127
2205
  runId,