@mastra/editor 0.13.8 → 0.13.9

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/dist/index.d.cts CHANGED
@@ -1,44 +1,43 @@
1
- import { Mastra } from '@mastra/core';
2
- import { IAgentBuilder } from '@mastra/core/agent-builder/ee';
3
- import { GetByIdOptions, IEditorFavoritesNamespace, EditorFavoriteTargetInput, EditorFavoriteToggleResult, EditorIsFavoritedBatchInput, EditorListFavoritedIdsInput, FilesystemProvider, SandboxProvider, IMastraEditor, BlobStoreProvider, BrowserProvider, WorkspaceProvider, MastraEditorConfig } from '@mastra/core/editor';
4
- export { BrowserProvider, MastraEditorConfig } from '@mastra/core/editor';
5
- import { IMastraLogger } from '@mastra/core/logger';
6
- import { ProcessorProvider } from '@mastra/core/processor-provider';
7
- import { StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType, StorageCreateMCPClientInput, StorageUpdateMCPClientInput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageListMCPClientsResolvedOutput, StorageResolvedMCPClientType, StorageMCPServerConfig, StorageCreateMCPServerInput, StorageUpdateMCPServerInput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageListMCPServersResolvedOutput, StorageResolvedMCPServerType, StorageCreatePromptBlockInput, StorageUpdatePromptBlockInput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, StorageListPromptBlocksResolvedOutput, StorageResolvedPromptBlockType, AgentInstructionBlock, StorageCreateScorerDefinitionInput, StorageUpdateScorerDefinitionInput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput, StorageListScorerDefinitionsResolvedOutput, StorageResolvedScorerDefinitionType, StorageCreateWorkspaceInput, StorageUpdateWorkspaceInput, StorageListWorkspacesInput, StorageListWorkspacesOutput, StorageListWorkspacesResolvedOutput, StorageResolvedWorkspaceType, StorageWorkspaceSnapshotType, StorageCreateSkillInput, StorageUpdateSkillInput, StorageListSkillsInput, StorageListSkillsOutput, StorageListSkillsResolvedOutput, StorageResolvedSkillType, RuleGroup, PromptBlocksStorage, SourceControlProvider, BlobStore } from '@mastra/core/storage';
8
- import { ToolProvider } from '@mastra/core/tool-provider';
9
- import { Agent } from '@mastra/core/agent';
10
- import { RequestContext } from '@mastra/core/request-context';
11
- import { MCPServerBase } from '@mastra/core/mcp';
12
- import { MastraScorer } from '@mastra/core/evals';
13
- import { SkillSource, Workspace, WorkspaceFilesystem, WorkspaceSandbox } from '@mastra/core/workspace';
14
-
1
+ import { ToolProvider } from "@mastra/core/tool-provider";
2
+ import { AgentInstructionBlock, BlobStore, PromptBlocksStorage, RuleGroup, SourceControlProvider, StorageCreateAgentInput, StorageCreateMCPClientInput, StorageCreateMCPServerInput, StorageCreatePromptBlockInput, StorageCreateScorerDefinitionInput, StorageCreateSkillInput, StorageCreateWorkspaceInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageListMCPClientsResolvedOutput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageListMCPServersResolvedOutput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, StorageListPromptBlocksResolvedOutput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput, StorageListScorerDefinitionsResolvedOutput, StorageListSkillsInput, StorageListSkillsOutput, StorageListSkillsResolvedOutput, StorageListWorkspacesInput, StorageListWorkspacesOutput, StorageListWorkspacesResolvedOutput, StorageMCPServerConfig, StorageResolvedAgentType, StorageResolvedMCPClientType, StorageResolvedMCPServerType, StorageResolvedPromptBlockType, StorageResolvedScorerDefinitionType, StorageResolvedSkillType, StorageResolvedWorkspaceType, StorageUpdateAgentInput, StorageUpdateMCPClientInput, StorageUpdateMCPServerInput, StorageUpdatePromptBlockInput, StorageUpdateScorerDefinitionInput, StorageUpdateSkillInput, StorageUpdateWorkspaceInput, StorageWorkspaceSnapshotType } from "@mastra/core/storage";
3
+ import { IAgentBuilder } from "@mastra/core/agent-builder/ee";
4
+ import { Agent } from "@mastra/core/agent";
5
+ import { Mastra } from "@mastra/core";
6
+ import { BlobStoreProvider, BrowserProvider, BrowserProvider as BrowserProvider$1, EditorFavoriteTargetInput, EditorFavoriteToggleResult, EditorIsFavoritedBatchInput, EditorListFavoritedIdsInput, FilesystemProvider, GetByIdOptions, IEditorFavoritesNamespace, IMastraEditor, MastraEditorConfig, SandboxProvider, WorkspaceProvider } from "@mastra/core/editor";
7
+ import { IMastraLogger } from "@mastra/core/logger";
8
+ import { ProcessorProvider } from "@mastra/core/processor-provider";
9
+ import { RequestContext } from "@mastra/core/request-context";
10
+ import { MCPServerBase } from "@mastra/core/mcp";
11
+ import { MastraScorer } from "@mastra/core/evals";
12
+ import { SkillSource, Workspace, WorkspaceFilesystem, WorkspaceSandbox } from "@mastra/core/workspace";
13
+ //#region src/namespaces/base.d.ts
15
14
  /**
16
15
  * Adapter interface that bridges entity-specific storage method names
17
16
  * to a generic CRUD interface. Each CrudEditorNamespace subclass implements
18
17
  * this to map its storage domain's methods.
19
18
  */
20
19
  interface StorageAdapter<TCreateInput extends {
21
- id: string;
20
+ id: string;
22
21
  }, TUpdateInput extends {
23
- id: string;
22
+ id: string;
24
23
  }, TListInput, TListOutput, TListResolvedOutput, TResolved> {
25
- create(input: TCreateInput): Promise<unknown>;
26
- getByIdResolved(id: string, options?: GetByIdOptions): Promise<TResolved | null>;
27
- update(input: TUpdateInput): Promise<unknown>;
28
- delete(id: string): Promise<void>;
29
- list(args?: TListInput): Promise<TListOutput>;
30
- listResolved(args?: TListInput): Promise<TListResolvedOutput>;
24
+ create(input: TCreateInput): Promise<unknown>;
25
+ getByIdResolved(id: string, options?: GetByIdOptions): Promise<TResolved | null>;
26
+ update(input: TUpdateInput): Promise<unknown>;
27
+ delete(id: string): Promise<void>;
28
+ list(args?: TListInput): Promise<TListOutput>;
29
+ listResolved(args?: TListInput): Promise<TListResolvedOutput>;
31
30
  }
32
31
  /**
33
32
  * Base class for all editor namespaces.
34
33
  * Provides shared infrastructure: mastra/logger access and registration check.
35
34
  */
36
35
  declare abstract class EditorNamespace {
37
- protected editor: MastraEditor;
38
- constructor(editor: MastraEditor);
39
- protected get mastra(): Mastra | undefined;
40
- protected get logger(): IMastraLogger | undefined;
41
- protected ensureRegistered(): void;
36
+ protected editor: MastraEditor;
37
+ constructor(editor: MastraEditor);
38
+ protected get mastra(): Mastra | undefined;
39
+ protected get logger(): IMastraLogger | undefined;
40
+ protected ensureRegistered(): void;
42
41
  }
43
42
  /**
44
43
  * Abstract base class for editor namespaces with full CRUD operations.
@@ -56,293 +55,301 @@ declare abstract class EditorNamespace {
56
55
  * automatically invalidate the cache for the affected entity.
57
56
  */
58
57
  declare abstract class CrudEditorNamespace<TCreateInput extends {
59
- id: string;
58
+ id: string;
60
59
  }, TUpdateInput extends {
61
- id: string;
60
+ id: string;
62
61
  }, TListInput, TListOutput, TListResolvedOutput, TResolved, THydrated = TResolved> extends EditorNamespace {
63
- protected _cache: Map<string, THydrated>;
64
- /**
65
- * Each subclass must provide a storage adapter that maps
66
- * entity-specific storage method names to the generic interface.
67
- */
68
- protected abstract getStorageAdapter(): Promise<StorageAdapter<TCreateInput, TUpdateInput, TListInput, TListOutput, TListResolvedOutput, TResolved>>;
69
- /**
70
- * Convert a raw resolved config into a runtime primitive.
71
- * Override in subclasses that need hydration (e.g. agents → Agent instance).
72
- * Default implementation returns the resolved config as-is.
73
- */
74
- protected hydrate(resolved: TResolved): Promise<THydrated>;
75
- /**
76
- * Hook called when an entity is evicted from the cache (on delete, update, or clearCache).
77
- * Override in subclasses to also remove the entity from the Mastra runtime registry.
78
- */
79
- protected onCacheEvict(_id: string): void;
80
- create(input: TCreateInput): Promise<THydrated>;
81
- getById(id: string, options?: GetByIdOptions): Promise<THydrated | null>;
82
- update(input: TUpdateInput): Promise<THydrated>;
83
- delete(id: string): Promise<void>;
84
- list(args?: TListInput): Promise<TListOutput>;
85
- listResolved(args?: TListInput): Promise<TListResolvedOutput>;
86
- /**
87
- * Clear cached entities. If an id is provided, only that entity is cleared.
88
- * Otherwise all cached entities in this namespace are cleared.
89
- */
90
- clearCache(id?: string): void;
62
+ protected _cache: Map<string, THydrated>;
63
+ /**
64
+ * Each subclass must provide a storage adapter that maps
65
+ * entity-specific storage method names to the generic interface.
66
+ */
67
+ protected abstract getStorageAdapter(): Promise<StorageAdapter<TCreateInput, TUpdateInput, TListInput, TListOutput, TListResolvedOutput, TResolved>>;
68
+ /**
69
+ * Convert a raw resolved config into a runtime primitive.
70
+ * Override in subclasses that need hydration (e.g. agents → Agent instance).
71
+ * Default implementation returns the resolved config as-is.
72
+ */
73
+ protected hydrate(resolved: TResolved): Promise<THydrated>;
74
+ /**
75
+ * Hook called when an entity is evicted from the cache (on delete, update, or clearCache).
76
+ * Override in subclasses to also remove the entity from the Mastra runtime registry.
77
+ */
78
+ protected onCacheEvict(_id: string): void;
79
+ create(input: TCreateInput): Promise<THydrated>;
80
+ getById(id: string, options?: GetByIdOptions): Promise<THydrated | null>;
81
+ update(input: TUpdateInput): Promise<THydrated>;
82
+ delete(id: string): Promise<void>;
83
+ list(args?: TListInput): Promise<TListOutput>;
84
+ listResolved(args?: TListInput): Promise<TListResolvedOutput>;
85
+ /**
86
+ * Clear cached entities. If an id is provided, only that entity is cleared.
87
+ * Otherwise all cached entities in this namespace are cleared.
88
+ */
89
+ clearCache(id?: string): void;
91
90
  }
92
-
91
+ //#endregion
92
+ //#region src/namespaces/agent.d.ts
93
93
  declare class EditorAgentNamespace extends CrudEditorNamespace<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType, Agent> {
94
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType>>;
95
- /**
96
- * Hydrate a stored agent config into a runtime Agent instance.
97
- */
98
- protected hydrate(storedAgent: StorageResolvedAgentType): Promise<Agent>;
99
- update(input: StorageUpdateAgentInput): Promise<Agent>;
100
- /**
101
- * Create a new agent, applying builder defaults for fields not specified in input.
102
- * Also ensures the referenced workspace (if any) is persisted as a stored workspace.
103
- */
104
- create(input: StorageCreateAgentInput): Promise<Agent>;
105
- private getCodeDefinedAgent;
106
- private ensureStoredWorkspaceRefs;
107
- /**
108
- * Ensure a workspace reference is persisted in the DB.
109
- *
110
- * For `type: 'id'`: looks up the runtime workspace, serializes its config,
111
- * and creates a stored workspace record if one doesn't already exist.
112
- *
113
- * For `type: 'inline'`: derives a deterministic ID from the config and
114
- * persists it as a stored workspace if one doesn't already exist.
115
- */
116
- private ensureStoredWorkspace;
117
- protected onCacheEvict(id: string): void;
118
- /**
119
- * Evict all cached agents that reference a given skill ID.
120
- * Called by EditorSkillNamespace after a skill is published so that
121
- * subsequent agent.getById() calls re-hydrate with the updated skill version.
122
- */
123
- invalidateAgentsReferencingSkill(skillId: string): void;
124
- /**
125
- * Apply stored configuration overrides to a code-defined agent.
126
- *
127
- * When a stored config exists for the given agent's ID, the following fields
128
- * from the stored config override the code agent's values (if explicitly set):
129
- * - `instructions` — system prompt
130
- * - `tools` — tool selection with description overrides (merged on top of code tools)
131
- *
132
- * Fields that are absent or undefined in the stored config are left untouched.
133
- * Model, workspace, memory, and other code-defined fields are never overridden —
134
- * they may contain SDK instances or dynamic functions that cannot be safely serialized.
135
- * Returns the (possibly mutated) agent.
136
- */
137
- applyStoredOverrides(agent: Agent, options?: {
138
- status?: 'draft' | 'published';
139
- } | {
140
- versionId: string;
141
- }, requestContext?: RequestContext): Promise<Agent>;
142
- /**
143
- * Detect whether a StorageConditionalField value is a conditional variant array
144
- * (as opposed to the plain static value T).
145
- */
146
- private isConditionalVariants;
147
- /**
148
- * Accumulate all matching variants for an array-typed field.
149
- * Each matching variant's value (an array) is concatenated in order.
150
- * Variants with no rules are treated as unconditional (always included).
151
- */
152
- private accumulateArrayVariants;
153
- /**
154
- * Accumulate all matching variants for an object/record-typed field.
155
- * Each matching variant's value is shallow-merged in order, so later
156
- * matches override keys from earlier ones.
157
- * Variants with no rules are treated as unconditional (always included).
158
- */
159
- private accumulateObjectVariants;
160
- private createAgentFromStoredConfig;
161
- private resolveStoredInstructions;
162
- private applyStoredToolDescriptions;
163
- /**
164
- * Resolve stored tool IDs to actual tool instances from Mastra's registry.
165
- * Applies description overrides from per-tool config when present.
166
- */
167
- private resolveStoredTools;
168
- /**
169
- * Resolve MCP client/server references to tools.
170
- *
171
- * For each entry in `mcpClients`, resolution checks two sources in order:
172
- * 1. Stored MCP clients (from DB) — creates an MCPClient to fetch remote tools
173
- * 2. Code-defined MCP servers on the Mastra instance — uses `server.tools()` directly
174
- *
175
- * When `clientToolsConfig.tools` is absent, no tools are included (client registered but nothing selected).
176
- * When `clientToolsConfig.tools` is an empty object `{}`, all tools from the source are included.
177
- * When specified with keys, only listed tools are included with optional description overrides.
178
- */
179
- private resolveStoredMCPTools;
180
- /**
181
- * Resolve integration tool references from tool providers.
182
- *
183
- * For each entry in `integrationTools`, looks up the tool provider by ID
184
- * from the editor's registered tool providers and calls `getTools()` on it.
185
- *
186
- * When `providerConfig.tools` is absent, no tools are included (provider registered but nothing selected).
187
- * When `providerConfig.tools` is an empty object `{}`, all tools from the provider are included.
188
- * When `providerConfig.tools` has specific keys, only those tools are included with optional overrides.
189
- */
190
- private resolveStoredIntegrationTools;
191
- private resolveStoredWorkflows;
192
- private resolveStoredAgents;
193
- private resolveStoredMemory;
194
- private resolveStoredScorers;
195
- /**
196
- * Clone a runtime Agent instance into storage, creating a new stored agent
197
- * with the resolved configuration of the source agent.
198
- */
199
- clone(agent: Agent, options: {
200
- newId: string;
201
- newName?: string;
202
- metadata?: Record<string, unknown>;
203
- authorId?: string;
204
- visibility?: 'private' | 'public';
205
- requestContext?: RequestContext;
206
- }): Promise<StorageResolvedAgentType>;
207
- /**
208
- * Resolve a stored workspace reference to a runtime Workspace instance.
209
- * Handles both ID-based references (looked up from editor.workspace) and
210
- * inline workspace configurations (hydrated directly).
211
- *
212
- * When a skillSource is provided (from resolveAgentSkillSource), it is passed
213
- * to the workspace hydration so the workspace uses versioned blob-backed skills
214
- * instead of filesystem-based discovery.
215
- */
216
- private resolveStoredWorkspace;
217
- /**
218
- * Resolve a stored browser config to a runtime MastraBrowser instance.
219
- * Looks up the provider by ID in the editor's browser registry.
220
- * Only supports `type: 'inline'` refs (config is embedded in the agent snapshot).
221
- */
222
- private resolveStoredBrowser;
223
- /**
224
- * Resolve agent-level skill configurations into a CompositeVersionedSkillSource.
225
- *
226
- * For each skill in the agent's `skills` map, checks the resolution strategy:
227
- * - `pin: '<versionId>'` → reads the specific version's tree from the DB
228
- * - `strategy: 'latest'` → reads the skill's active version tree
229
- * - `strategy: 'live'` or no strategy → skips (uses filesystem-based discovery)
230
- *
231
- * Returns a CompositeVersionedSkillSource if any versioned skills were resolved,
232
- * or undefined if all skills use filesystem-based discovery.
233
- */
234
- private resolveAgentSkillSource;
94
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageListAgentsResolvedOutput, StorageResolvedAgentType>>;
95
+ /**
96
+ * Hydrate a stored agent config into a runtime Agent instance.
97
+ */
98
+ protected hydrate(storedAgent: StorageResolvedAgentType): Promise<Agent>;
99
+ update(input: StorageUpdateAgentInput): Promise<Agent>;
100
+ /**
101
+ * Create a new agent, applying builder defaults for fields not specified in input.
102
+ * Also ensures the referenced workspace (if any) is persisted as a stored workspace.
103
+ */
104
+ create(input: StorageCreateAgentInput): Promise<Agent>;
105
+ private getCodeDefinedAgent;
106
+ private ensureStoredWorkspaceRefs;
107
+ /**
108
+ * Ensure a workspace reference is persisted in the DB.
109
+ *
110
+ * For `type: 'id'`: looks up the runtime workspace, serializes its config,
111
+ * and creates a stored workspace record if one doesn't already exist.
112
+ *
113
+ * For `type: 'inline'`: derives a deterministic ID from the config and
114
+ * persists it as a stored workspace if one doesn't already exist.
115
+ */
116
+ private ensureStoredWorkspace;
117
+ protected onCacheEvict(id: string): void;
118
+ /**
119
+ * Evict all cached agents that reference a given skill ID.
120
+ * Called by EditorSkillNamespace after a skill is published so that
121
+ * subsequent agent.getById() calls re-hydrate with the updated skill version.
122
+ */
123
+ invalidateAgentsReferencingSkill(skillId: string): void;
124
+ /**
125
+ * Apply stored configuration overrides to a code-defined agent.
126
+ *
127
+ * When a stored config exists for the given agent's ID, the following fields
128
+ * from the stored config override the code agent's values (if explicitly set):
129
+ * - `instructions` — system prompt
130
+ * - `tools` — tool selection with description overrides (merged on top of code tools)
131
+ *
132
+ * Fields that are absent or undefined in the stored config are left untouched.
133
+ * Model, workspace, memory, and other code-defined fields are never overridden —
134
+ * they may contain SDK instances or dynamic functions that cannot be safely serialized.
135
+ * Returns the (possibly mutated) agent.
136
+ */
137
+ applyStoredOverrides(agent: Agent, options?: {
138
+ status?: 'draft' | 'published';
139
+ } | {
140
+ versionId: string;
141
+ }, requestContext?: RequestContext): Promise<Agent>;
142
+ /**
143
+ * Detect whether a StorageConditionalField value is a conditional variant array
144
+ * (as opposed to the plain static value T).
145
+ */
146
+ private isConditionalVariants;
147
+ /**
148
+ * Accumulate all matching variants for an array-typed field.
149
+ * Each matching variant's value (an array) is concatenated in order.
150
+ * Variants with no rules are treated as unconditional (always included).
151
+ */
152
+ private accumulateArrayVariants;
153
+ /**
154
+ * Accumulate all matching variants for an object/record-typed field.
155
+ * Each matching variant's value is shallow-merged in order, so later
156
+ * matches override keys from earlier ones.
157
+ * Variants with no rules are treated as unconditional (always included).
158
+ */
159
+ private accumulateObjectVariants;
160
+ private createAgentFromStoredConfig;
161
+ private resolveStoredInstructions;
162
+ private applyStoredToolDescriptions;
163
+ /**
164
+ * Resolve stored tool IDs to actual tool instances from Mastra's registry.
165
+ * Applies description overrides from per-tool config when present.
166
+ */
167
+ private resolveStoredTools;
168
+ /**
169
+ * Resolve MCP client/server references to tools.
170
+ *
171
+ * For each entry in `mcpClients`, resolution checks two sources in order:
172
+ * 1. Stored MCP clients (from DB) — creates an MCPClient to fetch remote tools
173
+ * 2. Code-defined MCP servers on the Mastra instance — uses `server.tools()` directly
174
+ *
175
+ * When `clientToolsConfig.tools` is absent, no tools are included (client registered but nothing selected).
176
+ * When `clientToolsConfig.tools` is an empty object `{}`, all tools from the source are included.
177
+ * When specified with keys, only listed tools are included with optional description overrides.
178
+ */
179
+ private resolveStoredMCPTools;
180
+ /**
181
+ * Resolve integration tool references from tool providers.
182
+ *
183
+ * For each entry in `integrationTools`, looks up the tool provider by ID
184
+ * from the editor's registered tool providers and calls `getTools()` on it.
185
+ *
186
+ * When `providerConfig.tools` is absent, no tools are included (provider registered but nothing selected).
187
+ * When `providerConfig.tools` is an empty object `{}`, all tools from the provider are included.
188
+ * When `providerConfig.tools` has specific keys, only those tools are included with optional overrides.
189
+ */
190
+ private resolveStoredIntegrationTools;
191
+ private resolveStoredWorkflows;
192
+ private resolveStoredAgents;
193
+ private resolveStoredMemory;
194
+ private resolveStoredScorers;
195
+ /**
196
+ * Clone a runtime Agent instance into storage, creating a new stored agent
197
+ * with the resolved configuration of the source agent.
198
+ */
199
+ clone(agent: Agent, options: {
200
+ newId: string;
201
+ newName?: string;
202
+ metadata?: Record<string, unknown>;
203
+ authorId?: string;
204
+ visibility?: 'private' | 'public';
205
+ requestContext?: RequestContext;
206
+ }): Promise<StorageResolvedAgentType>;
207
+ /**
208
+ * Resolve a stored workspace reference to a runtime Workspace instance.
209
+ * Handles both ID-based references (looked up from editor.workspace) and
210
+ * inline workspace configurations (hydrated directly).
211
+ *
212
+ * When a skillSource is provided (from resolveAgentSkillSource), it is passed
213
+ * to the workspace hydration so the workspace uses versioned blob-backed skills
214
+ * instead of filesystem-based discovery.
215
+ */
216
+ private resolveStoredWorkspace;
217
+ /**
218
+ * Resolve a stored browser config to a runtime MastraBrowser instance.
219
+ * Looks up the provider by ID in the editor's browser registry.
220
+ * Only supports `type: 'inline'` refs (config is embedded in the agent snapshot).
221
+ */
222
+ private resolveStoredBrowser;
223
+ /**
224
+ * Resolve agent-level skill configurations into a CompositeVersionedSkillSource.
225
+ *
226
+ * For each skill in the agent's `skills` map, checks the resolution strategy:
227
+ * - `pin: '<versionId>'` → reads the specific version's tree from the DB
228
+ * - `strategy: 'latest'` → reads the skill's active version tree
229
+ * - `strategy: 'live'` or no strategy → skips (uses filesystem-based discovery)
230
+ *
231
+ * Returns a CompositeVersionedSkillSource if any versioned skills were resolved,
232
+ * or undefined if all skills use filesystem-based discovery.
233
+ */
234
+ private resolveAgentSkillSource;
235
235
  }
