@mastra/libsql 1.4.0 → 1.5.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 +288 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +1523 -484
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1522 -486
- package/dist/index.js.map +1 -1
- package/dist/storage/db/utils.d.ts.map +1 -1
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/blobs/index.d.ts +17 -0
- package/dist/storage/domains/blobs/index.d.ts.map +1 -0
- package/dist/storage/domains/datasets/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/index.d.ts +26 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/index.d.ts +26 -0
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +4 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,293 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added workspace and skill storage domains with full CRUD, versioning, and implementations across LibSQL, Postgres, and MongoDB. Added `editor.workspace` and `editor.skill` namespaces for managing workspace configurations and skill definitions through the editor. Agents stored in the editor can now reference workspaces (by ID or inline config) and skills, with full hydration to runtime `Workspace` instances during agent resolution. ([#13156](https://github.com/mastra-ai/mastra/pull/13156))
|
|
8
|
+
|
|
9
|
+
**Filesystem-native skill versioning (draft → publish model):**
|
|
10
|
+
|
|
11
|
+
Skills are versioned as filesystem trees with content-addressable blob storage. The editing surface (live filesystem) is separated from the serving surface (versioned blob store), enabling a `draft → publish` workflow:
|
|
12
|
+
- `editor.skill.publish(skillId, source, skillPath)` — Snapshots a skill directory from the filesystem into blob storage, creates a new version with a tree manifest, and sets `activeVersionId`
|
|
13
|
+
- Version switching via `editor.skill.update({ id, activeVersionId })` — Points the skill to a previous version without re-publishing
|
|
14
|
+
- Publishing a skill automatically invalidates cached agents that reference it, so they re-hydrate with the updated version on next access
|
|
15
|
+
|
|
16
|
+
**Agent skill resolution strategies:**
|
|
17
|
+
|
|
18
|
+
Agents can reference skills with different resolution strategies:
|
|
19
|
+
- `strategy: 'latest'` — Resolves the skill's active version (honors `activeVersionId` for rollback)
|
|
20
|
+
- `pin: '<versionId>'` — Pins to a specific version, immune to publishes
|
|
21
|
+
- `strategy: 'live'` — Reads directly from the live filesystem (no blob store)
|
|
22
|
+
|
|
23
|
+
**Blob storage infrastructure:**
|
|
24
|
+
- `BlobStore` abstract class for content-addressable storage keyed by SHA-256 hash
|
|
25
|
+
- `InMemoryBlobStore` for testing
|
|
26
|
+
- LibSQL, Postgres, and MongoDB implementations
|
|
27
|
+
- `S3BlobStore` for storing blobs in S3 or S3-compatible storage (AWS, R2, MinIO, DO Spaces)
|
|
28
|
+
- `BlobStoreProvider` interface and `MastraEditorConfig.blobStores` registry for pluggable blob storage
|
|
29
|
+
- `VersionedSkillSource` and `CompositeVersionedSkillSource` for reading skill files from the blob store at runtime
|
|
30
|
+
|
|
31
|
+
**New storage types:**
|
|
32
|
+
- `StorageWorkspaceSnapshotType` and `StorageSkillSnapshotType` with corresponding input/output types
|
|
33
|
+
- `StorageWorkspaceRef` for ID-based or inline workspace references on agents
|
|
34
|
+
- `StorageSkillConfig` for per-agent skill overrides (`pin`, `strategy`, description, instructions)
|
|
35
|
+
- `SkillVersionTree` and `SkillVersionTreeEntry` for tree manifests
|
|
36
|
+
- `StorageBlobEntry` for content-addressable blob entries
|
|
37
|
+
- `SKILL_BLOBS_SCHEMA` for the `mastra_skill_blobs` table
|
|
38
|
+
|
|
39
|
+
**New editor namespaces:**
|
|
40
|
+
- `editor.workspace` — CRUD for workspace configs, plus `hydrateSnapshotToWorkspace()` for resolving to runtime `Workspace` instances
|
|
41
|
+
- `editor.skill` — CRUD for skill definitions, plus `publish()` for filesystem-to-blob snapshots
|
|
42
|
+
|
|
43
|
+
**Provider registries:**
|
|
44
|
+
- `MastraEditorConfig` accepts `filesystems`, `sandboxes`, and `blobStores` provider registries (keyed by provider ID)
|
|
45
|
+
- Built-in `local` filesystem and sandbox providers are auto-registered
|
|
46
|
+
- `editor.resolveBlobStore()` resolves from provider registry or falls back to the storage backend's blobs domain
|
|
47
|
+
- Providers expose `id`, `name`, `description`, `configSchema` (JSON Schema for UI form rendering), and a factory method
|
|
48
|
+
|
|
49
|
+
**Storage adapter support:**
|
|
50
|
+
- LibSQL: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
51
|
+
- Postgres: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
52
|
+
- MongoDB: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
53
|
+
- All three include `workspace`, `skills`, and `skillsFormat` fields on agent versions
|
|
54
|
+
|
|
55
|
+
**Server endpoints:**
|
|
56
|
+
- `GET/POST/PATCH/DELETE /stored/workspaces` — CRUD for stored workspaces
|
|
57
|
+
- `GET/POST/PATCH/DELETE /stored/skills` — CRUD for stored skills
|
|
58
|
+
- `POST /stored/skills/:id/publish` — Publish a skill from a filesystem source
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { MastraEditor } from '@mastra/editor';
|
|
62
|
+
import { s3FilesystemProvider, s3BlobStoreProvider } from '@mastra/s3';
|
|
63
|
+
import { e2bSandboxProvider } from '@mastra/e2b';
|
|
64
|
+
|
|
65
|
+
const editor = new MastraEditor({
|
|
66
|
+
filesystems: { s3: s3FilesystemProvider },
|
|
67
|
+
sandboxes: { e2b: e2bSandboxProvider },
|
|
68
|
+
blobStores: { s3: s3BlobStoreProvider },
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Create a skill and publish it
|
|
72
|
+
const skill = await editor.skill.create({
|
|
73
|
+
name: 'Code Review',
|
|
74
|
+
description: 'Reviews code for best practices',
|
|
75
|
+
instructions: 'Analyze the code and provide feedback...',
|
|
76
|
+
});
|
|
77
|
+
await editor.skill.publish(skill.id, source, 'skills/code-review');
|
|
78
|
+
|
|
79
|
+
// Agents resolve skills by strategy
|
|
80
|
+
await editor.agent.create({
|
|
81
|
+
name: 'Dev Assistant',
|
|
82
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
83
|
+
workspace: { type: 'id', workspaceId: workspace.id },
|
|
84
|
+
skills: { [skill.id]: { strategy: 'latest' } },
|
|
85
|
+
skillsFormat: 'xml',
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- Added draft/publish version management for all editor primitives (agents, scorers, MCP clients, prompt blocks). ([#13061](https://github.com/mastra-ai/mastra/pull/13061))
|
|
90
|
+
|
|
91
|
+
**Status filtering on list endpoints** — All list endpoints now accept a `?status=draft|published|archived` query parameter to filter by entity status. Defaults to `published` to preserve backward compatibility.
|
|
92
|
+
|
|
93
|
+
**Draft vs published resolution on get-by-id endpoints** — All get-by-id endpoints now accept `?status=draft` to resolve the entity with its latest (unpublished) version, or `?status=published` (default) to resolve with the active published version.
|
|
94
|
+
|
|
95
|
+
**Edits no longer auto-publish** — When updating any primitive, a new version is created but `activeVersionId` is no longer automatically updated. Edits stay as drafts until explicitly published via the activate endpoint.
|
|
96
|
+
|
|
97
|
+
**Full version management for all primitives** — Scorers, MCP clients, and prompt blocks now have the same version management API that agents have: list versions, create version snapshots, get specific versions, activate/publish, restore from a previous version, delete versions, and compare versions.
|
|
98
|
+
|
|
99
|
+
**New prompt block CRUD routes** — Prompt blocks now have full server routes (`GET /stored/prompt-blocks`, `GET /stored/prompt-blocks/:id`, `POST`, `PATCH`, `DELETE`).
|
|
100
|
+
|
|
101
|
+
**New version endpoints** — Each primitive now exposes 7 version management endpoints under `/stored/{type}/:id/versions` (list, create, get, activate, restore, delete, compare).
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
// Fetch the published version (default behavior, backward compatible)
|
|
105
|
+
const published = await fetch('/api/stored/scorers/my-scorer');
|
|
106
|
+
|
|
107
|
+
// Fetch the draft version for editing in the UI
|
|
108
|
+
const draft = await fetch('/api/stored/scorers/my-scorer?status=draft');
|
|
109
|
+
|
|
110
|
+
// Publish a specific version
|
|
111
|
+
await fetch('/api/stored/scorers/my-scorer/versions/abc123/activate', { method: 'POST' });
|
|
112
|
+
|
|
113
|
+
// Compare two versions
|
|
114
|
+
const diff = await fetch('/api/stored/scorers/my-scorer/versions/compare?from=v1&to=v2');
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Dataset schemas now appear in the Edit Dataset dialog. Previously the `inputSchema` and `groundTruthSchema` fields were not passed to the dialog, so editing a dataset always showed empty schemas. ([#13175](https://github.com/mastra-ai/mastra/pull/13175))
|
|
120
|
+
|
|
121
|
+
Schema edits in the JSON editor no longer cause the cursor to jump to the top of the field. Typing `{"type": "object"}` in the schema editor now behaves like a normal text input instead of resetting on every keystroke.
|
|
122
|
+
|
|
123
|
+
Validation errors are now surfaced when updating a dataset schema that conflicts with existing items. For example, adding a `required: ["name"]` constraint when existing items lack a `name` field now shows "2 existing item(s) fail validation" in the dialog instead of silently dropping the error.
|
|
124
|
+
|
|
125
|
+
Disabling a dataset schema from the Studio UI now correctly clears it. Previously the server converted `null` (disable) to `undefined` (no change), so the old schema persisted and validation continued.
|
|
126
|
+
|
|
127
|
+
Workflow schemas fetched via `client.getWorkflow().getSchema()` are now correctly parsed. The server serializes schemas with `superjson`, but the client was using plain `JSON.parse`, yielding a `{json: {...}}` wrapper instead of the actual JSON Schema object.
|
|
128
|
+
|
|
129
|
+
- CMS draft support with status badges for agents. ([#13194](https://github.com/mastra-ai/mastra/pull/13194))
|
|
130
|
+
- Agent list now resolves the latest (draft) version for each stored agent, showing current edits rather than the last published state.
|
|
131
|
+
- Added `hasDraft` and `activeVersionId` fields to the agent list API response.
|
|
132
|
+
- Agent list badges: "Published" (green) when a published version exists, "Draft" (colored when unpublished changes exist, grayed out otherwise).
|
|
133
|
+
- Added `resolvedVersionId` to all `StorageResolved*Type` types so the server can detect whether the latest version differs from the active version.
|
|
134
|
+
- Added `status` option to `GetByIdOptions` to allow resolving draft vs published versions through the editor layer.
|
|
135
|
+
- Fixed editor cache not being cleared on version activate, restore, and delete — all four versioned domains (agents, scorers, prompt-blocks, mcp-clients) now clear the cache after version mutations.
|
|
136
|
+
- Added `ALTER TABLE` migration for `mastra_agent_versions` in libsql and pg to add newer columns (`mcpClients`, `requestContextSchema`, `workspace`, `skills`, `skillsFormat`).
|
|
137
|
+
|
|
138
|
+
- Added scorer version management and CMS draft/publish flow for scorers. ([#13194](https://github.com/mastra-ai/mastra/pull/13194))
|
|
139
|
+
- Added scorer version methods to the client SDK: `listVersions`, `createVersion`, `getVersion`, `activateVersion`, `restoreVersion`, `deleteVersion`, `compareVersions`.
|
|
140
|
+
- Added `ScorerVersionCombobox` for navigating scorer versions with Published/Draft labels.
|
|
141
|
+
- Scorer edit page now supports Save (draft) and Publish workflows with an "Unpublished changes" indicator.
|
|
142
|
+
- Storage list methods for agents and scorers no longer default to filtering only published entities, allowing drafts to appear in the playground.
|
|
143
|
+
|
|
144
|
+
- Updated dependencies [[`252580a`](https://github.com/mastra-ai/mastra/commit/252580a71feb0e46d0ccab04a70a79ff6a2ee0ab), [`f8e819f`](https://github.com/mastra-ai/mastra/commit/f8e819fabdfdc43d2da546a3ad81ba23685f603d), [`5c75261`](https://github.com/mastra-ai/mastra/commit/5c7526120d936757d4ffb7b82232e1641ebd45cb), [`e27d832`](https://github.com/mastra-ai/mastra/commit/e27d83281b5e166fd63a13969689e928d8605944), [`e37ef84`](https://github.com/mastra-ai/mastra/commit/e37ef8404043c94ca0c8e35ecdedb093b8087878), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`10cf521`](https://github.com/mastra-ai/mastra/commit/10cf52183344743a0d7babe24cd24fd78870c354), [`efdb682`](https://github.com/mastra-ai/mastra/commit/efdb682887f6522149769383908f9790c188ab88), [`0dee7a0`](https://github.com/mastra-ai/mastra/commit/0dee7a0ff4c2507e6eb6e6ee5f9738877ebd4ad1), [`04c2c8e`](https://github.com/mastra-ai/mastra/commit/04c2c8e888984364194131aecb490a3d6e920e61), [`02dc07a`](https://github.com/mastra-ai/mastra/commit/02dc07acc4ad42d93335825e3308f5b42266eba2), [`bb7262b`](https://github.com/mastra-ai/mastra/commit/bb7262b7c0ca76320d985b40510b6ffbbb936582), [`cf1c6e7`](https://github.com/mastra-ai/mastra/commit/cf1c6e789b131f55638fed52183a89d5078b4876), [`5ffadfe`](https://github.com/mastra-ai/mastra/commit/5ffadfefb1468ac2612b20bb84d24c39de6961c0), [`1e1339c`](https://github.com/mastra-ai/mastra/commit/1e1339cc276e571a48cfff5014487877086bfe68), [`d03df73`](https://github.com/mastra-ai/mastra/commit/d03df73f8fe9496064a33e1c3b74ba0479bf9ee6), [`79b8f45`](https://github.com/mastra-ai/mastra/commit/79b8f45a6767e1a5c3d56cd3c5b1214326b81661), [`9bbf08e`](https://github.com/mastra-ai/mastra/commit/9bbf08e3c20731c79dea13a765895b9fcf29cbf1), [`0a25952`](https://github.com/mastra-ai/mastra/commit/0a259526b5e1ac11e6efa53db1f140272962af2d), [`ffa5468`](https://github.com/mastra-ai/mastra/commit/ffa546857fc4821753979b3a34e13b4d76fbbcd4), [`3264a04`](https://github.com/mastra-ai/mastra/commit/3264a04e30340c3c5447433300a035ea0878df85), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`088d9ba`](https://github.com/mastra-ai/mastra/commit/088d9ba2577518703c52b0dccd617178d9ee6b0d), [`74fbebd`](https://github.com/mastra-ai/mastra/commit/74fbebd918a03832a2864965a8bea59bf617d3a2), [`aea6217`](https://github.com/mastra-ai/mastra/commit/aea621790bfb2291431b08da0cc5e6e150303ae7), [`b6a855e`](https://github.com/mastra-ai/mastra/commit/b6a855edc056e088279075506442ba1d6fa6def9), [`ae408ea`](https://github.com/mastra-ai/mastra/commit/ae408ea7128f0d2710b78d8623185198e7cb19c1), [`17e942e`](https://github.com/mastra-ai/mastra/commit/17e942eee2ba44985b1f807e6208cdde672f82f9), [`2015cf9`](https://github.com/mastra-ai/mastra/commit/2015cf921649f44c3f5bcd32a2c052335f8e49b4), [`7ef454e`](https://github.com/mastra-ai/mastra/commit/7ef454eaf9dcec6de60021c8f42192052dd490d6), [`2be1d99`](https://github.com/mastra-ai/mastra/commit/2be1d99564ce79acc4846071082bff353035a87a), [`2708fa1`](https://github.com/mastra-ai/mastra/commit/2708fa1055ac91c03e08b598869f6b8fb51fa37f), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ec53e89`](https://github.com/mastra-ai/mastra/commit/ec53e8939c76c638991e21af762e51378eff7543), [`9b5a8cb`](https://github.com/mastra-ai/mastra/commit/9b5a8cb13e120811b0bf14140ada314f1c067894), [`607e66b`](https://github.com/mastra-ai/mastra/commit/607e66b02dc7f531ee37799f3456aa2dc0ca7ac5), [`a215d06`](https://github.com/mastra-ai/mastra/commit/a215d06758dcf590eabfe0b7afd4ae39bdbf082c), [`6909c74`](https://github.com/mastra-ai/mastra/commit/6909c74a7781e0447d475e9dbc1dc871b700f426), [`192438f`](https://github.com/mastra-ai/mastra/commit/192438f8a90c4f375e955f8ff179bf8dc6821a83)]:
|
|
145
|
+
- @mastra/core@1.5.0
|
|
146
|
+
|
|
147
|
+
## 1.5.0-alpha.0
|
|
148
|
+
|
|
149
|
+
### Minor Changes
|
|
150
|
+
|
|
151
|
+
- Added workspace and skill storage domains with full CRUD, versioning, and implementations across LibSQL, Postgres, and MongoDB. Added `editor.workspace` and `editor.skill` namespaces for managing workspace configurations and skill definitions through the editor. Agents stored in the editor can now reference workspaces (by ID or inline config) and skills, with full hydration to runtime `Workspace` instances during agent resolution. ([#13156](https://github.com/mastra-ai/mastra/pull/13156))
|
|
152
|
+
|
|
153
|
+
**Filesystem-native skill versioning (draft → publish model):**
|
|
154
|
+
|
|
155
|
+
Skills are versioned as filesystem trees with content-addressable blob storage. The editing surface (live filesystem) is separated from the serving surface (versioned blob store), enabling a `draft → publish` workflow:
|
|
156
|
+
- `editor.skill.publish(skillId, source, skillPath)` — Snapshots a skill directory from the filesystem into blob storage, creates a new version with a tree manifest, and sets `activeVersionId`
|
|
157
|
+
- Version switching via `editor.skill.update({ id, activeVersionId })` — Points the skill to a previous version without re-publishing
|
|
158
|
+
- Publishing a skill automatically invalidates cached agents that reference it, so they re-hydrate with the updated version on next access
|
|
159
|
+
|
|
160
|
+
**Agent skill resolution strategies:**
|
|
161
|
+
|
|
162
|
+
Agents can reference skills with different resolution strategies:
|
|
163
|
+
- `strategy: 'latest'` — Resolves the skill's active version (honors `activeVersionId` for rollback)
|
|
164
|
+
- `pin: '<versionId>'` — Pins to a specific version, immune to publishes
|
|
165
|
+
- `strategy: 'live'` — Reads directly from the live filesystem (no blob store)
|
|
166
|
+
|
|
167
|
+
**Blob storage infrastructure:**
|
|
168
|
+
- `BlobStore` abstract class for content-addressable storage keyed by SHA-256 hash
|
|
169
|
+
- `InMemoryBlobStore` for testing
|
|
170
|
+
- LibSQL, Postgres, and MongoDB implementations
|
|
171
|
+
- `S3BlobStore` for storing blobs in S3 or S3-compatible storage (AWS, R2, MinIO, DO Spaces)
|
|
172
|
+
- `BlobStoreProvider` interface and `MastraEditorConfig.blobStores` registry for pluggable blob storage
|
|
173
|
+
- `VersionedSkillSource` and `CompositeVersionedSkillSource` for reading skill files from the blob store at runtime
|
|
174
|
+
|
|
175
|
+
**New storage types:**
|
|
176
|
+
- `StorageWorkspaceSnapshotType` and `StorageSkillSnapshotType` with corresponding input/output types
|
|
177
|
+
- `StorageWorkspaceRef` for ID-based or inline workspace references on agents
|
|
178
|
+
- `StorageSkillConfig` for per-agent skill overrides (`pin`, `strategy`, description, instructions)
|
|
179
|
+
- `SkillVersionTree` and `SkillVersionTreeEntry` for tree manifests
|
|
180
|
+
- `StorageBlobEntry` for content-addressable blob entries
|
|
181
|
+
- `SKILL_BLOBS_SCHEMA` for the `mastra_skill_blobs` table
|
|
182
|
+
|
|
183
|
+
**New editor namespaces:**
|
|
184
|
+
- `editor.workspace` — CRUD for workspace configs, plus `hydrateSnapshotToWorkspace()` for resolving to runtime `Workspace` instances
|
|
185
|
+
- `editor.skill` — CRUD for skill definitions, plus `publish()` for filesystem-to-blob snapshots
|
|
186
|
+
|
|
187
|
+
**Provider registries:**
|
|
188
|
+
- `MastraEditorConfig` accepts `filesystems`, `sandboxes`, and `blobStores` provider registries (keyed by provider ID)
|
|
189
|
+
- Built-in `local` filesystem and sandbox providers are auto-registered
|
|
190
|
+
- `editor.resolveBlobStore()` resolves from provider registry or falls back to the storage backend's blobs domain
|
|
191
|
+
- Providers expose `id`, `name`, `description`, `configSchema` (JSON Schema for UI form rendering), and a factory method
|
|
192
|
+
|
|
193
|
+
**Storage adapter support:**
|
|
194
|
+
- LibSQL: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
195
|
+
- Postgres: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
196
|
+
- MongoDB: Full `workspaces`, `skills`, and `blobs` domain implementations
|
|
197
|
+
- All three include `workspace`, `skills`, and `skillsFormat` fields on agent versions
|
|
198
|
+
|
|
199
|
+
**Server endpoints:**
|
|
200
|
+
- `GET/POST/PATCH/DELETE /stored/workspaces` — CRUD for stored workspaces
|
|
201
|
+
- `GET/POST/PATCH/DELETE /stored/skills` — CRUD for stored skills
|
|
202
|
+
- `POST /stored/skills/:id/publish` — Publish a skill from a filesystem source
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
import { MastraEditor } from '@mastra/editor';
|
|
206
|
+
import { s3FilesystemProvider, s3BlobStoreProvider } from '@mastra/s3';
|
|
207
|
+
import { e2bSandboxProvider } from '@mastra/e2b';
|
|
208
|
+
|
|
209
|
+
const editor = new MastraEditor({
|
|
210
|
+
filesystems: { s3: s3FilesystemProvider },
|
|
211
|
+
sandboxes: { e2b: e2bSandboxProvider },
|
|
212
|
+
blobStores: { s3: s3BlobStoreProvider },
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Create a skill and publish it
|
|
216
|
+
const skill = await editor.skill.create({
|
|
217
|
+
name: 'Code Review',
|
|
218
|
+
description: 'Reviews code for best practices',
|
|
219
|
+
instructions: 'Analyze the code and provide feedback...',
|
|
220
|
+
});
|
|
221
|
+
await editor.skill.publish(skill.id, source, 'skills/code-review');
|
|
222
|
+
|
|
223
|
+
// Agents resolve skills by strategy
|
|
224
|
+
await editor.agent.create({
|
|
225
|
+
name: 'Dev Assistant',
|
|
226
|
+
model: { provider: 'openai', name: 'gpt-4' },
|
|
227
|
+
workspace: { type: 'id', workspaceId: workspace.id },
|
|
228
|
+
skills: { [skill.id]: { strategy: 'latest' } },
|
|
229
|
+
skillsFormat: 'xml',
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- Added draft/publish version management for all editor primitives (agents, scorers, MCP clients, prompt blocks). ([#13061](https://github.com/mastra-ai/mastra/pull/13061))
|
|
234
|
+
|
|
235
|
+
**Status filtering on list endpoints** — All list endpoints now accept a `?status=draft|published|archived` query parameter to filter by entity status. Defaults to `published` to preserve backward compatibility.
|
|
236
|
+
|
|
237
|
+
**Draft vs published resolution on get-by-id endpoints** — All get-by-id endpoints now accept `?status=draft` to resolve the entity with its latest (unpublished) version, or `?status=published` (default) to resolve with the active published version.
|
|
238
|
+
|
|
239
|
+
**Edits no longer auto-publish** — When updating any primitive, a new version is created but `activeVersionId` is no longer automatically updated. Edits stay as drafts until explicitly published via the activate endpoint.
|
|
240
|
+
|
|
241
|
+
**Full version management for all primitives** — Scorers, MCP clients, and prompt blocks now have the same version management API that agents have: list versions, create version snapshots, get specific versions, activate/publish, restore from a previous version, delete versions, and compare versions.
|
|
242
|
+
|
|
243
|
+
**New prompt block CRUD routes** — Prompt blocks now have full server routes (`GET /stored/prompt-blocks`, `GET /stored/prompt-blocks/:id`, `POST`, `PATCH`, `DELETE`).
|
|
244
|
+
|
|
245
|
+
**New version endpoints** — Each primitive now exposes 7 version management endpoints under `/stored/{type}/:id/versions` (list, create, get, activate, restore, delete, compare).
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
// Fetch the published version (default behavior, backward compatible)
|
|
249
|
+
const published = await fetch('/api/stored/scorers/my-scorer');
|
|
250
|
+
|
|
251
|
+
// Fetch the draft version for editing in the UI
|
|
252
|
+
const draft = await fetch('/api/stored/scorers/my-scorer?status=draft');
|
|
253
|
+
|
|
254
|
+
// Publish a specific version
|
|
255
|
+
await fetch('/api/stored/scorers/my-scorer/versions/abc123/activate', { method: 'POST' });
|
|
256
|
+
|
|
257
|
+
// Compare two versions
|
|
258
|
+
const diff = await fetch('/api/stored/scorers/my-scorer/versions/compare?from=v1&to=v2');
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Patch Changes
|
|
262
|
+
|
|
263
|
+
- Dataset schemas now appear in the Edit Dataset dialog. Previously the `inputSchema` and `groundTruthSchema` fields were not passed to the dialog, so editing a dataset always showed empty schemas. ([#13175](https://github.com/mastra-ai/mastra/pull/13175))
|
|
264
|
+
|
|
265
|
+
Schema edits in the JSON editor no longer cause the cursor to jump to the top of the field. Typing `{"type": "object"}` in the schema editor now behaves like a normal text input instead of resetting on every keystroke.
|
|
266
|
+
|
|
267
|
+
Validation errors are now surfaced when updating a dataset schema that conflicts with existing items. For example, adding a `required: ["name"]` constraint when existing items lack a `name` field now shows "2 existing item(s) fail validation" in the dialog instead of silently dropping the error.
|
|
268
|
+
|
|
269
|
+
Disabling a dataset schema from the Studio UI now correctly clears it. Previously the server converted `null` (disable) to `undefined` (no change), so the old schema persisted and validation continued.
|
|
270
|
+
|
|
271
|
+
Workflow schemas fetched via `client.getWorkflow().getSchema()` are now correctly parsed. The server serializes schemas with `superjson`, but the client was using plain `JSON.parse`, yielding a `{json: {...}}` wrapper instead of the actual JSON Schema object.
|
|
272
|
+
|
|
273
|
+
- CMS draft support with status badges for agents. ([#13194](https://github.com/mastra-ai/mastra/pull/13194))
|
|
274
|
+
- Agent list now resolves the latest (draft) version for each stored agent, showing current edits rather than the last published state.
|
|
275
|
+
- Added `hasDraft` and `activeVersionId` fields to the agent list API response.
|
|
276
|
+
- Agent list badges: "Published" (green) when a published version exists, "Draft" (colored when unpublished changes exist, grayed out otherwise).
|
|
277
|
+
- Added `resolvedVersionId` to all `StorageResolved*Type` types so the server can detect whether the latest version differs from the active version.
|
|
278
|
+
- Added `status` option to `GetByIdOptions` to allow resolving draft vs published versions through the editor layer.
|
|
279
|
+
- Fixed editor cache not being cleared on version activate, restore, and delete — all four versioned domains (agents, scorers, prompt-blocks, mcp-clients) now clear the cache after version mutations.
|
|
280
|
+
- Added `ALTER TABLE` migration for `mastra_agent_versions` in libsql and pg to add newer columns (`mcpClients`, `requestContextSchema`, `workspace`, `skills`, `skillsFormat`).
|
|
281
|
+
|
|
282
|
+
- Added scorer version management and CMS draft/publish flow for scorers. ([#13194](https://github.com/mastra-ai/mastra/pull/13194))
|
|
283
|
+
- Added scorer version methods to the client SDK: `listVersions`, `createVersion`, `getVersion`, `activateVersion`, `restoreVersion`, `deleteVersion`, `compareVersions`.
|
|
284
|
+
- Added `ScorerVersionCombobox` for navigating scorer versions with Published/Draft labels.
|
|
285
|
+
- Scorer edit page now supports Save (draft) and Publish workflows with an "Unpublished changes" indicator.
|
|
286
|
+
- Storage list methods for agents and scorers no longer default to filtering only published entities, allowing drafts to appear in the playground.
|
|
287
|
+
|
|
288
|
+
- Updated dependencies [[`252580a`](https://github.com/mastra-ai/mastra/commit/252580a71feb0e46d0ccab04a70a79ff6a2ee0ab), [`f8e819f`](https://github.com/mastra-ai/mastra/commit/f8e819fabdfdc43d2da546a3ad81ba23685f603d), [`5c75261`](https://github.com/mastra-ai/mastra/commit/5c7526120d936757d4ffb7b82232e1641ebd45cb), [`e27d832`](https://github.com/mastra-ai/mastra/commit/e27d83281b5e166fd63a13969689e928d8605944), [`e37ef84`](https://github.com/mastra-ai/mastra/commit/e37ef8404043c94ca0c8e35ecdedb093b8087878), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`10cf521`](https://github.com/mastra-ai/mastra/commit/10cf52183344743a0d7babe24cd24fd78870c354), [`efdb682`](https://github.com/mastra-ai/mastra/commit/efdb682887f6522149769383908f9790c188ab88), [`0dee7a0`](https://github.com/mastra-ai/mastra/commit/0dee7a0ff4c2507e6eb6e6ee5f9738877ebd4ad1), [`04c2c8e`](https://github.com/mastra-ai/mastra/commit/04c2c8e888984364194131aecb490a3d6e920e61), [`02dc07a`](https://github.com/mastra-ai/mastra/commit/02dc07acc4ad42d93335825e3308f5b42266eba2), [`bb7262b`](https://github.com/mastra-ai/mastra/commit/bb7262b7c0ca76320d985b40510b6ffbbb936582), [`cf1c6e7`](https://github.com/mastra-ai/mastra/commit/cf1c6e789b131f55638fed52183a89d5078b4876), [`5ffadfe`](https://github.com/mastra-ai/mastra/commit/5ffadfefb1468ac2612b20bb84d24c39de6961c0), [`1e1339c`](https://github.com/mastra-ai/mastra/commit/1e1339cc276e571a48cfff5014487877086bfe68), [`d03df73`](https://github.com/mastra-ai/mastra/commit/d03df73f8fe9496064a33e1c3b74ba0479bf9ee6), [`79b8f45`](https://github.com/mastra-ai/mastra/commit/79b8f45a6767e1a5c3d56cd3c5b1214326b81661), [`9bbf08e`](https://github.com/mastra-ai/mastra/commit/9bbf08e3c20731c79dea13a765895b9fcf29cbf1), [`0a25952`](https://github.com/mastra-ai/mastra/commit/0a259526b5e1ac11e6efa53db1f140272962af2d), [`ffa5468`](https://github.com/mastra-ai/mastra/commit/ffa546857fc4821753979b3a34e13b4d76fbbcd4), [`3264a04`](https://github.com/mastra-ai/mastra/commit/3264a04e30340c3c5447433300a035ea0878df85), [`6fdd3d4`](https://github.com/mastra-ai/mastra/commit/6fdd3d451a07a8e7e216c62ac364f8dd8e36c2af), [`088d9ba`](https://github.com/mastra-ai/mastra/commit/088d9ba2577518703c52b0dccd617178d9ee6b0d), [`74fbebd`](https://github.com/mastra-ai/mastra/commit/74fbebd918a03832a2864965a8bea59bf617d3a2), [`aea6217`](https://github.com/mastra-ai/mastra/commit/aea621790bfb2291431b08da0cc5e6e150303ae7), [`b6a855e`](https://github.com/mastra-ai/mastra/commit/b6a855edc056e088279075506442ba1d6fa6def9), [`ae408ea`](https://github.com/mastra-ai/mastra/commit/ae408ea7128f0d2710b78d8623185198e7cb19c1), [`17e942e`](https://github.com/mastra-ai/mastra/commit/17e942eee2ba44985b1f807e6208cdde672f82f9), [`2015cf9`](https://github.com/mastra-ai/mastra/commit/2015cf921649f44c3f5bcd32a2c052335f8e49b4), [`7ef454e`](https://github.com/mastra-ai/mastra/commit/7ef454eaf9dcec6de60021c8f42192052dd490d6), [`2be1d99`](https://github.com/mastra-ai/mastra/commit/2be1d99564ce79acc4846071082bff353035a87a), [`2708fa1`](https://github.com/mastra-ai/mastra/commit/2708fa1055ac91c03e08b598869f6b8fb51fa37f), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ba74aef`](https://github.com/mastra-ai/mastra/commit/ba74aef5716142dbbe931351f5243c9c6e4128a9), [`ec53e89`](https://github.com/mastra-ai/mastra/commit/ec53e8939c76c638991e21af762e51378eff7543), [`9b5a8cb`](https://github.com/mastra-ai/mastra/commit/9b5a8cb13e120811b0bf14140ada314f1c067894), [`607e66b`](https://github.com/mastra-ai/mastra/commit/607e66b02dc7f531ee37799f3456aa2dc0ca7ac5), [`a215d06`](https://github.com/mastra-ai/mastra/commit/a215d06758dcf590eabfe0b7afd4ae39bdbf082c), [`6909c74`](https://github.com/mastra-ai/mastra/commit/6909c74a7781e0447d475e9dbc1dc871b700f426), [`192438f`](https://github.com/mastra-ai/mastra/commit/192438f8a90c4f375e955f8ff179bf8dc6821a83)]:
|
|
289
|
+
- @mastra/core@1.5.0-alpha.0
|
|
290
|
+
|
|
3
291
|
## 1.4.0
|
|
4
292
|
|
|
5
293
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED