@mastra/libsql 0.0.0-stream-vnext-usage-20250908171242 → 0.0.0-suspendRuntimeContextTypeFix-20250930142630
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 +92 -3
- package/README.md +2 -2
- package/dist/index.cjs +120 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -10
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +5 -5
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +8 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +2 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +11 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,100 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-suspendRuntimeContextTypeFix-20250930142630
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added Postgres and updated libsql storage adapters for ai-traces ([#8027](https://github.com/mastra-ai/mastra/pull/8027))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Update peer deps ([#8154](https://github.com/mastra-ai/mastra/pull/8154))
|
|
12
|
+
|
|
13
|
+
- Fix incorrect title and import references in README.md ([#8288](https://github.com/mastra-ai/mastra/pull/8288))
|
|
14
|
+
|
|
15
|
+
Fixed the package title from '@mastra/pg' to '@mastra/libsql' and corrected the import statement in the Storage usage example.
|
|
16
|
+
|
|
17
|
+
- Libsql get scores by span ([#8154](https://github.com/mastra-ai/mastra/pull/8154))
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`504438b`](https://github.com/mastra-ai/mastra/commit/504438b961bde211071186bba63a842c4e3db879), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`7fceb0a`](https://github.com/mastra-ai/mastra/commit/7fceb0a327d678e812f90f5387c5bc4f38bd039e), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`c7db3e0`](https://github.com/mastra-ai/mastra/commit/c7db3e057c4b2858a630a7c3f3d3aae571e3e5b7), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`809eea0`](https://github.com/mastra-ai/mastra/commit/809eea092fa80c3f69b9eaf078d843b57fd2a88e), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`db1891a`](https://github.com/mastra-ai/mastra/commit/db1891a4707443720b7cd8a260dc7e1d49b3609c), [`e8f379d`](https://github.com/mastra-ai/mastra/commit/e8f379d390efa264c4e0874f9ac0cf8839b07777), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`c2a4919`](https://github.com/mastra-ai/mastra/commit/c2a4919ba6797d8bdb1509e02287496eef69303e), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5)]:
|
|
20
|
+
- @mastra/core@0.0.0-suspendRuntimeContextTypeFix-20250930142630
|
|
21
|
+
|
|
22
|
+
## 0.14.3
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a)]:
|
|
29
|
+
- @mastra/core@0.18.0
|
|
30
|
+
|
|
31
|
+
## 0.14.3-alpha.0
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55)]:
|
|
38
|
+
- @mastra/core@0.18.0-alpha.2
|
|
39
|
+
|
|
40
|
+
## 0.14.2
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- dependencies updates: ([#7742](https://github.com/mastra-ai/mastra/pull/7742))
|
|
45
|
+
- Updated dependency [`@libsql/client@^0.15.15` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.15) (from `^0.15.14`, in `dependencies`)
|
|
46
|
+
|
|
47
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
48
|
+
|
|
49
|
+
- Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`197cbb2`](https://github.com/mastra-ai/mastra/commit/197cbb248fc8cb4bbf61bf70b770f1388b445df2), [`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`6590763`](https://github.com/mastra-ai/mastra/commit/65907630ef4bf4127067cecd1cb21b56f55d5f1b), [`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`c2eade3`](https://github.com/mastra-ai/mastra/commit/c2eade3508ef309662f065e5f340d7840295dd53), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`222965a`](https://github.com/mastra-ai/mastra/commit/222965a98ce8197b86673ec594244650b5960257), [`6047778`](https://github.com/mastra-ai/mastra/commit/6047778e501df460648f31decddf8e443f36e373), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`05c7abf`](https://github.com/mastra-ai/mastra/commit/05c7abfe105a015b7760c9bf33ff4419727502a0), [`0324ceb`](https://github.com/mastra-ai/mastra/commit/0324ceb8af9d16c12a531f90e575f6aab797ac81), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0f9d227`](https://github.com/mastra-ai/mastra/commit/0f9d227890a98db33865abbea39daf407cd55ef7), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`de056a0`](https://github.com/mastra-ai/mastra/commit/de056a02cbb43f6aa0380ab2150ea404af9ec0dd), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`60c9cec`](https://github.com/mastra-ai/mastra/commit/60c9cec7048a79a87440f7840c383875bd710d93), [`c93532a`](https://github.com/mastra-ai/mastra/commit/c93532a340b80e4dd946d4c138d9381de5f70399), [`6cb1fcb`](https://github.com/mastra-ai/mastra/commit/6cb1fcbc8d0378ffed0d17784c96e68f30cb0272), [`aee4f00`](https://github.com/mastra-ai/mastra/commit/aee4f00e61e1a42e81a6d74ff149dbe69e32695a), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4), [`897995e`](https://github.com/mastra-ai/mastra/commit/897995e630d572fe2891e7ede817938cabb43251), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`2685a78`](https://github.com/mastra-ai/mastra/commit/2685a78f224b8b04e20d4fab5ac1adb638190071), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11), [`239b5a4`](https://github.com/mastra-ai/mastra/commit/239b5a497aeae2e8b4d764f46217cfff2284788e), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
52
|
+
- @mastra/core@0.17.0
|
|
53
|
+
|
|
54
|
+
## 0.14.2-alpha.2
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
61
|
+
- @mastra/core@0.17.0-alpha.3
|
|
62
|
+
|
|
63
|
+
## 0.14.2-alpha.1
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Add resource id to workflow run snapshots ([#7740](https://github.com/mastra-ai/mastra/pull/7740))
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [[`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4)]:
|
|
70
|
+
- @mastra/core@0.16.4-alpha.1
|
|
71
|
+
|
|
72
|
+
## 0.14.2-alpha.0
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- dependencies updates: ([#7742](https://github.com/mastra-ai/mastra/pull/7742))
|
|
77
|
+
- Updated dependency [`@libsql/client@^0.15.15` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.15) (from `^0.15.14`, in `dependencies`)
|
|
78
|
+
- Updated dependencies [[`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11)]:
|
|
79
|
+
- @mastra/core@0.16.4-alpha.0
|
|
80
|
+
|
|
81
|
+
## 0.14.1
|
|
4
82
|
|
|
5
83
|
### Patch Changes
|
|
6
84
|
|
|
7
|
-
-
|
|
8
|
-
|
|
85
|
+
- Fix AI Trace bug for libsql ([#7695](https://github.com/mastra-ai/mastra/pull/7695))
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
88
|
+
- @mastra/core@0.16.3
|
|
89
|
+
|
|
90
|
+
## 0.14.1-alpha.0
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Fix AI Trace bug for libsql ([#7695](https://github.com/mastra-ai/mastra/pull/7695))
|
|
95
|
+
|
|
96
|
+
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
97
|
+
- @mastra/core@0.16.3-alpha.0
|
|
9
98
|
|
|
10
99
|
## 0.14.0
|
|
11
100
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @mastra/
|
|
1
|
+
# @mastra/libsql
|
|
2
2
|
|
|
3
3
|
SQLite implementation for Mastra, providing both vector similarity search and general storage capabilities with connection pooling and transaction support.
|
|
4
4
|
|
|
@@ -47,7 +47,7 @@ const results = await vectorStore.query({
|
|
|
47
47
|
### Storage
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
|
-
import { LibSQLStore } from '@mastra/
|
|
50
|
+
import { LibSQLStore } from '@mastra/libsql';
|
|
51
51
|
|
|
52
52
|
const store = new LibSQLStore({
|
|
53
53
|
url: 'file:./my-db.db',
|
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var vector = require('@mastra/core/vector');
|
|
|
7
7
|
var filter = require('@mastra/core/vector/filter');
|
|
8
8
|
var storage = require('@mastra/core/storage');
|
|
9
9
|
var agent = require('@mastra/core/agent');
|
|
10
|
+
var scores = require('@mastra/core/scores');
|
|
10
11
|
|
|
11
12
|
// src/vector/index.ts
|
|
12
13
|
var LibSQLFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
@@ -1951,7 +1952,13 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
|
|
|
1951
1952
|
}
|
|
1952
1953
|
async createAISpan(span) {
|
|
1953
1954
|
try {
|
|
1954
|
-
|
|
1955
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1956
|
+
const record = {
|
|
1957
|
+
...span,
|
|
1958
|
+
createdAt: now,
|
|
1959
|
+
updatedAt: now
|
|
1960
|
+
};
|
|
1961
|
+
return this.operations.insert({ tableName: storage.TABLE_AI_SPANS, record });
|
|
1955
1962
|
} catch (error$1) {
|
|
1956
1963
|
throw new error.MastraError(
|
|
1957
1964
|
{
|
|
@@ -2029,17 +2036,47 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
|
|
|
2029
2036
|
}) {
|
|
2030
2037
|
const page = pagination?.page ?? 0;
|
|
2031
2038
|
const perPage = pagination?.perPage ?? 10;
|
|
2039
|
+
const { entityId, entityType, ...actualFilters } = filters || {};
|
|
2032
2040
|
const filtersWithDateRange = {
|
|
2033
|
-
...
|
|
2034
|
-
...buildDateRangeFilter(pagination?.dateRange, "startedAt")
|
|
2041
|
+
...actualFilters,
|
|
2042
|
+
...buildDateRangeFilter(pagination?.dateRange, "startedAt"),
|
|
2043
|
+
parentSpanId: null
|
|
2035
2044
|
};
|
|
2036
2045
|
const whereClause = prepareWhereClause(filtersWithDateRange, storage.AI_SPAN_SCHEMA);
|
|
2046
|
+
let actualWhereClause = whereClause.sql || "";
|
|
2047
|
+
if (entityId && entityType) {
|
|
2048
|
+
const statement = `name = ?`;
|
|
2049
|
+
let name = "";
|
|
2050
|
+
if (entityType === "workflow") {
|
|
2051
|
+
name = `workflow run: '${entityId}'`;
|
|
2052
|
+
} else if (entityType === "agent") {
|
|
2053
|
+
name = `agent run: '${entityId}'`;
|
|
2054
|
+
} else {
|
|
2055
|
+
const error$1 = new error.MastraError({
|
|
2056
|
+
id: "LIBSQL_STORE_GET_AI_TRACES_PAGINATED_FAILED",
|
|
2057
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2058
|
+
category: error.ErrorCategory.USER,
|
|
2059
|
+
details: {
|
|
2060
|
+
entityType
|
|
2061
|
+
},
|
|
2062
|
+
text: `Cannot filter by entity type: ${entityType}`
|
|
2063
|
+
});
|
|
2064
|
+
this.logger?.trackException(error$1);
|
|
2065
|
+
throw error$1;
|
|
2066
|
+
}
|
|
2067
|
+
whereClause.args.push(name);
|
|
2068
|
+
if (actualWhereClause) {
|
|
2069
|
+
actualWhereClause += ` AND ${statement}`;
|
|
2070
|
+
} else {
|
|
2071
|
+
actualWhereClause += `WHERE ${statement}`;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2037
2074
|
const orderBy = "startedAt DESC";
|
|
2038
2075
|
let count = 0;
|
|
2039
2076
|
try {
|
|
2040
2077
|
count = await this.operations.loadTotalCount({
|
|
2041
2078
|
tableName: storage.TABLE_AI_SPANS,
|
|
2042
|
-
whereClause: { sql:
|
|
2079
|
+
whereClause: { sql: actualWhereClause, args: whereClause.args }
|
|
2043
2080
|
});
|
|
2044
2081
|
} catch (error$1) {
|
|
2045
2082
|
throw new error.MastraError(
|
|
@@ -2065,7 +2102,10 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
|
|
|
2065
2102
|
try {
|
|
2066
2103
|
const spans = await this.operations.loadMany({
|
|
2067
2104
|
tableName: storage.TABLE_AI_SPANS,
|
|
2068
|
-
whereClause
|
|
2105
|
+
whereClause: {
|
|
2106
|
+
sql: actualWhereClause,
|
|
2107
|
+
args: whereClause.args
|
|
2108
|
+
},
|
|
2069
2109
|
orderBy,
|
|
2070
2110
|
offset: page * perPage,
|
|
2071
2111
|
limit: perPage
|
|
@@ -2092,12 +2132,13 @@ var ObservabilityLibSQL = class extends storage.ObservabilityStorage {
|
|
|
2092
2132
|
}
|
|
2093
2133
|
async batchCreateAISpans(args) {
|
|
2094
2134
|
try {
|
|
2135
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2095
2136
|
return this.operations.batchInsert({
|
|
2096
2137
|
tableName: storage.TABLE_AI_SPANS,
|
|
2097
2138
|
records: args.records.map((record) => ({
|
|
2098
2139
|
...record,
|
|
2099
|
-
createdAt:
|
|
2100
|
-
updatedAt:
|
|
2140
|
+
createdAt: now,
|
|
2141
|
+
updatedAt: now
|
|
2101
2142
|
}))
|
|
2102
2143
|
});
|
|
2103
2144
|
} catch (error$1) {
|
|
@@ -2638,6 +2679,7 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2638
2679
|
return {
|
|
2639
2680
|
id: row.id,
|
|
2640
2681
|
traceId: row.traceId,
|
|
2682
|
+
spanId: row.spanId,
|
|
2641
2683
|
runId: row.runId,
|
|
2642
2684
|
scorer: scorerValue,
|
|
2643
2685
|
score: row.score,
|
|
@@ -2672,6 +2714,26 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2672
2714
|
return result.rows?.[0] ? this.transformScoreRow(result.rows[0]) : null;
|
|
2673
2715
|
}
|
|
2674
2716
|
async saveScore(score) {
|
|
2717
|
+
let parsedScore;
|
|
2718
|
+
try {
|
|
2719
|
+
parsedScore = scores.saveScorePayloadSchema.parse(score);
|
|
2720
|
+
} catch (error$1) {
|
|
2721
|
+
throw new error.MastraError(
|
|
2722
|
+
{
|
|
2723
|
+
id: "LIBSQL_STORE_SAVE_SCORE_FAILED_INVALID_SCORE_PAYLOAD",
|
|
2724
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2725
|
+
category: error.ErrorCategory.USER,
|
|
2726
|
+
details: {
|
|
2727
|
+
scorer: score.scorer.name,
|
|
2728
|
+
entityId: score.entityId,
|
|
2729
|
+
entityType: score.entityType,
|
|
2730
|
+
traceId: score.traceId || "",
|
|
2731
|
+
spanId: score.spanId || ""
|
|
2732
|
+
}
|
|
2733
|
+
},
|
|
2734
|
+
error$1
|
|
2735
|
+
);
|
|
2736
|
+
}
|
|
2675
2737
|
try {
|
|
2676
2738
|
const id = crypto.randomUUID();
|
|
2677
2739
|
await this.operations.insert({
|
|
@@ -2680,7 +2742,7 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2680
2742
|
id,
|
|
2681
2743
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2682
2744
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2683
|
-
...
|
|
2745
|
+
...parsedScore
|
|
2684
2746
|
}
|
|
2685
2747
|
});
|
|
2686
2748
|
const scoreFromDb = await this.getScoreById({ id });
|
|
@@ -2726,6 +2788,43 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2726
2788
|
);
|
|
2727
2789
|
}
|
|
2728
2790
|
}
|
|
2791
|
+
async getScoresBySpan({
|
|
2792
|
+
traceId,
|
|
2793
|
+
spanId,
|
|
2794
|
+
pagination
|
|
2795
|
+
}) {
|
|
2796
|
+
try {
|
|
2797
|
+
const countSQLResult = await this.client.execute({
|
|
2798
|
+
sql: `SELECT COUNT(*) as count FROM ${storage.TABLE_SCORERS} WHERE traceId = ? AND spanId = ?`,
|
|
2799
|
+
args: [traceId, spanId]
|
|
2800
|
+
});
|
|
2801
|
+
const total = Number(countSQLResult.rows?.[0]?.count ?? 0);
|
|
2802
|
+
const result = await this.client.execute({
|
|
2803
|
+
sql: `SELECT * FROM ${storage.TABLE_SCORERS} WHERE traceId = ? AND spanId = ? ORDER BY createdAt DESC LIMIT ? OFFSET ?`,
|
|
2804
|
+
args: [traceId, spanId, pagination.perPage + 1, pagination.page * pagination.perPage]
|
|
2805
|
+
});
|
|
2806
|
+
const hasMore = result.rows?.length > pagination.perPage;
|
|
2807
|
+
const scores = result.rows?.slice(0, pagination.perPage).map((row) => this.transformScoreRow(row)) ?? [];
|
|
2808
|
+
return {
|
|
2809
|
+
scores,
|
|
2810
|
+
pagination: {
|
|
2811
|
+
total,
|
|
2812
|
+
page: pagination.page,
|
|
2813
|
+
perPage: pagination.perPage,
|
|
2814
|
+
hasMore
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
2817
|
+
} catch (error$1) {
|
|
2818
|
+
throw new error.MastraError(
|
|
2819
|
+
{
|
|
2820
|
+
id: "LIBSQL_STORE_GET_SCORES_BY_SPAN_FAILED",
|
|
2821
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2822
|
+
category: error.ErrorCategory.THIRD_PARTY
|
|
2823
|
+
},
|
|
2824
|
+
error$1
|
|
2825
|
+
);
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2729
2828
|
};
|
|
2730
2829
|
var TracesLibSQL = class extends storage.TracesStorage {
|
|
2731
2830
|
client;
|
|
@@ -3039,11 +3138,13 @@ var WorkflowsLibSQL = class extends storage.WorkflowsStorage {
|
|
|
3039
3138
|
async persistWorkflowSnapshot({
|
|
3040
3139
|
workflowName,
|
|
3041
3140
|
runId,
|
|
3141
|
+
resourceId,
|
|
3042
3142
|
snapshot
|
|
3043
3143
|
}) {
|
|
3044
3144
|
const data = {
|
|
3045
3145
|
workflow_name: workflowName,
|
|
3046
3146
|
run_id: runId,
|
|
3147
|
+
resourceId,
|
|
3047
3148
|
snapshot,
|
|
3048
3149
|
createdAt: /* @__PURE__ */ new Date(),
|
|
3049
3150
|
updatedAt: /* @__PURE__ */ new Date()
|
|
@@ -3213,7 +3314,8 @@ var LibSQLStore = class extends storage.MastraStorage {
|
|
|
3213
3314
|
hasColumn: true,
|
|
3214
3315
|
createTable: true,
|
|
3215
3316
|
deleteMessages: true,
|
|
3216
|
-
aiTracing: true
|
|
3317
|
+
aiTracing: true,
|
|
3318
|
+
getScoresBySpan: true
|
|
3217
3319
|
};
|
|
3218
3320
|
}
|
|
3219
3321
|
async createTable({
|
|
@@ -3374,9 +3476,10 @@ var LibSQLStore = class extends storage.MastraStorage {
|
|
|
3374
3476
|
async persistWorkflowSnapshot({
|
|
3375
3477
|
workflowName,
|
|
3376
3478
|
runId,
|
|
3479
|
+
resourceId,
|
|
3377
3480
|
snapshot
|
|
3378
3481
|
}) {
|
|
3379
|
-
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
3482
|
+
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
|
|
3380
3483
|
}
|
|
3381
3484
|
async loadWorkflowSnapshot({
|
|
3382
3485
|
workflowName,
|
|
@@ -3425,6 +3528,13 @@ var LibSQLStore = class extends storage.MastraStorage {
|
|
|
3425
3528
|
async getAITracesPaginated(args) {
|
|
3426
3529
|
return this.stores.observability.getAITracesPaginated(args);
|
|
3427
3530
|
}
|
|
3531
|
+
async getScoresBySpan({
|
|
3532
|
+
traceId,
|
|
3533
|
+
spanId,
|
|
3534
|
+
pagination
|
|
3535
|
+
}) {
|
|
3536
|
+
return this.stores.scores.getScoresBySpan({ traceId, spanId, pagination });
|
|
3537
|
+
}
|
|
3428
3538
|
async batchCreateAISpans(args) {
|
|
3429
3539
|
return this.stores.observability.batchCreateAISpans(args);
|
|
3430
3540
|
}
|