@mastra/libsql 0.0.0-declaration-maps-20250730004430 → 0.0.0-experimental-agent-builder-20250815195917
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 +144 -2
- package/dist/index.cjs +66 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +67 -47
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +4 -3
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/traces/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -1
- package/dist/storage/index.d.ts +3 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/dist/vector/sql-builder.d.ts +1 -1
- package/dist/vector/sql-builder.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/storage/domains/memory/index.ts +0 -1
- package/src/storage/domains/scores/index.ts +22 -13
- package/src/storage/domains/traces/index.ts +5 -5
- package/src/storage/index.ts +4 -2
- package/src/vector/index.test.ts +22 -1
- package/src/vector/index.ts +1 -1
- package/src/vector/sql-builder.ts +51 -33
- package/tsconfig.json +1 -1
- package/tsup.config.ts +2 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,138 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-experimental-agent-builder-20250815195917
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8e59433]
|
|
8
|
+
- Updated dependencies [49281f5]
|
|
9
|
+
- Updated dependencies [6faaee5]
|
|
10
|
+
- Updated dependencies [4232b14]
|
|
11
|
+
- Updated dependencies [6720c51]
|
|
12
|
+
- Updated dependencies [2256977]
|
|
13
|
+
- Updated dependencies [c597dc5]
|
|
14
|
+
- Updated dependencies [a722c0b]
|
|
15
|
+
- Updated dependencies [c30bca8]
|
|
16
|
+
- Updated dependencies [7444737]
|
|
17
|
+
- Updated dependencies [83d180b]
|
|
18
|
+
- Updated dependencies [3b5fec7]
|
|
19
|
+
- @mastra/core@0.0.0-experimental-agent-builder-20250815195917
|
|
20
|
+
|
|
21
|
+
## 0.13.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- b5cf2a3: make system message always available during agent calls
|
|
26
|
+
- b32c50d: Filter scores by source
|
|
27
|
+
- Updated dependencies [d5330bf]
|
|
28
|
+
- Updated dependencies [2e74797]
|
|
29
|
+
- Updated dependencies [8388649]
|
|
30
|
+
- Updated dependencies [a239d41]
|
|
31
|
+
- Updated dependencies [dd94a26]
|
|
32
|
+
- Updated dependencies [3ba6772]
|
|
33
|
+
- Updated dependencies [b5cf2a3]
|
|
34
|
+
- Updated dependencies [2fff911]
|
|
35
|
+
- Updated dependencies [b32c50d]
|
|
36
|
+
- Updated dependencies [63449d0]
|
|
37
|
+
- Updated dependencies [121a3f8]
|
|
38
|
+
- Updated dependencies [ec510e7]
|
|
39
|
+
- @mastra/core@0.13.2
|
|
40
|
+
|
|
41
|
+
## 0.13.2-alpha.1
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- b5cf2a3: make system message always available during agent calls
|
|
46
|
+
- Updated dependencies [b5cf2a3]
|
|
47
|
+
- @mastra/core@0.13.2-alpha.3
|
|
48
|
+
|
|
49
|
+
## 0.13.2-alpha.0
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- b32c50d: Filter scores by source
|
|
54
|
+
- Updated dependencies [d5330bf]
|
|
55
|
+
- Updated dependencies [a239d41]
|
|
56
|
+
- Updated dependencies [b32c50d]
|
|
57
|
+
- Updated dependencies [121a3f8]
|
|
58
|
+
- Updated dependencies [ec510e7]
|
|
59
|
+
- @mastra/core@0.13.2-alpha.2
|
|
60
|
+
|
|
61
|
+
## 0.13.1
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 8888b57: Fix LibSQL vector metadata filtering for Memory system - corrected JSON path syntax for simple fields and changed default minScore to -1 to include all similarity results
|
|
66
|
+
- Updated dependencies [cd0042e]
|
|
67
|
+
- @mastra/core@0.13.1
|
|
68
|
+
|
|
69
|
+
## 0.13.1-alpha.0
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- 8888b57: Fix LibSQL vector metadata filtering for Memory system - corrected JSON path syntax for simple fields and changed default minScore to -1 to include all similarity results
|
|
74
|
+
- Updated dependencies [cd0042e]
|
|
75
|
+
- @mastra/core@0.13.1-alpha.0
|
|
76
|
+
|
|
77
|
+
## 0.13.0
|
|
78
|
+
|
|
79
|
+
### Minor Changes
|
|
80
|
+
|
|
81
|
+
- ea0c5f2: Add store support to new score api
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 2871020: update safelyParseJSON to check for value of param when handling parse
|
|
86
|
+
- 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
|
|
87
|
+
- Updated dependencies [cb36de0]
|
|
88
|
+
- Updated dependencies [d0496e6]
|
|
89
|
+
- Updated dependencies [a82b851]
|
|
90
|
+
- Updated dependencies [ea0c5f2]
|
|
91
|
+
- Updated dependencies [41a0a0e]
|
|
92
|
+
- Updated dependencies [2871020]
|
|
93
|
+
- Updated dependencies [94f4812]
|
|
94
|
+
- Updated dependencies [e202b82]
|
|
95
|
+
- Updated dependencies [e00f6a0]
|
|
96
|
+
- Updated dependencies [4a406ec]
|
|
97
|
+
- Updated dependencies [b0e43c1]
|
|
98
|
+
- Updated dependencies [5d377e5]
|
|
99
|
+
- Updated dependencies [1fb812e]
|
|
100
|
+
- Updated dependencies [35c5798]
|
|
101
|
+
- @mastra/core@0.13.0
|
|
102
|
+
|
|
103
|
+
## 0.13.0-alpha.1
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- 2871020: update safelyParseJSON to check for value of param when handling parse
|
|
108
|
+
- 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
|
|
109
|
+
- Updated dependencies [cb36de0]
|
|
110
|
+
- Updated dependencies [a82b851]
|
|
111
|
+
- Updated dependencies [41a0a0e]
|
|
112
|
+
- Updated dependencies [2871020]
|
|
113
|
+
- Updated dependencies [4a406ec]
|
|
114
|
+
- Updated dependencies [5d377e5]
|
|
115
|
+
- @mastra/core@0.13.0-alpha.2
|
|
116
|
+
|
|
117
|
+
## 0.13.0-alpha.0
|
|
118
|
+
|
|
119
|
+
### Minor Changes
|
|
120
|
+
|
|
121
|
+
- ea0c5f2: Add store support to new score api
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- Updated dependencies [ea0c5f2]
|
|
126
|
+
- Updated dependencies [b0e43c1]
|
|
127
|
+
- Updated dependencies [1fb812e]
|
|
128
|
+
- Updated dependencies [35c5798]
|
|
129
|
+
- @mastra/core@0.13.0-alpha.1
|
|
130
|
+
|
|
131
|
+
## 0.12.0
|
|
132
|
+
|
|
133
|
+
### Minor Changes
|
|
134
|
+
|
|
135
|
+
- f42c4c2: update peer deps for packages to latest core range
|
|
4
136
|
|
|
5
137
|
### Patch Changes
|
|
6
138
|
|
|
@@ -43,7 +175,17 @@
|
|
|
43
175
|
- Updated dependencies [b8efbb9]
|
|
44
176
|
- Updated dependencies [71466e7]
|
|
45
177
|
- Updated dependencies [0c99fbe]
|
|
46
|
-
- @mastra/core@0.
|
|
178
|
+
- @mastra/core@0.12.0
|
|
179
|
+
|
|
180
|
+
## 0.12.0-alpha.2
|
|
181
|
+
|
|
182
|
+
### Minor Changes
|
|
183
|
+
|
|
184
|
+
- f42c4c2: update peer deps for packages to latest core range
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- @mastra/core@0.12.0-alpha.5
|
|
47
189
|
|
|
48
190
|
## 0.11.3-alpha.1
|
|
49
191
|
|
package/dist/index.cjs
CHANGED
|
@@ -78,11 +78,11 @@ var LibSQLFilterTranslator = class extends filter.BaseFilterTranslator {
|
|
|
78
78
|
};
|
|
79
79
|
var createBasicOperator = (symbol) => {
|
|
80
80
|
return (key, value) => {
|
|
81
|
-
const
|
|
81
|
+
const jsonPath = getJsonPath(key);
|
|
82
82
|
return {
|
|
83
83
|
sql: `CASE
|
|
84
|
-
WHEN ? IS NULL THEN json_extract(metadata,
|
|
85
|
-
ELSE json_extract(metadata,
|
|
84
|
+
WHEN ? IS NULL THEN json_extract(metadata, ${jsonPath}) IS ${symbol === "=" ? "" : "NOT"} NULL
|
|
85
|
+
ELSE json_extract(metadata, ${jsonPath}) ${symbol} ?
|
|
86
86
|
END`,
|
|
87
87
|
needsValue: true,
|
|
88
88
|
transformValue: () => {
|
|
@@ -93,16 +93,19 @@ var createBasicOperator = (symbol) => {
|
|
|
93
93
|
};
|
|
94
94
|
var createNumericOperator = (symbol) => {
|
|
95
95
|
return (key) => {
|
|
96
|
-
const
|
|
96
|
+
const jsonPath = getJsonPath(key);
|
|
97
97
|
return {
|
|
98
|
-
sql: `CAST(json_extract(metadata,
|
|
98
|
+
sql: `CAST(json_extract(metadata, ${jsonPath}) AS NUMERIC) ${symbol} ?`,
|
|
99
99
|
needsValue: true
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
var validateJsonArray = (key) =>
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
var validateJsonArray = (key) => {
|
|
104
|
+
const jsonPath = getJsonPath(key);
|
|
105
|
+
return `json_valid(json_extract(metadata, ${jsonPath}))
|
|
106
|
+
AND json_type(json_extract(metadata, ${jsonPath})) = 'array'`;
|
|
107
|
+
};
|
|
108
|
+
var pattern = /json_extract\(metadata, '\$\.(?:"[^"]*"(?:\."[^"]*")*|[^']+)'\)/g;
|
|
106
109
|
function buildElemMatchConditions(value) {
|
|
107
110
|
const conditions = Object.entries(value).map(([field, fieldValue]) => {
|
|
108
111
|
if (field.startsWith("$")) {
|
|
@@ -111,12 +114,13 @@ function buildElemMatchConditions(value) {
|
|
|
111
114
|
return { sql: elemSql, values };
|
|
112
115
|
} else if (typeof fieldValue === "object" && !Array.isArray(fieldValue)) {
|
|
113
116
|
const { sql, values } = buildCondition(field, fieldValue);
|
|
114
|
-
const
|
|
117
|
+
const jsonPath = parseJsonPathKey(field);
|
|
118
|
+
const elemSql = sql.replace(pattern, `json_extract(elem.value, '$.${jsonPath}')`);
|
|
115
119
|
return { sql: elemSql, values };
|
|
116
120
|
} else {
|
|
117
|
-
const
|
|
121
|
+
const jsonPath = parseJsonPathKey(field);
|
|
118
122
|
return {
|
|
119
|
-
sql: `json_extract(elem.value, '
|
|
123
|
+
sql: `json_extract(elem.value, '$.${jsonPath}') = ?`,
|
|
120
124
|
values: [fieldValue]
|
|
121
125
|
};
|
|
122
126
|
}
|
|
@@ -132,7 +136,7 @@ var FILTER_OPERATORS = {
|
|
|
132
136
|
$lte: createNumericOperator("<="),
|
|
133
137
|
// Array Operators
|
|
134
138
|
$in: (key, value) => {
|
|
135
|
-
const
|
|
139
|
+
const jsonPath = getJsonPath(key);
|
|
136
140
|
const arr = Array.isArray(value) ? value : [value];
|
|
137
141
|
if (arr.length === 0) {
|
|
138
142
|
return { sql: "1 = 0", needsValue: true, transformValue: () => [] };
|
|
@@ -141,12 +145,12 @@ var FILTER_OPERATORS = {
|
|
|
141
145
|
return {
|
|
142
146
|
sql: `(
|
|
143
147
|
CASE
|
|
144
|
-
WHEN ${validateJsonArray(
|
|
148
|
+
WHEN ${validateJsonArray(key)} THEN
|
|
145
149
|
EXISTS (
|
|
146
|
-
SELECT 1 FROM json_each(json_extract(metadata,
|
|
150
|
+
SELECT 1 FROM json_each(json_extract(metadata, ${jsonPath})) as elem
|
|
147
151
|
WHERE elem.value IN (SELECT value FROM json_each(?))
|
|
148
152
|
)
|
|
149
|
-
ELSE json_extract(metadata,
|
|
153
|
+
ELSE json_extract(metadata, ${jsonPath}) IN (${paramPlaceholders})
|
|
150
154
|
END
|
|
151
155
|
)`,
|
|
152
156
|
needsValue: true,
|
|
@@ -154,7 +158,7 @@ var FILTER_OPERATORS = {
|
|
|
154
158
|
};
|
|
155
159
|
},
|
|
156
160
|
$nin: (key, value) => {
|
|
157
|
-
const
|
|
161
|
+
const jsonPath = getJsonPath(key);
|
|
158
162
|
const arr = Array.isArray(value) ? value : [value];
|
|
159
163
|
if (arr.length === 0) {
|
|
160
164
|
return { sql: "1 = 1", needsValue: true, transformValue: () => [] };
|
|
@@ -163,12 +167,12 @@ var FILTER_OPERATORS = {
|
|
|
163
167
|
return {
|
|
164
168
|
sql: `(
|
|
165
169
|
CASE
|
|
166
|
-
WHEN ${validateJsonArray(
|
|
170
|
+
WHEN ${validateJsonArray(key)} THEN
|
|
167
171
|
NOT EXISTS (
|
|
168
|
-
SELECT 1 FROM json_each(json_extract(metadata,
|
|
172
|
+
SELECT 1 FROM json_each(json_extract(metadata, ${jsonPath})) as elem
|
|
169
173
|
WHERE elem.value IN (SELECT value FROM json_each(?))
|
|
170
174
|
)
|
|
171
|
-
ELSE json_extract(metadata,
|
|
175
|
+
ELSE json_extract(metadata, ${jsonPath}) NOT IN (${paramPlaceholders})
|
|
172
176
|
END
|
|
173
177
|
)`,
|
|
174
178
|
needsValue: true,
|
|
@@ -176,7 +180,7 @@ var FILTER_OPERATORS = {
|
|
|
176
180
|
};
|
|
177
181
|
},
|
|
178
182
|
$all: (key, value) => {
|
|
179
|
-
const
|
|
183
|
+
const jsonPath = getJsonPath(key);
|
|
180
184
|
let sql;
|
|
181
185
|
const arrayValue = Array.isArray(value) ? value : [value];
|
|
182
186
|
if (arrayValue.length === 0) {
|
|
@@ -184,13 +188,13 @@ var FILTER_OPERATORS = {
|
|
|
184
188
|
} else {
|
|
185
189
|
sql = `(
|
|
186
190
|
CASE
|
|
187
|
-
WHEN ${validateJsonArray(
|
|
191
|
+
WHEN ${validateJsonArray(key)} THEN
|
|
188
192
|
NOT EXISTS (
|
|
189
193
|
SELECT value
|
|
190
194
|
FROM json_each(?)
|
|
191
195
|
WHERE value NOT IN (
|
|
192
196
|
SELECT value
|
|
193
|
-
FROM json_each(json_extract(metadata,
|
|
197
|
+
FROM json_each(json_extract(metadata, ${jsonPath}))
|
|
194
198
|
)
|
|
195
199
|
)
|
|
196
200
|
ELSE FALSE
|
|
@@ -209,7 +213,7 @@ var FILTER_OPERATORS = {
|
|
|
209
213
|
};
|
|
210
214
|
},
|
|
211
215
|
$elemMatch: (key, value) => {
|
|
212
|
-
const
|
|
216
|
+
const jsonPath = getJsonPath(key);
|
|
213
217
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
214
218
|
throw new Error("$elemMatch requires an object with conditions");
|
|
215
219
|
}
|
|
@@ -217,10 +221,10 @@ var FILTER_OPERATORS = {
|
|
|
217
221
|
return {
|
|
218
222
|
sql: `(
|
|
219
223
|
CASE
|
|
220
|
-
WHEN ${validateJsonArray(
|
|
224
|
+
WHEN ${validateJsonArray(key)} THEN
|
|
221
225
|
EXISTS (
|
|
222
226
|
SELECT 1
|
|
223
|
-
FROM json_each(json_extract(metadata,
|
|
227
|
+
FROM json_each(json_extract(metadata, ${jsonPath})) as elem
|
|
224
228
|
WHERE ${conditions.map((c) => c.sql).join(" AND ")}
|
|
225
229
|
)
|
|
226
230
|
ELSE FALSE
|
|
@@ -232,9 +236,9 @@ var FILTER_OPERATORS = {
|
|
|
232
236
|
},
|
|
233
237
|
// Element Operators
|
|
234
238
|
$exists: (key) => {
|
|
235
|
-
const
|
|
239
|
+
const jsonPath = getJsonPath(key);
|
|
236
240
|
return {
|
|
237
|
-
sql: `json_extract(metadata,
|
|
241
|
+
sql: `json_extract(metadata, ${jsonPath}) IS NOT NULL`,
|
|
238
242
|
needsValue: false
|
|
239
243
|
};
|
|
240
244
|
},
|
|
@@ -253,12 +257,12 @@ var FILTER_OPERATORS = {
|
|
|
253
257
|
needsValue: false
|
|
254
258
|
}),
|
|
255
259
|
$size: (key, paramIndex) => {
|
|
256
|
-
const
|
|
260
|
+
const jsonPath = getJsonPath(key);
|
|
257
261
|
return {
|
|
258
262
|
sql: `(
|
|
259
263
|
CASE
|
|
260
|
-
WHEN json_type(json_extract(metadata,
|
|
261
|
-
json_array_length(json_extract(metadata,
|
|
264
|
+
WHEN json_type(json_extract(metadata, ${jsonPath})) = 'array' THEN
|
|
265
|
+
json_array_length(json_extract(metadata, ${jsonPath})) = $${paramIndex}
|
|
262
266
|
ELSE FALSE
|
|
263
267
|
END
|
|
264
268
|
)`,
|
|
@@ -377,7 +381,14 @@ function isFilterResult(obj) {
|
|
|
377
381
|
}
|
|
378
382
|
var parseJsonPathKey = (key) => {
|
|
379
383
|
const parsedKey = utils.parseFieldKey(key);
|
|
380
|
-
|
|
384
|
+
if (parsedKey.includes(".")) {
|
|
385
|
+
return parsedKey.split(".").map((segment) => `"${segment}"`).join(".");
|
|
386
|
+
}
|
|
387
|
+
return parsedKey;
|
|
388
|
+
};
|
|
389
|
+
var getJsonPath = (key) => {
|
|
390
|
+
const jsonPathKey = parseJsonPathKey(key);
|
|
391
|
+
return `'$.${jsonPathKey}'`;
|
|
381
392
|
};
|
|
382
393
|
function escapeLikePattern(str) {
|
|
383
394
|
return str.replace(/([%_\\])/g, "\\$1");
|
|
@@ -402,8 +413,9 @@ function buildCondition(key, value, parentPath) {
|
|
|
402
413
|
return handleLogicalOperator(key, value);
|
|
403
414
|
}
|
|
404
415
|
if (!value || typeof value !== "object") {
|
|
416
|
+
const jsonPath = getJsonPath(key);
|
|
405
417
|
return {
|
|
406
|
-
sql: `json_extract(metadata,
|
|
418
|
+
sql: `json_extract(metadata, ${jsonPath}) = ?`,
|
|
407
419
|
values: [value]
|
|
408
420
|
};
|
|
409
421
|
}
|
|
@@ -549,7 +561,8 @@ var LibSQLVector = class extends vector.MastraVector {
|
|
|
549
561
|
topK = 10,
|
|
550
562
|
filter,
|
|
551
563
|
includeVector = false,
|
|
552
|
-
minScore =
|
|
564
|
+
minScore = -1
|
|
565
|
+
// Default to -1 to include all results (cosine similarity ranges from -1 to 1)
|
|
553
566
|
}) {
|
|
554
567
|
try {
|
|
555
568
|
if (!Number.isInteger(topK) || topK <= 0) {
|
|
@@ -1447,7 +1460,6 @@ var MemoryLibSQL = class extends storage.MemoryStorage {
|
|
|
1447
1460
|
};
|
|
1448
1461
|
}
|
|
1449
1462
|
async saveResource({ resource }) {
|
|
1450
|
-
console.log("resource", resource);
|
|
1451
1463
|
await this.operations.insert({
|
|
1452
1464
|
tableName: storage.TABLE_RESOURCES,
|
|
1453
1465
|
record: {
|
|
@@ -2047,6 +2059,7 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2047
2059
|
scorerId,
|
|
2048
2060
|
entityId,
|
|
2049
2061
|
entityType,
|
|
2062
|
+
source,
|
|
2050
2063
|
pagination
|
|
2051
2064
|
}) {
|
|
2052
2065
|
try {
|
|
@@ -2064,6 +2077,10 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2064
2077
|
conditions.push(`entityType = ?`);
|
|
2065
2078
|
queryParams.push(entityType);
|
|
2066
2079
|
}
|
|
2080
|
+
if (source) {
|
|
2081
|
+
conditions.push(`source = ?`);
|
|
2082
|
+
queryParams.push(source);
|
|
2083
|
+
}
|
|
2067
2084
|
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2068
2085
|
const result = await this.client.execute({
|
|
2069
2086
|
sql: `SELECT * FROM ${storage.TABLE_SCORERS} ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,
|
|
@@ -2090,15 +2107,15 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2090
2107
|
}
|
|
2091
2108
|
}
|
|
2092
2109
|
transformScoreRow(row) {
|
|
2093
|
-
const scorerValue =
|
|
2094
|
-
const inputValue =
|
|
2095
|
-
const outputValue =
|
|
2096
|
-
const additionalLLMContextValue = row.additionalLLMContext ?
|
|
2097
|
-
const runtimeContextValue = row.runtimeContext ?
|
|
2098
|
-
const metadataValue = row.metadata ?
|
|
2099
|
-
const entityValue = row.entity ?
|
|
2100
|
-
const
|
|
2101
|
-
const analyzeStepResultValue = row.analyzeStepResult ?
|
|
2110
|
+
const scorerValue = storage.safelyParseJSON(row.scorer);
|
|
2111
|
+
const inputValue = storage.safelyParseJSON(row.input ?? "{}");
|
|
2112
|
+
const outputValue = storage.safelyParseJSON(row.output ?? "{}");
|
|
2113
|
+
const additionalLLMContextValue = row.additionalLLMContext ? storage.safelyParseJSON(row.additionalLLMContext) : null;
|
|
2114
|
+
const runtimeContextValue = row.runtimeContext ? storage.safelyParseJSON(row.runtimeContext) : null;
|
|
2115
|
+
const metadataValue = row.metadata ? storage.safelyParseJSON(row.metadata) : null;
|
|
2116
|
+
const entityValue = row.entity ? storage.safelyParseJSON(row.entity) : null;
|
|
2117
|
+
const preprocessStepResultValue = row.preprocessStepResult ? storage.safelyParseJSON(row.preprocessStepResult) : null;
|
|
2118
|
+
const analyzeStepResultValue = row.analyzeStepResult ? storage.safelyParseJSON(row.analyzeStepResult) : null;
|
|
2102
2119
|
return {
|
|
2103
2120
|
id: row.id,
|
|
2104
2121
|
traceId: row.traceId,
|
|
@@ -2106,10 +2123,12 @@ var ScoresLibSQL = class extends storage.ScoresStorage {
|
|
|
2106
2123
|
scorer: scorerValue,
|
|
2107
2124
|
score: row.score,
|
|
2108
2125
|
reason: row.reason,
|
|
2109
|
-
|
|
2126
|
+
preprocessStepResult: preprocessStepResultValue,
|
|
2110
2127
|
analyzeStepResult: analyzeStepResultValue,
|
|
2111
2128
|
analyzePrompt: row.analyzePrompt,
|
|
2112
|
-
|
|
2129
|
+
preprocessPrompt: row.preprocessPrompt,
|
|
2130
|
+
generateScorePrompt: row.generateScorePrompt,
|
|
2131
|
+
generateReasonPrompt: row.generateReasonPrompt,
|
|
2113
2132
|
metadata: metadataValue,
|
|
2114
2133
|
input: inputValue,
|
|
2115
2134
|
output: outputValue,
|
|
@@ -2617,9 +2636,10 @@ var LibSQLStore = class extends storage.MastraStorage {
|
|
|
2617
2636
|
scorerId,
|
|
2618
2637
|
entityId,
|
|
2619
2638
|
entityType,
|
|
2639
|
+
source,
|
|
2620
2640
|
pagination
|
|
2621
2641
|
}) {
|
|
2622
|
-
return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, pagination });
|
|
2642
|
+
return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, source, pagination });
|
|
2623
2643
|
}
|
|
2624
2644
|
async getScoresByRunId({
|
|
2625
2645
|
runId,
|