@mastra/libsql 1.10.1-alpha.1 → 1.10.1-alpha.2
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 +21 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +25 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +25 -14
- package/dist/index.js.map +1 -1
- package/dist/storage/db/utils.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 +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 1.10.1-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **Fixed** Workflow run snapshots no longer lose fields when serialized for storage. The libsql `safeStringify` cycle-detection treated any object that appeared more than once in a snapshot as a circular reference and dropped it. Because `snapshot.result` and the final step's `context[step].output` share the same reference on success, `snapshot.result` was being silently stripped on every persist. This caused `listWorkflowRuns` to return runs with `snapshot.result === undefined` and broke workflow resume when suspended-state fields were shared elsewhere in the snapshot. ([#16368](https://github.com/mastra-ai/mastra/pull/16368))
|
|
8
|
+
|
|
9
|
+
- 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))
|
|
10
|
+
|
|
11
|
+
Example:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const thread = await memory.getThreadById({
|
|
15
|
+
threadId: 'my-thread-id',
|
|
16
|
+
resourceId: 'my-user-id',
|
|
17
|
+
});
|
|
18
|
+
// Returns null if the thread does not belong to 'my-user-id'.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- 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)]:
|
|
22
|
+
- @mastra/core@1.33.0-alpha.8
|
|
23
|
+
|
|
3
24
|
## 1.10.1-alpha.1
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1173,29 +1173,33 @@ var LibSQLVector = class extends vector.MastraVector {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
var safeStringify = (value) => {
|
|
1176
|
-
const
|
|
1176
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
1177
1177
|
const sanitize = (val) => {
|
|
1178
1178
|
if (val === null || val === void 0) return val;
|
|
1179
1179
|
if (typeof val === "function") return void 0;
|
|
1180
1180
|
if (typeof val === "symbol") return void 0;
|
|
1181
1181
|
if (typeof val === "bigint") return val.toString();
|
|
1182
1182
|
if (typeof val !== "object") return val;
|
|
1183
|
-
if (
|
|
1184
|
-
seen.add(val);
|
|
1183
|
+
if (ancestors.has(val)) return void 0;
|
|
1185
1184
|
if (typeof val.toJSON === "function") {
|
|
1186
1185
|
return sanitize(val.toJSON());
|
|
1187
1186
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
for (const key of Object.keys(val)) {
|
|
1193
|
-
const sanitized = sanitize(val[key]);
|
|
1194
|
-
if (sanitized !== void 0) {
|
|
1195
|
-
result[key] = sanitized;
|
|
1187
|
+
ancestors.add(val);
|
|
1188
|
+
try {
|
|
1189
|
+
if (Array.isArray(val)) {
|
|
1190
|
+
return val.map((item) => sanitize(item));
|
|
1196
1191
|
}
|
|
1192
|
+
const result = {};
|
|
1193
|
+
for (const key of Object.keys(val)) {
|
|
1194
|
+
const sanitized = sanitize(val[key]);
|
|
1195
|
+
if (sanitized !== void 0) {
|
|
1196
|
+
result[key] = sanitized;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
return result;
|
|
1200
|
+
} finally {
|
|
1201
|
+
ancestors.delete(val);
|
|
1197
1202
|
}
|
|
1198
|
-
return result;
|
|
1199
1203
|
};
|
|
1200
1204
|
return JSON.stringify(sanitize(value)) ?? "null";
|
|
1201
1205
|
};
|
|
@@ -6636,11 +6640,18 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
6636
6640
|
});
|
|
6637
6641
|
return updatedResource;
|
|
6638
6642
|
}
|
|
6639
|
-
async getThreadById({
|
|
6643
|
+
async getThreadById({
|
|
6644
|
+
threadId,
|
|
6645
|
+
resourceId
|
|
6646
|
+
}) {
|
|
6640
6647
|
try {
|
|
6648
|
+
const keys = { id: threadId };
|
|
6649
|
+
if (resourceId !== void 0) {
|
|
6650
|
+
keys.resourceId = resourceId;
|
|
6651
|
+
}
|
|
6641
6652
|
const result = await this.#db.select({
|
|
6642
6653
|
tableName: storage.TABLE_THREADS,
|
|
6643
|
-
keys
|
|
6654
|
+
keys
|
|
6644
6655
|
});
|
|
6645
6656
|
if (!result) {
|
|
6646
6657
|
return null;
|