@mastra/server 1.67.0-alpha.3 → 1.67.0-alpha.4
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/_types/@mastra_schema-compat/dist/schema.types.d.ts +20 -1
- package/dist/{api-schema-manifest-DNk8B4kw.js → api-schema-manifest-B8uyCfJp.js} +2 -2
- package/dist/{api-schema-manifest-DNk8B4kw.js.map → api-schema-manifest-B8uyCfJp.js.map} +1 -1
- package/dist/{api-schema-manifest-1LriOYQM.cjs → api-schema-manifest-nIt4xi1r.cjs} +2 -2
- package/dist/{api-schema-manifest-1LriOYQM.cjs.map → api-schema-manifest-nIt4xi1r.cjs.map} +1 -1
- package/dist/{datasets-C-_ZWnxR.cjs → datasets-BqCRJLYH.cjs} +25 -2
- package/dist/datasets-BqCRJLYH.cjs.map +1 -0
- package/dist/{datasets-B4qPHzEy.js → datasets-Dhk4CUat.js} +20 -3
- package/dist/datasets-Dhk4CUat.js.map +1 -0
- package/dist/{dist-Bw-Zrv4_.js → dist-8iDh9UbP.js} +14 -5
- package/dist/dist-8iDh9UbP.js.map +1 -0
- package/dist/{dist-Du9y2ur5.cjs → dist-CBDJtAr5.cjs} +14 -5
- package/dist/dist-CBDJtAr5.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{routes-DXUcYEc6.js → routes-BSAA4PVg.js} +4 -1
- package/dist/routes-BSAA4PVg.js.map +1 -0
- package/dist/{routes-9i4gAixo.cjs → routes-D5r7qWgZ.cjs} +4 -1
- package/dist/routes-D5r7qWgZ.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-controller.cjs +1 -1
- package/dist/server/handlers/agent-controller.js +1 -1
- package/dist/server/handlers/agents.cjs +9 -16
- package/dist/server/handlers/agents.cjs.map +1 -1
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +2 -9
- package/dist/server/handlers/agents.js.map +1 -1
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/datasets.cjs +17 -8
- package/dist/server/handlers/datasets.cjs.map +1 -1
- package/dist/server/handlers/datasets.d.ts +27 -0
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +17 -8
- package/dist/server/handlers/datasets.js.map +1 -1
- package/dist/server/handlers/logs.cjs +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/plans.cjs +1 -1
- package/dist/server/handlers/plans.js +1 -1
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.d.ts +11 -11
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/responses.storage.cjs +1 -1
- package/dist/server/handlers/responses.storage.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -1
- package/dist/server/handlers/utils.d.ts +6 -0
- package/dist/server/handlers/utils.d.ts.map +1 -1
- package/dist/server/handlers/utils.js +2 -2
- package/dist/server/handlers/workflow-builder.cjs +5 -0
- package/dist/server/handlers/workflow-builder.d.ts +322 -0
- package/dist/server/handlers/workflow-builder.d.ts.map +1 -0
- package/dist/server/handlers/workflow-builder.js +2 -0
- package/dist/server/handlers/workflows.cjs +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/schemas/datasets.d.ts +18 -0
- package/dist/server/schemas/datasets.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +2 -1
- package/dist/server/schemas/index.js +2 -2
- package/dist/server/schemas/workflow-builder.d.ts +26 -0
- package/dist/server/schemas/workflow-builder.d.ts.map +1 -0
- package/dist/server/server-adapter/index.cjs +11 -1
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +11 -1
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/conversations.d.ts +3 -3
- package/dist/server/server-adapter/routes/datasets.d.ts +27 -0
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/editor-builder.d.ts +319 -0
- package/dist/server/server-adapter/routes/editor-builder.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/workspace.d.ts +23 -23
- package/dist/{utils-CMWGBd0O.js → utils-KsERfbhc.js} +15 -3
- package/dist/utils-KsERfbhc.js.map +1 -0
- package/dist/{utils-BtkczLrA.cjs → utils-aIu3gkhJ.cjs} +19 -1
- package/dist/utils-aIu3gkhJ.cjs.map +1 -0
- package/dist/workflow-builder-C9DVk9Tw.js +102 -0
- package/dist/workflow-builder-C9DVk9Tw.js.map +1 -0
- package/dist/workflow-builder-_rQWs1B6.cjs +115 -0
- package/dist/workflow-builder-_rQWs1B6.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/datasets-B4qPHzEy.js.map +0 -1
- package/dist/datasets-C-_ZWnxR.cjs.map +0 -1
- package/dist/dist-Bw-Zrv4_.js.map +0 -1
- package/dist/dist-Du9y2ur5.cjs.map +0 -1
- package/dist/routes-9i4gAixo.cjs.map +0 -1
- package/dist/routes-DXUcYEc6.js.map +0 -1
- package/dist/utils-BtkczLrA.cjs.map +0 -1
- package/dist/utils-CMWGBd0O.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/datasets.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/datasets.ts"],"names":[],"mappings":"A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8ClB,CAAC"}
|
|
@@ -173,6 +173,325 @@ export declare const EDITOR_BUILDER_ROUTES: readonly [Omit<import("@mastra/core/
|
|
|
173
173
|
}, import("zod/v4/core").$strip>> | undefined;
|
|
174
174
|
} & {
|
|
175
175
|
readonly _mastraSchemaRoute: true;
|
|
176
|
+
}, Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
177
|
+
method: "GET";
|
|
178
|
+
path: "/editor/workflow-builder/settings";
|
|
179
|
+
responseType: "json";
|
|
180
|
+
streamFormat?: 'sse' | 'stream';
|
|
181
|
+
sseFlushOnConnect?: boolean;
|
|
182
|
+
handler(params: import(".").ServerContext): Promise<{
|
|
183
|
+
enabled: boolean;
|
|
184
|
+
modelPolicy?: {
|
|
185
|
+
active: boolean;
|
|
186
|
+
pickerVisible?: boolean | undefined;
|
|
187
|
+
allowed?: ({
|
|
188
|
+
kind: "custom";
|
|
189
|
+
provider: string;
|
|
190
|
+
modelId?: string | undefined;
|
|
191
|
+
} | {
|
|
192
|
+
provider: string;
|
|
193
|
+
modelId?: string | undefined;
|
|
194
|
+
})[] | undefined;
|
|
195
|
+
default?: {
|
|
196
|
+
kind: "custom";
|
|
197
|
+
provider: string;
|
|
198
|
+
modelId: string;
|
|
199
|
+
} | {
|
|
200
|
+
provider: string;
|
|
201
|
+
modelId: string;
|
|
202
|
+
} | undefined;
|
|
203
|
+
} | undefined;
|
|
204
|
+
}>;
|
|
205
|
+
pathParamSchema?: import("zod").ZodType;
|
|
206
|
+
queryParamSchema?: import("zod").ZodType;
|
|
207
|
+
bodySchema?: import("zod").ZodType;
|
|
208
|
+
responseSchema?: import("zod").ZodType;
|
|
209
|
+
openapi?: import("../openapi-utils").OpenAPIRoute;
|
|
210
|
+
maxBodySize?: number;
|
|
211
|
+
deprecated?: boolean;
|
|
212
|
+
requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
|
|
213
|
+
fga?: import("@mastra/core/auth").FGARouteConfig;
|
|
214
|
+
onValidationError?: import("@mastra/core/server").ValidationErrorHook;
|
|
215
|
+
readonly __schemas?: import(".").RouteSchemas<undefined, undefined, undefined, import("zod").ZodObject<{
|
|
216
|
+
enabled: import("zod").ZodBoolean;
|
|
217
|
+
modelPolicy: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
218
|
+
active: import("zod").ZodBoolean;
|
|
219
|
+
pickerVisible: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
220
|
+
allowed: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
221
|
+
kind: import("zod").ZodLiteral<"custom">;
|
|
222
|
+
provider: import("zod").ZodString;
|
|
223
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
224
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
225
|
+
provider: import("zod").ZodString;
|
|
226
|
+
modelId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
227
|
+
}, import("zod/v4/core").$strict>]>>>;
|
|
228
|
+
default: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
229
|
+
kind: import("zod").ZodLiteral<"custom">;
|
|
230
|
+
provider: import("zod").ZodString;
|
|
231
|
+
modelId: import("zod").ZodString;
|
|
232
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
233
|
+
provider: import("zod").ZodString;
|
|
234
|
+
modelId: import("zod").ZodString;
|
|
235
|
+
}, import("zod/v4/core").$strict>]>>;
|
|
236
|
+
}, import("zod/v4/core").$strip>>;
|
|
237
|
+
}, import("zod/v4/core").$strip>> | undefined;
|
|
238
|
+
} & {
|
|
239
|
+
readonly _mastraSchemaRoute: true;
|
|
240
|
+
}, Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
241
|
+
method: "POST";
|
|
242
|
+
path: "/editor/workflow-builder/stream";
|
|
243
|
+
responseType: "stream";
|
|
244
|
+
streamFormat?: 'sse' | 'stream';
|
|
245
|
+
sseFlushOnConnect?: boolean;
|
|
246
|
+
handler(params: {
|
|
247
|
+
[x: string]: unknown;
|
|
248
|
+
messages: string | import("@mastra/core/agent/message-list").MessageInput[];
|
|
249
|
+
instructions?: import("@mastra/core/llm").SystemMessage | undefined;
|
|
250
|
+
system?: import("@mastra/core/llm").SystemMessage | undefined;
|
|
251
|
+
context?: import("@mastra/core/agent/message-list").MessageInput[] | undefined;
|
|
252
|
+
memory?: {
|
|
253
|
+
thread: string | {
|
|
254
|
+
[x: string]: unknown;
|
|
255
|
+
id: string;
|
|
256
|
+
};
|
|
257
|
+
resource?: string | undefined;
|
|
258
|
+
options?: Record<string, unknown> | undefined;
|
|
259
|
+
readOnly?: boolean | undefined;
|
|
260
|
+
} | undefined;
|
|
261
|
+
runId?: string | undefined;
|
|
262
|
+
savePerStep?: boolean | undefined;
|
|
263
|
+
requestContext?: Record<string, unknown> | undefined;
|
|
264
|
+
versions?: {
|
|
265
|
+
agents?: Record<string, {
|
|
266
|
+
versionId: string;
|
|
267
|
+
} | {
|
|
268
|
+
status: "draft" | "published";
|
|
269
|
+
}> | undefined;
|
|
270
|
+
defaultStatus?: "draft" | "published" | undefined;
|
|
271
|
+
} | undefined;
|
|
272
|
+
maxSteps?: number | undefined;
|
|
273
|
+
stopWhen?: ((event: unknown) => boolean | PromiseLike<boolean>)[] | ((event: unknown) => boolean | PromiseLike<boolean>) | undefined;
|
|
274
|
+
model?: string | undefined;
|
|
275
|
+
providerOptions?: Record<string, Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
|
|
276
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
277
|
+
} | null)[] | {
|
|
278
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
279
|
+
} | null)[] | {
|
|
280
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
281
|
+
} | null)[] | {
|
|
282
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
283
|
+
} | null)[] | {
|
|
284
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
285
|
+
} | null)[] | {
|
|
286
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
287
|
+
} | null)[] | {
|
|
288
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
289
|
+
} | null)[] | {
|
|
290
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
291
|
+
} | null)[] | {
|
|
292
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
293
|
+
} | null)[] | {
|
|
294
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
295
|
+
} | null)[] | {
|
|
296
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
297
|
+
} | null)[] | {
|
|
298
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
299
|
+
} | null>> | undefined;
|
|
300
|
+
modelSettings?: {
|
|
301
|
+
maxOutputTokens?: number;
|
|
302
|
+
temperature?: number;
|
|
303
|
+
topP?: number;
|
|
304
|
+
topK?: number;
|
|
305
|
+
presencePenalty?: number;
|
|
306
|
+
frequencyPenalty?: number;
|
|
307
|
+
stopSequences?: string[];
|
|
308
|
+
seed?: number;
|
|
309
|
+
maxRetries?: number;
|
|
310
|
+
headers?: Record<string, string | undefined>;
|
|
311
|
+
reasoning?: import("@mastra/core/loop").ReasoningLevel;
|
|
312
|
+
} | undefined;
|
|
313
|
+
activeTools?: string[] | undefined;
|
|
314
|
+
toolsets?: import("@mastra/core/agent").ToolsetsInput | undefined;
|
|
315
|
+
clientTools?: import("@mastra/core/agent").ToolsInput | undefined;
|
|
316
|
+
toolChoice?: "auto" | "none" | "required" | {
|
|
317
|
+
type: "tool";
|
|
318
|
+
toolName: string;
|
|
319
|
+
} | undefined;
|
|
320
|
+
requireToolApproval?: boolean | undefined;
|
|
321
|
+
scorers?: Record<string, {
|
|
322
|
+
scorer: string;
|
|
323
|
+
sampling?: import("@mastra/core/evals").ScoringSamplingConfig;
|
|
324
|
+
}> | undefined;
|
|
325
|
+
returnScorerData?: boolean | undefined;
|
|
326
|
+
tracingOptions?: {
|
|
327
|
+
metadata?: Record<string, unknown> | undefined;
|
|
328
|
+
requestContextKeys?: string[] | undefined;
|
|
329
|
+
traceId?: string | undefined;
|
|
330
|
+
parentSpanId?: string | undefined;
|
|
331
|
+
tags?: string[] | undefined;
|
|
332
|
+
hideInput?: boolean | undefined;
|
|
333
|
+
hideOutput?: boolean | undefined;
|
|
334
|
+
} | undefined;
|
|
335
|
+
output?: import("@mastra/core/llm").OutputType;
|
|
336
|
+
structuredOutput?: import("@mastra/core/agent").PublicStructuredOutputOptions<Record<string, unknown>> | undefined;
|
|
337
|
+
untilIdle?: boolean | {
|
|
338
|
+
maxIdleMs?: number | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
} & import(".").ServerContext): Promise<import("./stream-types").MastraStreamReturn>;
|
|
341
|
+
pathParamSchema?: import("zod").ZodType;
|
|
342
|
+
queryParamSchema?: import("zod").ZodType;
|
|
343
|
+
bodySchema?: import("zod").ZodType;
|
|
344
|
+
responseSchema?: import("zod").ZodType;
|
|
345
|
+
openapi?: import("../openapi-utils").OpenAPIRoute;
|
|
346
|
+
maxBodySize?: number;
|
|
347
|
+
deprecated?: boolean;
|
|
348
|
+
requiresPermission?: import("@mastra/core/auth").MastraFGAPermissionInput | import("@mastra/core/auth").MastraFGAPermissionInput[];
|
|
349
|
+
fga?: import("@mastra/core/auth").FGARouteConfig;
|
|
350
|
+
onValidationError?: import("@mastra/core/server").ValidationErrorHook;
|
|
351
|
+
readonly __schemas?: import(".").RouteSchemas<undefined, undefined, import("zod").ZodObject<{
|
|
352
|
+
messages: import("zod").ZodUnion<readonly [import("zod").ZodArray<import("zod").ZodType<import("@mastra/core/agent/message-list").MessageInput, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/agent/message-list").MessageInput, unknown>>>, import("zod").ZodString]>;
|
|
353
|
+
instructions: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/llm").SystemMessage, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/llm").SystemMessage, unknown>>>;
|
|
354
|
+
system: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/llm").SystemMessage, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/llm").SystemMessage, unknown>>>;
|
|
355
|
+
context: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodType<import("@mastra/core/agent/message-list").MessageInput, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/agent/message-list").MessageInput, unknown>>>>;
|
|
356
|
+
memory: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
357
|
+
thread: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
|
|
358
|
+
id: import("zod").ZodString;
|
|
359
|
+
}, import("zod/v4/core").$loose>]>;
|
|
360
|
+
resource: import("zod").ZodOptional<import("zod").ZodString>;
|
|
361
|
+
options: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
362
|
+
readOnly: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
363
|
+
}, import("zod/v4/core").$strip>>;
|
|
364
|
+
runId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
365
|
+
savePerStep: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
366
|
+
requestContext: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
367
|
+
versions: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
368
|
+
agents: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
|
|
369
|
+
versionId: import("zod").ZodString;
|
|
370
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
371
|
+
status: import("zod").ZodEnum<{
|
|
372
|
+
draft: "draft";
|
|
373
|
+
published: "published";
|
|
374
|
+
}>;
|
|
375
|
+
}, import("zod/v4/core").$strip>]>>>;
|
|
376
|
+
defaultStatus: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
377
|
+
draft: "draft";
|
|
378
|
+
published: "published";
|
|
379
|
+
}>>;
|
|
380
|
+
}, import("zod/v4/core").$strip>>;
|
|
381
|
+
maxSteps: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
382
|
+
stopWhen: import("zod").ZodOptional<import("zod").ZodType<((event: unknown) => boolean | PromiseLike<boolean>)[] | ((event: unknown) => boolean | PromiseLike<boolean>), unknown, import("zod/v4/core").$ZodTypeInternals<((event: unknown) => boolean | PromiseLike<boolean>)[] | ((event: unknown) => boolean | PromiseLike<boolean>), unknown>>>;
|
|
383
|
+
model: import("zod").ZodOptional<import("zod").ZodString>;
|
|
384
|
+
providerOptions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodType<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
|
|
385
|
+
[key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
|
|
386
|
+
} | null)[] | {
|
|
387
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
388
|
+
} | null)[] | {
|
|
389
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
390
|
+
} | null)[] | {
|
|
391
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
392
|
+
} | null)[] | {
|
|
393
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
394
|
+
} | null)[] | {
|
|
395
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
396
|
+
} | null)[] | {
|
|
397
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
398
|
+
} | null)[] | {
|
|
399
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
400
|
+
} | null)[] | {
|
|
401
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
402
|
+
} | null)[] | {
|
|
403
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
404
|
+
} | null)[] | {
|
|
405
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
406
|
+
} | null)[] | {
|
|
407
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
408
|
+
} | null, unknown, import("zod/v4/core").$ZodTypeInternals<string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
409
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
410
|
+
} | null)[] | {
|
|
411
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
412
|
+
} | null)[] | {
|
|
413
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
414
|
+
} | null)[] | {
|
|
415
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
416
|
+
} | null)[] | {
|
|
417
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
418
|
+
} | null)[] | {
|
|
419
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
420
|
+
} | null)[] | {
|
|
421
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
422
|
+
} | null)[] | {
|
|
423
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
424
|
+
} | null)[] | {
|
|
425
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
426
|
+
} | null)[] | {
|
|
427
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
428
|
+
} | null)[] | {
|
|
429
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
430
|
+
} | null)[] | {
|
|
431
|
+
[key: string]: string | number | boolean | any | any | null;
|
|
432
|
+
} | null, unknown>>>>>;
|
|
433
|
+
modelSettings: import("zod").ZodOptional<import("zod").ZodType<{
|
|
434
|
+
maxOutputTokens?: number;
|
|
435
|
+
temperature?: number;
|
|
436
|
+
topP?: number;
|
|
437
|
+
topK?: number;
|
|
438
|
+
presencePenalty?: number;
|
|
439
|
+
frequencyPenalty?: number;
|
|
440
|
+
stopSequences?: string[];
|
|
441
|
+
seed?: number;
|
|
442
|
+
maxRetries?: number;
|
|
443
|
+
headers?: Record<string, string | undefined>;
|
|
444
|
+
reasoning?: import("@mastra/core/loop").ReasoningLevel;
|
|
445
|
+
}, unknown, import("zod/v4/core").$ZodTypeInternals<{
|
|
446
|
+
maxOutputTokens?: number;
|
|
447
|
+
temperature?: number;
|
|
448
|
+
topP?: number;
|
|
449
|
+
topK?: number;
|
|
450
|
+
presencePenalty?: number;
|
|
451
|
+
frequencyPenalty?: number;
|
|
452
|
+
stopSequences?: string[];
|
|
453
|
+
seed?: number;
|
|
454
|
+
maxRetries?: number;
|
|
455
|
+
headers?: Record<string, string | undefined>;
|
|
456
|
+
reasoning?: import("@mastra/core/loop").ReasoningLevel;
|
|
457
|
+
}, unknown>>>;
|
|
458
|
+
activeTools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
459
|
+
toolsets: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/agent").ToolsetsInput, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/agent").ToolsetsInput, unknown>>>;
|
|
460
|
+
clientTools: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/agent").ToolsInput, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/agent").ToolsInput, unknown>>>;
|
|
461
|
+
toolChoice: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodEnum<{
|
|
462
|
+
auto: "auto";
|
|
463
|
+
none: "none";
|
|
464
|
+
required: "required";
|
|
465
|
+
}>, import("zod").ZodObject<{
|
|
466
|
+
type: import("zod").ZodLiteral<"tool">;
|
|
467
|
+
toolName: import("zod").ZodString;
|
|
468
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
469
|
+
requireToolApproval: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
470
|
+
scorers: import("zod").ZodOptional<import("zod").ZodType<Record<string, {
|
|
471
|
+
scorer: string;
|
|
472
|
+
sampling?: import("@mastra/core/evals").ScoringSamplingConfig;
|
|
473
|
+
}>, unknown, import("zod/v4/core").$ZodTypeInternals<Record<string, {
|
|
474
|
+
scorer: string;
|
|
475
|
+
sampling?: import("@mastra/core/evals").ScoringSamplingConfig;
|
|
476
|
+
}>, unknown>>>;
|
|
477
|
+
returnScorerData: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
478
|
+
tracingOptions: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
479
|
+
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
480
|
+
requestContextKeys: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
481
|
+
traceId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
482
|
+
parentSpanId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
483
|
+
tags: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
484
|
+
hideInput: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
485
|
+
hideOutput: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
486
|
+
}, import("zod/v4/core").$strip>>;
|
|
487
|
+
output: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/llm").OutputType, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/llm").OutputType, unknown>>>;
|
|
488
|
+
structuredOutput: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/agent").PublicStructuredOutputOptions<Record<string, unknown>>, unknown, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/agent").PublicStructuredOutputOptions<Record<string, unknown>>, unknown>>>;
|
|
489
|
+
untilIdle: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodObject<{
|
|
490
|
+
maxIdleMs: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
491
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
492
|
+
}, import("zod/v4/core").$loose>, import("zod").ZodUnknown> | undefined;
|
|
493
|
+
} & {
|
|
494
|
+
readonly _mastraSchemaRoute: true;
|
|
176
495
|
}, Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
177
496
|
method: "GET";
|
|
178
497
|
path: "/editor/builder/models/available";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-builder.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/editor-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor-builder.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/editor-builder.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWxB,CAAC"}
|
|
@@ -569,8 +569,8 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
|
|
|
569
569
|
} & {
|
|
570
570
|
readonly _mastraSchemaRoute: true;
|
|
571
571
|
}) | (Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
572
|
-
method: "
|
|
573
|
-
path: "/workspaces/:workspaceId/fs/
|
|
572
|
+
method: "DELETE";
|
|
573
|
+
path: "/workspaces/:workspaceId/fs/delete";
|
|
574
574
|
responseType: "json";
|
|
575
575
|
streamFormat?: 'sse' | 'stream';
|
|
576
576
|
sseFlushOnConnect?: boolean;
|
|
@@ -578,13 +578,11 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
|
|
|
578
578
|
workspaceId: string;
|
|
579
579
|
} & {
|
|
580
580
|
path: string;
|
|
581
|
+
recursive?: boolean | undefined;
|
|
582
|
+
force?: boolean | undefined;
|
|
581
583
|
} & import(".").ServerContext): Promise<{
|
|
584
|
+
success: boolean;
|
|
582
585
|
path: string;
|
|
583
|
-
type: "directory" | "file";
|
|
584
|
-
size?: number | undefined;
|
|
585
|
-
createdAt?: string | undefined;
|
|
586
|
-
modifiedAt?: string | undefined;
|
|
587
|
-
mimeType?: string | undefined;
|
|
588
586
|
}>;
|
|
589
587
|
pathParamSchema?: import("zod").ZodType;
|
|
590
588
|
queryParamSchema?: import("zod").ZodType;
|
|
@@ -600,22 +598,17 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
|
|
|
600
598
|
workspaceId: import("zod").ZodString;
|
|
601
599
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
602
600
|
path: import("zod").ZodString;
|
|
601
|
+
recursive: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
602
|
+
force: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
603
603
|
}, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
|
|
604
|
+
success: import("zod").ZodBoolean;
|
|
604
605
|
path: import("zod").ZodString;
|
|
605
|
-
type: import("zod").ZodEnum<{
|
|
606
|
-
directory: "directory";
|
|
607
|
-
file: "file";
|
|
608
|
-
}>;
|
|
609
|
-
size: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
610
|
-
createdAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
611
|
-
modifiedAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
612
|
-
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
613
606
|
}, import("zod/v4/core").$strip>> | undefined;
|
|
614
607
|
} & {
|
|
615
608
|
readonly _mastraSchemaRoute: true;
|
|
616
609
|
}) | (Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
|
|
617
|
-
method: "
|
|
618
|
-
path: "/workspaces/:workspaceId/fs/
|
|
610
|
+
method: "GET";
|
|
611
|
+
path: "/workspaces/:workspaceId/fs/stat";
|
|
619
612
|
responseType: "json";
|
|
620
613
|
streamFormat?: 'sse' | 'stream';
|
|
621
614
|
sseFlushOnConnect?: boolean;
|
|
@@ -623,11 +616,13 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
|
|
|
623
616
|
workspaceId: string;
|
|
624
617
|
} & {
|
|
625
618
|
path: string;
|
|
626
|
-
recursive?: boolean | undefined;
|
|
627
|
-
force?: boolean | undefined;
|
|
628
619
|
} & import(".").ServerContext): Promise<{
|
|
629
|
-
success: boolean;
|
|
630
620
|
path: string;
|
|
621
|
+
type: "directory" | "file";
|
|
622
|
+
size?: number | undefined;
|
|
623
|
+
createdAt?: string | undefined;
|
|
624
|
+
modifiedAt?: string | undefined;
|
|
625
|
+
mimeType?: string | undefined;
|
|
631
626
|
}>;
|
|
632
627
|
pathParamSchema?: import("zod").ZodType;
|
|
633
628
|
queryParamSchema?: import("zod").ZodType;
|
|
@@ -643,11 +638,16 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
|
|
|
643
638
|
workspaceId: import("zod").ZodString;
|
|
644
639
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
645
640
|
path: import("zod").ZodString;
|
|
646
|
-
recursive: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
647
|
-
force: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
648
641
|
}, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
|
|
649
|
-
success: import("zod").ZodBoolean;
|
|
650
642
|
path: import("zod").ZodString;
|
|
643
|
+
type: import("zod").ZodEnum<{
|
|
644
|
+
directory: "directory";
|
|
645
|
+
file: "file";
|
|
646
|
+
}>;
|
|
647
|
+
size: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
648
|
+
createdAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
649
|
+
modifiedAt: import("zod").ZodOptional<import("zod").ZodString>;
|
|
650
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
651
651
|
}, import("zod/v4/core").$strip>> | undefined;
|
|
652
652
|
} & {
|
|
653
653
|
readonly _mastraSchemaRoute: true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as HTTPException } from "./http-exception-CyfxZB6W.js";
|
|
2
|
-
import { o as MASTRA_RESOURCE_ID_KEY } from "./constants-0jFCWoex.js";
|
|
2
|
+
import { o as MASTRA_RESOURCE_ID_KEY, p as isReservedRequestContextKey } from "./constants-0jFCWoex.js";
|
|
3
3
|
import * as authEE from "@mastra/core/auth/ee";
|
|
4
4
|
import { MastraMemory } from "@mastra/core/memory";
|
|
5
5
|
//#region src/server/fga-permissions.ts
|
|
@@ -83,6 +83,18 @@ function parseFilters(filters) {
|
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
+
* Merges a body-supplied requestContext into the trusted server RequestContext.
|
|
87
|
+
* The server context is authoritative: reserved keys are skipped and body values
|
|
88
|
+
* only fill keys the server context has not already set.
|
|
89
|
+
*/
|
|
90
|
+
function mergeBodyRequestContext(serverRequestContext, bodyRequestContext) {
|
|
91
|
+
if (!bodyRequestContext || typeof bodyRequestContext !== "object") return;
|
|
92
|
+
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
93
|
+
if (isReservedRequestContextKey(key)) continue;
|
|
94
|
+
if (serverRequestContext.get(key) === void 0) serverRequestContext.set(key, value);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
86
98
|
* Gets the effective resourceId, preferring the reserved key from requestContext
|
|
87
99
|
* over client-provided values for security.
|
|
88
100
|
*/
|
|
@@ -149,6 +161,6 @@ async function validateRunOwnership(run, effectiveResourceId) {
|
|
|
149
161
|
if (run && effectiveResourceId && run.resourceId && run.resourceId !== effectiveResourceId) throw new HTTPException(403, { message: "Access denied: workflow run belongs to a different resource" });
|
|
150
162
|
}
|
|
151
163
|
//#endregion
|
|
152
|
-
export {
|
|
164
|
+
export { mergeBodyRequestContext as a, requireEffectiveResourceId as c, validateRunOwnership as d, validateThreadOwnership as f, getEffectiveThreadId as i, sanitizeBody as l, getContextResourceId as n, parseFilters as o, MastraFGAPermissions as p, getEffectiveResourceId as r, parsePerPage as s, enforceThreadAccess as t, validateBody as u };
|
|
153
165
|
|
|
154
|
-
//# sourceMappingURL=utils-
|
|
166
|
+
//# sourceMappingURL=utils-KsERfbhc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-KsERfbhc.js","names":[],"sources":["../src/server/fga-permissions.ts","../src/server/handlers/utils.ts"],"sourcesContent":["/**\n * Safe re-export of `MastraFGAPermissions` from `@mastra/core/auth/ee`.\n *\n * Why this shim exists:\n * `MastraFGAPermissions` was introduced in `@mastra/core@1.32.0`. Earlier\n * versions of `@mastra/core` ship `@mastra/core/auth/ee` but do not export\n * this constant. A direct named import (`import { MastraFGAPermissions }\n * from '@mastra/core/auth/ee'`) fails at ESM link time when this version\n * of `@mastra/server` is paired with `@mastra/core < 1.32.0`, taking the\n * entire user bundle down before any code runs.\n *\n * A namespace import tolerates missing names — `ns.MissingExport` is just\n * `undefined`, no link-time error. We then expose the permission map.\n *\n * Fallback values:\n * If the consuming `@mastra/core` does not export `MastraFGAPermissions`,\n * we substitute a hardcoded map of the canonical permission strings used\n * by routes in `@mastra/server`. This preserves the explicit RBAC\n * permission overrides those routes already had as string literals in\n * `@mastra/server@1.31.0` (e.g. `requiresPermission: \"agents:execute\"`\n * on `/v1/responses`). Without this fallback, `requiresPermission` would\n * be `undefined` on old core and the auth layer would derive the wrong\n * permission from the route path (e.g. `v1:write` instead of\n * `agents:execute`), breaking RBAC users who upgrade `@mastra/server`\n * but stay on `@mastra/core@1.31.0`.\n *\n * Once the consuming `@mastra/core` is on `1.32.0+` the values are real\n * and behaviour is identical to a direct named import.\n */\n\nimport * as authEE from '@mastra/core/auth/ee';\n\n// Canonical strings for the FGA permission keys actually referenced by\n// `@mastra/server` source. Mirrors `MastraFGAPermissions` in\n// `@mastra/core@1.32.0+` for these specific keys, and matches the string\n// literals previously hardcoded on the same routes in `@mastra/server@1.31.0`.\nconst FALLBACK_PERMISSIONS = {\n AGENTS_CREATE: 'agents:create',\n AGENTS_DELETE: 'agents:delete',\n AGENTS_EXECUTE: 'agents:execute',\n AGENTS_READ: 'agents:read',\n MEMORY_DELETE: 'memory:delete',\n MEMORY_READ: 'memory:read',\n MEMORY_WRITE: 'memory:write',\n TOOLS_EXECUTE: 'tools:execute',\n TOOLS_READ: 'tools:read',\n STORED_WORKFLOWS_READ: 'stored-workflows:read',\n STORED_WORKFLOWS_WRITE: 'stored-workflows:write',\n WORKFLOWS_EXECUTE: 'workflows:execute',\n WORKFLOWS_READ: 'workflows:read',\n} as const;\n\nconst realPermissions = (authEE as any).MastraFGAPermissions;\n\n// Typed as `any` on purpose: consumers of `@mastra/server` may run their\n// typecheck against a `@mastra/core` that doesn't export `MastraFGAPermissions`\n// (anything < 1.32.0). Pinning to the real type would push that name into the\n// emitted `.d.ts` and break downstream typecheck. `any` lets the property\n// accesses (`MastraFGAPermissions.AGENTS_READ`) flow through cleanly on every\n// supported core.\nexport const MastraFGAPermissions: any =\n realPermissions && Object.keys(realPermissions).length > 0 ? realPermissions : FALLBACK_PERMISSIONS;\n","import type { MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\nimport { MastraMemory } from '@mastra/core/memory';\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY, isReservedRequestContextKey } from '../constants';\nimport { MastraFGAPermissions } from '../fga-permissions';\nimport { HTTPException } from '../http-exception';\n\n// Validation helper\nexport function validateBody(body: Record<string, unknown>) {\n const errorResponse = Object.entries(body).reduce<Record<string, string>>((acc, [key, value]) => {\n if (!value) {\n acc[key] = `Argument \"${key}\" is required`;\n }\n return acc;\n }, {});\n\n if (Object.keys(errorResponse).length > 0) {\n throw new HTTPException(400, { message: Object.values(errorResponse)[0] });\n }\n}\n\n/**\n * sanitizes the body by removing disallowed keys.\n * @param body body to sanitize\n * @param disallowedKeys keys to remove from the body\n */\nexport function sanitizeBody(body: Record<string, unknown>, disallowedKeys: string[]) {\n for (const key of disallowedKeys) {\n if (key in body) {\n delete body[key];\n }\n }\n}\n\nexport function parsePerPage(\n value: string | undefined,\n defaultValue: number = 100,\n max: number = 1000,\n): number | false {\n const normalized = (value || '').trim().toLowerCase();\n // Handle explicit false to bypass pagination\n if (normalized === 'false') {\n return false;\n }\n const parsed = parseInt(value || String(defaultValue), 10);\n if (isNaN(parsed)) return defaultValue;\n return Math.min(max, Math.max(1, parsed));\n}\n\n/**\n * Parses filter query parameters into a key-value object.\n */\nexport function parseFilters(filters: string | string[] | undefined): Record<string, string> | undefined {\n if (!filters) return undefined;\n\n return Object.fromEntries(\n (Array.isArray(filters) ? filters : [filters]).map((attr: string) => {\n const [key, ...valueParts] = attr.split(':');\n const value = valueParts.join(':'); // ✅ Handles colons in values\n return [key, value];\n }),\n );\n}\n\n/**\n * Merges a body-supplied requestContext into the trusted server RequestContext.\n * The server context is authoritative: reserved keys are skipped and body values\n * only fill keys the server context has not already set.\n */\nexport function mergeBodyRequestContext(serverRequestContext: RequestContext, bodyRequestContext: unknown): void {\n if (!bodyRequestContext || typeof bodyRequestContext !== 'object') {\n return;\n }\n\n for (const [key, value] of Object.entries(bodyRequestContext)) {\n if (isReservedRequestContextKey(key)) continue;\n if (serverRequestContext.get(key) === undefined) {\n serverRequestContext.set(key, value);\n }\n }\n}\n\n// ============================================================================\n// Authorization Utilities\n// ============================================================================\n\n/**\n * Gets the effective resourceId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveResourceId(\n requestContext: RequestContext | undefined,\n clientResourceId: string | undefined,\n): string | undefined {\n const contextResourceId = requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n return contextResourceId || clientResourceId;\n}\n\n/**\n * Returns the resource id resolved from the request context alone (set via\n * `mapUserToResourceId` or the `x-resource-id` header), ignoring any\n * client-provided value. Its presence indicates a resource-scoped caller;\n * its absence indicates a privileged/service context.\n */\nexport function getContextResourceId(requestContext: RequestContext | undefined): string | undefined {\n return requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n}\n\n/**\n * Ensures a memory request has a resolvable resource ID. The body's\n * `memory.resource` is optional so authenticated setups can rely on the\n * server-derived resource ID (MASTRA_RESOURCE_ID_KEY set via mapUserToResourceId).\n * When neither the body nor the request context provides one, reject with a\n * clear 400 instead of failing deep inside agent execution.\n */\nexport function requireEffectiveResourceId(\n effectiveResourceId: string | undefined,\n): asserts effectiveResourceId is string {\n if (!effectiveResourceId) {\n throw new HTTPException(400, {\n message:\n 'A resource ID is required when using memory. Provide memory.resource in the request body, or configure server auth with mapUserToResourceId to derive it from the authenticated user.',\n });\n }\n}\n\n/**\n * Gets the effective threadId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveThreadId(\n requestContext: RequestContext | undefined,\n clientThreadId: string | undefined,\n): string | undefined {\n const contextThreadId = requestContext?.get(MASTRA_THREAD_ID_KEY) as string | undefined;\n return contextThreadId || clientThreadId;\n}\n\n/**\n * Validates that a thread belongs to the specified resourceId.\n * Throws 403 if the thread exists but belongs to a different resource.\n * Threads with no resourceId are accessible to all (shared threads).\n */\nexport async function validateThreadOwnership(\n thread: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (thread && effectiveResourceId && thread.resourceId && thread.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: thread belongs to a different resource' });\n }\n}\n\n/**\n * Validates both coarse resource ownership and fine-grained thread access.\n * FGA enforcement is a no-op when no FGA provider is configured.\n */\nexport async function enforceThreadAccess({\n mastra,\n requestContext,\n threadId,\n thread,\n effectiveResourceId,\n permission = MastraFGAPermissions.MEMORY_READ,\n}: {\n mastra: any;\n requestContext?: RequestContext;\n threadId: string;\n thread?: { resourceId?: string | null } | null;\n effectiveResourceId?: string;\n permission?: MastraFGAPermissionInput;\n}): Promise<void> {\n await validateThreadOwnership(thread, effectiveResourceId);\n\n const fgaProvider = mastra?.getServer?.()?.fga;\n if (!fgaProvider) {\n return;\n }\n\n const user = requestContext?.get('user');\n if (!user || typeof user !== 'object') {\n throw new HTTPException(403, { message: 'FGA authorization denied: authenticated user is required' });\n }\n\n await MastraMemory.checkThreadFGA({\n mastra,\n user: user as { id: string; [key: string]: unknown },\n threadId,\n resourceId: thread?.resourceId ?? effectiveResourceId,\n requestContext,\n permission,\n });\n}\n\n/**\n * Validates that a workflow run belongs to the specified resourceId.\n * Throws 403 if the run exists but belongs to a different resource.\n */\nexport async function validateRunOwnership(\n run: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (run && effectiveResourceId && run.resourceId && run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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EAClC;EACA;CACF,CAAC;AACH;;;;;AAMA,eAAsB,qBACpB,KACA,qBACe;CACf,IAAI,OAAO,uBAAuB,IAAI,cAAc,IAAI,eAAe,qBACrE,MAAM,IAAI,cAAc,KAAK,EAAE,SAAS,8DAA8D,CAAC;AAE3G"}
|
|
@@ -85,6 +85,18 @@ function parseFilters(filters) {
|
|
|
85
85
|
}));
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
+
* Merges a body-supplied requestContext into the trusted server RequestContext.
|
|
89
|
+
* The server context is authoritative: reserved keys are skipped and body values
|
|
90
|
+
* only fill keys the server context has not already set.
|
|
91
|
+
*/
|
|
92
|
+
function mergeBodyRequestContext(serverRequestContext, bodyRequestContext) {
|
|
93
|
+
if (!bodyRequestContext || typeof bodyRequestContext !== "object") return;
|
|
94
|
+
for (const [key, value] of Object.entries(bodyRequestContext)) {
|
|
95
|
+
if (require_constants.isReservedRequestContextKey(key)) continue;
|
|
96
|
+
if (serverRequestContext.get(key) === void 0) serverRequestContext.set(key, value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
88
100
|
* Gets the effective resourceId, preferring the reserved key from requestContext
|
|
89
101
|
* over client-provided values for security.
|
|
90
102
|
*/
|
|
@@ -181,6 +193,12 @@ Object.defineProperty(exports, "getEffectiveThreadId", {
|
|
|
181
193
|
return getEffectiveThreadId;
|
|
182
194
|
}
|
|
183
195
|
});
|
|
196
|
+
Object.defineProperty(exports, "mergeBodyRequestContext", {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: function() {
|
|
199
|
+
return mergeBodyRequestContext;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
184
202
|
Object.defineProperty(exports, "parseFilters", {
|
|
185
203
|
enumerable: true,
|
|
186
204
|
get: function() {
|
|
@@ -224,4 +242,4 @@ Object.defineProperty(exports, "validateThreadOwnership", {
|
|
|
224
242
|
}
|
|
225
243
|
});
|
|
226
244
|
|
|
227
|
-
//# sourceMappingURL=utils-
|
|
245
|
+
//# sourceMappingURL=utils-aIu3gkhJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-aIu3gkhJ.cjs","names":["authEE","HTTPException","isReservedRequestContextKey","MASTRA_RESOURCE_ID_KEY","MastraMemory"],"sources":["../src/server/fga-permissions.ts","../src/server/handlers/utils.ts"],"sourcesContent":["/**\n * Safe re-export of `MastraFGAPermissions` from `@mastra/core/auth/ee`.\n *\n * Why this shim exists:\n * `MastraFGAPermissions` was introduced in `@mastra/core@1.32.0`. Earlier\n * versions of `@mastra/core` ship `@mastra/core/auth/ee` but do not export\n * this constant. A direct named import (`import { MastraFGAPermissions }\n * from '@mastra/core/auth/ee'`) fails at ESM link time when this version\n * of `@mastra/server` is paired with `@mastra/core < 1.32.0`, taking the\n * entire user bundle down before any code runs.\n *\n * A namespace import tolerates missing names — `ns.MissingExport` is just\n * `undefined`, no link-time error. We then expose the permission map.\n *\n * Fallback values:\n * If the consuming `@mastra/core` does not export `MastraFGAPermissions`,\n * we substitute a hardcoded map of the canonical permission strings used\n * by routes in `@mastra/server`. This preserves the explicit RBAC\n * permission overrides those routes already had as string literals in\n * `@mastra/server@1.31.0` (e.g. `requiresPermission: \"agents:execute\"`\n * on `/v1/responses`). Without this fallback, `requiresPermission` would\n * be `undefined` on old core and the auth layer would derive the wrong\n * permission from the route path (e.g. `v1:write` instead of\n * `agents:execute`), breaking RBAC users who upgrade `@mastra/server`\n * but stay on `@mastra/core@1.31.0`.\n *\n * Once the consuming `@mastra/core` is on `1.32.0+` the values are real\n * and behaviour is identical to a direct named import.\n */\n\nimport * as authEE from '@mastra/core/auth/ee';\n\n// Canonical strings for the FGA permission keys actually referenced by\n// `@mastra/server` source. Mirrors `MastraFGAPermissions` in\n// `@mastra/core@1.32.0+` for these specific keys, and matches the string\n// literals previously hardcoded on the same routes in `@mastra/server@1.31.0`.\nconst FALLBACK_PERMISSIONS = {\n AGENTS_CREATE: 'agents:create',\n AGENTS_DELETE: 'agents:delete',\n AGENTS_EXECUTE: 'agents:execute',\n AGENTS_READ: 'agents:read',\n MEMORY_DELETE: 'memory:delete',\n MEMORY_READ: 'memory:read',\n MEMORY_WRITE: 'memory:write',\n TOOLS_EXECUTE: 'tools:execute',\n TOOLS_READ: 'tools:read',\n STORED_WORKFLOWS_READ: 'stored-workflows:read',\n STORED_WORKFLOWS_WRITE: 'stored-workflows:write',\n WORKFLOWS_EXECUTE: 'workflows:execute',\n WORKFLOWS_READ: 'workflows:read',\n} as const;\n\nconst realPermissions = (authEE as any).MastraFGAPermissions;\n\n// Typed as `any` on purpose: consumers of `@mastra/server` may run their\n// typecheck against a `@mastra/core` that doesn't export `MastraFGAPermissions`\n// (anything < 1.32.0). Pinning to the real type would push that name into the\n// emitted `.d.ts` and break downstream typecheck. `any` lets the property\n// accesses (`MastraFGAPermissions.AGENTS_READ`) flow through cleanly on every\n// supported core.\nexport const MastraFGAPermissions: any =\n realPermissions && Object.keys(realPermissions).length > 0 ? realPermissions : FALLBACK_PERMISSIONS;\n","import type { MastraFGAPermissionInput } from '@mastra/core/auth/ee';\nimport type { RequestContext } from '@mastra/core/di';\nimport { MastraMemory } from '@mastra/core/memory';\nimport { MASTRA_RESOURCE_ID_KEY, MASTRA_THREAD_ID_KEY, isReservedRequestContextKey } from '../constants';\nimport { MastraFGAPermissions } from '../fga-permissions';\nimport { HTTPException } from '../http-exception';\n\n// Validation helper\nexport function validateBody(body: Record<string, unknown>) {\n const errorResponse = Object.entries(body).reduce<Record<string, string>>((acc, [key, value]) => {\n if (!value) {\n acc[key] = `Argument \"${key}\" is required`;\n }\n return acc;\n }, {});\n\n if (Object.keys(errorResponse).length > 0) {\n throw new HTTPException(400, { message: Object.values(errorResponse)[0] });\n }\n}\n\n/**\n * sanitizes the body by removing disallowed keys.\n * @param body body to sanitize\n * @param disallowedKeys keys to remove from the body\n */\nexport function sanitizeBody(body: Record<string, unknown>, disallowedKeys: string[]) {\n for (const key of disallowedKeys) {\n if (key in body) {\n delete body[key];\n }\n }\n}\n\nexport function parsePerPage(\n value: string | undefined,\n defaultValue: number = 100,\n max: number = 1000,\n): number | false {\n const normalized = (value || '').trim().toLowerCase();\n // Handle explicit false to bypass pagination\n if (normalized === 'false') {\n return false;\n }\n const parsed = parseInt(value || String(defaultValue), 10);\n if (isNaN(parsed)) return defaultValue;\n return Math.min(max, Math.max(1, parsed));\n}\n\n/**\n * Parses filter query parameters into a key-value object.\n */\nexport function parseFilters(filters: string | string[] | undefined): Record<string, string> | undefined {\n if (!filters) return undefined;\n\n return Object.fromEntries(\n (Array.isArray(filters) ? filters : [filters]).map((attr: string) => {\n const [key, ...valueParts] = attr.split(':');\n const value = valueParts.join(':'); // ✅ Handles colons in values\n return [key, value];\n }),\n );\n}\n\n/**\n * Merges a body-supplied requestContext into the trusted server RequestContext.\n * The server context is authoritative: reserved keys are skipped and body values\n * only fill keys the server context has not already set.\n */\nexport function mergeBodyRequestContext(serverRequestContext: RequestContext, bodyRequestContext: unknown): void {\n if (!bodyRequestContext || typeof bodyRequestContext !== 'object') {\n return;\n }\n\n for (const [key, value] of Object.entries(bodyRequestContext)) {\n if (isReservedRequestContextKey(key)) continue;\n if (serverRequestContext.get(key) === undefined) {\n serverRequestContext.set(key, value);\n }\n }\n}\n\n// ============================================================================\n// Authorization Utilities\n// ============================================================================\n\n/**\n * Gets the effective resourceId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveResourceId(\n requestContext: RequestContext | undefined,\n clientResourceId: string | undefined,\n): string | undefined {\n const contextResourceId = requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n return contextResourceId || clientResourceId;\n}\n\n/**\n * Returns the resource id resolved from the request context alone (set via\n * `mapUserToResourceId` or the `x-resource-id` header), ignoring any\n * client-provided value. Its presence indicates a resource-scoped caller;\n * its absence indicates a privileged/service context.\n */\nexport function getContextResourceId(requestContext: RequestContext | undefined): string | undefined {\n return requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n}\n\n/**\n * Ensures a memory request has a resolvable resource ID. The body's\n * `memory.resource` is optional so authenticated setups can rely on the\n * server-derived resource ID (MASTRA_RESOURCE_ID_KEY set via mapUserToResourceId).\n * When neither the body nor the request context provides one, reject with a\n * clear 400 instead of failing deep inside agent execution.\n */\nexport function requireEffectiveResourceId(\n effectiveResourceId: string | undefined,\n): asserts effectiveResourceId is string {\n if (!effectiveResourceId) {\n throw new HTTPException(400, {\n message:\n 'A resource ID is required when using memory. Provide memory.resource in the request body, or configure server auth with mapUserToResourceId to derive it from the authenticated user.',\n });\n }\n}\n\n/**\n * Gets the effective threadId, preferring the reserved key from requestContext\n * over client-provided values for security.\n */\nexport function getEffectiveThreadId(\n requestContext: RequestContext | undefined,\n clientThreadId: string | undefined,\n): string | undefined {\n const contextThreadId = requestContext?.get(MASTRA_THREAD_ID_KEY) as string | undefined;\n return contextThreadId || clientThreadId;\n}\n\n/**\n * Validates that a thread belongs to the specified resourceId.\n * Throws 403 if the thread exists but belongs to a different resource.\n * Threads with no resourceId are accessible to all (shared threads).\n */\nexport async function validateThreadOwnership(\n thread: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (thread && effectiveResourceId && thread.resourceId && thread.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: thread belongs to a different resource' });\n }\n}\n\n/**\n * Validates both coarse resource ownership and fine-grained thread access.\n * FGA enforcement is a no-op when no FGA provider is configured.\n */\nexport async function enforceThreadAccess({\n mastra,\n requestContext,\n threadId,\n thread,\n effectiveResourceId,\n permission = MastraFGAPermissions.MEMORY_READ,\n}: {\n mastra: any;\n requestContext?: RequestContext;\n threadId: string;\n thread?: { resourceId?: string | null } | null;\n effectiveResourceId?: string;\n permission?: MastraFGAPermissionInput;\n}): Promise<void> {\n await validateThreadOwnership(thread, effectiveResourceId);\n\n const fgaProvider = mastra?.getServer?.()?.fga;\n if (!fgaProvider) {\n return;\n }\n\n const user = requestContext?.get('user');\n if (!user || typeof user !== 'object') {\n throw new HTTPException(403, { message: 'FGA authorization denied: authenticated user is required' });\n }\n\n await MastraMemory.checkThreadFGA({\n mastra,\n user: user as { id: string; [key: string]: unknown },\n threadId,\n resourceId: thread?.resourceId ?? effectiveResourceId,\n requestContext,\n permission,\n });\n}\n\n/**\n * Validates that a workflow run belongs to the specified resourceId.\n * Throws 403 if the run exists but belongs to a different resource.\n */\nexport async function validateRunOwnership(\n run: { resourceId?: string | null } | null | undefined,\n effectiveResourceId: string | undefined,\n): Promise<void> {\n if (run && effectiveResourceId && run.resourceId && run.resourceId !== effectiveResourceId) {\n throw new HTTPException(403, { message: 'Access denied: workflow run belongs to a different resource' });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,uBAAuB;CAC3B,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,aAAa;CACb,eAAe;CACf,aAAa;CACb,cAAc;CACd,eAAe;CACf,YAAY;CACZ,uBAAuB;CACvB,wBAAwB;CACxB,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAM,kBAAmBA,qBAAe;AAQxC,MAAa,uBACX,mBAAmB,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS,IAAI,kBAAkB;;;ACrDjF,SAAgB,aAAa,MAA+B;CAC1D,MAAM,gBAAgB,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAgC,KAAK,CAAC,KAAK,WAAW;EAC/F,IAAI,CAAC,OACH,IAAI,OAAO,aAAa,IAAI;EAE9B,OAAO;CACT,GAAG,CAAC,CAAC;CAEL,IAAI,OAAO,KAAK,aAAa,CAAC,CAAC,SAAS,GACtC,MAAM,IAAIC,uBAAAA,cAAc,KAAK,EAAE,SAAS,OAAO,OAAO,aAAa,CAAC,CAAC,GAAG,CAAC;AAE7E;;;;;;AAOA,SAAgB,aAAa,MAA+B,gBAA0B;CACpF,KAAK,MAAM,OAAO,gBAChB,IAAI,OAAO,MACT,OAAO,KAAK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