@mastra/libsql 0.13.1 → 0.13.2-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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/index.cjs +16 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +3 -2
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +3 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/storage/domains/memory/index.ts +0 -1
- package/src/storage/domains/scores/index.ts +18 -11
- package/src/storage/index.ts +4 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
|
3
3
|
import { parseSqlIdentifier, parseFieldKey } from '@mastra/core/utils';
|
|
4
4
|
import { MastraVector } from '@mastra/core/vector';
|
|
5
5
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
6
|
-
import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS, TracesStorage, TABLE_TRACES,
|
|
6
|
+
import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS, safelyParseJSON, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
|
|
7
7
|
import { parseSqlIdentifier as parseSqlIdentifier$1 } from '@mastra/core';
|
|
8
8
|
import { MessageList } from '@mastra/core/agent';
|
|
9
9
|
|
|
@@ -1458,7 +1458,6 @@ var MemoryLibSQL = class extends MemoryStorage {
|
|
|
1458
1458
|
};
|
|
1459
1459
|
}
|
|
1460
1460
|
async saveResource({ resource }) {
|
|
1461
|
-
console.log("resource", resource);
|
|
1462
1461
|
await this.operations.insert({
|
|
1463
1462
|
tableName: TABLE_RESOURCES,
|
|
1464
1463
|
record: {
|
|
@@ -2058,6 +2057,7 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2058
2057
|
scorerId,
|
|
2059
2058
|
entityId,
|
|
2060
2059
|
entityType,
|
|
2060
|
+
source,
|
|
2061
2061
|
pagination
|
|
2062
2062
|
}) {
|
|
2063
2063
|
try {
|
|
@@ -2075,6 +2075,10 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2075
2075
|
conditions.push(`entityType = ?`);
|
|
2076
2076
|
queryParams.push(entityType);
|
|
2077
2077
|
}
|
|
2078
|
+
if (source) {
|
|
2079
|
+
conditions.push(`source = ?`);
|
|
2080
|
+
queryParams.push(source);
|
|
2081
|
+
}
|
|
2078
2082
|
const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
2079
2083
|
const result = await this.client.execute({
|
|
2080
2084
|
sql: `SELECT * FROM ${TABLE_SCORERS} ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,
|
|
@@ -2101,15 +2105,15 @@ var ScoresLibSQL = class extends ScoresStorage {
|
|
|
2101
2105
|
}
|
|
2102
2106
|
}
|
|
2103
2107
|
transformScoreRow(row) {
|
|
2104
|
-
const scorerValue =
|
|
2105
|
-
const inputValue =
|
|
2106
|
-
const outputValue =
|
|
2107
|
-
const additionalLLMContextValue = row.additionalLLMContext ?
|
|
2108
|
-
const runtimeContextValue = row.runtimeContext ?
|
|
2109
|
-
const metadataValue = row.metadata ?
|
|
2110
|
-
const entityValue = row.entity ?
|
|
2111
|
-
const preprocessStepResultValue = row.preprocessStepResult ?
|
|
2112
|
-
const analyzeStepResultValue = row.analyzeStepResult ?
|
|
2108
|
+
const scorerValue = safelyParseJSON(row.scorer);
|
|
2109
|
+
const inputValue = safelyParseJSON(row.input ?? "{}");
|
|
2110
|
+
const outputValue = safelyParseJSON(row.output ?? "{}");
|
|
2111
|
+
const additionalLLMContextValue = row.additionalLLMContext ? safelyParseJSON(row.additionalLLMContext) : null;
|
|
2112
|
+
const runtimeContextValue = row.runtimeContext ? safelyParseJSON(row.runtimeContext) : null;
|
|
2113
|
+
const metadataValue = row.metadata ? safelyParseJSON(row.metadata) : null;
|
|
2114
|
+
const entityValue = row.entity ? safelyParseJSON(row.entity) : null;
|
|
2115
|
+
const preprocessStepResultValue = row.preprocessStepResult ? safelyParseJSON(row.preprocessStepResult) : null;
|
|
2116
|
+
const analyzeStepResultValue = row.analyzeStepResult ? safelyParseJSON(row.analyzeStepResult) : null;
|
|
2113
2117
|
return {
|
|
2114
2118
|
id: row.id,
|
|
2115
2119
|
traceId: row.traceId,
|
|
@@ -2630,9 +2634,10 @@ var LibSQLStore = class extends MastraStorage {
|
|
|
2630
2634
|
scorerId,
|
|
2631
2635
|
entityId,
|
|
2632
2636
|
entityType,
|
|
2637
|
+
source,
|
|
2633
2638
|
pagination
|
|
2634
2639
|
}) {
|
|
2635
|
-
return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, pagination });
|
|
2640
|
+
return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, source, pagination });
|
|
2636
2641
|
}
|
|
2637
2642
|
async getScoresByRunId({
|
|
2638
2643
|
runId,
|