@mastra/editor 0.11.2 → 0.12.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 +25 -0
- package/dist/index.cjs +43 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +49 -15
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @mastra/editor
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added source-backed storage primitives for code-mode agent editing. ([#17582](https://github.com/mastra-ai/mastra/pull/17582))
|
|
8
|
+
|
|
9
|
+
Mastra now exposes a `SourceControlProvider` interface for hosted source-control-backed editor storage, and `MastraEditor` can persist code-mode agent overrides through either local filesystem storage or a source provider.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const editor = new MastraEditor({
|
|
13
|
+
source: 'code',
|
|
14
|
+
sourceControlProvider,
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Code-defined agents still respect their `editor` ownership config, while source-backed storage can read, write, list history, and open change requests through a provider implementation.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`de66bb0`](https://github.com/mastra-ai/mastra/commit/de66bb040570444c702ce4d8e1e228a5de2949cb), [`67bf8e2`](https://github.com/mastra-ai/mastra/commit/67bf8e206dfe583954d96015cf0d09f7ac50e45f), [`8216d05`](https://github.com/mastra-ai/mastra/commit/8216d0528d866eb9a07f5d4c87ea3bb1e1139b45), [`d18b23c`](https://github.com/mastra-ai/mastra/commit/d18b23c5e29dfc381e73e3c51fcf6c779afd1823), [`5eb94eb`](https://github.com/mastra-ai/mastra/commit/5eb94ebcf66d4e28c9e26d5821ac93379bab20a0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`f9ee2ac`](https://github.com/mastra-ai/mastra/commit/f9ee2ac661af584e61bc063ac208c9035cd752ef), [`c853d53`](https://github.com/mastra-ai/mastra/commit/c853d535d2df84ab89db1adb4c28900c54c9a2d2), [`d8df1f8`](https://github.com/mastra-ai/mastra/commit/d8df1f8e947e1966c9d4e54713df56d0d0d65226), [`9192ddb`](https://github.com/mastra-ai/mastra/commit/9192ddbced8949113b30de444cbe763f075b59f5), [`ae96523`](https://github.com/mastra-ai/mastra/commit/ae965231f562d9766b0c90c49a69fc68acaa031c), [`17d5a92`](https://github.com/mastra-ai/mastra/commit/17d5a9211aa293b4d4418de3de70dc0394d58101), [`5573693`](https://github.com/mastra-ai/mastra/commit/5573693b589822250e20dfe6cf66e9ff3bc96da8), [`ec4da8a`](https://github.com/mastra-ai/mastra/commit/ec4da8a09e0d2ab452c6ee2c786042ea826b77e5), [`adc44e1`](https://github.com/mastra-ai/mastra/commit/adc44e13c7e570b91e86b20ea7556e61d819db31), [`218d952`](https://github.com/mastra-ai/mastra/commit/218d952ec09e5111c10ccd143b5bc0ef19434376), [`7c987b4`](https://github.com/mastra-ai/mastra/commit/7c987b4cfcc498bb579f986d07f794633f8e0ff8), [`ed346c0`](https://github.com/mastra-ai/mastra/commit/ed346c0bee2d8496690a4e538bfba1e46894660f), [`9b1adf7`](https://github.com/mastra-ai/mastra/commit/9b1adf7f39943c869182106bc4016e793b3304ac), [`c9ce1b2`](https://github.com/mastra-ai/mastra/commit/c9ce1b28d10871110648f9d7b6d76e880b9fa999), [`3ef01fd`](https://github.com/mastra-ai/mastra/commit/3ef01fd130b53d5bd4f828beb174e516a2eb1158), [`245a9a3`](https://github.com/mastra-ai/mastra/commit/245a9a315705fce17ddd980f78a92504b6615c4a), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`38b5de8`](https://github.com/mastra-ai/mastra/commit/38b5de8e5d1d41a69522addf53d96f4b3a1d5bf0), [`eae1556`](https://github.com/mastra-ai/mastra/commit/eae1556eedac109b67d91b627689cdf70a83bab7), [`efe917d`](https://github.com/mastra-ai/mastra/commit/efe917d524f285d9d131804027c7201bf7aee110), [`dc0b611`](https://github.com/mastra-ai/mastra/commit/dc0b6119b769bd00ee2c5df9259fb376fe63077a), [`dd6a66e`](https://github.com/mastra-ai/mastra/commit/dd6a66ea0b32e0dea8059aec6b35d151e2c87dc4), [`d785c59`](https://github.com/mastra-ai/mastra/commit/d785c593b67fcb4cdc4fab9fdbde5f3b7665efc0), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`8b984f4`](https://github.com/mastra-ai/mastra/commit/8b984f4361c202270ceb69257185c4756c9a7c56), [`bf08402`](https://github.com/mastra-ai/mastra/commit/bf084022374fa5d06ca70ed67a86dd64e379071b), [`81fe587`](https://github.com/mastra-ai/mastra/commit/81fe587275035715c1720ddf3fee0505cf053036), [`1fa3e12`](https://github.com/mastra-ai/mastra/commit/1fa3e123582b63cfe49de4ee52dc6a065e8d956a), [`403c438`](https://github.com/mastra-ai/mastra/commit/403c438e417278989ce247233d2c465b8d902cdd), [`f8ba195`](https://github.com/mastra-ai/mastra/commit/f8ba1954e27ee2b20586cc6cd9cf13c002c232f2)]:
|
|
23
|
+
- @mastra/core@1.43.0
|
|
24
|
+
- @mastra/memory@1.20.4
|
|
25
|
+
- @mastra/schema-compat@1.2.12
|
|
26
|
+
- @mastra/mcp@1.10.0
|
|
27
|
+
|
|
3
28
|
## 0.11.2
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -956,8 +956,24 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
956
956
|
finalInput = applyBuilderDefaults(input, agentConfig);
|
|
957
957
|
}
|
|
958
958
|
await this.ensureStoredWorkspace(finalInput.workspace);
|
|
959
|
+
const existingCodeAgent = this.getCodeDefinedAgent(finalInput.id);
|
|
960
|
+
if (existingCodeAgent) {
|
|
961
|
+
const adapter = await this.getStorageAdapter();
|
|
962
|
+
await adapter.create(finalInput);
|
|
963
|
+
this._cache.set(finalInput.id, existingCodeAgent);
|
|
964
|
+
return existingCodeAgent;
|
|
965
|
+
}
|
|
959
966
|
return super.create(finalInput);
|
|
960
967
|
}
|
|
968
|
+
getCodeDefinedAgent(id) {
|
|
969
|
+
let agent;
|
|
970
|
+
try {
|
|
971
|
+
agent = this.mastra?.getAgentById(id);
|
|
972
|
+
} catch {
|
|
973
|
+
return void 0;
|
|
974
|
+
}
|
|
975
|
+
return agent?.source === "code" ? agent : void 0;
|
|
976
|
+
}
|
|
961
977
|
/**
|
|
962
978
|
* Ensure a workspace reference is persisted in the DB.
|
|
963
979
|
*
|
|
@@ -1449,14 +1465,7 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
|
|
|
1449
1465
|
browser,
|
|
1450
1466
|
...skillsFormat && { skillsFormat }
|
|
1451
1467
|
});
|
|
1452
|
-
|
|
1453
|
-
try {
|
|
1454
|
-
return this.mastra?.getAgentById(storedAgent.id);
|
|
1455
|
-
} catch {
|
|
1456
|
-
return void 0;
|
|
1457
|
-
}
|
|
1458
|
-
})();
|
|
1459
|
-
if (!existingCodeAgent || existingCodeAgent.source !== "code") {
|
|
1468
|
+
if (!this.getCodeDefinedAgent(storedAgent.id)) {
|
|
1460
1469
|
this.mastra?.addAgent(agent, storedAgent.id, { source: "stored" });
|
|
1461
1470
|
}
|
|
1462
1471
|
this.logger?.debug(`[createAgentFromStoredConfig] Successfully created agent "${storedAgent.id}"`);
|
|
@@ -2605,6 +2614,7 @@ var MastraEditor = class {
|
|
|
2605
2614
|
this.__processorProviders = { ...import_processor_provider2.BUILT_IN_PROCESSOR_PROVIDERS, ...config?.processorProviders };
|
|
2606
2615
|
this.__source = config?.source;
|
|
2607
2616
|
this.__codePath = config?.codePath ?? "./mastra/editor";
|
|
2617
|
+
this.__sourceControlProvider = config?.sourceControlProvider ?? (0, import_storage.createGitHubSourceControlProviderFromEnv)(process.env, { pathPrefix: this.__codePath });
|
|
2608
2618
|
this.__filesystems = /* @__PURE__ */ new Map();
|
|
2609
2619
|
this.__filesystems.set(localFilesystemProvider.id, localFilesystemProvider);
|
|
2610
2620
|
for (const [id, provider] of Object.entries(config?.filesystems ?? {})) {
|
|
@@ -2643,18 +2653,33 @@ var MastraEditor = class {
|
|
|
2643
2653
|
this.__logger = mastra.getLogger();
|
|
2644
2654
|
}
|
|
2645
2655
|
if (this.__source === "code") {
|
|
2646
|
-
const filesystemStore = new import_storage.FilesystemStore({ dir: this.__codePath });
|
|
2647
2656
|
const existingStorage = mastra.getStorage();
|
|
2648
|
-
if (
|
|
2657
|
+
if (this.__sourceControlProvider) {
|
|
2658
|
+
const sourceAgentsStore = new import_storage.SourceAgentsSourceControl({
|
|
2659
|
+
provider: this.__sourceControlProvider
|
|
2660
|
+
});
|
|
2661
|
+
const filesystemStore = new import_storage.FilesystemStore({ dir: this.__codePath });
|
|
2649
2662
|
mastra.setStorage(
|
|
2650
2663
|
new import_storage.MastraCompositeStore({
|
|
2651
|
-
id: `${existingStorage
|
|
2652
|
-
default: existingStorage,
|
|
2653
|
-
editor: filesystemStore
|
|
2664
|
+
id: `${existingStorage?.id ?? "mastra"}-with-editor-source-control`,
|
|
2665
|
+
...existingStorage ? { default: existingStorage } : {},
|
|
2666
|
+
editor: filesystemStore,
|
|
2667
|
+
domains: { agents: sourceAgentsStore }
|
|
2654
2668
|
})
|
|
2655
2669
|
);
|
|
2656
2670
|
} else {
|
|
2657
|
-
|
|
2671
|
+
const filesystemStore = new import_storage.FilesystemStore({ dir: this.__codePath });
|
|
2672
|
+
if (existingStorage) {
|
|
2673
|
+
mastra.setStorage(
|
|
2674
|
+
new import_storage.MastraCompositeStore({
|
|
2675
|
+
id: `${existingStorage.id}-with-editor-filesystem`,
|
|
2676
|
+
default: existingStorage,
|
|
2677
|
+
editor: filesystemStore
|
|
2678
|
+
})
|
|
2679
|
+
);
|
|
2680
|
+
} else {
|
|
2681
|
+
mastra.setStorage(filesystemStore);
|
|
2682
|
+
}
|
|
2658
2683
|
}
|
|
2659
2684
|
}
|
|
2660
2685
|
this.ensureBuilderWorkspaces().then(() => this.reconcileBuilderWorkspaces()).catch((err) => {
|
|
@@ -2809,6 +2834,10 @@ var MastraEditor = class {
|
|
|
2809
2834
|
getSource() {
|
|
2810
2835
|
return this.__source;
|
|
2811
2836
|
}
|
|
2837
|
+
/** Returns the configured source control provider, if any. */
|
|
2838
|
+
getSourceControlProvider() {
|
|
2839
|
+
return this.__sourceControlProvider;
|
|
2840
|
+
}
|
|
2812
2841
|
/** Registered tool providers */
|
|
2813
2842
|
getToolProvider(id) {
|
|
2814
2843
|
return this.__toolProviders[id];
|