@mastra/convex 1.0.10 → 1.0.11-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 +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +2 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/convex
|
|
2
2
|
|
|
3
|
+
## 1.0.11-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Respect optional `resourceId` in `getThreadById` so scoped thread lookups return `null` when the thread belongs to a different resource. ([#14237](https://github.com/mastra-ai/mastra/pull/14237))
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
const thread = await memory.getThreadById({
|
|
13
|
+
threadId: 'my-thread-id',
|
|
14
|
+
resourceId: 'my-user-id',
|
|
15
|
+
});
|
|
16
|
+
// Returns null if the thread does not belong to 'my-user-id'.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
|
|
20
|
+
- @mastra/core@1.33.0-alpha.8
|
|
21
|
+
|
|
22
|
+
## 1.0.11-alpha.0
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
|
|
29
|
+
- @mastra/core@1.33.0-alpha.4
|
|
30
|
+
|
|
3
31
|
## 1.0.10
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -193,8 +193,10 @@ function toStored(task) {
|
|
|
193
193
|
args: serializeJson(task.args),
|
|
194
194
|
result: serializeJson(task.result),
|
|
195
195
|
error: serializeJson(task.error),
|
|
196
|
+
suspendPayload: serializeJson(task.suspendPayload),
|
|
196
197
|
createdAt: task.createdAt.toISOString(),
|
|
197
198
|
startedAt: task.startedAt?.toISOString(),
|
|
199
|
+
suspendedAt: task.suspendedAt?.toISOString(),
|
|
198
200
|
completedAt: task.completedAt?.toISOString()
|
|
199
201
|
};
|
|
200
202
|
}
|
|
@@ -219,11 +221,13 @@ function fromStored(stored) {
|
|
|
219
221
|
runId: stored.runId,
|
|
220
222
|
result: parseJson(stored.result),
|
|
221
223
|
error: parseJson(stored.error),
|
|
224
|
+
suspendPayload: parseJson(stored.suspendPayload),
|
|
222
225
|
retryCount: stored.retryCount,
|
|
223
226
|
maxRetries: stored.maxRetries,
|
|
224
227
|
timeoutMs: stored.timeoutMs,
|
|
225
228
|
createdAt: new Date(stored.createdAt),
|
|
226
229
|
startedAt: stored.startedAt ? new Date(stored.startedAt) : void 0,
|
|
230
|
+
suspendedAt: stored.suspendedAt ? new Date(stored.suspendedAt) : void 0,
|
|
227
231
|
completedAt: stored.completedAt ? new Date(stored.completedAt) : void 0
|
|
228
232
|
};
|
|
229
233
|
}
|
|
@@ -247,8 +251,10 @@ var BackgroundTasksConvex = class extends storage.BackgroundTasksStorage {
|
|
|
247
251
|
if ("status" in update) merged.status = update.status;
|
|
248
252
|
if ("result" in update) merged.result = update.result;
|
|
249
253
|
if ("error" in update) merged.error = update.error;
|
|
254
|
+
if ("suspendPayload" in update) merged.suspendPayload = update.suspendPayload;
|
|
250
255
|
if ("retryCount" in update) merged.retryCount = update.retryCount;
|
|
251
256
|
if ("startedAt" in update) merged.startedAt = update.startedAt;
|
|
257
|
+
if ("suspendedAt" in update) merged.suspendedAt = update.suspendedAt;
|
|
252
258
|
if ("completedAt" in update) merged.completedAt = update.completedAt;
|
|
253
259
|
await this.#db.deleteMany(storage.TABLE_BACKGROUND_TASKS, [taskId]);
|
|
254
260
|
await this.#db.insert({ tableName: storage.TABLE_BACKGROUND_TASKS, record: toStored(merged) });
|
|
@@ -267,6 +273,7 @@ var BackgroundTasksConvex = class extends storage.BackgroundTasksStorage {
|
|
|
267
273
|
if (filter.agentId) tasks = tasks.filter((t) => t.agentId === filter.agentId);
|
|
268
274
|
if (filter.threadId) tasks = tasks.filter((t) => t.threadId === filter.threadId);
|
|
269
275
|
if (filter.toolName) tasks = tasks.filter((t) => t.toolName === filter.toolName);
|
|
276
|
+
if (filter.toolCallId) tasks = tasks.filter((t) => t.toolCallId === filter.toolCallId);
|
|
270
277
|
if (filter.runId) tasks = tasks.filter((t) => t.runId === filter.runId);
|
|
271
278
|
const dateCol = filter.dateFilterBy ?? "createdAt";
|
|
272
279
|
if (filter.fromDate) {
|
|
@@ -324,12 +331,15 @@ var MemoryConvex = class extends storage.MemoryStorage {
|
|
|
324
331
|
await this.#db.clearTable({ tableName: storage.TABLE_MESSAGES });
|
|
325
332
|
await this.#db.clearTable({ tableName: storage.TABLE_RESOURCES });
|
|
326
333
|
}
|
|
327
|
-
async getThreadById({
|
|
334
|
+
async getThreadById({
|
|
335
|
+
threadId,
|
|
336
|
+
resourceId
|
|
337
|
+
}) {
|
|
328
338
|
const row = await this.#db.load({
|
|
329
339
|
tableName: storage.TABLE_THREADS,
|
|
330
340
|
keys: { id: threadId }
|
|
331
341
|
});
|
|
332
|
-
if (!row) return null;
|
|
342
|
+
if (!row || resourceId !== void 0 && row.resourceId !== resourceId) return null;
|
|
333
343
|
return {
|
|
334
344
|
...row,
|
|
335
345
|
metadata: typeof row.metadata === "string" ? JSON.parse(row.metadata) : row.metadata,
|