236
-
236
+ //#endregion
237
+ //#region src/namespaces/mcp.d.ts
237
238
  declare class EditorMCPNamespace extends CrudEditorNamespace<StorageCreateMCPClientInput, StorageUpdateMCPClientInput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageListMCPClientsResolvedOutput, StorageResolvedMCPClientType> {
238
- protected onCacheEvict(_id: string): void;
239
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateMCPClientInput, StorageUpdateMCPClientInput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageListMCPClientsResolvedOutput, StorageResolvedMCPClientType>>;
240
- /**
241
- * Convert a stored MCP server config into the shape expected by MCPClient.
242
- * Converts `url` from string to URL for HTTP servers.
243
- * Returns a plain object — callers must pass it to `new MCPClient()`.
244
- */
245
- static toMCPServerDefinition(serverConfig: StorageMCPServerConfig, requestInit?: {
246
- headers: Record<string, string>;
247
- }): Record<string, unknown>;
248
- /**
249
- * Convert all servers in a stored MCP client to MCPClientOptions shape.
250
- */
251
- static toMCPClientOptions(config: StorageResolvedMCPClientType, requestInit?: {
252
- headers: Record<string, string>;
253
- }): {
254
- id: string;
255
- servers: Record<string, Record<string, unknown>>;
256
- };
239
+ protected onCacheEvict(_id: string): void;
240
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateMCPClientInput, StorageUpdateMCPClientInput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageListMCPClientsResolvedOutput, StorageResolvedMCPClientType>>;
241
+ /**
242
+ * Convert a stored MCP server config into the shape expected by MCPClient.
243
+ * Converts `url` from string to URL for HTTP servers.
244
+ * Returns a plain object — callers must pass it to `new MCPClient()`.
245
+ */
246
+ static toMCPServerDefinition(serverConfig: StorageMCPServerConfig, requestInit?: {
247
+ headers: Record<string, string>;
248
+ }): Record<string, unknown>;
249
+ /**
250
+ * Convert all servers in a stored MCP client to MCPClientOptions shape.
251
+ */
252
+ static toMCPClientOptions(config: StorageResolvedMCPClientType, requestInit?: {
253
+ headers: Record<string, string>;
254
+ }): {
255
+ id: string;
256
+ servers: Record<string, Record<string, unknown>>;
257
+ };
257
258
  }
258
-
259
+ //#endregion
260
+ //#region src/namespaces/mcp-server.d.ts
259
261
  declare class EditorMCPServerNamespace extends CrudEditorNamespace<StorageCreateMCPServerInput, StorageUpdateMCPServerInput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageListMCPServersResolvedOutput, StorageResolvedMCPServerType, MCPServerBase> {
260
- private mcpServerCtor;
261
- protected onCacheEvict(_id: string): void;
262
- protected hydrate(resolved: StorageResolvedMCPServerType): Promise<MCPServerBase>;
263
- private resolveStoredTools;
264
- private resolveStoredAgents;
265
- private resolveStoredWorkflows;
266
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateMCPServerInput, StorageUpdateMCPServerInput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageListMCPServersResolvedOutput, StorageResolvedMCPServerType>>;
262
+ private mcpServerCtor;
263
+ protected onCacheEvict(_id: string): void;
264
+ protected hydrate(resolved: StorageResolvedMCPServerType): Promise<MCPServerBase>;
265
+ private resolveStoredTools;
266
+ private resolveStoredAgents;
267
+ private resolveStoredWorkflows;
268
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateMCPServerInput, StorageUpdateMCPServerInput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageListMCPServersResolvedOutput, StorageResolvedMCPServerType>>;
267
269
  }
268
-
270
+ //#endregion
271
+ //#region src/namespaces/prompt.d.ts
269
272
  declare class EditorPromptNamespace extends CrudEditorNamespace<StorageCreatePromptBlockInput, StorageUpdatePromptBlockInput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, StorageListPromptBlocksResolvedOutput, StorageResolvedPromptBlockType> {
270
- protected onCacheEvict(id: string): void;
271
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreatePromptBlockInput, StorageUpdatePromptBlockInput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, StorageListPromptBlocksResolvedOutput, StorageResolvedPromptBlockType>>;
272
- update(input: StorageUpdatePromptBlockInput): Promise<StorageResolvedPromptBlockType>;
273
- preview(blocks: AgentInstructionBlock[], context: Record<string, unknown>): Promise<string>;
273
+ protected onCacheEvict(id: string): void;
274
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreatePromptBlockInput, StorageUpdatePromptBlockInput, StorageListPromptBlocksInput, StorageListPromptBlocksOutput, StorageListPromptBlocksResolvedOutput, StorageResolvedPromptBlockType>>;
275
+ update(input: StorageUpdatePromptBlockInput): Promise<StorageResolvedPromptBlockType>;
276
+ preview(blocks: AgentInstructionBlock[], context: Record<string, unknown>): Promise<string>;
274
277
  }
