@mastra/convex 1.5.2 → 1.5.3-alpha.1
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 +28 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/storage.d.ts.map +1 -1
- package/dist/{server-13j_f22k.cjs → server-B9VqvICT.cjs} +4 -6
- package/dist/server-B9VqvICT.cjs.map +1 -0
- package/dist/{server-DJt7jjL-.js → server-LdwFA9lH.js} +4 -6
- package/dist/server-LdwFA9lH.js.map +1 -0
- package/dist/storage/db/index.d.ts +2 -2
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +10 -2
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +2 -2
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/server-13j_f22k.cjs.map +0 -1
- package/dist/server-DJt7jjL-.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/convex
|
|
2
2
|
|
|
3
|
+
## 1.5.3-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed generated thread titles being clobbered during a turn ([#21041](https://github.com/mastra-ai/mastra/pull/21041))
|
|
8
|
+
|
|
9
|
+
`updateThread` required both `title` and `metadata`, so callers that only needed to
|
|
10
|
+
change metadata (message persistence, working memory, observational memory, channel
|
|
11
|
+
subscriptions) had to read the thread and pass its title back. When title generation
|
|
12
|
+
finished between that read and the write, the freshly generated title was overwritten
|
|
13
|
+
with the stale one.
|
|
14
|
+
|
|
15
|
+
`title` and `metadata` are now independently optional: omitting one leaves that column
|
|
16
|
+
untouched. Callers that only change metadata no longer send a title, and message
|
|
17
|
+
persistence no longer rewrites a thread row it just read.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`1c75e32`](https://github.com/mastra-ai/mastra/commit/1c75e32f7fc0b9fb6f548b4407feaec8a1440212), [`c47165c`](https://github.com/mastra-ai/mastra/commit/c47165c983c87594c6952f1fd2fa51a90205034c), [`e08e789`](https://github.com/mastra-ai/mastra/commit/e08e789c1bf4cd2fe46363f7a4728536ceccc9bd), [`35cc901`](https://github.com/mastra-ai/mastra/commit/35cc90102cf834a84827acaf9eee0b6d6d1e2a3b), [`a8b4cf0`](https://github.com/mastra-ai/mastra/commit/a8b4cf02823cffebc4751a53337dfacf097c1ae1), [`f33264f`](https://github.com/mastra-ai/mastra/commit/f33264f517ae603279afd5c4251e2b40f6dd3618), [`689f2c4`](https://github.com/mastra-ai/mastra/commit/689f2c4b6c0835fe455702b01d21daa8abcd9331), [`eeae63e`](https://github.com/mastra-ai/mastra/commit/eeae63e7fbe8e1f237adc69bca6e2ac13c5ca907), [`4c186a0`](https://github.com/mastra-ai/mastra/commit/4c186a017275f45e6ed4c09de0f89550e2d09e8c), [`b0fa077`](https://github.com/mastra-ai/mastra/commit/b0fa077bcbc9b08551846fe372a0d3d15b71ed72)]:
|
|
20
|
+
- @mastra/core@1.58.0-alpha.8
|
|
21
|
+
|
|
22
|
+
## 1.5.3-alpha.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Fixed resource-scoped message includes across storage adapters so included context cannot cross resource boundaries. ([#20984](https://github.com/mastra-ai/mastra/pull/20984))
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`6445eba`](https://github.com/mastra-ai/mastra/commit/6445eba6020abac681aba1cc9289f446cb400cbe), [`df31eb0`](https://github.com/mastra-ai/mastra/commit/df31eb0c7087d782a0d9346e467f9a4af4b0eef6), [`fcd0667`](https://github.com/mastra-ai/mastra/commit/fcd0667a4e378be35c9a1b1eb19cce78fbfd7282), [`bab06b1`](https://github.com/mastra-ai/mastra/commit/bab06b18923873a584bdfc71a6b4ec7fb4727fb7)]:
|
|
29
|
+
- @mastra/core@1.58.0-alpha.5
|
|
30
|
+
|
|
3
31
|
## 1.5.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_server = require("./server-
|
|
2
|
+
const require_server = require("./server-B9VqvICT.cjs");
|
|
3
3
|
const require_schema = require("./schema.cjs");
|
|
4
4
|
let _mastra_core_cache = require("@mastra/core/cache");
|
|
5
5
|
let _mastra_core_storage = require("@mastra/core/storage");
|
|
@@ -1090,7 +1090,7 @@ var MemoryConvex = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1090
1090
|
hasMore: false
|
|
1091
1091
|
};
|
|
1092
1092
|
if (perPage === 0 && include && include.length > 0) {
|
|
1093
|
-
const messages = await this._getIncludedMessages(include);
|
|
1093
|
+
const messages = await this._getIncludedMessages(include, void 0, resourceId);
|
|
1094
1094
|
const list = new _mastra_core_agent.MessageList().add(messages, "memory");
|
|
1095
1095
|
return {
|
|
1096
1096
|
messages: this._sortMessages(list.get.all.db(), field, direction),
|
|
@@ -1123,7 +1123,7 @@ var MemoryConvex = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1123
1123
|
if (include && include.length > 0) {
|
|
1124
1124
|
const preloadedThreads = /* @__PURE__ */ new Map();
|
|
1125
1125
|
if (!resourceId && !filter?.dateRange && !metadataFilter) for (const tid of threadIds) preloadedThreads.set(tid, rows.filter((r) => r.thread_id === tid));
|
|
1126
|
-
const includedMessages = await this._getIncludedMessages(include, preloadedThreads);
|
|
1126
|
+
const includedMessages = await this._getIncludedMessages(include, preloadedThreads, resourceId);
|
|
1127
1127
|
for (const msg of includedMessages) if (!messageIds.has(msg.id)) {
|
|
1128
1128
|
messages.push(msg);
|
|
1129
1129
|
messageIds.add(msg.id);
|
|
@@ -1305,8 +1305,20 @@ var MemoryConvex = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1305
1305
|
return direction === "ASC" ? String(aValue).localeCompare(String(bValue)) : String(bValue).localeCompare(String(aValue));
|
|
1306
1306
|
});
|
|
1307
1307
|
}
|
|
1308
|
-
|
|
1308
|
+
/**
|
|
1309
|
+
* Fetches the messages named by `include` together with their surrounding context.
|
|
1310
|
+
*
|
|
1311
|
+
* @param include - Message ids to pin, each with an optional before/after window.
|
|
1312
|
+
* @param preloadedThreads - Thread snapshots already loaded by the caller, reused instead of re-querying.
|
|
1313
|
+
* @param resourceId - When set, restricts both the pinned messages and their context
|
|
1314
|
+
* to that resource so an id from another resource returns nothing.
|
|
1315
|
+
*/
|
|
1316
|
+
async _getIncludedMessages(include, preloadedThreads, resourceId) {
|
|
1309
1317
|
if (include.length === 0) return [];
|
|
1318
|
+
const resourceFilters = resourceId ? [{
|
|
1319
|
+
field: "resourceId",
|
|
1320
|
+
value: resourceId
|
|
1321
|
+
}] : [];
|
|
1310
1322
|
const messages = [];
|
|
1311
1323
|
const messageIds = /* @__PURE__ */ new Set();
|
|
1312
1324
|
const threadMessagesCache = new Map(preloadedThreads ?? []);
|
|
@@ -1327,7 +1339,7 @@ var MemoryConvex = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1327
1339
|
const messageRows = await this.#db.queryTable(_mastra_core_storage.TABLE_MESSAGES, [{
|
|
1328
1340
|
field: "id",
|
|
1329
1341
|
value: includeItem.id
|
|
1330
|
-
}]);
|
|
1342
|
+
}, ...resourceFilters]);
|
|
1331
1343
|
if (messageRows.length > 0) {
|
|
1332
1344
|
target = messageRows[0];
|
|
1333
1345
|
targetThreadId = target.thread_id;
|
|
@@ -1335,7 +1347,7 @@ var MemoryConvex = class extends _mastra_core_storage.MemoryStorage {
|
|
|
1335
1347
|
const otherThreadRows = await this.#db.queryTable(_mastra_core_storage.TABLE_MESSAGES, [{
|
|
1336
1348
|
field: "thread_id",
|
|
1337
1349
|
value: targetThreadId
|
|
1338
|
-
}]);
|
|
1350
|
+
}, ...resourceFilters]);
|
|
1339
1351
|
threadMessagesCache.set(targetThreadId, otherThreadRows);
|
|
1340
1352
|
for (const row of otherThreadRows) cachedTargets.set(row.id, {
|
|
1341
1353
|
threadId: targetThreadId,
|