@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/CHANGELOG.md +17 -0
- package/dist/arcade.cjs +645 -292
- package/dist/arcade.cjs.map +1 -1
- package/dist/arcade.d.cts +47 -46
- package/dist/arcade.d.cts.map +1 -0
- package/dist/arcade.d.ts +47 -46
- package/dist/arcade.d.ts.map +1 -0
- package/dist/arcade.js +642 -263
- package/dist/arcade.js.map +1 -1
- package/dist/composio.cjs +336 -361
- package/dist/composio.cjs.map +1 -1
- package/dist/composio.d.cts +52 -51
- package/dist/composio.d.cts.map +1 -0
- package/dist/composio.d.ts +52 -51
- package/dist/composio.d.ts.map +1 -0
- package/dist/composio.js +330 -329
- package/dist/composio.js.map +1 -1
- package/dist/ee/index.cjs +199 -191
- package/dist/ee/index.cjs.map +1 -1
- package/dist/ee/index.d.cts +47 -44
- package/dist/ee/index.d.cts.map +1 -0
- package/dist/ee/index.d.ts +47 -44
- package/dist/ee/index.d.ts.map +1 -0
- package/dist/ee/index.js +180 -158
- package/dist/ee/index.js.map +1 -1
- package/dist/index.cjs +2459 -3145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +461 -478
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +461 -478
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2442 -2797
- package/dist/index.js.map +1 -1
- package/dist/storage/index.cjs +24 -35
- package/dist/storage/index.d.cts +2 -1
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2 -14
- package/package.json +11 -11
- package/dist/storage/index.cjs.map +0 -1
- package/dist/storage/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
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
|
-
|
|
20
|
+
id: string;
|
|
22
21
|
}, TUpdateInput extends {
|
|
23
|
-
|
|
22
|
+
id: string;
|
|
24
23
|
}, TListInput, TListOutput, TListResolvedOutput, TResolved> {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
58
|
+
id: string;
|
|
60
59
|
}, TUpdateInput extends {
|
|
61
|
-
|
|
60
|
+
id: string;
|
|
62
61
|
}, TListInput, TListOutput, TListResolvedOutput, TResolved, THydrated = TResolved> extends EditorNamespace {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
|
|
438
|
-
|
|
439
|
-
|
|
418
|
+
basePath: string;
|
|
419
|
+
contained?: boolean;
|
|
420
|
+
readOnly?: boolean;
|
|
440
421
|
}>;
|
|
441
422
|
declare const localSandboxProvider: SandboxProvider<{
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|