275
-
278
+ //#endregion
279
+ //#region src/namespaces/scorer.d.ts
276
280
  declare class EditorScorerNamespace extends CrudEditorNamespace<StorageCreateScorerDefinitionInput, StorageUpdateScorerDefinitionInput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput, StorageListScorerDefinitionsResolvedOutput, StorageResolvedScorerDefinitionType> {
277
- protected onCacheEvict(id: string): void;
278
- /**
279
- * Hydrate a stored scorer definition into a runtime MastraScorer instance
280
- * and register it on the Mastra instance so it can be discovered via
281
- * `mastra.getScorer()` / `mastra.getScorerById()`.
282
- */
283
- protected hydrate(storedScorer: StorageResolvedScorerDefinitionType): Promise<StorageResolvedScorerDefinitionType>;
284
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateScorerDefinitionInput, StorageUpdateScorerDefinitionInput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput, StorageListScorerDefinitionsResolvedOutput, StorageResolvedScorerDefinitionType>>;
285
- /**
286
- * Create a MastraScorer instance from a stored scorer definition.
287
- * Supports:
288
- * - 'llm-judge': Creates a scorer with a single LLM call using custom instructions
289
- * - Preset types (e.g., 'bias', 'toxicity'): Not yet supported, returns null
290
- */
291
- resolve(storedScorer: StorageResolvedScorerDefinitionType): MastraScorer<any, any, any, any> | null;
281
+ protected onCacheEvict(id: string): void;
282
+ /**
283
+ * Hydrate a stored scorer definition into a runtime MastraScorer instance
284
+ * and register it on the Mastra instance so it can be discovered via
285
+ * `mastra.getScorer()` / `mastra.getScorerById()`.
286
+ */
287
+ protected hydrate(storedScorer: StorageResolvedScorerDefinitionType): Promise<StorageResolvedScorerDefinitionType>;
288
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateScorerDefinitionInput, StorageUpdateScorerDefinitionInput, StorageListScorerDefinitionsInput, StorageListScorerDefinitionsOutput, StorageListScorerDefinitionsResolvedOutput, StorageResolvedScorerDefinitionType>>;
289
+ /**
290
+ * Create a MastraScorer instance from a stored scorer definition.
291
+ * Supports:
292
+ * - 'llm-judge': Creates a scorer with a single LLM call using custom instructions
293
+ * - Preset types (e.g., 'bias', 'toxicity'): Not yet supported, returns null
294
+ */
295
+ resolve(storedScorer: StorageResolvedScorerDefinitionType): MastraScorer<any, any, any, any> | null;
292
296
  }
293
-
297
+ //#endregion
298
+ //#region src/namespaces/workspace.d.ts
294
299
  declare class EditorWorkspaceNamespace extends CrudEditorNamespace<StorageCreateWorkspaceInput, StorageUpdateWorkspaceInput, StorageListWorkspacesInput, StorageListWorkspacesOutput, StorageListWorkspacesResolvedOutput, StorageResolvedWorkspaceType, StorageResolvedWorkspaceType> {
295
- protected onCacheEvict(_id: string): void;
296
- /**
297
- * Hydrate a stored workspace snapshot config into a runtime Workspace instance.
298
- * Resolves provider strings to actual instances using the editor's registries.
299
- *
300
- * This is NOT called from the CrudEditorNamespace flow — it is a public utility
301
- * used by EditorAgentNamespace during agent hydration.
302
- */
303
- hydrateSnapshotToWorkspace(id: string, snapshot: StorageWorkspaceSnapshotType, options?: {
304
- skillSource?: SkillSource;
305
- }): Promise<Workspace<WorkspaceFilesystem | undefined, WorkspaceSandbox | undefined, Record<string, WorkspaceFilesystem> | undefined>>;
306
- /**
307
- * Serialize a runtime Workspace instance into a StorageWorkspaceSnapshotType.
308
- * The reverse of hydrateSnapshotToWorkspace — extracts provider IDs and config
309
- * from live filesystem/sandbox instances so the workspace can be persisted to the DB.
310
- */
311
- snapshotFromWorkspace(workspace: Workspace): Promise<StorageWorkspaceSnapshotType>;
312
- /**
313
- * Serialize a runtime WorkspaceFilesystem into a StorageFilesystemConfig.
314
- * Awaits getInfo() so async providers like CompositeFilesystem keep their mount metadata.
315
- */
316
- private serializeFilesystem;
317
- /**
318
- * Resolve a stored filesystem config to a runtime WorkspaceFilesystem instance.
319
- * Looks up the provider by ID in the editor's registry (which includes built-in providers).
320
- */
321
- private resolveFilesystem;
322
- /**
323
- * Resolve a stored sandbox config to a runtime WorkspaceSandbox instance.
324
- * Looks up the provider by ID in the editor's registry (which includes built-in providers).
325
- */
326
- private resolveSandbox;
327
- /**
328
- * Resolve a stored workspace provider config to a complete runtime Workspace instance.
329
- * Looks up the provider by ID in the editor's workspace provider registry.
330
- */
331
- resolveWorkspaceProvider(providerId: string, config: Record<string, unknown>): Promise<Workspace<any, any, any>>;
332
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateWorkspaceInput, StorageUpdateWorkspaceInput, StorageListWorkspacesInput, StorageListWorkspacesOutput, StorageListWorkspacesResolvedOutput, StorageResolvedWorkspaceType>>;
300
+ protected onCacheEvict(_id: string): void;
301
+ /**
302
+ * Hydrate a stored workspace snapshot config into a runtime Workspace instance.
303
+ * Resolves provider strings to actual instances using the editor's registries.
304
+ *
305
+ * This is NOT called from the CrudEditorNamespace flow — it is a public utility
306
+ * used by EditorAgentNamespace during agent hydration.
307
+ */
308
+ hydrateSnapshotToWorkspace(id: string, snapshot: StorageWorkspaceSnapshotType, options?: {
309
+ skillSource?: SkillSource;
310
+ }): Promise<Workspace<WorkspaceFilesystem | undefined, WorkspaceSandbox | undefined, Record<string, WorkspaceFilesystem> | undefined>>;
311
+ /**
312
+ * Serialize a runtime Workspace instance into a StorageWorkspaceSnapshotType.
313
+ * The reverse of hydrateSnapshotToWorkspace — extracts provider IDs and config
314
+ * from live filesystem/sandbox instances so the workspace can be persisted to the DB.
315
+ */
316
+ snapshotFromWorkspace(workspace: Workspace): Promise<StorageWorkspaceSnapshotType>;
317
+ /**
318
+ * Serialize a runtime WorkspaceFilesystem into a StorageFilesystemConfig.
319
+ * Awaits getInfo() so async providers like CompositeFilesystem keep their mount metadata.
320
+ */
321
+ private serializeFilesystem;
322
+ /**
323
+ * Resolve a stored filesystem config to a runtime WorkspaceFilesystem instance.
324
+ * Looks up the provider by ID in the editor's registry (which includes built-in providers).
325
+ */
326
+ private resolveFilesystem;
327
+ /**
328
+ * Resolve a stored sandbox config to a runtime WorkspaceSandbox instance.
329
+ * Looks up the provider by ID in the editor's registry (which includes built-in providers).
330
+ */
331
+ private resolveSandbox;
332
+ /**
333
+ * Resolve a stored workspace provider config to a complete runtime Workspace instance.
334
+ * Looks up the provider by ID in the editor's workspace provider registry.
335
+ */
336
+ resolveWorkspaceProvider(providerId: string, config: Record<string, unknown>): Promise<Workspace<any, any, any>>;
337
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateWorkspaceInput, StorageUpdateWorkspaceInput, StorageListWorkspacesInput, StorageListWorkspacesOutput, StorageListWorkspacesResolvedOutput, StorageResolvedWorkspaceType>>;
333
338
  }
