@mastra/editor 0.7.9-alpha.4 → 0.7.9-alpha.5

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/editor
2
2
 
3
+ ## 0.7.9-alpha.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Changed default agent version resolution from draft to published. Execution endpoints now use the latest published agent version by default instead of the draft version. ([#14847](https://github.com/mastra-ai/mastra/pull/14847))
8
+
9
+ - Updated dependencies [[`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a)]:
10
+ - @mastra/core@1.18.0-alpha.5
11
+
3
12
  ## 0.7.9-alpha.4
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -580,6 +580,9 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
580
580
  if (!agent) return null;
581
581
  const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
582
582
  if (!version) return null;
583
+ if (version.agentId !== id) {
584
+ throw new Error(`Version "${version.id}" does not belong to agent "${id}"`);
585
+ }
583
586
  const {
584
587
  id: versionId,
585
588
  agentId: _aId,
@@ -654,6 +657,12 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
654
657
  * they may contain SDK instances or dynamic functions that cannot be safely serialized.
655
658
  * Returns the (possibly mutated) agent.
656
659
  */
660
+ clearResolvedVersionId(agent) {
661
+ const raw = agent.toRawConfig();
662
+ if (!raw || !("resolvedVersionId" in raw)) return;
663
+ const { resolvedVersionId: _removed, ...rest } = raw;
664
+ agent.__setRawConfig(rest);
665
+ }
657
666
  async applyStoredOverrides(agent, options) {
658
667
  let storedConfig = null;
659
668
  try {
@@ -661,12 +670,17 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
661
670
  const adapter = await this.getStorageAdapter();
662
671
  const resolvedOptions = options && "versionId" in options ? { versionId: options.versionId } : { status: options?.status ?? "draft" };
663
672
  storedConfig = await adapter.getByIdResolved(agent.id, resolvedOptions);
664
- } catch {
673
+ } catch (error) {
674
+ if (options && "versionId" in options) {
675
+ throw error;
676
+ }
665
677
  this.restoreCodeDefaults(agent);
678
+ this.clearResolvedVersionId(agent);
666
679
  return agent;
667
680
  }
668
681
  if (!storedConfig) {
669
682
  this.restoreCodeDefaults(agent);
683
+ this.clearResolvedVersionId(agent);
670
684
  return agent;
671
685
  }
672
686
  this.saveCodeDefaults(agent);
@@ -724,6 +738,12 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
724
738
  agent.__setTools({ ...codeTools, ...registryTools, ...mcpTools, ...integrationTools });
725
739
  }
726
740
  }
741
+ if (storedConfig.resolvedVersionId) {
742
+ const existing = agent.toRawConfig() ?? {};
743
+ agent.__setRawConfig({ ...existing, resolvedVersionId: storedConfig.resolvedVersionId });
744
+ } else {
745
+ this.clearResolvedVersionId(agent);
746
+ }
727
747
  return agent;
728
748
  }
729
749
  /**
package/dist/index.d.cts CHANGED
@@ -115,6 +115,7 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
115
115
  * they may contain SDK instances or dynamic functions that cannot be safely serialized.
116
116
  * Returns the (possibly mutated) agent.
117
117
  */
118
+ private clearResolvedVersionId;
118
119
  applyStoredOverrides(agent: Agent, options?: {
119
120
  status?: 'draft' | 'published';
120
121
  } | {
package/dist/index.d.ts CHANGED
@@ -115,6 +115,7 @@ declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgen
115
115
  * they may contain SDK instances or dynamic functions that cannot be safely serialized.
116
116
  * Returns the (possibly mutated) agent.
117
117
  */
118
+ private clearResolvedVersionId;
118
119
  applyStoredOverrides(agent: Agent, options?: {
119
120
  status?: 'draft' | 'published';
120
121
  } | {
package/dist/index.js CHANGED
@@ -532,6 +532,9 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
532
532
  if (!agent) return null;
533
533
  const version = options.versionId ? await store.getVersion(options.versionId) : await store.getVersionByNumber(id, options.versionNumber);
534
534
  if (!version) return null;
535
+ if (version.agentId !== id) {
536
+ throw new Error(`Version "${version.id}" does not belong to agent "${id}"`);
537
+ }
535
538
  const {
536
539
  id: versionId,
537
540
  agentId: _aId,
@@ -606,6 +609,12 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
606
609
  * they may contain SDK instances or dynamic functions that cannot be safely serialized.
607
610
  * Returns the (possibly mutated) agent.
608
611
  */
612
+ clearResolvedVersionId(agent) {
613
+ const raw = agent.toRawConfig();
614
+ if (!raw || !("resolvedVersionId" in raw)) return;
615
+ const { resolvedVersionId: _removed, ...rest } = raw;
616
+ agent.__setRawConfig(rest);
617
+ }
609
618
  async applyStoredOverrides(agent, options) {
610
619
  let storedConfig = null;
611
620
  try {
@@ -613,12 +622,17 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
613
622
  const adapter = await this.getStorageAdapter();
614
623
  const resolvedOptions = options && "versionId" in options ? { versionId: options.versionId } : { status: options?.status ?? "draft" };
615
624
  storedConfig = await adapter.getByIdResolved(agent.id, resolvedOptions);
616
- } catch {
625
+ } catch (error) {
626
+ if (options && "versionId" in options) {
627
+ throw error;
628
+ }
617
629
  this.restoreCodeDefaults(agent);
630
+ this.clearResolvedVersionId(agent);
618
631
  return agent;
619
632
  }
620
633
  if (!storedConfig) {
621
634
  this.restoreCodeDefaults(agent);
635
+ this.clearResolvedVersionId(agent);
622
636
  return agent;
623
637
  }
624
638
  this.saveCodeDefaults(agent);
@@ -676,6 +690,12 @@ var EditorAgentNamespace = class extends CrudEditorNamespace {
676
690
  agent.__setTools({ ...codeTools, ...registryTools, ...mcpTools, ...integrationTools });
677
691
  }
678
692
  }
693
+ if (storedConfig.resolvedVersionId) {
694
+ const existing = agent.toRawConfig() ?? {};
695
+ agent.__setRawConfig({ ...existing, resolvedVersionId: storedConfig.resolvedVersionId });
696
+ } else {
697
+ this.clearResolvedVersionId(agent);
698
+ }
679
699
  return agent;
680
700
  }
681
701
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/editor",
3
- "version": "0.7.9-alpha.4",
3
+ "version": "0.7.9-alpha.5",
4
4
  "description": "Mastra Editor for agent management and instantiation",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -75,13 +75,13 @@
75
75
  "typescript": "^5.9.3",
76
76
  "vitest": "4.0.18",
77
77
  "zod": "^3.25.76",
78
+ "@internal/ai-v6": "0.0.21",
78
79
  "@internal/ai-sdk-v4": "0.0.21",
80
+ "@mastra/hono": "1.3.1-alpha.8",
81
+ "@mastra/core": "1.18.0-alpha.5",
79
82
  "@internal/ai-sdk-v5": "0.0.21",
80
- "@internal/ai-v6": "0.0.21",
81
- "@mastra/core": "1.18.0-alpha.3",
82
- "@mastra/hono": "1.3.1-alpha.6",
83
- "@mastra/mcp": "1.3.1",
84
- "@mastra/libsql": "1.7.3-alpha.2"
83
+ "@mastra/mcp": "1.3.2-alpha.0",
84
+ "@mastra/libsql": "1.7.3-alpha.3"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@mastra/core": ">=1.7.1-0 <2.0.0-0",