@mastra/libsql 1.1.0-alpha.0 → 1.1.0-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/CHANGELOG.md +25 -0
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +67 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -51
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 1.1.0-alpha.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Restructured stored agents to use a thin metadata record with versioned configuration snapshots. ([#12488](https://github.com/mastra-ai/mastra/pull/12488))
|
|
8
|
+
|
|
9
|
+
The agent record now only stores metadata fields (id, status, activeVersionId, authorId, metadata, timestamps). All configuration fields (name, instructions, model, tools, etc.) live exclusively in version snapshot rows, enabling full version history and rollback.
|
|
10
|
+
|
|
11
|
+
**Key changes:**
|
|
12
|
+
- Stored Agent records are now thin metadata-only (StorageAgentType)
|
|
13
|
+
- All config lives in version snapshots (StorageAgentSnapshotType)
|
|
14
|
+
- New resolved type (StorageResolvedAgentType) merges agent record + active version config
|
|
15
|
+
- Renamed `ownerId` to `authorId` for multi-tenant filtering
|
|
16
|
+
- Changed `memory` field type from `string` to `Record<string, unknown>`
|
|
17
|
+
- Added `status` field ('draft' | 'published') to agent records
|
|
18
|
+
- Flattened CreateAgent/UpdateAgent input types (config fields at top level, no nested snapshot)
|
|
19
|
+
- Version config columns are top-level in the agent_versions table (no single snapshot jsonb column)
|
|
20
|
+
- List endpoints return resolved agents (thin record + active version config)
|
|
21
|
+
- Auto-versioning on update with retention limits and race condition handling
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`b99ceac`](https://github.com/mastra-ai/mastra/commit/b99ceace2c830dbdef47c8692d56a91954aefea2), [`deea43e`](https://github.com/mastra-ai/mastra/commit/deea43eb1366d03a864c5e597d16a48592b9893f), [`ac9ec66`](https://github.com/mastra-ai/mastra/commit/ac9ec6672779b2e6d4344e415481d1a6a7d4911a)]:
|
|
26
|
+
- @mastra/core@1.1.0-alpha.1
|
|
27
|
+
|
|
3
28
|
## 1.1.0-alpha.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2083,21 +2083,9 @@ var AgentsLibSQL = class extends storage.AgentsStorage {
|
|
|
2083
2083
|
parseRow(row) {
|
|
2084
2084
|
return {
|
|
2085
2085
|
id: row.id,
|
|
2086
|
-
|
|
2087
|
-
description: row.description,
|
|
2088
|
-
instructions: row.instructions,
|
|
2089
|
-
model: this.parseJson(row.model, "model"),
|
|
2090
|
-
tools: this.parseJson(row.tools, "tools"),
|
|
2091
|
-
defaultOptions: this.parseJson(row.defaultOptions, "defaultOptions"),
|
|
2092
|
-
workflows: this.parseJson(row.workflows, "workflows"),
|
|
2093
|
-
agents: this.parseJson(row.agents, "agents"),
|
|
2094
|
-
inputProcessors: this.parseJson(row.inputProcessors, "inputProcessors"),
|
|
2095
|
-
outputProcessors: this.parseJson(row.outputProcessors, "outputProcessors"),
|
|
2096
|
-
memory: this.parseJson(row.memory, "memory"),
|
|
2097
|
-
scorers: this.parseJson(row.scorers, "scorers"),
|
|
2098
|
-
integrationTools: this.parseJson(row.integrationTools, "integrationTools"),
|
|
2099
|
-
ownerId: row.ownerId,
|
|
2086
|
+
status: row.status,
|
|
2100
2087
|
activeVersionId: row.activeVersionId,
|
|
2088
|
+
authorId: row.authorId,
|
|
2101
2089
|
metadata: this.parseJson(row.metadata, "metadata"),
|
|
2102
2090
|
createdAt: new Date(row.createdAt),
|
|
2103
2091
|
updatedAt: new Date(row.updatedAt)
|
|
@@ -2129,32 +2117,48 @@ var AgentsLibSQL = class extends storage.AgentsStorage {
|
|
|
2129
2117
|
tableName: storage.TABLE_AGENTS,
|
|
2130
2118
|
record: {
|
|
2131
2119
|
id: agent.id,
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
model: agent.model,
|
|
2136
|
-
tools: agent.tools ?? null,
|
|
2137
|
-
defaultOptions: agent.defaultOptions ?? null,
|
|
2138
|
-
workflows: agent.workflows ?? null,
|
|
2139
|
-
agents: agent.agents ?? null,
|
|
2140
|
-
inputProcessors: agent.inputProcessors ?? null,
|
|
2141
|
-
outputProcessors: agent.outputProcessors ?? null,
|
|
2142
|
-
memory: agent.memory ?? null,
|
|
2143
|
-
scorers: agent.scorers ?? null,
|
|
2144
|
-
integrationTools: agent.integrationTools ?? null,
|
|
2145
|
-
ownerId: agent.ownerId ?? null,
|
|
2146
|
-
activeVersionId: agent.activeVersionId ?? null,
|
|
2120
|
+
status: "draft",
|
|
2121
|
+
activeVersionId: null,
|
|
2122
|
+
authorId: agent.authorId ?? null,
|
|
2147
2123
|
metadata: agent.metadata ?? null,
|
|
2148
2124
|
createdAt: now,
|
|
2149
2125
|
updatedAt: now
|
|
2150
2126
|
}
|
|
2151
2127
|
});
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2128
|
+
const { id: _id, authorId: _authorId, metadata: _metadata, ...snapshotConfig } = agent;
|
|
2129
|
+
const versionId = crypto.randomUUID();
|
|
2130
|
+
await this.createVersion({
|
|
2131
|
+
id: versionId,
|
|
2132
|
+
agentId: agent.id,
|
|
2133
|
+
versionNumber: 1,
|
|
2134
|
+
...snapshotConfig,
|
|
2135
|
+
changedFields: Object.keys(snapshotConfig),
|
|
2136
|
+
changeMessage: "Initial version"
|
|
2137
|
+
});
|
|
2138
|
+
await this.#db.update({
|
|
2139
|
+
tableName: storage.TABLE_AGENTS,
|
|
2140
|
+
keys: { id: agent.id },
|
|
2141
|
+
data: {
|
|
2142
|
+
activeVersionId: versionId,
|
|
2143
|
+
status: "published",
|
|
2144
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
const created = await this.getAgentById({ id: agent.id });
|
|
2148
|
+
if (!created) {
|
|
2149
|
+
throw new error.MastraError({
|
|
2150
|
+
id: storage.createStorageErrorId("LIBSQL", "CREATE_AGENT", "NOT_FOUND_AFTER_CREATE"),
|
|
2151
|
+
domain: error.ErrorDomain.STORAGE,
|
|
2152
|
+
category: error.ErrorCategory.SYSTEM,
|
|
2153
|
+
text: `Agent ${agent.id} not found after creation`,
|
|
2154
|
+
details: { agentId: agent.id }
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
return created;
|
|
2157
2158
|
} catch (error$1) {
|
|
2159
|
+
if (error$1 instanceof error.MastraError) {
|
|
2160
|
+
throw error$1;
|
|
2161
|
+
}
|
|
2158
2162
|
throw new error.MastraError(
|
|
2159
2163
|
{
|
|
2160
2164
|
id: storage.createStorageErrorId("LIBSQL", "CREATE_AGENT", "FAILED"),
|
|
@@ -2181,21 +2185,11 @@ var AgentsLibSQL = class extends storage.AgentsStorage {
|
|
|
2181
2185
|
const data = {
|
|
2182
2186
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2183
2187
|
};
|
|
2184
|
-
if (updates.
|
|
2185
|
-
if (updates.
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
if (updates.defaultOptions !== void 0) data.defaultOptions = updates.defaultOptions;
|
|
2190
|
-
if (updates.workflows !== void 0) data.workflows = updates.workflows;
|
|
2191
|
-
if (updates.agents !== void 0) data.agents = updates.agents;
|
|
2192
|
-
if (updates.inputProcessors !== void 0) data.inputProcessors = updates.inputProcessors;
|
|
2193
|
-
if (updates.outputProcessors !== void 0) data.outputProcessors = updates.outputProcessors;
|
|
2194
|
-
if (updates.memory !== void 0) data.memory = updates.memory;
|
|
2195
|
-
if (updates.scorers !== void 0) data.scorers = updates.scorers;
|
|
2196
|
-
if (updates.integrationTools !== void 0) data.integrationTools = updates.integrationTools;
|
|
2197
|
-
if (updates.ownerId !== void 0) data.ownerId = updates.ownerId;
|
|
2198
|
-
if (updates.activeVersionId !== void 0) data.activeVersionId = updates.activeVersionId;
|
|
2188
|
+
if (updates.authorId !== void 0) data.authorId = updates.authorId;
|
|
2189
|
+
if (updates.activeVersionId !== void 0) {
|
|
2190
|
+
data.activeVersionId = updates.activeVersionId;
|
|
2191
|
+
data.status = "published";
|
|
2192
|
+
}
|
|
2199
2193
|
if (updates.metadata !== void 0) {
|
|
2200
2194
|
data.metadata = { ...existingAgent.metadata, ...updates.metadata };
|
|
2201
2195
|
}
|
|
@@ -2317,7 +2311,18 @@ var AgentsLibSQL = class extends storage.AgentsStorage {
|
|
|
2317
2311
|
agentId: input.agentId,
|
|
2318
2312
|
versionNumber: input.versionNumber,
|
|
2319
2313
|
name: input.name ?? null,
|
|
2320
|
-
|
|
2314
|
+
description: input.description ?? null,
|
|
2315
|
+
instructions: input.instructions,
|
|
2316
|
+
model: input.model,
|
|
2317
|
+
tools: input.tools ?? null,
|
|
2318
|
+
defaultOptions: input.defaultOptions ?? null,
|
|
2319
|
+
workflows: input.workflows ?? null,
|
|
2320
|
+
agents: input.agents ?? null,
|
|
2321
|
+
integrationTools: input.integrationTools ?? null,
|
|
2322
|
+
inputProcessors: input.inputProcessors ?? null,
|
|
2323
|
+
outputProcessors: input.outputProcessors ?? null,
|
|
2324
|
+
memory: input.memory ?? null,
|
|
2325
|
+
scorers: input.scorers ?? null,
|
|
2321
2326
|
changedFields: input.changedFields ?? null,
|
|
2322
2327
|
changeMessage: input.changeMessage ?? null,
|
|
2323
2328
|
createdAt: now
|
|
@@ -2554,7 +2559,18 @@ var AgentsLibSQL = class extends storage.AgentsStorage {
|
|
|
2554
2559
|
agentId: row.agentId,
|
|
2555
2560
|
versionNumber: row.versionNumber,
|
|
2556
2561
|
name: row.name,
|
|
2557
|
-
|
|
2562
|
+
description: row.description,
|
|
2563
|
+
instructions: row.instructions,
|
|
2564
|
+
model: this.parseJson(row.model, "model"),
|
|
2565
|
+
tools: this.parseJson(row.tools, "tools"),
|
|
2566
|
+
defaultOptions: this.parseJson(row.defaultOptions, "defaultOptions"),
|
|
2567
|
+
workflows: this.parseJson(row.workflows, "workflows"),
|
|
2568
|
+
agents: this.parseJson(row.agents, "agents"),
|
|
2569
|
+
integrationTools: this.parseJson(row.integrationTools, "integrationTools"),
|
|
2570
|
+
inputProcessors: this.parseJson(row.inputProcessors, "inputProcessors"),
|
|
2571
|
+
outputProcessors: this.parseJson(row.outputProcessors, "outputProcessors"),
|
|
2572
|
+
memory: this.parseJson(row.memory, "memory"),
|
|
2573
|
+
scorers: this.parseJson(row.scorers, "scorers"),
|
|
2558
2574
|
changedFields: this.parseJson(row.changedFields, "changedFields"),
|
|
2559
2575
|
changeMessage: row.changeMessage,
|
|
2560
2576
|
createdAt: new Date(row.createdAt)
|