334
-
339
+ //#endregion
340
+ //#region src/namespaces/skill.d.ts
335
341
  declare class EditorSkillNamespace extends CrudEditorNamespace<StorageCreateSkillInput, StorageUpdateSkillInput, StorageListSkillsInput, StorageListSkillsOutput, StorageListSkillsResolvedOutput, StorageResolvedSkillType> {
336
- protected onCacheEvict(_id: string): void;
337
- protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateSkillInput, StorageUpdateSkillInput, StorageListSkillsInput, StorageListSkillsOutput, StorageListSkillsResolvedOutput, StorageResolvedSkillType>>;
338
- /**
339
- * Publish a skill from a live filesystem source.
340
- * Walks the skill directory, hashes files into the blob store,
341
- * creates a new version with the tree manifest, and sets activeVersionId.
342
- */
343
- publish(skillId: string, source: SkillSource, skillPath: string): Promise<StorageResolvedSkillType>;
342
+ protected onCacheEvict(_id: string): void;
343
+ protected getStorageAdapter(): Promise<StorageAdapter<StorageCreateSkillInput, StorageUpdateSkillInput, StorageListSkillsInput, StorageListSkillsOutput, StorageListSkillsResolvedOutput, StorageResolvedSkillType>>;
344
+ /**
345
+ * Publish a skill from a live filesystem source.
346
+ * Walks the skill directory, hashes files into the blob store,
347
+ * creates a new version with the tree manifest, and sets activeVersionId.
348
+ */
349
+ publish(skillId: string, source: SkillSource, skillPath: string): Promise<StorageResolvedSkillType>;
344
350
  }
345
-
351
+ //#endregion
352
+ //#region src/namespaces/favorites.d.ts
346
353
  /**
347
354
  * Favorites namespace.
348
355
  *
@@ -352,14 +359,15 @@ declare class EditorSkillNamespace extends CrudEditorNamespace<StorageCreateSkil
352
359
  * perform their own access check before invoking these methods.
353
360
  */
354
361
  declare class EditorFavoritesNamespace extends EditorNamespace implements IEditorFavoritesNamespace {
355
- favorite(input: EditorFavoriteTargetInput): Promise<EditorFavoriteToggleResult>;
356
- unfavorite(input: EditorFavoriteTargetInput): Promise<EditorFavoriteToggleResult>;
357
- isFavorited(input: EditorFavoriteTargetInput): Promise<boolean>;
358
- isFavoritedBatch(input: EditorIsFavoritedBatchInput): Promise<Set<string>>;
359
- listFavoritedIds(input: EditorListFavoritedIdsInput): Promise<string[]>;
360
- private getFavoritesStore;
362
+ favorite(input: EditorFavoriteTargetInput): Promise<EditorFavoriteToggleResult>;
363
+ unfavorite(input: EditorFavoriteTargetInput): Promise<EditorFavoriteToggleResult>;
364
+ isFavorited(input: EditorFavoriteTargetInput): Promise<boolean>;
365
+ isFavoritedBatch(input: EditorIsFavoritedBatchInput): Promise<Set<string>>;
366
+ listFavoritedIds(input: EditorListFavoritedIdsInput): Promise<string[]>;
367
+ private getFavoritesStore;
361
368
  }
362
-
369
+ //#endregion
370
+ //#region src/template-engine.d.ts
363
371
  /**
364
372
  * TemplateEngine: Simple variable interpolation for prompt block content.
365
373
  *
@@ -378,17 +386,8 @@ declare class EditorFavoritesNamespace extends EditorNamespace implements IEdito
378
386
  * @returns The rendered string with variables replaced
379
387
  */
380
388
  declare function renderTemplate(template: string, context: Record<string, unknown>): string;
381
-
382
- /**
383
- * RuleEvaluator: Evaluates recursive RuleGroup conditions against a context object.
384
- *
385
- * Supports:
386
- * - Leaf rules with operators: equals, not_equals, contains, not_contains,
387
- * greater_than, less_than, greater_than_or_equal, less_than_or_equal,
388
- * in, not_in, exists, not_exists
389
- * - Recursive AND / OR grouping via RuleGroup
390
- */
391
-
389
+ //#endregion
390
+ //#region src/rule-evaluator.d.ts
392
391
  /**
393
392
  * Evaluates a RuleGroup (which may contain nested RuleGroups) against a context object.
394
393
  *
@@ -397,24 +396,12 @@ declare function renderTemplate(template: string, context: Record<string, unknow
397
396
  * @returns true if the rule group passes, false otherwise
398
397
  */
399
398
  declare function evaluateRuleGroup(ruleGroup: RuleGroup, context: Record<string, unknown>): boolean;
400
-
401
- /**
402
- * InstructionBuilder: Resolves an array of AgentInstructionBlock items
403
- * into a final instruction string.
404
- *
405
- * For each block:
406
- * - `{ type: 'text', content }` → render template with context
407
- * - `{ type: 'prompt_block_ref', id }` → fetch from storage, evaluate rules, render template
408
- * - `{ type: 'prompt_block', content, rules? }` → inline block, evaluate rules, render template
409
- *
410
- * Blocks that fail rule evaluation are excluded.
411
- * Resolved text segments are joined with double newlines.
412
- */
413
-
399
+ //#endregion
400
+ //#region src/instruction-builder.d.ts
414
401
  interface InstructionBuilderDeps {
415
- promptBlocksStorage: PromptBlocksStorage;
416
- /** When true, include draft (unpublished) prompt block refs. Used for preview mode. */
417
- includeDrafts?: boolean;
402
+ promptBlocksStorage: PromptBlocksStorage;
403
+ /** When true, include draft (unpublished) prompt block refs. Used for preview mode. */
404
+ includeDrafts?: boolean;
418
405
  }
419
406
  /**
420
407
  * Resolves an array of instruction blocks into a final instruction string.
@@ -425,155 +412,151 @@ interface InstructionBuilderDeps {
425
412
  * @returns The resolved instruction string
426
413
  */
427
414
  declare function resolveInstructionBlocks(blocks: AgentInstructionBlock[], context: Record<string, unknown>, deps: InstructionBuilderDeps): Promise<string>;
428
-
429
- /**
430
- * Built-in workspace provider descriptors.
431
- *
432
- * These are auto-registered by MastraEditor and always available.
433
- * External providers (S3, GCS, E2B) are supplied via MastraEditorConfig.
434
- */
435
-
415
+ //#endregion
416
+ //#region src/providers.d.ts
436
417
  declare const localFilesystemProvider: FilesystemProvider<{
437
- basePath: string;
438
- contained?: boolean;
439
- readOnly?: boolean;
418
+ basePath: string;
419
+ contained?: boolean;
420
+ readOnly?: boolean;
440
421
  }>;
