@mastra/libsql 1.19.0 → 1.20.0-alpha.0
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 +45 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +1 -1
- package/dist/docs/references/docs-agents-networks.md +2 -2
- package/dist/docs/references/docs-memory-overview.md +2 -2
- package/dist/docs/references/docs-storage-overview.md +2 -2
- package/dist/docs/references/reference-file-based-agents-storage.md +1 -1
- package/dist/index.cjs +53 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -25
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4591,7 +4591,13 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4591
4591
|
ifNotExists: [
|
|
4592
4592
|
"agentVersion",
|
|
4593
4593
|
"organizationId",
|
|
4594
|
-
"projectId"
|
|
4594
|
+
"projectId",
|
|
4595
|
+
"provenance",
|
|
4596
|
+
"runnerAttestation",
|
|
4597
|
+
"experimentSetId",
|
|
4598
|
+
"comparisonId",
|
|
4599
|
+
"variantId",
|
|
4600
|
+
"trialIndex"
|
|
4595
4601
|
]
|
|
4596
4602
|
});
|
|
4597
4603
|
await this.#db.alterTable({
|
|
@@ -4611,6 +4617,10 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4611
4617
|
sql: `CREATE INDEX IF NOT EXISTS idx_experiments_datasetid ON "${TABLE_EXPERIMENTS}" ("datasetId")`,
|
|
4612
4618
|
args: []
|
|
4613
4619
|
},
|
|
4620
|
+
{
|
|
4621
|
+
sql: `CREATE INDEX IF NOT EXISTS idx_experiments_grouping ON "${TABLE_EXPERIMENTS}" ("experimentSetId", "comparisonId", "variantId", "trialIndex")`,
|
|
4622
|
+
args: []
|
|
4623
|
+
},
|
|
4614
4624
|
{
|
|
4615
4625
|
sql: `CREATE INDEX IF NOT EXISTS idx_experiment_results_experimentid ON "${TABLE_EXPERIMENT_RESULTS}" ("experimentId")`,
|
|
4616
4626
|
args: []
|
|
@@ -4710,6 +4720,12 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4710
4720
|
name: row.name ?? void 0,
|
|
4711
4721
|
description: row.description ?? void 0,
|
|
4712
4722
|
metadata: row.metadata ? safelyParseJSON(row.metadata) : void 0,
|
|
4723
|
+
provenance: row.provenance ? safelyParseJSON(row.provenance) : null,
|
|
4724
|
+
runnerAttestation: row.runnerAttestation ? safelyParseJSON(row.runnerAttestation) : null,
|
|
4725
|
+
experimentSetId: row.experimentSetId ?? null,
|
|
4726
|
+
comparisonId: row.comparisonId ?? null,
|
|
4727
|
+
variantId: row.variantId ?? null,
|
|
4728
|
+
trialIndex: row.trialIndex != null ? row.trialIndex : null,
|
|
4713
4729
|
status: row.status,
|
|
4714
4730
|
totalItems: row.totalItems,
|
|
4715
4731
|
succeededCount: row.succeededCount,
|
|
@@ -4763,6 +4779,12 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4763
4779
|
name: input.name ?? null,
|
|
4764
4780
|
description: input.description ?? null,
|
|
4765
4781
|
metadata: input.metadata ?? null,
|
|
4782
|
+
provenance: input.provenance ?? null,
|
|
4783
|
+
runnerAttestation: input.runnerAttestation ?? null,
|
|
4784
|
+
experimentSetId: input.experimentSetId ?? null,
|
|
4785
|
+
comparisonId: input.comparisonId ?? null,
|
|
4786
|
+
variantId: input.variantId ?? null,
|
|
4787
|
+
trialIndex: input.trialIndex ?? null,
|
|
4766
4788
|
status: "pending",
|
|
4767
4789
|
totalItems: input.totalItems,
|
|
4768
4790
|
succeededCount: 0,
|
|
@@ -4786,6 +4808,12 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4786
4808
|
name: input.name,
|
|
4787
4809
|
description: input.description,
|
|
4788
4810
|
metadata: input.metadata,
|
|
4811
|
+
provenance: input.provenance ?? null,
|
|
4812
|
+
runnerAttestation: input.runnerAttestation ?? null,
|
|
4813
|
+
experimentSetId: input.experimentSetId ?? null,
|
|
4814
|
+
comparisonId: input.comparisonId ?? null,
|
|
4815
|
+
variantId: input.variantId ?? null,
|
|
4816
|
+
trialIndex: input.trialIndex ?? null,
|
|
4789
4817
|
status: "pending",
|
|
4790
4818
|
totalItems: input.totalItems,
|
|
4791
4819
|
succeededCount: 0,
|
|
@@ -4911,6 +4939,22 @@ var ExperimentsLibSQL = class extends ExperimentsStorage {
|
|
|
4911
4939
|
conditions.push("status = ?");
|
|
4912
4940
|
queryParams.push(args.status);
|
|
4913
4941
|
}
|
|
4942
|
+
if (args.experimentSetId !== void 0) {
|
|
4943
|
+
conditions.push("experimentSetId = ?");
|
|
4944
|
+
queryParams.push(args.experimentSetId);
|
|
4945
|
+
}
|
|
4946
|
+
if (args.comparisonId !== void 0) {
|
|
4947
|
+
conditions.push("comparisonId = ?");
|
|
4948
|
+
queryParams.push(args.comparisonId);
|
|
4949
|
+
}
|
|
4950
|
+
if (args.variantId !== void 0) {
|
|
4951
|
+
conditions.push("variantId = ?");
|
|
4952
|
+
queryParams.push(args.variantId);
|
|
4953
|
+
}
|
|
4954
|
+
if (args.trialIndex !== void 0) {
|
|
4955
|
+
conditions.push("trialIndex = ?");
|
|
4956
|
+
queryParams.push(args.trialIndex);
|
|
4957
|
+
}
|
|
4914
4958
|
if (args.filters) {
|
|
4915
4959
|
const { organizationId, projectId } = args.filters;
|
|
4916
4960
|
if (organizationId !== void 0) {
|
|
@@ -6872,6 +6916,7 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
6872
6916
|
hasMore: metadataFilter ? perPageInput !== false && offset + paginatedCount < total : perPageInput !== false && !allThreadMessagesReturned && offset + perPage < total
|
|
6873
6917
|
};
|
|
6874
6918
|
} catch (error) {
|
|
6919
|
+
if (error instanceof MastraError && error.category === ErrorCategory.USER) throw error;
|
|
6875
6920
|
const mastraError = new MastraError({
|
|
6876
6921
|
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES", "FAILED"),
|
|
6877
6922
|
domain: ErrorDomain.STORAGE,
|
|
@@ -6883,25 +6928,19 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
6883
6928
|
}, error);
|
|
6884
6929
|
this.logger?.error?.(mastraError.toString());
|
|
6885
6930
|
this.logger?.trackException?.(mastraError);
|
|
6886
|
-
|
|
6887
|
-
messages: [],
|
|
6888
|
-
total: 0,
|
|
6889
|
-
page,
|
|
6890
|
-
perPage: perPageForResponse,
|
|
6891
|
-
hasMore: false
|
|
6892
|
-
};
|
|
6931
|
+
throw mastraError;
|
|
6893
6932
|
}
|
|
6894
6933
|
}
|
|
6895
6934
|
async listMessagesByResourceId(args) {
|
|
6896
6935
|
const { resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
6897
6936
|
if (!resourceId || typeof resourceId !== "string" || resourceId.trim().length === 0) throw new MastraError({
|
|
6898
|
-
id: createStorageErrorId("LIBSQL", "
|
|
6937
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES_BY_RESOURCE_ID", "INVALID_QUERY"),
|
|
6899
6938
|
domain: ErrorDomain.STORAGE,
|
|
6900
6939
|
category: ErrorCategory.USER,
|
|
6901
6940
|
details: { resourceId: resourceId ?? "" }
|
|
6902
6941
|
}, /* @__PURE__ */ new Error("resourceId is required"));
|
|
6903
6942
|
if (page < 0) throw new MastraError({
|
|
6904
|
-
id: createStorageErrorId("LIBSQL", "
|
|
6943
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES_BY_RESOURCE_ID", "INVALID_PAGE"),
|
|
6905
6944
|
domain: ErrorDomain.STORAGE,
|
|
6906
6945
|
category: ErrorCategory.USER,
|
|
6907
6946
|
details: { page }
|
|
@@ -6993,21 +7032,16 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
6993
7032
|
hasMore: perPageInput !== false && offset + perPage < total
|
|
6994
7033
|
};
|
|
6995
7034
|
} catch (error) {
|
|
7035
|
+
if (error instanceof MastraError && error.category === ErrorCategory.USER) throw error;
|
|
6996
7036
|
const mastraError = new MastraError({
|
|
6997
|
-
id: createStorageErrorId("LIBSQL", "
|
|
7037
|
+
id: createStorageErrorId("LIBSQL", "LIST_MESSAGES_BY_RESOURCE_ID", "FAILED"),
|
|
6998
7038
|
domain: ErrorDomain.STORAGE,
|
|
6999
7039
|
category: ErrorCategory.THIRD_PARTY,
|
|
7000
7040
|
details: { resourceId }
|
|
7001
7041
|
}, error);
|
|
7002
7042
|
this.logger?.error?.(mastraError.toString());
|
|
7003
7043
|
this.logger?.trackException?.(mastraError);
|
|
7004
|
-
|
|
7005
|
-
messages: [],
|
|
7006
|
-
total: 0,
|
|
7007
|
-
page,
|
|
7008
|
-
perPage: perPageForResponse,
|
|
7009
|
-
hasMore: false
|
|
7010
|
-
};
|
|
7044
|
+
throw mastraError;
|
|
7011
7045
|
}
|
|
7012
7046
|
}
|
|
7013
7047
|
async saveMessages({ messages }) {
|
|
@@ -7355,13 +7389,7 @@ var MemoryLibSQL = class MemoryLibSQL extends MemoryStorage {
|
|
|
7355
7389
|
}, error);
|
|
7356
7390
|
this.logger?.trackException?.(mastraError);
|
|
7357
7391
|
this.logger?.error?.(mastraError.toString());
|
|
7358
|
-
|
|
7359
|
-
threads: [],
|
|
7360
|
-
total: 0,
|
|
7361
|
-
page,
|
|
7362
|
-
perPage: perPageForResponse,
|
|
7363
|
-
hasMore: false
|
|
7364
|
-
};
|
|
7392
|
+
throw mastraError;
|
|
7365
7393
|
}
|
|
7366
7394
|
}
|
|
7367
7395
|
async saveThread({ thread }) {
|