@mastra/server 0.0.0-fix-9244-clickhouse-metadata-20251104223105 → 0.0.0-fix-thread-list-20251105222841
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 +96 -3
- package/dist/{chunk-FKZVCLOY.js → chunk-A5SOZY5R.js} +22 -47
- package/dist/chunk-A5SOZY5R.js.map +1 -0
- package/dist/{chunk-JIIVA4BA.cjs → chunk-M6KNPIZZ.cjs} +34 -48
- package/dist/chunk-M6KNPIZZ.cjs.map +1 -0
- package/dist/{chunk-KCP6I5F3.js → chunk-QXWWLCTQ.js} +18 -31
- package/dist/chunk-QXWWLCTQ.js.map +1 -0
- package/dist/{chunk-QFGNUBOA.cjs → chunk-SIPNICB3.cjs} +21 -47
- package/dist/chunk-SIPNICB3.cjs.map +1 -0
- package/dist/{chunk-AEVI2HIU.cjs → chunk-SRAPUMPM.cjs} +2 -33
- package/dist/chunk-SRAPUMPM.cjs.map +1 -0
- package/dist/{chunk-R6OQFR47.js → chunk-TWHS6DKL.js} +3 -33
- package/dist/{chunk-AEVI2HIU.cjs.map → chunk-TWHS6DKL.js.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +19 -23
- package/dist/server/handlers/agent-builder.d.ts +0 -6
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/memory.cjs +14 -18
- package/dist/server/handlers/memory.d.ts +1 -5
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.d.ts +1 -1
- package/dist/server/handlers/workflows.cjs +19 -23
- package/dist/server/handlers/workflows.d.ts +0 -6
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +6 -6
- package/dist/server/handlers.js +3 -3
- package/package.json +9 -6
- package/dist/chunk-FKZVCLOY.js.map +0 -1
- package/dist/chunk-JIIVA4BA.cjs.map +0 -1
- package/dist/chunk-KCP6I5F3.js.map +0 -1
- package/dist/chunk-QFGNUBOA.cjs.map +0 -1
- package/dist/chunk-R6OQFR47.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-thread-list-20251105222841
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
@@ -43,8 +43,99 @@
|
|
|
43
43
|
+ thread.listMessages({ page: 0, perPage: 20 })
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
- # Major Changes ([#9695](https://github.com/mastra-ai/mastra/pull/9695))
|
|
47
|
+
|
|
48
|
+
## Storage Layer
|
|
49
|
+
|
|
50
|
+
### BREAKING: Removed `storage.getMessages()`
|
|
51
|
+
|
|
52
|
+
The `getMessages()` method has been removed from all storage implementations. Use `listMessages()` instead, which provides pagination support.
|
|
53
|
+
|
|
54
|
+
**Migration:**
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Before
|
|
58
|
+
const messages = await storage.getMessages({ threadId: 'thread-1' });
|
|
59
|
+
|
|
60
|
+
// After
|
|
61
|
+
const result = await storage.listMessages({
|
|
62
|
+
threadId: 'thread-1',
|
|
63
|
+
page: 0,
|
|
64
|
+
perPage: 50,
|
|
65
|
+
});
|
|
66
|
+
const messages = result.messages; // Access messages array
|
|
67
|
+
console.log(result.total); // Total count
|
|
68
|
+
console.log(result.hasMore); // Whether more pages exist
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Message ordering default
|
|
72
|
+
|
|
73
|
+
`listMessages()` defaults to ASC (oldest first) ordering by `createdAt`, matching the previous `getMessages()` behavior.
|
|
74
|
+
|
|
75
|
+
**To use DESC ordering (newest first):**
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const result = await storage.listMessages({
|
|
79
|
+
threadId: 'thread-1',
|
|
80
|
+
orderBy: { field: 'createdAt', direction: 'DESC' },
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Client SDK
|
|
85
|
+
|
|
86
|
+
### BREAKING: Renamed `client.getThreadMessages()` → `client.listThreadMessages()`
|
|
87
|
+
|
|
88
|
+
**Migration:**
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Before
|
|
92
|
+
const response = await client.getThreadMessages(threadId, { agentId });
|
|
93
|
+
|
|
94
|
+
// After
|
|
95
|
+
const response = await client.listThreadMessages(threadId, { agentId });
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The response format remains the same.
|
|
99
|
+
|
|
100
|
+
## Type Changes
|
|
101
|
+
|
|
102
|
+
### BREAKING: Removed `StorageGetMessagesArg` type
|
|
103
|
+
|
|
104
|
+
Use `StorageListMessagesInput` instead:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// Before
|
|
108
|
+
import type { StorageGetMessagesArg } from '@mastra/core';
|
|
109
|
+
|
|
110
|
+
// After
|
|
111
|
+
import type { StorageListMessagesInput } from '@mastra/core';
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- Bump minimum required Node.js version to 22.13.0 ([#9706](https://github.com/mastra-ai/mastra/pull/9706))
|
|
115
|
+
|
|
46
116
|
- Replace `getThreadsByResourceIdPaginated` with `listThreadsByResourceId` across memory handlers. Update client SDK to use `listThreads()` with `offset`/`limit` parameters instead of deprecated `getMemoryThreads()`. Consolidate `/api/memory/threads` routes to single paginated endpoint. ([#9508](https://github.com/mastra-ai/mastra/pull/9508))
|
|
47
117
|
|
|
118
|
+
- This simplifies the Memory API by removing the confusing rememberMessages method and renaming query to recall for better clarity. ([#9701](https://github.com/mastra-ai/mastra/pull/9701))
|
|
119
|
+
|
|
120
|
+
The rememberMessages method name implied it might persist data when it was actually just retrieving messages, same as query. Having two methods that did essentially the same thing was unnecessary.
|
|
121
|
+
|
|
122
|
+
Before:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
// Two methods that did the same thing
|
|
126
|
+
memory.rememberMessages({ threadId, resourceId, config, vectorMessageSearch });
|
|
127
|
+
memory.query({ threadId, resourceId, perPage, vectorSearchString });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
After:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// Single unified method with clear purpose
|
|
134
|
+
memory.recall({ threadId, resourceId, perPage, vectorMessageSearch, threadConfig });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
All usages have been updated across the codebase including tests. The agent now calls recall directly with the appropriate parameters.
|
|
138
|
+
|
|
48
139
|
- Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
|
|
49
140
|
|
|
50
141
|
- Rename `defaultVNextStreamOptions` to `defaultOptions`. Add "Legacy" suffix to v1 option properties and methods (`defaultGenerateOptions` → `defaultGenerateOptionsLegacy`, `defaultStreamOptions` → `defaultStreamOptionsLegacy`). ([#9535](https://github.com/mastra-ai/mastra/pull/9535))
|
|
@@ -244,12 +335,14 @@
|
|
|
244
335
|
|
|
245
336
|
- Make step optional in resumeStreamVNext API ([#9453](https://github.com/mastra-ai/mastra/pull/9453))
|
|
246
337
|
|
|
338
|
+
- Remove `waitForEvent` from workflows. `waitForEvent` is now removed, please use suspend & resume flow instead. See https://mastra.ai/en/docs/workflows/suspend-and-resume for more details on suspend & resume flow. ([#9214](https://github.com/mastra-ai/mastra/pull/9214))
|
|
339
|
+
|
|
247
340
|
- Use memory mock in server tests ([#9486](https://github.com/mastra-ai/mastra/pull/9486))
|
|
248
341
|
|
|
249
342
|
- Remove format from stream/generate ([#9577](https://github.com/mastra-ai/mastra/pull/9577))
|
|
250
343
|
|
|
251
|
-
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`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), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`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), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`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), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`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), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`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), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`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)]:
|
|
252
|
-
- @mastra/core@0.0.0-fix-
|
|
344
|
+
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`0491e7c`](https://github.com/mastra-ai/mastra/commit/0491e7c9b714cb0ba22187ee062147ec2dd7c712), [`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), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`aaa40e7`](https://github.com/mastra-ai/mastra/commit/aaa40e788628b319baa8e889407d11ad626547fa), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`dd1c38d`](https://github.com/mastra-ai/mastra/commit/dd1c38d1b75f1b695c27b40d8d9d6ed00d5e0f6f), [`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), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`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), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`ca8041c`](https://github.com/mastra-ai/mastra/commit/ca8041cce0379fda22ed293a565bcb5b6ddca68a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`354ad0b`](https://github.com/mastra-ai/mastra/commit/354ad0b7b1b8183ac567f236a884fc7ede6d7138), [`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), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`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), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`b7959e6`](https://github.com/mastra-ai/mastra/commit/b7959e6e25a46b480f9ea2217c4c6c588c423791), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`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), [`e59e0d3`](https://github.com/mastra-ai/mastra/commit/e59e0d32afb5fcf2c9f3c00c8f81f6c21d3a63fa), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
345
|
+
- @mastra/core@0.0.0-fix-thread-list-20251105222841
|
|
253
346
|
|
|
254
347
|
## 0.22.2
|
|
255
348
|
|
|
@@ -2,7 +2,6 @@ import { validateBody } from './chunk-SZIFSF4T.js';
|
|
|
2
2
|
import { handleError } from './chunk-UXGQZUYZ.js';
|
|
3
3
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
4
4
|
import { __export } from './chunk-PR4QN5HX.js';
|
|
5
|
-
import { convertMessages } from '@mastra/core/agent';
|
|
6
5
|
import { RequestContext } from '@mastra/core/di';
|
|
7
6
|
import { generateEmptyFromSchema } from '@mastra/core/utils';
|
|
8
7
|
|
|
@@ -14,7 +13,6 @@ __export(memory_exports, {
|
|
|
14
13
|
deleteThreadHandler: () => deleteThreadHandler,
|
|
15
14
|
getMemoryConfigHandler: () => getMemoryConfigHandler,
|
|
16
15
|
getMemoryStatusHandler: () => getMemoryStatusHandler,
|
|
17
|
-
getMessagesHandler: () => getMessagesHandler,
|
|
18
16
|
getThreadByIdHandler: () => getThreadByIdHandler,
|
|
19
17
|
getWorkingMemoryHandler: () => getWorkingMemoryHandler,
|
|
20
18
|
listMessagesHandler: () => listMessagesHandler,
|
|
@@ -259,48 +257,16 @@ async function deleteThreadHandler({
|
|
|
259
257
|
}
|
|
260
258
|
async function listMessagesHandler({
|
|
261
259
|
mastra,
|
|
260
|
+
agentId,
|
|
262
261
|
threadId,
|
|
263
262
|
resourceId,
|
|
264
263
|
perPage,
|
|
265
264
|
page,
|
|
266
265
|
orderBy,
|
|
267
266
|
include,
|
|
268
|
-
filter
|
|
269
|
-
}) {
|
|
270
|
-
try {
|
|
271
|
-
validateBody({ threadId });
|
|
272
|
-
const storage = mastra.getStorage();
|
|
273
|
-
if (!storage) {
|
|
274
|
-
throw new HTTPException(400, { message: "Storage is not initialized" });
|
|
275
|
-
}
|
|
276
|
-
const thread = await storage.getThreadById({ threadId });
|
|
277
|
-
if (!thread) {
|
|
278
|
-
throw new HTTPException(404, { message: "Thread not found" });
|
|
279
|
-
}
|
|
280
|
-
const result = await storage.listMessages({
|
|
281
|
-
threadId,
|
|
282
|
-
resourceId,
|
|
283
|
-
perPage,
|
|
284
|
-
page,
|
|
285
|
-
orderBy,
|
|
286
|
-
include,
|
|
287
|
-
filter
|
|
288
|
-
});
|
|
289
|
-
return result;
|
|
290
|
-
} catch (error) {
|
|
291
|
-
return handleError(error, "Error getting messages");
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
async function getMessagesHandler({
|
|
295
|
-
mastra,
|
|
296
|
-
agentId,
|
|
297
|
-
threadId,
|
|
298
|
-
limit,
|
|
267
|
+
filter,
|
|
299
268
|
requestContext
|
|
300
269
|
}) {
|
|
301
|
-
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
302
|
-
throw new HTTPException(400, { message: "Invalid limit: must be a positive integer" });
|
|
303
|
-
}
|
|
304
270
|
try {
|
|
305
271
|
validateBody({ threadId });
|
|
306
272
|
const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
|
|
@@ -314,12 +280,16 @@ async function getMessagesHandler({
|
|
|
314
280
|
if (!thread) {
|
|
315
281
|
throw new HTTPException(404, { message: "Thread not found" });
|
|
316
282
|
}
|
|
317
|
-
const result = await memory.
|
|
283
|
+
const result = await memory.recall({
|
|
318
284
|
threadId,
|
|
319
|
-
|
|
285
|
+
resourceId,
|
|
286
|
+
perPage,
|
|
287
|
+
page,
|
|
288
|
+
orderBy,
|
|
289
|
+
include,
|
|
290
|
+
filter
|
|
320
291
|
});
|
|
321
|
-
|
|
322
|
-
return { messages: result.messages, uiMessages };
|
|
292
|
+
return result;
|
|
323
293
|
} catch (error) {
|
|
324
294
|
return handleError(error, "Error getting messages");
|
|
325
295
|
}
|
|
@@ -466,11 +436,16 @@ async function searchMemoryHandler({
|
|
|
466
436
|
{ messageRange: 0, topK: 2, scope: "resource" }
|
|
467
437
|
) : { ...config.semanticRecall, messageRange: 0 };
|
|
468
438
|
}
|
|
469
|
-
const
|
|
439
|
+
const threadConfig = memory.getMergedThreadConfig(config || {});
|
|
440
|
+
if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {
|
|
441
|
+
return { results: [], count: 0, query: searchQuery };
|
|
442
|
+
}
|
|
443
|
+
const result = await memory.recall({
|
|
470
444
|
threadId,
|
|
471
445
|
resourceId,
|
|
472
|
-
|
|
473
|
-
config
|
|
446
|
+
perPage: threadConfig.lastMessages,
|
|
447
|
+
threadConfig: config,
|
|
448
|
+
vectorSearchString: threadConfig.semanticRecall && searchQuery ? searchQuery : void 0
|
|
474
449
|
});
|
|
475
450
|
const threadIds = Array.from(
|
|
476
451
|
new Set(result.messages.map((m) => m.threadId || threadId).filter(Boolean))
|
|
@@ -481,7 +456,7 @@ async function searchMemoryHandler({
|
|
|
481
456
|
const content = typeof msg.content.content === `string` ? msg.content.content : msg.content.parts?.map((p) => p.type === "text" ? p.text : "").join(" ") || "";
|
|
482
457
|
const msgThreadId = msg.threadId || threadId;
|
|
483
458
|
const thread = threadMap.get(msgThreadId);
|
|
484
|
-
const threadMessages = (await memory.
|
|
459
|
+
const threadMessages = (await memory.recall({ threadId: msgThreadId })).messages;
|
|
485
460
|
const messageIndex = threadMessages.findIndex((m) => m.id === msg.id);
|
|
486
461
|
const searchResult = {
|
|
487
462
|
id: msg.id,
|
|
@@ -522,6 +497,6 @@ async function searchMemoryHandler({
|
|
|
522
497
|
}
|
|
523
498
|
}
|
|
524
499
|
|
|
525
|
-
export { createThreadHandler, deleteMessagesHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler,
|
|
526
|
-
//# sourceMappingURL=chunk-
|
|
527
|
-
//# sourceMappingURL=chunk-
|
|
500
|
+
export { createThreadHandler, deleteMessagesHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getThreadByIdHandler, getWorkingMemoryHandler, listMessagesHandler, listThreadsHandler, memory_exports, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler };
|
|
501
|
+
//# sourceMappingURL=chunk-A5SOZY5R.js.map
|
|
502
|
+
//# sourceMappingURL=chunk-A5SOZY5R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/memory.ts"],"names":["agents"],"mappings":";;;;;;;;AAAA,IAAA,cAAA,GAAA;AAAA,QAAA,CAAA,cAAA,EAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAkBA,eAAe,oBAAA,CAAqB;AAAA,EAClC,MAAA;AAAA,EACA,OAA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;AACd,IAAA,OAAO,WAAA,CAAY,OAAO,wBAAwB,CAAA;AAAA,EACpD;AACF","file":"chunk-A5SOZY5R.js","sourcesContent":["import type { MastraDBMessage } from '@mastra/core/agent';\nimport { RequestContext } from '@mastra/core/di';\nimport type { MastraMemory } from '@mastra/core/memory';\nimport type { StorageListMessagesInput, StorageOrderBy } from '@mastra/core/storage';\nimport { generateEmptyFromSchema } from '@mastra/core/utils';\nimport { HTTPException } from '../http-exception';\nimport type { Context } from '../types';\n\nimport { handleError } from './error';\nimport { validateBody } from './utils';\n\ninterface MemoryContext extends Context {\n agentId?: string;\n resourceId?: string;\n threadId?: string;\n requestContext?: RequestContext;\n}\n\nasync function getMemoryFromContext({\n mastra,\n agentId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>): Promise<MastraMemory | null | undefined> {\n const logger = mastra.getLogger();\n let agent;\n if (agentId) {\n try {\n agent = mastra.getAgent(agentId);\n } catch (error) {\n logger.debug('Error getting agent from mastra, searching agents for agent', error);\n }\n }\n if (agentId && !agent) {\n logger.debug('Agent not found, searching agents for agent', { agentId });\n const agents = mastra.listAgents();\n if (Object.keys(agents || {}).length) {\n for (const [_, ag] of Object.entries(agents)) {\n try {\n const agents = await ag.listAgents();\n\n if (agents[agentId]) {\n agent = agents[agentId];\n break;\n }\n } catch (error) {\n logger.debug('Error getting agent from agent', error);\n }\n }\n }\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n }\n\n if (agent) {\n return await agent?.getMemory({\n requestContext: requestContext ?? new RequestContext(),\n });\n }\n}\n\n// Memory handlers\nexport async function getMemoryStatusHandler({\n mastra,\n agentId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n return { result: false };\n }\n\n return { result: true };\n } catch (error) {\n return handleError(error, 'Error getting memory status');\n }\n}\n\nexport async function getMemoryConfigHandler({\n mastra,\n agentId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Get the merged configuration (defaults + custom)\n const config = memory.getMergedThreadConfig({});\n\n return { config };\n } catch (error) {\n return handleError(error, 'Error getting memory configuration');\n }\n}\n\nexport async function listThreadsHandler({\n mastra,\n agentId,\n resourceId,\n requestContext,\n page,\n perPage,\n orderBy,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'requestContext'> & {\n page: number;\n perPage: number | false;\n orderBy?: StorageOrderBy;\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n validateBody({ resourceId });\n\n const result = await memory.listThreadsByResourceId({\n resourceId: resourceId!,\n page,\n perPage,\n orderBy,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error listing threads');\n }\n}\n\nexport async function getThreadByIdHandler({\n mastra,\n agentId,\n threadId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n return thread;\n } catch (error) {\n return handleError(error, 'Error getting thread');\n }\n}\n\nexport async function saveMessagesHandler({\n mastra,\n agentId,\n body,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n body: {\n messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];\n };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n if (!body?.messages) {\n throw new HTTPException(400, { message: 'Messages are required' });\n }\n\n if (!Array.isArray(body.messages)) {\n throw new HTTPException(400, { message: 'Messages should be an array' });\n }\n\n // Validate that all messages have threadId and resourceId\n const invalidMessages = body.messages.filter(message => !message.threadId || !message.resourceId);\n if (invalidMessages.length > 0) {\n throw new HTTPException(400, {\n message: `All messages must have threadId and resourceId fields. Found ${invalidMessages.length} invalid message(s).`,\n });\n }\n\n const processedMessages = body.messages.map(message => ({\n ...message,\n id: message.id || memory.generateId(),\n createdAt: message.createdAt ? new Date(message.createdAt) : new Date(),\n }));\n\n const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });\n return result;\n } catch (error) {\n return handleError(error, 'Error saving messages');\n }\n}\n\nexport async function createThreadHandler({\n mastra,\n agentId,\n body,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & { resourceId?: string };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n validateBody({ resourceId: body?.resourceId });\n\n const result = await memory.createThread({\n resourceId: body?.resourceId!,\n title: body?.title,\n metadata: body?.metadata,\n threadId: body?.threadId,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error saving thread to memory');\n }\n}\n\nexport async function updateThreadHandler({\n mastra,\n agentId,\n threadId,\n body,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n body?: Parameters<MastraMemory['saveThread']>[0]['thread'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!body) {\n throw new HTTPException(400, { message: 'Body is required' });\n }\n\n const { title, metadata, resourceId } = body;\n const updatedAt = new Date();\n\n validateBody({ threadId });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n const updatedThread = {\n ...thread,\n title: title || thread.title,\n metadata: metadata || thread.metadata,\n resourceId: resourceId || thread.resourceId,\n createdAt: thread.createdAt,\n updatedAt,\n };\n\n const result = await memory.saveThread({ thread: updatedThread });\n return result;\n } catch (error) {\n return handleError(error, 'Error updating thread');\n }\n}\n\nexport async function deleteThreadHandler({\n mastra,\n agentId,\n threadId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n await memory.deleteThread(threadId!);\n return { result: 'Thread deleted' };\n } catch (error) {\n return handleError(error, 'Error deleting thread');\n }\n}\n\nexport async function listMessagesHandler({\n mastra,\n agentId,\n threadId,\n resourceId,\n perPage,\n page,\n orderBy,\n include,\n filter,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> &\n Omit<StorageListMessagesInput, 'threadId'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n if (!threadId) {\n throw new HTTPException(400, { message: 'No threadId found' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n const result = await memory.recall({\n threadId: threadId,\n resourceId,\n perPage,\n page,\n orderBy,\n include,\n filter,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error getting messages');\n }\n}\n\n/**\n * Handler to get the working memory for a thread (optionally resource-scoped).\n * @returns workingMemory - the working memory for the thread\n * @returns source - thread or resource\n */\nexport async function getWorkingMemoryHandler({\n mastra,\n agentId,\n threadId,\n resourceId,\n requestContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];\n memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n validateBody({ threadId });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n const thread = await memory.getThreadById({ threadId: threadId! });\n const threadExists = !!thread;\n const template = await memory.getWorkingMemoryTemplate({ memoryConfig });\n const workingMemoryTemplate =\n template?.format === 'json'\n ? { ...template, content: JSON.stringify(generateEmptyFromSchema(template.content)) }\n : template;\n const workingMemory = await memory.getWorkingMemory({ threadId: threadId!, resourceId, memoryConfig });\n const config = memory.getMergedThreadConfig(memoryConfig || {});\n const source = config.workingMemory?.scope !== 'thread' && resourceId ? 'resource' : 'thread';\n return { workingMemory, source, workingMemoryTemplate, threadExists };\n } catch (error) {\n return handleError(error, 'Error getting working memory');\n }\n}\n\n/**\n * Handler to update the working memory for a thread (optionally resource-scoped).\n * @param threadId - the thread id\n * @param body - the body containing the working memory to update and the resource id (optional)\n */\nexport async function updateWorkingMemoryHandler({\n mastra,\n agentId,\n threadId,\n body,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;\n}) {\n try {\n validateBody({ threadId });\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n const { resourceId, memoryConfig, workingMemory } = body;\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n await memory.updateWorkingMemory({ threadId: threadId!, resourceId, workingMemory, memoryConfig });\n return { success: true };\n } catch (error) {\n return handleError(error, 'Error updating working memory');\n }\n}\n\ninterface SearchResult {\n id: string;\n role: string;\n content: any;\n createdAt: Date;\n threadId?: string;\n threadTitle?: string;\n score?: number;\n context?: {\n before?: SearchResult[];\n after?: SearchResult[];\n };\n}\n\ninterface SearchResponse {\n results: SearchResult[];\n count: number;\n query: string;\n searchScope?: string;\n searchType?: string;\n}\n\n/**\n * Handler to delete one or more messages.\n * @param messageIds - Can be a single ID, array of IDs, or objects with ID property\n */\nexport async function deleteMessagesHandler({\n mastra,\n agentId,\n messageIds,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n messageIds: string | string[] | { id: string } | { id: string }[];\n}) {\n try {\n if (messageIds === undefined || messageIds === null) {\n throw new HTTPException(400, { message: 'messageIds is required' });\n }\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Delete the messages - let the memory method handle validation\n await memory.deleteMessages(messageIds as any);\n\n // Count messages for response\n let count = 1;\n if (Array.isArray(messageIds)) {\n count = messageIds.length;\n }\n\n return { success: true, message: `${count} message${count === 1 ? '' : 's'} deleted successfully` };\n } catch (error) {\n return handleError(error, 'Error deleting messages');\n }\n}\n\nexport async function searchMemoryHandler({\n mastra,\n agentId,\n searchQuery,\n resourceId,\n threadId,\n limit = 20,\n requestContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n searchQuery: string;\n resourceId: string;\n threadId?: string;\n limit?: number;\n memoryConfig?: any;\n}): Promise<SearchResponse | ReturnType<typeof handleError>> {\n try {\n validateBody({ searchQuery, resourceId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Get memory configuration first to check scope\n const config = memory.getMergedThreadConfig(memoryConfig || {});\n const hasSemanticRecall = !!config?.semanticRecall;\n const resourceScope =\n typeof config?.semanticRecall === 'object' ? config?.semanticRecall?.scope !== 'thread' : true;\n\n // Only validate thread ownership if we're in thread scope\n if (threadId && !resourceScope) {\n const thread = await memory.getThreadById({ threadId });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n if (thread.resourceId !== resourceId) {\n throw new HTTPException(403, { message: 'Thread does not belong to the specified resource' });\n }\n }\n\n const searchResults: SearchResult[] = [];\n\n // If threadId is provided and scope is thread-based, check if the thread exists\n if (threadId && !resourceScope) {\n const thread = await memory.getThreadById({ threadId });\n if (!thread) {\n // Thread doesn't exist yet (new unsaved thread) - return empty results\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n }\n\n // If no threadId provided, get one from the resource\n if (!threadId) {\n const { threads } = await memory.listThreadsByResourceId({\n resourceId,\n page: 0,\n perPage: 1,\n orderBy: { field: 'updatedAt', direction: 'DESC' },\n });\n\n if (threads.length === 0) {\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n\n // Use first thread - Memory class will handle scope internally\n threadId = threads[0]!.id;\n }\n\n const beforeRange =\n typeof config.semanticRecall === `boolean`\n ? 2\n : typeof config.semanticRecall?.messageRange === `number`\n ? config.semanticRecall.messageRange\n : config.semanticRecall?.messageRange.before || 2;\n const afterRange =\n typeof config.semanticRecall === `boolean`\n ? 2\n : typeof config.semanticRecall?.messageRange === `number`\n ? config.semanticRecall.messageRange\n : config.semanticRecall?.messageRange.after || 2;\n\n if (resourceScope && config.semanticRecall) {\n config.semanticRecall =\n typeof config.semanticRecall === `boolean`\n ? // make message range 0 so we can highlight the matches in search, message range will include other messages, not the matching ones\n // and we add prev/next messages in a special section on each message anyway\n { messageRange: 0, topK: 2, scope: 'resource' }\n : { ...config.semanticRecall, messageRange: 0 };\n }\n\n // Single call to recall - just like the agent does\n // The Memory class handles scope (thread vs resource) internally\n const threadConfig = memory.getMergedThreadConfig(config || {});\n if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {\n return { results: [], count: 0, query: searchQuery };\n }\n\n const result = await memory.recall({\n threadId,\n resourceId,\n perPage: threadConfig.lastMessages,\n threadConfig: config,\n vectorSearchString: threadConfig.semanticRecall && searchQuery ? searchQuery : undefined,\n });\n\n // Get all threads to build context and show which thread each message is from\n // Fetch threads by IDs from the actual messages to avoid truncation\n const threadIds = Array.from(\n new Set(result.messages.map((m: MastraDBMessage) => m.threadId || threadId!).filter(Boolean)),\n );\n const fetched = await Promise.all(threadIds.map((id: string) => memory.getThreadById({ threadId: id })));\n const threadMap = new Map(fetched.filter(Boolean).map(t => [t!.id, t!]));\n\n // Process each message in the results\n for (const msg of result.messages) {\n const content =\n typeof msg.content.content === `string`\n ? msg.content.content\n : msg.content.parts?.map((p: any) => (p.type === 'text' ? p.text : '')).join(' ') || '';\n\n const msgThreadId = msg.threadId || threadId;\n const thread = threadMap.get(msgThreadId);\n\n // Get thread messages for context\n const threadMessages = (await memory.recall({ threadId: msgThreadId })).messages;\n const messageIndex = threadMessages.findIndex(m => m.id === msg.id);\n\n const searchResult: SearchResult = {\n id: msg.id,\n role: msg.role,\n content,\n createdAt: msg.createdAt,\n threadId: msgThreadId,\n threadTitle: thread?.title || msgThreadId,\n };\n\n if (messageIndex !== -1) {\n searchResult.context = {\n before: threadMessages.slice(Math.max(0, messageIndex - beforeRange), messageIndex).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n after: threadMessages.slice(messageIndex + 1, messageIndex + afterRange + 1).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n };\n }\n\n searchResults.push(searchResult);\n }\n\n // Sort by date (newest first) and limit\n const sortedResults = searchResults\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())\n .slice(0, limit);\n\n return {\n results: sortedResults,\n count: sortedResults.length,\n query: searchQuery,\n searchScope: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n } catch (error) {\n return handleError(error, 'Error searching memory');\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chunkX6C7BUWN_cjs = require('./chunk-X6C7BUWN.cjs');
|
|
4
4
|
var chunk2PLXW4ZX_cjs = require('./chunk-2PLXW4ZX.cjs');
|
|
5
5
|
var chunkLPM6BBAX_cjs = require('./chunk-LPM6BBAX.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkSRAPUMPM_cjs = require('./chunk-SRAPUMPM.cjs');
|
|
7
7
|
var chunkLWLSQ2W4_cjs = require('./chunk-LWLSQ2W4.cjs');
|
|
8
8
|
var chunkV5WWQN7P_cjs = require('./chunk-V5WWQN7P.cjs');
|
|
9
9
|
var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
|
|
@@ -750,7 +750,6 @@ chunkO7I5CWRX_cjs.__export(agent_builder_exports, {
|
|
|
750
750
|
resumeAgentBuilderActionHandler: () => resumeAgentBuilderActionHandler,
|
|
751
751
|
resumeAsyncAgentBuilderActionHandler: () => resumeAsyncAgentBuilderActionHandler,
|
|
752
752
|
resumeStreamAgentBuilderActionHandler: () => resumeStreamAgentBuilderActionHandler,
|
|
753
|
-
sendAgentBuilderActionRunEventHandler: () => sendAgentBuilderActionRunEventHandler,
|
|
754
753
|
startAgentBuilderActionRunHandler: () => startAgentBuilderActionRunHandler,
|
|
755
754
|
startAsyncAgentBuilderActionHandler: () => startAsyncAgentBuilderActionHandler,
|
|
756
755
|
streamAgentBuilderActionHandler: () => streamAgentBuilderActionHandler,
|
|
@@ -13834,7 +13833,15 @@ var updateWorkingMemoryTool = (memoryConfig) => {
|
|
|
13834
13833
|
if (!threadId || !memory || !resourceId) {
|
|
13835
13834
|
throw new Error("Thread ID, Memory instance, and resourceId are required for working memory updates");
|
|
13836
13835
|
}
|
|
13837
|
-
|
|
13836
|
+
let thread = await memory.getThreadById({ threadId });
|
|
13837
|
+
if (!thread) {
|
|
13838
|
+
thread = await memory.createThread({
|
|
13839
|
+
threadId,
|
|
13840
|
+
resourceId,
|
|
13841
|
+
memoryConfig
|
|
13842
|
+
});
|
|
13843
|
+
}
|
|
13844
|
+
if (thread.resourceId && thread.resourceId !== resourceId) {
|
|
13838
13845
|
throw new Error(`Thread with id ${threadId} resourceId does not match the current resourceId ${resourceId}`);
|
|
13839
13846
|
}
|
|
13840
13847
|
const workingMemory = typeof inputData.memory === "string" ? inputData.memory : JSON.stringify(inputData.memory);
|
|
@@ -13866,7 +13873,7 @@ var __experimental_updateWorkingMemoryToolVNext = (config) => {
|
|
|
13866
13873
|
execute: async (inputData, context) => {
|
|
13867
13874
|
const threadId = context?.agent?.threadId;
|
|
13868
13875
|
const resourceId = context?.agent?.resourceId;
|
|
13869
|
-
const memory = context?.mastra?.memory;
|
|
13876
|
+
const memory = context?.mastra?.memory || context?.memory;
|
|
13870
13877
|
if (!threadId || !memory || !resourceId) {
|
|
13871
13878
|
throw new Error("Thread ID, Memory instance, and resourceId are required for working memory updates");
|
|
13872
13879
|
}
|
|
@@ -13953,12 +13960,13 @@ var Memory = class extends memory.MastraMemory {
|
|
|
13953
13960
|
);
|
|
13954
13961
|
}
|
|
13955
13962
|
}
|
|
13956
|
-
async
|
|
13957
|
-
const { threadId, resourceId, perPage, page, orderBy, threadConfig, vectorSearchString, filter: filter3 } = args;
|
|
13963
|
+
async recall(args) {
|
|
13964
|
+
const { threadId, resourceId, perPage: perPageArg, page, orderBy, threadConfig, vectorSearchString, filter: filter3 } = args;
|
|
13958
13965
|
const config = this.getMergedThreadConfig(threadConfig || {});
|
|
13959
13966
|
if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId, config);
|
|
13967
|
+
const perPage = perPageArg !== void 0 ? perPageArg : config.lastMessages;
|
|
13960
13968
|
const vectorResults = [];
|
|
13961
|
-
this.logger.debug(`Memory
|
|
13969
|
+
this.logger.debug(`Memory recall() with:`, {
|
|
13962
13970
|
threadId,
|
|
13963
13971
|
perPage,
|
|
13964
13972
|
page,
|
|
@@ -14027,23 +14035,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
14027
14035
|
const messages = list.get.all.db();
|
|
14028
14036
|
return { messages };
|
|
14029
14037
|
}
|
|
14030
|
-
async rememberMessages(args) {
|
|
14031
|
-
const { threadId, resourceId, vectorMessageSearch, config } = args;
|
|
14032
|
-
const threadConfig = this.getMergedThreadConfig(config || {});
|
|
14033
|
-
if (resourceId) await this.validateThreadIsOwnedByResource(threadId, resourceId, threadConfig);
|
|
14034
|
-
if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {
|
|
14035
|
-
return { messages: [] };
|
|
14036
|
-
}
|
|
14037
|
-
const messagesResult = await this.query({
|
|
14038
|
-
resourceId,
|
|
14039
|
-
threadId,
|
|
14040
|
-
perPage: threadConfig.lastMessages,
|
|
14041
|
-
vectorSearchString: threadConfig.semanticRecall && vectorMessageSearch ? vectorMessageSearch : void 0,
|
|
14042
|
-
threadConfig: config
|
|
14043
|
-
});
|
|
14044
|
-
this.logger.debug(`Remembered message history includes ${messagesResult.messages.length} messages.`);
|
|
14045
|
-
return messagesResult;
|
|
14046
|
-
}
|
|
14047
14038
|
async getThreadById({ threadId }) {
|
|
14048
14039
|
return this.storage.getThreadById({ threadId });
|
|
14049
14040
|
}
|
|
@@ -22991,77 +22982,73 @@ var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () =
|
|
|
22991
22982
|
}
|
|
22992
22983
|
}, "Getting agent builder actions");
|
|
22993
22984
|
var getAgentBuilderActionByIdHandler = createAgentBuilderWorkflowHandler(
|
|
22994
|
-
|
|
22985
|
+
chunkSRAPUMPM_cjs.getWorkflowByIdHandler,
|
|
22995
22986
|
"Getting agent builder action by ID"
|
|
22996
22987
|
);
|
|
22997
22988
|
var getAgentBuilderActionRunByIdHandler = createAgentBuilderWorkflowHandler(
|
|
22998
|
-
|
|
22989
|
+
chunkSRAPUMPM_cjs.getWorkflowRunByIdHandler,
|
|
22999
22990
|
"Getting agent builder action run by ID"
|
|
23000
22991
|
);
|
|
23001
22992
|
var getAgentBuilderActionRunExecutionResultHandler = createAgentBuilderWorkflowHandler(
|
|
23002
|
-
|
|
22993
|
+
chunkSRAPUMPM_cjs.getWorkflowRunExecutionResultHandler,
|
|
23003
22994
|
"Getting agent builder action run execution result"
|
|
23004
22995
|
);
|
|
23005
22996
|
var createAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
23006
|
-
|
|
22997
|
+
chunkSRAPUMPM_cjs.createWorkflowRunHandler,
|
|
23007
22998
|
"Creating agent builder action run"
|
|
23008
22999
|
);
|
|
23009
23000
|
var startAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23010
|
-
|
|
23001
|
+
chunkSRAPUMPM_cjs.startAsyncWorkflowHandler,
|
|
23011
23002
|
"Starting async agent builder action"
|
|
23012
23003
|
);
|
|
23013
23004
|
var startAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
23014
|
-
|
|
23005
|
+
chunkSRAPUMPM_cjs.startWorkflowRunHandler,
|
|
23015
23006
|
"Starting agent builder action run"
|
|
23016
23007
|
);
|
|
23017
23008
|
var streamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23018
|
-
|
|
23009
|
+
chunkSRAPUMPM_cjs.streamWorkflowHandler,
|
|
23019
23010
|
"Streaming agent builder action"
|
|
23020
23011
|
);
|
|
23021
23012
|
var streamLegacyAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23022
|
-
|
|
23013
|
+
chunkSRAPUMPM_cjs.streamLegacyWorkflowHandler,
|
|
23023
23014
|
"Streaming legacy agent builder action"
|
|
23024
23015
|
);
|
|
23025
23016
|
var streamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23026
|
-
|
|
23017
|
+
chunkSRAPUMPM_cjs.streamVNextWorkflowHandler,
|
|
23027
23018
|
"Streaming VNext agent builder action"
|
|
23028
23019
|
);
|
|
23029
23020
|
var observeStreamLegacyAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23030
|
-
|
|
23021
|
+
chunkSRAPUMPM_cjs.observeStreamLegacyWorkflowHandler,
|
|
23031
23022
|
"Observing legacy stream for agent builder action"
|
|
23032
23023
|
);
|
|
23033
23024
|
var observeStreamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23034
|
-
|
|
23025
|
+
chunkSRAPUMPM_cjs.observeStreamWorkflowHandler,
|
|
23035
23026
|
"Observing stream for agent builder action"
|
|
23036
23027
|
);
|
|
23037
23028
|
var observeStreamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23038
|
-
|
|
23029
|
+
chunkSRAPUMPM_cjs.observeStreamVNextWorkflowHandler,
|
|
23039
23030
|
"Observing VNext stream for agent builder action"
|
|
23040
23031
|
);
|
|
23041
23032
|
var resumeAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23042
|
-
|
|
23033
|
+
chunkSRAPUMPM_cjs.resumeAsyncWorkflowHandler,
|
|
23043
23034
|
"Resuming async agent builder action"
|
|
23044
23035
|
);
|
|
23045
23036
|
var resumeAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23046
|
-
|
|
23037
|
+
chunkSRAPUMPM_cjs.resumeWorkflowHandler,
|
|
23047
23038
|
"Resuming agent builder action"
|
|
23048
23039
|
);
|
|
23049
23040
|
var resumeStreamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
23050
|
-
|
|
23041
|
+
chunkSRAPUMPM_cjs.resumeStreamWorkflowHandler,
|
|
23051
23042
|
"Resuming stream for agent builder action"
|
|
23052
23043
|
);
|
|
23053
23044
|
var getAgentBuilderActionRunsHandler = createAgentBuilderWorkflowHandler(
|
|
23054
|
-
|
|
23045
|
+
chunkSRAPUMPM_cjs.listWorkflowRunsHandler,
|
|
23055
23046
|
"Getting agent builder action runs"
|
|
23056
23047
|
);
|
|
23057
23048
|
var cancelAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
23058
|
-
|
|
23049
|
+
chunkSRAPUMPM_cjs.cancelWorkflowRunHandler,
|
|
23059
23050
|
"Cancelling agent builder action run"
|
|
23060
23051
|
);
|
|
23061
|
-
var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
|
|
23062
|
-
chunkAEVI2HIU_cjs.sendWorkflowRunEventHandler,
|
|
23063
|
-
"Sending agent builder action run event"
|
|
23064
|
-
);
|
|
23065
23052
|
|
|
23066
23053
|
exports.agent_builder_exports = agent_builder_exports;
|
|
23067
23054
|
exports.cancelAgentBuilderActionRunHandler = cancelAgentBuilderActionRunHandler;
|
|
@@ -23077,11 +23064,10 @@ exports.observeStreamVNextAgentBuilderActionHandler = observeStreamVNextAgentBui
|
|
|
23077
23064
|
exports.resumeAgentBuilderActionHandler = resumeAgentBuilderActionHandler;
|
|
23078
23065
|
exports.resumeAsyncAgentBuilderActionHandler = resumeAsyncAgentBuilderActionHandler;
|
|
23079
23066
|
exports.resumeStreamAgentBuilderActionHandler = resumeStreamAgentBuilderActionHandler;
|
|
23080
|
-
exports.sendAgentBuilderActionRunEventHandler = sendAgentBuilderActionRunEventHandler;
|
|
23081
23067
|
exports.startAgentBuilderActionRunHandler = startAgentBuilderActionRunHandler;
|
|
23082
23068
|
exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandler;
|
|
23083
23069
|
exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
|
|
23084
23070
|
exports.streamLegacyAgentBuilderActionHandler = streamLegacyAgentBuilderActionHandler;
|
|
23085
23071
|
exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
|
|
23086
|
-
//# sourceMappingURL=chunk-
|
|
23087
|
-
//# sourceMappingURL=chunk-
|
|
23072
|
+
//# sourceMappingURL=chunk-M6KNPIZZ.cjs.map
|
|
23073
|
+
//# sourceMappingURL=chunk-M6KNPIZZ.cjs.map
|