441
422
  declare const localSandboxProvider: SandboxProvider<{
442
- workingDirectory?: string;
443
- timeout?: number;
444
- isolation?: 'none' | 'seatbelt' | 'bwrap';
445
- env?: Record<string, string>;
423
+ workingDirectory?: string;
424
+ timeout?: number;
425
+ isolation?: 'none' | 'seatbelt' | 'bwrap';
426
+ env?: Record<string, string>;
446
427
  }>;
447
-
428
+ //#endregion
429
+ //#region src/index.d.ts
448
430
  declare class MastraEditor implements IMastraEditor {
449
- /** @internal — exposed for namespace classes, not part of public API */
450
- __mastra?: Mastra;
451
- /** @internal — exposed for namespace classes, not part of public API */
452
- __logger?: IMastraLogger;
453
- private __toolProviders;
454
- private __processorProviders;
455
- private __source?;
456
- private __codePath;
457
- private __sourceControlProvider?;
458
- private readonly __builderConfig?;
459
- private __builderInstance?;
460
- private __builderResolved;
461
- /**
462
- * @internal — exposed for namespace classes to hydrate stored workspace configs.
463
- * Maps provider ID (e.g., 'local', 's3') to the provider descriptor.
464
- * Built-in providers are auto-registered; additional providers come from config.
465
- */
466
- readonly __filesystems: Map<string, FilesystemProvider>;
467
- /**
468
- * @internal — exposed for namespace classes to hydrate stored workspace configs.
469
- * Maps provider ID (e.g., 'local', 'e2b') to the provider descriptor.
470
- * Built-in providers are auto-registered; additional providers come from config.
471
- */
472
- readonly __sandboxes: Map<string, SandboxProvider>;
473
- /**
474
- * @internal — exposed for namespace classes to resolve blob stores.
475
- * Maps provider ID (e.g., 'storage', 's3') to the provider descriptor.
476
- * The built-in 'storage' provider uses the configured storage backend.
477
- * Additional providers come from config.
478
- */
479
- readonly __blobStores: Map<string, BlobStoreProvider>;
480
- /**
481
- * @internal — exposed for namespace classes to hydrate stored browser configs.
482
- * Maps provider ID (e.g., 'stagehand', 'agent-browser') to the provider descriptor.
483
- * No built-in providers — browser packages must be registered via config.
484
- */
485
- readonly __browsers: Map<string, BrowserProvider>;
486
- /**
487
- * @internal — exposed for namespace classes to hydrate stored workspace configs.
488
- * Maps provider ID to the provider descriptor.
489
- * No built-in providers — workspace providers must be registered via config.
490
- */
491
- readonly __workspaces: Map<string, WorkspaceProvider>;
492
- readonly agent: EditorAgentNamespace;
493
- readonly mcp: EditorMCPNamespace;
494
- readonly mcpServer: EditorMCPServerNamespace;
495
- readonly prompt: EditorPromptNamespace;
496
- readonly scorer: EditorScorerNamespace;
497
- readonly workspace: EditorWorkspaceNamespace;
498
- readonly skill: EditorSkillNamespace;
499
- readonly favorites: EditorFavoritesNamespace;
500
- constructor(config?: MastraEditorConfig);
501
- /**
502
- * Register this editor with a Mastra instance.
503
- * This gives the editor access to Mastra's storage, tools, workflows, etc.
504
- */
505
- registerWithMastra(mastra: Mastra): void;
506
- /**
507
- * Ensure the builder default workspace is persisted to the DB.
508
- * Called automatically on startup when the editor registers with Mastra.
509
- * Goes through the normal create() path so hydration validates that
510
- * all providers (filesystem, sandbox) are properly registered.
511
- *
512
- * If the workspace already exists but its config has drifted from the
513
- * runtime workspace, the DB record is updated (creating a new version).
514
- * Builder-created workspaces are tagged with `metadata.source = 'builder'`
515
- * so they can be identified during reconciliation.
516
- */
517
- private ensureBuilderWorkspaces;
518
- /**
519
- * Archive builder-created workspaces that no longer match the current
520
- * builder configuration. Called after `ensureBuilderWorkspaces()` on startup.
521
- *
522
- * Only touches workspaces tagged with `metadata.source === 'builder'`.
523
- * The current builder workspace (if any) is never archived.
524
- */
525
- private reconcileBuilderWorkspaces;
526
- /**
527
- * Sync. OSS-safe. Does NOT import @mastra/editor/ee.
528
- * Returns true if builder config is present and enabled.
529
- */
530
- hasEnabledBuilderConfig(): boolean;
531
- /**
532
- * Async. Dynamic-imports @mastra/editor/ee on first call. Caches result.
533
- * Returns undefined if builder is not enabled.
534
- */
535
- resolveBuilder(): Promise<IAgentBuilder | undefined>;
536
- /**
537
- * Defense-in-depth license guard for the Agent Builder. Mirrors the
538
- * startup-time check in `MastraServer.validateAgentBuilderLicense()` so the
539
- * builder cannot be instantiated outside the server boot path without a
540
- * valid EE license. Dev environments bypass via `isEEEnabled()`.
541
- */
542
- private assertAgentBuilderLicensed;
543
- /** Returns the editor's configured source, or undefined if unset. */
544
- getSource(): 'code' | 'db' | undefined;
545
- /** Returns the configured source control provider, if any. */
546
- getSourceControlProvider(): SourceControlProvider | undefined;
547
- /** Registered tool providers */
548
- getToolProvider(id: string): ToolProvider | undefined;
549
- /**
550
- * Like {@link getToolProvider}, but throws {@link UnknownToolProviderError}
551
- * when the id is unknown.
552
- */
553
- getToolProviderOrThrow(id: string): ToolProvider;
554
- /** List all registered tool providers */
555
- getToolProviders(): Record<string, ToolProvider>;
556
- /** Get a processor provider by ID */
557
- getProcessorProvider(id: string): ProcessorProvider | undefined;
558
- /** List all registered processor providers */
559
- getProcessorProviders(): Record<string, ProcessorProvider>;
560
- /** List all registered filesystem providers */
561
- getFilesystemProviders(): FilesystemProvider[];
562
- /** List all registered sandbox providers */
563
- getSandboxProviders(): SandboxProvider[];
564
- /** List all registered blob store providers */
565
- getBlobStoreProviders(): BlobStoreProvider[];
566
- /**
567
- * Resolve a blob store from the provider registry, or fall back to the
568
- * storage backend's blobs domain.
569
- *
570
- * @param providerId - If specified, look up a registered provider by ID
571
- * and create a blob store from the given config. If omitted, falls back
572
- * to `storage.getStore('blobs')`.
573
- * @param providerConfig - Provider-specific configuration (only used when
574
- * `providerId` is specified).
575
- */
576
- resolveBlobStore(providerId?: string, providerConfig?: Record<string, unknown>): Promise<BlobStore>;
431
+ /** @internal — exposed for namespace classes, not part of public API */
432
+ __mastra?: Mastra;
433
+ /** @internal — exposed for namespace classes, not part of public API */
434
+ __logger?: IMastraLogger;
435
+ private __toolProviders;
436
+ private __processorProviders;
437
+ private __source?;
438
+ private __codePath;
439
+ private __sourceControlProvider?;
440
+ private readonly __builderConfig?;
441
+ private __builderInstance?;
442
+ private __builderResolved;
443
+ /**
444
+ * @internal — exposed for namespace classes to hydrate stored workspace configs.
445
+ * Maps provider ID (e.g., 'local', 's3') to the provider descriptor.
446
+ * Built-in providers are auto-registered; additional providers come from config.
447
+ */
448
+ readonly __filesystems: Map<string, FilesystemProvider>;
449
+ /**
450
+ * @internal — exposed for namespace classes to hydrate stored workspace configs.
451
+ * Maps provider ID (e.g., 'local', 'e2b') to the provider descriptor.
452
+ * Built-in providers are auto-registered; additional providers come from config.
453
+ */
454
+ readonly __sandboxes: Map<string, SandboxProvider>;
455
+ /**
456
+ * @internal — exposed for namespace classes to resolve blob stores.
457
+ * Maps provider ID (e.g., 'storage', 's3') to the provider descriptor.
458
+ * The built-in 'storage' provider uses the configured storage backend.
459
+ * Additional providers come from config.
460
+ */
461
+ readonly __blobStores: Map<string, BlobStoreProvider>;
462
+ /**
463
+ * @internal — exposed for namespace classes to hydrate stored browser configs.
464
+ * Maps provider ID (e.g., 'stagehand', 'agent-browser') to the provider descriptor.
465
+ * No built-in providers — browser packages must be registered via config.
466
+ */
467
+ readonly __browsers: Map<string, BrowserProvider$1>;
468
+ /**
469
+ * @internal — exposed for namespace classes to hydrate stored workspace configs.
470
+ * Maps provider ID to the provider descriptor.
471
+ * No built-in providers — workspace providers must be registered via config.
472
+ */
473
+ readonly __workspaces: Map<string, WorkspaceProvider>;
474
+ readonly agent: EditorAgentNamespace;
475
+ readonly mcp: EditorMCPNamespace;
476
+ readonly mcpServer: EditorMCPServerNamespace;
477
+ readonly prompt: EditorPromptNamespace;
478
+ readonly scorer: EditorScorerNamespace;
479
+ readonly workspace: EditorWorkspaceNamespace;
480
+ readonly skill: EditorSkillNamespace;
481
+ readonly favorites: EditorFavoritesNamespace;
482
+ constructor(config?: MastraEditorConfig);
483
+ /**
484
+ * Register this editor with a Mastra instance.
485
+ * This gives the editor access to Mastra's storage, tools, workflows, etc.
486
+ */
487
+ registerWithMastra(mastra: Mastra): void;
488
+ /**
489
+ * Ensure the builder default workspace is persisted to the DB.
490
+ * Called automatically on startup when the editor registers with Mastra.
491
+ * Goes through the normal create() path so hydration validates that
492
+ * all providers (filesystem, sandbox) are properly registered.
493
+ *
494
+ * If the workspace already exists but its config has drifted from the
495
+ * runtime workspace, the DB record is updated (creating a new version).
496
+ * Builder-created workspaces are tagged with `metadata.source = 'builder'`
497
+ * so they can be identified during reconciliation.
498
+ */
499
+ private ensureBuilderWorkspaces;
500
+ /**
501
+ * Archive builder-created workspaces that no longer match the current
502
+ * builder configuration. Called after `ensureBuilderWorkspaces()` on startup.
503
+ *
504
+ * Only touches workspaces tagged with `metadata.source === 'builder'`.
505
+ * The current builder workspace (if any) is never archived.
506
+ */
507
+ private reconcileBuilderWorkspaces;
508
+ /**
509
+ * Sync. OSS-safe. Does NOT import @mastra/editor/ee.
510
+ * Returns true if builder config is present and enabled.
511
+ */
512
+ hasEnabledBuilderConfig(): boolean;
513
+ /**
514
+ * Async. Dynamic-imports @mastra/editor/ee on first call. Caches result.
515
+ * Returns undefined if builder is not enabled.
516
+ */
517
+ resolveBuilder(): Promise<IAgentBuilder | undefined>;
518
+ /**
519
+ * Defense-in-depth license guard for the Agent Builder. Mirrors the
520
+ * startup-time check in `MastraServer.validateAgentBuilderLicense()` so the
521
+ * builder cannot be instantiated outside the server boot path without a
522
+ * valid EE license. Dev environments bypass via `isEEEnabled()`.
523
+ */
524
+ private assertAgentBuilderLicensed;
525
+ /** Returns the editor's configured source, or undefined if unset. */
526
+ getSource(): 'code' | 'db' | undefined;
527
+ /** Returns the configured source control provider, if any. */
528
+ getSourceControlProvider(): SourceControlProvider | undefined;
529
+ /** Registered tool providers */
530
+ getToolProvider(id: string): ToolProvider | undefined;
531
+ /**
532
+ * Like {@link getToolProvider}, but throws {@link UnknownToolProviderError}
533
+ * when the id is unknown.
534
+ */
535
+ getToolProviderOrThrow(id: string): ToolProvider;
536
+ /** List all registered tool providers */
537
+ getToolProviders(): Record<string, ToolProvider>;
538
+ /** Get a processor provider by ID */
539
+ getProcessorProvider(id: string): ProcessorProvider | undefined;
540
+ /** List all registered processor providers */
541
+ getProcessorProviders(): Record<string, ProcessorProvider>;
542
+ /** List all registered filesystem providers */
543
+ getFilesystemProviders(): FilesystemProvider[];
544
+ /** List all registered sandbox providers */
545
+ getSandboxProviders(): SandboxProvider[];
546
+ /** List all registered blob store providers */
547
+ getBlobStoreProviders(): BlobStoreProvider[];
548
+ /**
549
+ * Resolve a blob store from the provider registry, or fall back to the
550
+ * storage backend's blobs domain.
551
+ *
552
+ * @param providerId - If specified, look up a registered provider by ID
553
+ * and create a blob store from the given config. If omitted, falls back
554
+ * to `storage.getStore('blobs')`.
555
+ * @param providerConfig - Provider-specific configuration (only used when
556
+ * `providerId` is specified).
557
+ */
558
+ resolveBlobStore(providerId?: string, providerConfig?: Record<string, unknown>): Promise<BlobStore>;
577
559
  }
578
-
579
- export { CrudEditorNamespace, EditorAgentNamespace, EditorFavoritesNamespace, EditorMCPNamespace, EditorMCPServerNamespace, EditorNamespace, EditorPromptNamespace, EditorScorerNamespace, EditorSkillNamespace, EditorWorkspaceNamespace, MastraEditor, type StorageAdapter, evaluateRuleGroup, localFilesystemProvider, localSandboxProvider, renderTemplate, resolveInstructionBlocks };
560
+ //#endregion
561
+ export { type BrowserProvider, CrudEditorNamespace, EditorAgentNamespace, EditorFavoritesNamespace, EditorMCPNamespace, EditorMCPServerNamespace, EditorNamespace, EditorPromptNamespace, EditorScorerNamespace, EditorSkillNamespace, EditorWorkspaceNamespace, MastraEditor, type MastraEditorConfig, type StorageAdapter, evaluateRuleGroup, localFilesystemProvider, localSandboxProvider, renderTemplate, resolveInstructionBlocks };
562
+ //# sourceMappingURL=index.d.cts.map