@mastra/server 1.83.0-alpha.3 → 1.83.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +0 -6
  2. package/dist/{agent-builder-73cAYGts.cjs → agent-builder-C4H6DCxX.cjs} +2 -2
  3. package/dist/{agent-builder-73cAYGts.cjs.map → agent-builder-C4H6DCxX.cjs.map} +1 -1
  4. package/dist/{agent-builder-pQaGXyFz.js → agent-builder-CM3ahyKi.js} +2 -2
  5. package/dist/{agent-builder-pQaGXyFz.js.map → agent-builder-CM3ahyKi.js.map} +1 -1
  6. package/dist/{api-schema-manifest-CDJEhBm9.cjs → api-schema-manifest-BxJovXGA.cjs} +2 -2
  7. package/dist/{api-schema-manifest-CDJEhBm9.cjs.map → api-schema-manifest-BxJovXGA.cjs.map} +1 -1
  8. package/dist/{api-schema-manifest-DvyXrvvK.js → api-schema-manifest-DyPtNiCm.js} +2 -2
  9. package/dist/{api-schema-manifest-DvyXrvvK.js.map → api-schema-manifest-DyPtNiCm.js.map} +1 -1
  10. package/dist/{dist-Dhi6UZwv.cjs → dist-CeTjOkVU.cjs} +1 -1
  11. package/dist/{dist-DIeKEdwH.cjs → dist-ChFEVV0z.cjs} +56 -20
  12. package/dist/{dist-DIeKEdwH.cjs.map → dist-ChFEVV0z.cjs.map} +1 -1
  13. package/dist/dist-Dd4aPQrP.js +1 -0
  14. package/dist/{dist-CXxA_Jnu.js → dist-cCQ5-Jqn.js} +56 -20
  15. package/dist/{dist-CXxA_Jnu.js.map → dist-cCQ5-Jqn.js.map} +1 -1
  16. package/dist/docs/SKILL.md +1 -1
  17. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  18. package/dist/{helpers-B29a1nM3.js → helpers-C3dENOkQ.js} +183 -53
  19. package/dist/helpers-C3dENOkQ.js.map +1 -0
  20. package/dist/{helpers-CylvUIZm.cjs → helpers-D7d2R3LL.cjs} +188 -52
  21. package/dist/helpers-D7d2R3LL.cjs.map +1 -0
  22. package/dist/{observability-Cl3qZKTD.js → observability-Bc1UruQ9.js} +2 -2
  23. package/dist/{observability-Cl3qZKTD.js.map → observability-Bc1UruQ9.js.map} +1 -1
  24. package/dist/{observability-BB0DeGo4.cjs → observability-CsgWy_Jd.cjs} +2 -2
  25. package/dist/{observability-BB0DeGo4.cjs.map → observability-CsgWy_Jd.cjs.map} +1 -1
  26. package/dist/{observability-new-endpoints-DugFsWBU.cjs → observability-new-endpoints-sgqxTIAg.cjs} +8 -4
  27. package/dist/observability-new-endpoints-sgqxTIAg.cjs.map +1 -0
  28. package/dist/{observability-new-endpoints-qE2NutZ1.js → observability-new-endpoints-ynMOfgxs.js} +9 -5
  29. package/dist/observability-new-endpoints-ynMOfgxs.js.map +1 -0
  30. package/dist/{probe-image-size-C2efNs3R.cjs → probe-image-size-BfNwxl51.cjs} +2 -2
  31. package/dist/{probe-image-size-C2efNs3R.cjs.map → probe-image-size-BfNwxl51.cjs.map} +1 -1
  32. package/dist/{probe-image-size-CO02-278.js → probe-image-size-DLmoo3Jh.js} +2 -2
  33. package/dist/{probe-image-size-CO02-278.js.map → probe-image-size-DLmoo3Jh.js.map} +1 -1
  34. package/dist/{routes-B9pnPvQx.cjs → routes-DTAeTr8M.cjs} +4 -4
  35. package/dist/{routes-B9pnPvQx.cjs.map → routes-DTAeTr8M.cjs.map} +1 -1
  36. package/dist/{routes-CHctVPfy.js → routes-P_uCi0AL.js} +4 -4
  37. package/dist/{routes-CHctVPfy.js.map → routes-P_uCi0AL.js.map} +1 -1
  38. package/dist/server/auth/custom-route-matcher.d.ts +54 -0
  39. package/dist/server/auth/custom-route-matcher.d.ts.map +1 -0
  40. package/dist/server/auth/helpers.d.ts +14 -5
  41. package/dist/server/auth/helpers.d.ts.map +1 -1
  42. package/dist/server/auth/index.cjs +1 -1
  43. package/dist/server/auth/index.js +1 -1
  44. package/dist/server/auth/path-pattern.d.ts.map +1 -1
  45. package/dist/server/handlers/agent-builder.cjs +1 -1
  46. package/dist/server/handlers/agent-builder.js +1 -1
  47. package/dist/server/handlers/auth.cjs +1 -1
  48. package/dist/server/handlers/auth.js +1 -1
  49. package/dist/server/handlers/datasets.cjs +22 -3
  50. package/dist/server/handlers/datasets.cjs.map +1 -1
  51. package/dist/server/handlers/datasets.d.ts +8 -2
  52. package/dist/server/handlers/datasets.d.ts.map +1 -1
  53. package/dist/server/handlers/datasets.js +22 -3
  54. package/dist/server/handlers/datasets.js.map +1 -1
  55. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  56. package/dist/server/handlers/observability-new-endpoints.d.ts +16 -0
  57. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  58. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  59. package/dist/server/handlers/observability-shared.cjs +9 -0
  60. package/dist/server/handlers/observability-shared.cjs.map +1 -1
  61. package/dist/server/handlers/observability-shared.d.ts +4 -0
  62. package/dist/server/handlers/observability-shared.d.ts.map +1 -1
  63. package/dist/server/handlers/observability-shared.js +9 -1
  64. package/dist/server/handlers/observability-shared.js.map +1 -1
  65. package/dist/server/handlers/observability.cjs +2 -2
  66. package/dist/server/handlers/observability.js +2 -2
  67. package/dist/server/handlers/system.cjs +2 -2
  68. package/dist/server/handlers/system.d.ts +4 -0
  69. package/dist/server/handlers/system.d.ts.map +1 -1
  70. package/dist/server/handlers/system.js +2 -2
  71. package/dist/server/handlers.cjs +2 -2
  72. package/dist/server/handlers.js +2 -2
  73. package/dist/server/schemas/index.cjs +1 -1
  74. package/dist/server/schemas/index.js +1 -1
  75. package/dist/server/schemas/system.d.ts +4 -0
  76. package/dist/server/schemas/system.d.ts.map +1 -1
  77. package/dist/server/server-adapter/index.cjs +68 -4
  78. package/dist/server/server-adapter/index.cjs.map +1 -1
  79. package/dist/server/server-adapter/index.d.ts +34 -0
  80. package/dist/server/server-adapter/index.d.ts.map +1 -1
  81. package/dist/server/server-adapter/index.js +68 -4
  82. package/dist/server/server-adapter/index.js.map +1 -1
  83. package/dist/server/server-adapter/routes/conversations.d.ts +3 -3
  84. package/dist/server/server-adapter/routes/datasets.d.ts +8 -2
  85. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  86. package/dist/server/server-adapter/routes/observability.d.ts +8 -0
  87. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  88. package/dist/server/server-adapter/routes/system.d.ts +4 -0
  89. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  90. package/dist/server/server-adapter/routes/workspace.d.ts +23 -23
  91. package/dist/{system-eeBLPCu1.cjs → system-CpGJI36-.cjs} +3 -1
  92. package/dist/system-CpGJI36-.cjs.map +1 -0
  93. package/dist/{system-DT0pqJSk.js → system-D5hurfjV.js} +3 -1
  94. package/dist/system-D5hurfjV.js.map +1 -0
  95. package/package.json +3 -4
  96. package/dist/dist-CQGBYe6U.js +0 -1
  97. package/dist/helpers-B29a1nM3.js.map +0 -1
  98. package/dist/helpers-CylvUIZm.cjs.map +0 -1
  99. package/dist/observability-new-endpoints-DugFsWBU.cjs.map +0 -1
  100. package/dist/observability-new-endpoints-qE2NutZ1.js.map +0 -1
  101. package/dist/system-DT0pqJSk.js.map +0 -1
  102. package/dist/system-eeBLPCu1.cjs.map +0 -1
@@ -114,13 +114,13 @@ export declare const CONVERSATIONS_ROUTES: readonly [Omit<import("@mastra/core/s
114
114
  role: "assistant" | "system" | "user";
115
115
  status: "completed";
116
116
  content: ({
117
- type: "input_text";
118
- text: string;
119
- } | {
120
117
  type: "output_text";
121
118
  text: string;
122
119
  annotations?: unknown[] | undefined;
123
120
  logprobs?: unknown[] | undefined;
121
+ } | {
122
+ type: "input_text";
123
+ text: string;
124
124
  })[];
125
125
  } | {
126
126
  id: string;
@@ -4945,7 +4945,10 @@ export declare const DATASETS_ROUTES: readonly [Omit<import("@mastra/core/server
4945
4945
  sseFlushOnConnect?: boolean;
4946
4946
  handler(params: import(".").InferParams<import("zod").ZodObject<{
4947
4947
  datasetId: import("zod").ZodString;
4948
- }, import("zod/v4/core").$strip>, undefined, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
4948
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4949
+ organizationId: import("zod").ZodOptional<import("zod").ZodString>;
4950
+ projectId: import("zod").ZodOptional<import("zod").ZodString>;
4951
+ }, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
4949
4952
  experimentIds: import("zod").ZodArray<import("zod").ZodString>;
4950
4953
  baselineId: import("zod").ZodOptional<import("zod").ZodString>;
4951
4954
  }, import("zod/v4/core").$strip>, import("zod").ZodPipe<import("zod").ZodObject<{
@@ -4981,7 +4984,10 @@ export declare const DATASETS_ROUTES: readonly [Omit<import("@mastra/core/server
4981
4984
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
4982
4985
  readonly __schemas?: import(".").RouteSchemas<import("zod").ZodObject<{
4983
4986
  datasetId: import("zod").ZodString;
4984
- }, import("zod/v4/core").$strip>, undefined, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
4987
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
4988
+ organizationId: import("zod").ZodOptional<import("zod").ZodString>;
4989
+ projectId: import("zod").ZodOptional<import("zod").ZodString>;
4990
+ }, import("zod/v4/core").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
4985
4991
  experimentIds: import("zod").ZodArray<import("zod").ZodString>;
4986
4992
  baselineId: import("zod").ZodOptional<import("zod").ZodString>;
4987
4993
  }, import("zod/v4/core").$strip>, import("zod").ZodPipe<import("zod").ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/datasets.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;EAgDlB,CAAC"}
@@ -274,6 +274,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
274
274
  streamFormat?: 'sse' | 'stream';
275
275
  sseFlushOnConnect?: boolean;
276
276
  handler(params: {
277
+ textSearch?: string | undefined;
277
278
  timeRange: {
278
279
  from: string;
279
280
  to: string;
@@ -409,6 +410,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
409
410
  fga?: import("@mastra/core/auth").FGARouteConfig;
410
411
  onValidationError?: import("@mastra/core/server").ValidationErrorHook;
411
412
  readonly __schemas?: import(".").RouteSchemas<undefined, undefined, import("zod").ZodPreprocess<import("zod").ZodObject<{
413
+ textSearch: import("zod").ZodOptional<import("zod").ZodString>;
412
414
  timeRange: import("zod").ZodObject<{
413
415
  from: import("zod").ZodString;
414
416
  to: import("zod").ZodString;
@@ -1078,6 +1080,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
1078
1080
  to: string;
1079
1081
  };
1080
1082
  where?: import("@mastra/core/storage").TraceQueryScalarPredicate | undefined;
1083
+ textSearch?: string | undefined;
1081
1084
  orderBy: {
1082
1085
  field: "endedAt" | "startedAt" | "timeToFirstChunkMs" | "timeToFirstTokenMs";
1083
1086
  direction: "asc" | "desc";
@@ -1151,6 +1154,7 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
1151
1154
  to: import("zod").ZodString;
1152
1155
  }, import("zod/v4/core").$strict>;
1153
1156
  where: import("zod").ZodOptional<import("zod").ZodType<import("@mastra/core/storage").TraceQueryScalarPredicate, import("@mastra/core/storage").TraceQueryScalarPredicate, import("zod/v4/core").$ZodTypeInternals<import("@mastra/core/storage").TraceQueryScalarPredicate, import("@mastra/core/storage").TraceQueryScalarPredicate>>>;
1157
+ textSearch: import("zod").ZodOptional<import("zod").ZodString>;
1154
1158
  orderBy: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
1155
1159
  field: import("zod").ZodEnum<{
1156
1160
  endedAt: "endedAt";
@@ -4432,6 +4436,8 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
4432
4436
  };
4433
4437
  deltaPolling: boolean;
4434
4438
  traceQuery: boolean;
4439
+ traceQueryTextSearch: boolean;
4440
+ spanQueryTextSearch: boolean;
4435
4441
  traceQueryRootDuration: boolean;
4436
4442
  traceQueryContextIds: boolean;
4437
4443
  traceQueryContextFields: boolean;
@@ -4483,6 +4489,8 @@ export declare const OBSERVABILITY_ROUTES: readonly [import(".").ServerRoute, Om
4483
4489
  }, import("zod/v4/core").$strip>;
4484
4490
  deltaPolling: import("zod").ZodBoolean;
4485
4491
  traceQuery: import("zod").ZodBoolean;
4492
+ traceQueryTextSearch: import("zod").ZodDefault<import("zod").ZodBoolean>;
4493
+ spanQueryTextSearch: import("zod").ZodDefault<import("zod").ZodBoolean>;
4486
4494
  traceQueryRootDuration: import("zod").ZodBoolean;
4487
4495
  traceQueryContextIds: import("zod").ZodBoolean;
4488
4496
  traceQueryContextFields: import("zod").ZodBoolean;
@@ -1 +1 @@
1
- {"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/observability.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDvB,CAAC"}
@@ -46,6 +46,8 @@ export declare const SYSTEM_ROUTES: readonly [Omit<import("@mastra/core/server")
46
46
  };
47
47
  deltaPolling: boolean;
48
48
  traceQuery: boolean;
49
+ traceQueryTextSearch: boolean;
50
+ spanQueryTextSearch: boolean;
49
51
  traceQueryRootDuration: boolean;
50
52
  traceQueryContextIds: boolean;
51
53
  traceQueryContextFields: boolean;
@@ -131,6 +133,8 @@ export declare const SYSTEM_ROUTES: readonly [Omit<import("@mastra/core/server")
131
133
  }, import("zod/v4/core").$strip>;
132
134
  deltaPolling: import("zod").ZodBoolean;
133
135
  traceQuery: import("zod").ZodBoolean;
136
+ traceQueryTextSearch: import("zod").ZodDefault<import("zod").ZodBoolean>;
137
+ spanQueryTextSearch: import("zod").ZodDefault<import("zod").ZodBoolean>;
134
138
  traceQueryRootDuration: import("zod").ZodBoolean;
135
139
  traceQueryContextIds: import("zod").ZodBoolean;
136
140
  traceQueryContextFields: import("zod").ZodBoolean;
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/system.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6D,CAAC"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/system.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6D,CAAC"}
@@ -573,8 +573,8 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
573
573
  } & {
574
574
  readonly _mastraSchemaRoute: true;
575
575
  }) | (Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
576
- method: "DELETE";
577
- path: "/workspaces/:workspaceId/fs/delete";
576
+ method: "GET";
577
+ path: "/workspaces/:workspaceId/fs/stat";
578
578
  responseType: "json";
579
579
  streamFormat?: 'sse' | 'stream';
580
580
  sseFlushOnConnect?: boolean;
@@ -582,11 +582,13 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
582
582
  workspaceId: string;
583
583
  } & {
584
584
  path: string;
585
- recursive?: boolean | undefined;
586
- force?: boolean | undefined;
587
585
  } & import(".").ServerContext): Promise<{
588
- success: boolean;
589
586
  path: string;
587
+ type: "directory" | "file";
588
+ size?: number | undefined;
589
+ createdAt?: string | undefined;
590
+ modifiedAt?: string | undefined;
591
+ mimeType?: string | undefined;
590
592
  }>;
591
593
  pathParamSchema?: import("zod").ZodSchema;
592
594
  queryParamSchema?: import("zod").ZodSchema;
@@ -602,17 +604,22 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
602
604
  workspaceId: import("zod").ZodString;
603
605
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
604
606
  path: import("zod").ZodString;
605
- recursive: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodBoolean, unknown>>;
606
- force: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodBoolean, unknown>>;
607
607
  }, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
608
- success: import("zod").ZodBoolean;
609
608
  path: import("zod").ZodString;
609
+ type: import("zod").ZodEnum<{
610
+ directory: "directory";
611
+ file: "file";
612
+ }>;
613
+ size: import("zod").ZodOptional<import("zod").ZodNumber>;
614
+ createdAt: import("zod").ZodOptional<import("zod").ZodString>;
615
+ modifiedAt: import("zod").ZodOptional<import("zod").ZodString>;
616
+ mimeType: import("zod").ZodOptional<import("zod").ZodString>;
610
617
  }, import("zod/v4/core").$strip>> | undefined;
611
618
  } & {
612
619
  readonly _mastraSchemaRoute: true;
613
620
  }) | (Omit<import("@mastra/core/server").ApiRoute, "createHandler" | "handler" | "method" | "openapi" | "path"> & {
614
- method: "GET";
615
- path: "/workspaces/:workspaceId/fs/stat";
621
+ method: "DELETE";
622
+ path: "/workspaces/:workspaceId/fs/delete";
616
623
  responseType: "json";
617
624
  streamFormat?: 'sse' | 'stream';
618
625
  sseFlushOnConnect?: boolean;
@@ -620,13 +627,11 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
620
627
  workspaceId: string;
621
628
  } & {
622
629
  path: string;
630
+ recursive?: boolean | undefined;
631
+ force?: boolean | undefined;
623
632
  } & import(".").ServerContext): Promise<{
633
+ success: boolean;
624
634
  path: string;
625
- type: "directory" | "file";
626
- size?: number | undefined;
627
- createdAt?: string | undefined;
628
- modifiedAt?: string | undefined;
629
- mimeType?: string | undefined;
630
635
  }>;
631
636
  pathParamSchema?: import("zod").ZodSchema;
632
637
  queryParamSchema?: import("zod").ZodSchema;
@@ -642,16 +647,11 @@ export declare const WORKSPACE_ROUTES: readonly [Omit<import("@mastra/core/serve
642
647
  workspaceId: import("zod").ZodString;
643
648
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
644
649
  path: import("zod").ZodString;
650
+ recursive: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodBoolean, unknown>>;
651
+ force: import("zod").ZodOptional<import("zod").ZodPreprocess<import("zod").ZodBoolean, unknown>>;
645
652
  }, import("zod/v4/core").$strip>, undefined, import("zod").ZodObject<{
653
+ success: import("zod").ZodBoolean;
646
654
  path: import("zod").ZodString;
647
- type: import("zod").ZodEnum<{
648
- directory: "directory";
649
- file: "file";
650
- }>;
651
- size: import("zod").ZodOptional<import("zod").ZodNumber>;
652
- createdAt: import("zod").ZodOptional<import("zod").ZodString>;
653
- modifiedAt: import("zod").ZodOptional<import("zod").ZodString>;
654
- mimeType: import("zod").ZodOptional<import("zod").ZodString>;
655
655
  }, import("zod/v4/core").$strip>> | undefined;
656
656
  } & {
657
657
  readonly _mastraSchemaRoute: true;
@@ -28,6 +28,8 @@ const observabilityStorageCapabilitiesSchema = zod_v4.z.object({
28
28
  discovery: observabilityDiscoveryCapabilitiesSchema.describe("Filter discovery endpoints. Unsupported discovery routes return empty results."),
29
29
  deltaPolling: zod_v4.z.boolean().describe("Cursor-based `mode: 'delta'` polling on observability list endpoints"),
30
30
  traceQuery: zod_v4.z.boolean().describe("Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead."),
31
+ traceQueryTextSearch: zod_v4.z.boolean().default(false).describe("Literal substring search across any span in a trace"),
32
+ spanQueryTextSearch: zod_v4.z.boolean().default(false).describe("Literal substring search within individual spans"),
31
33
  traceQueryRootDuration: zod_v4.z.boolean().describe("`durationMs` predicates in trace and thread queries"),
32
34
  traceQueryContextIds: zod_v4.z.boolean().describe("`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries"),
33
35
  traceQueryContextFields: zod_v4.z.boolean().describe("`requestId`, `serviceName` and `experimentId` predicates in trace and thread queries"),
@@ -178,4 +180,4 @@ Object.defineProperty(exports, "systemPackagesResponseSchema", {
178
180
  }
179
181
  });
180
182
 
181
- //# sourceMappingURL=system-eeBLPCu1.cjs.map
183
+ //# sourceMappingURL=system-CpGJI36-.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-CpGJI36-.cjs","names":["z"],"sources":["../src/server/schemas/system.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\nexport const mastraPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n});\n\nexport const observabilityRuntimeStrategySchema = z.enum([\n 'realtime',\n 'batch-with-updates',\n 'insert-only',\n 'event-sourced',\n]);\n\nexport const observabilityDiscoveryCapabilitiesSchema = z.object({\n entityTypes: z.boolean().describe('GET /observability/discovery/entity-types'),\n entityNames: z.boolean().describe('GET /observability/discovery/entity-names'),\n serviceNames: z.boolean().describe('GET /observability/discovery/service-names'),\n environments: z.boolean().describe('GET /observability/discovery/environments'),\n tags: z.boolean().describe('GET /observability/discovery/tags'),\n metrics: z.boolean().describe('GET /observability/discovery/metric-names, metric-label-keys and metric-label-values'),\n});\n\n/**\n * Optional observability APIs the configured observability store can serve.\n * Omitted when no observability store is configured.\n */\nexport const observabilityStorageCapabilitiesSchema = z.object({\n metrics: z.boolean().describe('Metrics endpoints (/observability/metrics and /observability/metrics/*)'),\n logs: z.boolean().describe('Logs endpoint (GET /observability/logs)'),\n discovery: observabilityDiscoveryCapabilitiesSchema.describe(\n 'Filter discovery endpoints. Unsupported discovery routes return empty results.',\n ),\n deltaPolling: z.boolean().describe(\"Cursor-based `mode: 'delta'` polling on observability list endpoints\"),\n traceQuery: z\n .boolean()\n .describe(\n 'Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead.',\n ),\n traceQueryTextSearch: z.boolean().default(false).describe('Literal substring search across any span in a trace'),\n spanQueryTextSearch: z.boolean().default(false).describe('Literal substring search within individual spans'),\n traceQueryRootDuration: z.boolean().describe('`durationMs` predicates in trace and thread queries'),\n traceQueryContextIds: z\n .boolean()\n .describe('`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries'),\n traceQueryContextFields: z\n .boolean()\n .describe('`requestId`, `serviceName` and `experimentId` predicates in trace and thread queries'),\n traceQueryTimeToFirstChunk: z\n .boolean()\n .describe(\n '`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryRootSpanFields: z\n .boolean()\n .describe('Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryRootEntityId: z\n .boolean()\n .describe('Root span `entityId` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryTimeToFirstChunkSort: z.boolean().describe('Sorting trace and span queries by `timeToFirstChunkMs`'),\n traceQueryTimeToFirstToken: z\n .boolean()\n .describe(\n '`timeToFirstTokenMs` in trace, thread and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryTimeToFirstTokenSort: z.boolean().describe('Sorting trace and span queries by `timeToFirstTokenMs`'),\n traceQueryDiscovery: z\n .boolean()\n .describe('Trace query field discovery (POST /observability/traces/query/fields and /values)'),\n traceQueryTenantScope: z.boolean().describe('Trusted tenant scoping of trace and thread queries'),\n traceAggregate: z\n .boolean()\n .describe(\n 'Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable.',\n ),\n spanAggregate: z\n .boolean()\n .describe(\n 'Span aggregation (POST /observability/spans/aggregate). Unlike `spanQuery`, clients should treat a missing value as unavailable.',\n ),\n threadQuery: z.boolean().describe('Advanced thread queries (POST /observability/threads/query)'),\n threadQueryRows: z\n .boolean()\n .default(false)\n .describe(\n 'Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable.',\n ),\n spanQuery: z.boolean().describe('Span queries (POST /observability/spans/query)'),\n spanQueryContextFields: z\n .boolean()\n .default(false)\n .describe(\n 'Additional identity, context and parent/root entity predicates in span queries. Treat a missing value as unavailable.',\n ),\n spanQueryModelFields: z\n .boolean()\n .default(false)\n .describe(\n '`model` and `provider` predicates in span queries and span aggregates. Treat a missing value as unavailable.',\n ),\n spanAggregateModelDimensions: z\n .boolean()\n .default(false)\n .describe(\n '`model` and `provider` in span aggregate `groupBy` and `countDistinct`. Treat a missing value as unavailable.',\n ),\n aggregateTimeToFirstMeasures: z\n .boolean()\n .default(false)\n .describe(\n '`timeToFirstToken.*` and `timeToFirstChunk.*` measures in trace and span aggregates. Treat a missing value as unavailable.',\n ),\n spanQueryOutcomeFields: z\n .boolean()\n .default(false)\n .describe(\n '`outcome` and `stopReason` predicates in span queries and span aggregates (including `groupBy` and `countDistinct`), and `outcome`, `stopReason` and `stopReasonContext` on span rows. Treat a missing value as unavailable.',\n ),\n traceQueryOutcomeFields: z\n .boolean()\n .default(false)\n .describe(\n \"The root span's `outcome` and `stopReason` in trace-scope predicates and trace aggregates, both fields in `spans.some`/`spans.none` predicates and value discovery, and the root span's `outcome`, `stopReason` and `stopReasonContext` on trace rows. Treat a missing value as unavailable.\",\n ),\n traceRetentionDays: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit.',\n ),\n feedback: z\n .boolean()\n .describe(\n 'Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.',\n ),\n});\n\nexport const editorSourceSchema = z.enum(['code', 'db']);\n\nexport const editorSourceCapabilitiesSchema = z.object({\n source: editorSourceSchema,\n storage: z.enum(['database', 'filesystem', 'source-provider', 'unavailable']),\n provider: z\n .object({\n id: z.string(),\n displayName: z.string(),\n })\n .optional(),\n canSave: z.boolean(),\n canOpenChangeRequest: z.boolean(),\n unavailableReason: z.string().optional(),\n});\n\nexport const systemPackagesResponseSchema = z.object({\n packages: z.array(mastraPackageSchema),\n isDev: z.boolean(),\n cmsEnabled: z.boolean(),\n /** Whether the default LiveKit connection-details route is registered — not whether credentials or a worker exist. */\n liveKitConnectionRouteEnabled: z.boolean(),\n /** True when the default LiveKit trace recording review route is registered. */\n liveKitRecordingRouteEnabled: z.boolean().optional(),\n /**\n * The editor's configured source, when set. `'code'` swaps Studio's\n * Save/Publish UI for Download JSON + Open PR. `'db'` keeps the standard\n * Save/Publish flow. Omitted when the editor has no explicit source.\n */\n editorSource: editorSourceSchema.optional(),\n editorSourceCapabilities: editorSourceCapabilitiesSchema.optional(),\n observabilityEnabled: z.boolean(),\n storageType: z.string().optional(),\n observabilityStorageType: z.string().optional(),\n observabilityStorageCapabilities: observabilityStorageCapabilitiesSchema.optional(),\n observabilityRuntimeStrategy: observabilityRuntimeStrategySchema.optional(),\n});\n\nconst jsonSchemaRecordSchema = z.record(z.string(), z.unknown());\n\nexport const apiSchemaResponseShapeSchema = z.object({\n kind: z.enum(['array', 'record', 'object-property', 'single', 'unknown']),\n listProperty: z.string().optional(),\n paginationProperty: z.string().optional(),\n});\n\nexport const apiSchemaManifestRouteSchema = z.object({\n method: z.string(),\n path: z.string(),\n responseType: z.string(),\n pathParamSchema: jsonSchemaRecordSchema.optional(),\n queryParamSchema: jsonSchemaRecordSchema.optional(),\n bodySchema: jsonSchemaRecordSchema.optional(),\n responseSchema: jsonSchemaRecordSchema.optional(),\n responseShape: apiSchemaResponseShapeSchema,\n});\n\nexport const apiSchemaManifestResponseSchema = z.object({\n version: z.literal(1),\n routes: z.array(apiSchemaManifestRouteSchema),\n});\n\nexport type MastraPackage = z.infer<typeof mastraPackageSchema>;\nexport type SystemPackagesResponse = z.infer<typeof systemPackagesResponseSchema>;\n"],"mappings":";;AAEA,MAAa,sBAAsBA,OAAAA,EAAE,OAAO;CAC1C,MAAMA,OAAAA,EAAE,OAAO;CACf,SAASA,OAAAA,EAAE,OAAO;AACpB,CAAC;AAED,MAAa,qCAAqCA,OAAAA,EAAE,KAAK;CACvD;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,2CAA2CA,OAAAA,EAAE,OAAO;CAC/D,aAAaA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,aAAaA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,cAAcA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,4CAA4C;CAC/E,cAAcA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC9E,MAAMA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,mCAAmC;CAC9D,SAASA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,sFAAsF;AACtH,CAAC;;;;;AAMD,MAAa,yCAAyCA,OAAAA,EAAE,OAAO;CAC7D,SAASA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,yEAAyE;CACvG,MAAMA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,yCAAyC;CACpE,WAAW,yCAAyC,SAClD,gFACF;CACA,cAAcA,OAAAA,EAAE,QAAQ,CAAC,CAAC,SAAS,sEAAsE;CACzG,YAAYA,OAAAA,EACT,QAAQ,CAAC,CACT,SACC,kIACF;CACF,sBAAsBA,OAAAA,EAAE,QAAQ,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,SAAS,qDAAqD;CAC/G,qBAAqBA,OAAAA,EAAE,QAAQ,CAAC,CA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AE,QAAQ;CAChC,aAAaA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,0BAA0BA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9C,kCAAkC,uCAAuC,SAAS;CAClF,8BAA8B,mCAAmC,SAAS;AAC5E,CAAC;AAED,MAAM,yBAAyBA,OAAAA,EAAE,OAAOA,OAAAA,EAAE,OAAO,GAAGA,OAAAA,EAAE,QAAQ,CAAC;AAE/D,MAAa,+BAA+BA,OAAAA,EAAE,OAAO;CACnD,MAAMA,OAAAA,EAAE,KAAK;EAAC;EAAS;EAAU;EAAmB;EAAU;CAAS,CAAC;CACxE,cAAcA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,oBAAoBA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;AAC1C,CAAC;AAED,MAAa,+BAA+BA,OAAAA,EAAE,OAAO;CACnD,QAAQA,OAAAA,EAAE,OAAO;CACjB,MAAMA,OAAAA,EAAE,OAAO;CACf,cAAcA,OAAAA,EAAE,OAAO;CACvB,iBAAiB,uBAAuB,SAAS;CACjD,kBAAkB,uBAAuB,SAAS;CAClD,YAAY,uBAAuB,SAAS;CAC5C,gBAAgB,uBAAuB,SAAS;CAChD,eAAe;AACjB,CAAC;AAED,MAAa,kCAAkCA,OAAAA,EAAE,OAAO;CACtD,SAASA,OAAAA,EAAE,QAAQ,CAAC;CACpB,QAAQA,OAAAA,EAAE,MAAM,4BAA4B;AAC9C,CAAC"}
@@ -28,6 +28,8 @@ const observabilityStorageCapabilitiesSchema = z.object({
28
28
  discovery: observabilityDiscoveryCapabilitiesSchema.describe("Filter discovery endpoints. Unsupported discovery routes return empty results."),
29
29
  deltaPolling: z.boolean().describe("Cursor-based `mode: 'delta'` polling on observability list endpoints"),
30
30
  traceQuery: z.boolean().describe("Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead."),
31
+ traceQueryTextSearch: z.boolean().default(false).describe("Literal substring search across any span in a trace"),
32
+ spanQueryTextSearch: z.boolean().default(false).describe("Literal substring search within individual spans"),
31
33
  traceQueryRootDuration: z.boolean().describe("`durationMs` predicates in trace and thread queries"),
32
34
  traceQueryContextIds: z.boolean().describe("`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries"),
33
35
  traceQueryContextFields: z.boolean().describe("`requestId`, `serviceName` and `experimentId` predicates in trace and thread queries"),
@@ -119,4 +121,4 @@ const apiSchemaManifestResponseSchema = z.object({
119
121
  });
120
122
  export { editorSourceSchema as a, observabilityRuntimeStrategySchema as c, editorSourceCapabilitiesSchema as i, observabilityStorageCapabilitiesSchema as l, apiSchemaManifestRouteSchema as n, mastraPackageSchema as o, apiSchemaResponseShapeSchema as r, observabilityDiscoveryCapabilitiesSchema as s, apiSchemaManifestResponseSchema as t, systemPackagesResponseSchema as u };
121
123
 
122
- //# sourceMappingURL=system-DT0pqJSk.js.map
124
+ //# sourceMappingURL=system-D5hurfjV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-D5hurfjV.js","names":[],"sources":["../src/server/schemas/system.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\nexport const mastraPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n});\n\nexport const observabilityRuntimeStrategySchema = z.enum([\n 'realtime',\n 'batch-with-updates',\n 'insert-only',\n 'event-sourced',\n]);\n\nexport const observabilityDiscoveryCapabilitiesSchema = z.object({\n entityTypes: z.boolean().describe('GET /observability/discovery/entity-types'),\n entityNames: z.boolean().describe('GET /observability/discovery/entity-names'),\n serviceNames: z.boolean().describe('GET /observability/discovery/service-names'),\n environments: z.boolean().describe('GET /observability/discovery/environments'),\n tags: z.boolean().describe('GET /observability/discovery/tags'),\n metrics: z.boolean().describe('GET /observability/discovery/metric-names, metric-label-keys and metric-label-values'),\n});\n\n/**\n * Optional observability APIs the configured observability store can serve.\n * Omitted when no observability store is configured.\n */\nexport const observabilityStorageCapabilitiesSchema = z.object({\n metrics: z.boolean().describe('Metrics endpoints (/observability/metrics and /observability/metrics/*)'),\n logs: z.boolean().describe('Logs endpoint (GET /observability/logs)'),\n discovery: observabilityDiscoveryCapabilitiesSchema.describe(\n 'Filter discovery endpoints. Unsupported discovery routes return empty results.',\n ),\n deltaPolling: z.boolean().describe(\"Cursor-based `mode: 'delta'` polling on observability list endpoints\"),\n traceQuery: z\n .boolean()\n .describe(\n 'Advanced trace queries (POST /observability/traces/query). When false, list traces with GET /observability/traces/light instead.',\n ),\n traceQueryTextSearch: z.boolean().default(false).describe('Literal substring search across any span in a trace'),\n spanQueryTextSearch: z.boolean().default(false).describe('Literal substring search within individual spans'),\n traceQueryRootDuration: z.boolean().describe('`durationMs` predicates in trace and thread queries'),\n traceQueryContextIds: z\n .boolean()\n .describe('`runId`, `sessionId`, `userId` and `organizationId` predicates in trace and thread queries'),\n traceQueryContextFields: z\n .boolean()\n .describe('`requestId`, `serviceName` and `experimentId` predicates in trace and thread queries'),\n traceQueryTimeToFirstChunk: z\n .boolean()\n .describe(\n '`timeToFirstChunkMs` in trace and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryRootSpanFields: z\n .boolean()\n .describe('Root span `name` and `spanType` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryRootEntityId: z\n .boolean()\n .describe('Root span `entityId` in trace-scope predicates, aggregate `groupBy` and `countDistinct`'),\n traceQueryTimeToFirstChunkSort: z.boolean().describe('Sorting trace and span queries by `timeToFirstChunkMs`'),\n traceQueryTimeToFirstToken: z\n .boolean()\n .describe(\n '`timeToFirstTokenMs` in trace, thread and span query results, and predicates on it in trace, thread and span queries',\n ),\n traceQueryTimeToFirstTokenSort: z.boolean().describe('Sorting trace and span queries by `timeToFirstTokenMs`'),\n traceQueryDiscovery: z\n .boolean()\n .describe('Trace query field discovery (POST /observability/traces/query/fields and /values)'),\n traceQueryTenantScope: z.boolean().describe('Trusted tenant scoping of trace and thread queries'),\n traceAggregate: z\n .boolean()\n .describe(\n 'Trace aggregation (POST /observability/traces/aggregate). Unlike `traceQuery`, clients should treat a missing value as unavailable.',\n ),\n spanAggregate: z\n .boolean()\n .describe(\n 'Span aggregation (POST /observability/spans/aggregate). Unlike `spanQuery`, clients should treat a missing value as unavailable.',\n ),\n threadQuery: z.boolean().describe('Advanced thread queries (POST /observability/threads/query)'),\n threadQueryRows: z\n .boolean()\n .default(false)\n .describe(\n 'Full-history thread rows with activity windows, filters and sorting. Treat a missing value as unavailable.',\n ),\n spanQuery: z.boolean().describe('Span queries (POST /observability/spans/query)'),\n spanQueryContextFields: z\n .boolean()\n .default(false)\n .describe(\n 'Additional identity, context and parent/root entity predicates in span queries. Treat a missing value as unavailable.',\n ),\n spanQueryModelFields: z\n .boolean()\n .default(false)\n .describe(\n '`model` and `provider` predicates in span queries and span aggregates. Treat a missing value as unavailable.',\n ),\n spanAggregateModelDimensions: z\n .boolean()\n .default(false)\n .describe(\n '`model` and `provider` in span aggregate `groupBy` and `countDistinct`. Treat a missing value as unavailable.',\n ),\n aggregateTimeToFirstMeasures: z\n .boolean()\n .default(false)\n .describe(\n '`timeToFirstToken.*` and `timeToFirstChunk.*` measures in trace and span aggregates. Treat a missing value as unavailable.',\n ),\n spanQueryOutcomeFields: z\n .boolean()\n .default(false)\n .describe(\n '`outcome` and `stopReason` predicates in span queries and span aggregates (including `groupBy` and `countDistinct`), and `outcome`, `stopReason` and `stopReasonContext` on span rows. Treat a missing value as unavailable.',\n ),\n traceQueryOutcomeFields: z\n .boolean()\n .default(false)\n .describe(\n \"The root span's `outcome` and `stopReason` in trace-scope predicates and trace aggregates, both fields in `spans.some`/`spans.none` predicates and value discovery, and the root span's `outcome`, `stopReason` and `stopReasonContext` on trace rows. Treat a missing value as unavailable.\",\n ),\n traceRetentionDays: z\n .number()\n .int()\n .positive()\n .optional()\n .describe(\n 'Days of traces the store keeps. Older traces are gone, so clients can stop users from picking dates before them. Omitted when the store does not report a limit.',\n ),\n feedback: z\n .boolean()\n .describe(\n 'Feedback endpoints (/observability/feedback and /observability/feedback/*). Unsupported feedback routes return 501.',\n ),\n});\n\nexport const editorSourceSchema = z.enum(['code', 'db']);\n\nexport const editorSourceCapabilitiesSchema = z.object({\n source: editorSourceSchema,\n storage: z.enum(['database', 'filesystem', 'source-provider', 'unavailable']),\n provider: z\n .object({\n id: z.string(),\n displayName: z.string(),\n })\n .optional(),\n canSave: z.boolean(),\n canOpenChangeRequest: z.boolean(),\n unavailableReason: z.string().optional(),\n});\n\nexport const systemPackagesResponseSchema = z.object({\n packages: z.array(mastraPackageSchema),\n isDev: z.boolean(),\n cmsEnabled: z.boolean(),\n /** Whether the default LiveKit connection-details route is registered — not whether credentials or a worker exist. */\n liveKitConnectionRouteEnabled: z.boolean(),\n /** True when the default LiveKit trace recording review route is registered. */\n liveKitRecordingRouteEnabled: z.boolean().optional(),\n /**\n * The editor's configured source, when set. `'code'` swaps Studio's\n * Save/Publish UI for Download JSON + Open PR. `'db'` keeps the standard\n * Save/Publish flow. Omitted when the editor has no explicit source.\n */\n editorSource: editorSourceSchema.optional(),\n editorSourceCapabilities: editorSourceCapabilitiesSchema.optional(),\n observabilityEnabled: z.boolean(),\n storageType: z.string().optional(),\n observabilityStorageType: z.string().optional(),\n observabilityStorageCapabilities: observabilityStorageCapabilitiesSchema.optional(),\n observabilityRuntimeStrategy: observabilityRuntimeStrategySchema.optional(),\n});\n\nconst jsonSchemaRecordSchema = z.record(z.string(), z.unknown());\n\nexport const apiSchemaResponseShapeSchema = z.object({\n kind: z.enum(['array', 'record', 'object-property', 'single', 'unknown']),\n listProperty: z.string().optional(),\n paginationProperty: z.string().optional(),\n});\n\nexport const apiSchemaManifestRouteSchema = z.object({\n method: z.string(),\n path: z.string(),\n responseType: z.string(),\n pathParamSchema: jsonSchemaRecordSchema.optional(),\n queryParamSchema: jsonSchemaRecordSchema.optional(),\n bodySchema: jsonSchemaRecordSchema.optional(),\n responseSchema: jsonSchemaRecordSchema.optional(),\n responseShape: apiSchemaResponseShapeSchema,\n});\n\nexport const apiSchemaManifestResponseSchema = z.object({\n version: z.literal(1),\n routes: z.array(apiSchemaManifestRouteSchema),\n});\n\nexport type MastraPackage = z.infer<typeof mastraPackageSchema>;\nexport type SystemPackagesResponse = z.infer<typeof systemPackagesResponseSchema>;\n"],"mappings":";;AAEA,MAAa,sBAAsB,EAAE,OAAO;CAC1C,MAAM,EAAE,OAAO;CACf,SAAS,EAAE,OAAO;AACpB,CAAC;AAED,MAAa,qCAAqC,EAAE,KAAK;CACvD;CACA;CACA;CACA;AACF,CAAC;AAED,MAAa,2CAA2C,EAAE,OAAO;CAC/D,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,aAAa,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC7E,cAAc,EAAE,QAAQ,CAAC,CAAC,SAAS,4CAA4C;CAC/E,cAAc,EAAE,QAAQ,CAAC,CAAC,SAAS,2CAA2C;CAC9E,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,mCAAmC;CAC9D,SAAS,EAAE,QAAQ,CAAC,CAAC,SAAS,sFAAsF;AACtH,CAAC;;;;;AAMD,MAAa,yCAAyC,EAAE,OAAO;CAC7D,SAAS,EAAE,QAAQ,CAAC,CAAC,SAAS,yEAAyE;CACvG,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,yCAAyC;CACpE,WAAW,yCAAyC,SAClD,gFACF;CACA,cAAc,EAAE,QAAQ,CAAC,CAAC,SAAS,sEAAsE;CACzG,YAAY,EACT,QAAQ,CAAC,CACT,SACC,kIACF;CACF,sBAAsB,EAAE,QAAQ,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,SAAS,qDAAqD;CAC/G,qBAAqB,EAAE,QAAQ,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,SAAS,kDAAkD;CAC3G,wBAAwB,EAAE,QAAQ,CAAC,CAAC,SAAS,qDAAqD;CAClG,sBAAsB,EACnB,QAAQ,CAAC,CACT,SAAS,4FAA4F;CACxG,yBAAyB,EACtB,QA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AAE,OAAO;CACf,cAAc,EAAE,OAAO;CACvB,iBAAiB,uBAAuB,SAAS;CACjD,kBAAkB,uBAAuB,SAAS;CAClD,YAAY,uBAAuB,SAAS;CAC5C,gBAAgB,uBAAuB,SAAS;CAChD,eAAe;AACjB,CAAC;AAED,MAAa,kCAAkC,EAAE,OAAO;CACtD,SAAS,EAAE,QAAQ,CAAC;CACpB,QAAQ,EAAE,MAAM,4BAA4B;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/server",
3
- "version": "1.83.0-alpha.3",
3
+ "version": "1.83.0-alpha.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -121,8 +121,8 @@
121
121
  "@internal/test-utils": "0.0.84",
122
122
  "@internal/types-builder": "0.0.123",
123
123
  "@internal/voice": "0.0.44",
124
- "@mastra/agent-builder": "1.2.1-alpha.1",
125
- "@mastra/core": "1.83.0-alpha.3",
124
+ "@mastra/agent-builder": "1.2.1-alpha.2",
125
+ "@mastra/core": "1.83.0-alpha.5",
126
126
  "@mastra/schema-compat": "1.3.17"
127
127
  },
128
128
  "homepage": "https://mastra.ai",
@@ -144,7 +144,6 @@
144
144
  "build:lib": "tsdown --silent --config tsdown.config.ts",
145
145
  "build:patch-commonjs": "node ../../scripts/commonjs-tsc-fixer.js",
146
146
  "build:watch": "pnpm build:lib --watch",
147
- "pull:openapispec": "node src/server/openapi.script.js",
148
147
  "generate:permissions": "tsx scripts/generate-permissions.ts",
149
148
  "generate:api-cli-route-metadata": "tsx scripts/generate-api-cli-route-metadata.ts",
150
149
  "generate:route-types": "tsx scripts/generate-route-types.ts",
@@ -1 +0,0 @@
1
- export { n as openai } from "./dist-CXxA_Jnu.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-B29a1nM3.js","names":[],"sources":["../src/server/auth/defaults.ts","../src/server/auth/path-pattern.ts","../src/server/auth/helpers.ts"],"sourcesContent":["import type { MastraAuthConfig } from '@mastra/core/server';\n\n// Default configuration that can be extended by clients\nexport const defaultAuthConfig: MastraAuthConfig = {\n protected: ['/api/*'],\n public: ['/api', '/api/auth/*'],\n // Simple rule system\n rules: [\n // Admin users can do anything\n {\n condition: user => {\n if (typeof user === 'object' && user !== null) {\n if ('isAdmin' in user) {\n return !!user.isAdmin;\n }\n\n if ('role' in user) {\n return user.role === 'admin';\n }\n }\n return false;\n },\n allow: true,\n },\n ],\n};\n","/**\n * Path pattern matching utility\n * Inlined from regexparam v3.0.0 (MIT License)\n * https://github.com/lukeed/regexparam\n *\n * Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport interface ParsedPattern {\n keys: string[] | false;\n pattern: RegExp;\n}\n\n/**\n * Parse a route pattern into a RegExp\n * Supports:\n * - Named parameters: /users/:id\n * - Optional parameters: /users/:id?\n * - Wildcards: /files/*\n * - Mixed patterns: /api/:version/users/:id\n */\nexport function parse(input: string | RegExp, loose?: boolean): ParsedPattern {\n if (input instanceof RegExp) return { keys: false, pattern: input };\n\n let c: string;\n let o: number;\n let tmp: string | undefined;\n let ext: number;\n const keys: string[] = [];\n let pattern = '';\n const arr = input.split('/');\n\n arr[0] || arr.shift();\n\n while ((tmp = arr.shift())) {\n c = tmp[0]!;\n if (c === '*') {\n keys.push(c);\n pattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';\n } else if (c === ':') {\n o = tmp.indexOf('?', 1);\n ext = tmp.indexOf('.', 1);\n keys.push(tmp.substring(1, ~o ? o : ~ext ? ext : tmp.length));\n pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';\n if (~ext) pattern += (~o ? '?' : '') + '\\\\' + tmp.substring(ext);\n } else {\n pattern += '/' + tmp;\n }\n }\n\n return {\n keys: keys,\n pattern: new RegExp('^' + pattern + (loose ? '(?=$|/)' : '/?$'), 'i'),\n };\n}\n\n/**\n * Test if a path matches a pattern\n */\nexport function matchPath(path: string, pattern: string | RegExp): boolean {\n const { pattern: regex } = parse(pattern);\n return regex.test(path);\n}\n","import type { ISessionProvider } from '@mastra/core/auth';\nimport type { IRBACProvider, EEUser } from '@mastra/core/auth/ee';\nimport type { Mastra } from '@mastra/core/mastra';\nimport { CompositeAuth } from '@mastra/core/server';\nimport type { ApiRoute, IMastraAuthProvider, MastraAuthConfig, MastraAuthRequest } from '@mastra/core/server';\n\nimport {\n MASTRA_RESOURCE_ID_KEY,\n MASTRA_USER_KEY,\n MASTRA_USER_PERMISSIONS_KEY,\n MASTRA_USER_ROLES_KEY,\n MASTRA_AUTH_TOKEN_KEY,\n MASTRA_AUTH_MODE_KEY,\n} from '../constants';\nimport { HTTPException } from '../http-exception';\nimport { defaultAuthConfig } from './defaults';\nimport { parse } from './path-pattern';\n\n// Re-export request-context key constants so custom middleware can read namespaced\n// auth state without importing internal paths.\nexport { MASTRA_USER_KEY, MASTRA_USER_PERMISSIONS_KEY, MASTRA_USER_ROLES_KEY } from '../constants';\n\n/**\n * Check if a route is a registered custom route that requires authentication.\n * Returns true only if the route is explicitly registered with requiresAuth: true.\n * Returns false if the route is not in the config or has requiresAuth: false.\n */\nexport const isProtectedCustomRoute = (\n path: string,\n method: string,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n if (!customRouteAuthConfig) {\n return false;\n }\n\n // Check exact match first (fast path for static routes)\n const exactRouteKey = `${method}:${path}`;\n if (customRouteAuthConfig.has(exactRouteKey)) {\n return customRouteAuthConfig.get(exactRouteKey) === true;\n }\n\n // Check exact match for ALL method\n const allRouteKey = `ALL:${path}`;\n if (customRouteAuthConfig.has(allRouteKey)) {\n return customRouteAuthConfig.get(allRouteKey) === true;\n }\n\n // Check pattern matches for dynamic routes (e.g., '/users/:id')\n for (const [routeKey, requiresAuth] of customRouteAuthConfig.entries()) {\n const colonIndex = routeKey.indexOf(':');\n if (colonIndex === -1) {\n continue; // Skip malformed keys\n }\n\n const routeMethod = routeKey.substring(0, colonIndex);\n const routePattern = routeKey.substring(colonIndex + 1);\n\n // Check if method matches (exact match or ALL)\n if (routeMethod !== method && routeMethod !== 'ALL') {\n continue;\n }\n\n // Check if path matches the pattern\n if (pathMatchesPattern(path, routePattern)) {\n return requiresAuth === true;\n }\n }\n\n return false; // Not in config = not a protected custom route\n};\n\n/**\n * Find a matching custom API route for the given path and method.\n * Returns the matched route and any extracted path parameters.\n */\nexport const findMatchingCustomRoute = (\n path: string,\n method: string,\n apiRoutes?: ApiRoute[],\n): { route: ApiRoute; params: Record<string, string> } | undefined => {\n if (!apiRoutes) return undefined;\n\n for (const route of apiRoutes) {\n if (route.method !== method && route.method !== 'ALL') continue;\n\n const { keys, pattern: regex } = parse(route.path);\n const match = regex.exec(path);\n if (!match) continue;\n\n const params: Record<string, string> = {};\n if (keys && keys.length > 0) {\n for (let i = 0; i < keys.length; i++) {\n if (match[i + 1] !== undefined) {\n params[keys[i]!] = match[i + 1]!;\n }\n }\n }\n\n return { route, params };\n }\n\n return undefined;\n};\n\n/**\n * Check if request is from dev playground\n * @param getHeader - Function to get header value from request\n * @param customRouteAuthConfig - Map of custom route auth configurations\n */\nexport const isDevPlaygroundRequest = (\n path: string,\n method: string,\n getHeader: (name: string) => string | undefined,\n authConfig: MastraAuthConfig,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n const protectedAccess = [...(defaultAuthConfig.protected || []), ...(authConfig.protected || [])];\n return (\n process.env.MASTRA_DEV === 'true' &&\n // Allow if path doesn't match protected patterns AND is not a protected custom route\n ((!isAnyMatch(path, method, protectedAccess) && !isProtectedCustomRoute(path, method, customRouteAuthConfig)) ||\n // Or if has playground header\n getHeader('x-mastra-dev-playground') === 'true')\n );\n};\n\nexport const isCustomRoutePublic = (\n path: string,\n method: string,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n if (!customRouteAuthConfig) {\n return false;\n }\n\n // Check exact match first (fast path for static routes)\n const exactRouteKey = `${method}:${path}`;\n if (customRouteAuthConfig.has(exactRouteKey)) {\n return !customRouteAuthConfig.get(exactRouteKey); // True when route opts out of auth\n }\n\n // Check exact match for ALL method\n const allRouteKey = `ALL:${path}`;\n if (customRouteAuthConfig.has(allRouteKey)) {\n return !customRouteAuthConfig.get(allRouteKey);\n }\n\n // Check pattern matches for dynamic routes (e.g., '/users/:id').\n // Any matching pattern that requires auth wins over overlapping public patterns.\n let matchedPublic = false;\n for (const [routeKey, requiresAuth] of customRouteAuthConfig.entries()) {\n const colonIndex = routeKey.indexOf(':');\n if (colonIndex === -1) {\n continue; // Skip malformed keys\n }\n\n const routeMethod = routeKey.substring(0, colonIndex);\n const routePattern = routeKey.substring(colonIndex + 1);\n\n // Check if method matches (exact match or ALL)\n if (routeMethod !== method && routeMethod !== 'ALL') {\n continue;\n }\n\n if (pathMatchesPattern(path, routePattern)) {\n if (requiresAuth) {\n return false;\n }\n matchedPublic = true;\n }\n }\n\n return matchedPublic;\n};\n\n// NOTE: This uses isProtectedCustomRoute (default-allow for unknown paths) rather than\n// !isCustomRoutePublic (default-deny). This is intentional — all registered server and\n// custom routes are auth-checked via registerRoute/checkRouteAuth regardless of this\n// function. The '/api/*' protected pattern exists as a user-facing override mechanism.\n// The old default-deny logic incorrectly blocked non-API paths (e.g. '/', '/agents')\n// which prevented the studio login page from loading in production.\nexport const isProtectedPath = (\n path: string,\n method: string,\n authConfig: MastraAuthConfig,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n const protectedAccess = [...(defaultAuthConfig.protected || []), ...(authConfig.protected || [])];\n return isAnyMatch(path, method, protectedAccess) || isProtectedCustomRoute(path, method, customRouteAuthConfig);\n};\n\nexport const canAccessPublicly = (path: string, method: string, authConfig: MastraAuthConfig): boolean => {\n // Check if this path+method combination is publicly accessible\n const publicAccess = [...(defaultAuthConfig.public || []), ...(authConfig.public || [])];\n\n return isAnyMatch(path, method, publicAccess);\n};\n\nconst isAnyMatch = (\n path: string,\n method: string,\n patterns: MastraAuthConfig['protected'] | MastraAuthConfig['public'],\n): boolean => {\n if (!patterns) {\n return false;\n }\n\n for (const patternPathOrMethod of patterns) {\n if (patternPathOrMethod instanceof RegExp) {\n if (patternPathOrMethod.test(path)) {\n return true;\n }\n }\n\n if (typeof patternPathOrMethod === 'string' && pathMatchesPattern(path, patternPathOrMethod)) {\n return true;\n }\n\n if (Array.isArray(patternPathOrMethod) && patternPathOrMethod.length === 2) {\n const [pattern, methodOrMethods] = patternPathOrMethod;\n if (pathMatchesPattern(path, pattern) && matchesOrIncludes(methodOrMethods, method)) {\n return true;\n }\n }\n }\n\n return false;\n};\n\nexport const pathMatchesPattern = (path: string, pattern: string): boolean => {\n // Use regexparam for battle-tested path matching\n // Supports:\n // - Exact paths: '/api/users'\n // - Wildcards: '/api/agents/*' matches '/api/agents/123'\n // - Path parameters: '/users/:id' matches '/users/123'\n // - Optional parameters: '/users/:id?' matches '/users' and '/users/123'\n // - Mixed patterns: '/api/:version/users/:id/profile'\n const { pattern: regex } = parse(pattern);\n return regex.test(path);\n};\n\nexport const pathMatchesRule = (path: string, rulePath: string | RegExp | string[] | undefined): boolean => {\n if (!rulePath) return true; // No path specified means all paths\n\n if (typeof rulePath === 'string') {\n return pathMatchesPattern(path, rulePath);\n }\n\n if (rulePath instanceof RegExp) {\n return rulePath.test(path);\n }\n\n if (Array.isArray(rulePath)) {\n return rulePath.some(p => pathMatchesPattern(path, p));\n }\n\n return false;\n};\n\nexport const matchesOrIncludes = (values: string | string[], value: string): boolean => {\n if (typeof values === 'string') {\n return values === value;\n }\n\n if (Array.isArray(values)) {\n return values.includes(value);\n }\n\n return false;\n};\n\n// ── Core auth middleware ──\n// Framework-agnostic auth logic extracted from adapter middlewares.\n// Each adapter builds an AuthMiddlewareContext and delegates to coreAuthMiddleware.\n\nexport interface AuthMiddlewareContext {\n path: string;\n method: string;\n getHeader: (name: string) => string | undefined;\n mastra: Mastra;\n authConfig: MastraAuthConfig;\n customRouteAuthConfig?: Map<string, boolean>;\n requestContext: { get: (key: string) => unknown; set: (key: string, value: unknown) => void };\n rawRequest: MastraAuthRequest;\n token: string | null;\n buildAuthorizeContext: () => unknown;\n /** When true, force authentication even if the path matches a public pattern. */\n requiresAuth?: boolean;\n}\n\nexport type AuthResult =\n | { action: 'next'; headers?: Record<string, string> }\n | { action: 'error'; status: number; body: Record<string, unknown>; headers?: Record<string, string> };\n\nconst pass: AuthResult = { action: 'next' };\n\n/**\n * Lets an app's `authorize(path, method, user, context)` read `context.get('requestContext')` and\n * `context.get('mastra')` on every adapter, as it can on Hono, so per-caller values (the Knowledge scope) bind\n * the same way everywhere. Hono and NestJS contexts already answer `get`; Express, Fastify and Koa pass a web\n * Request, Elysia its own context, and adapters with no builder pass nothing.\n */\nconst withAuthorizeVariables = (\n base: unknown,\n ctx: Pick<AuthMiddlewareContext, 'mastra' | 'requestContext' | 'customRouteAuthConfig' | 'rawRequest'>,\n): unknown => {\n const variables: Record<string, unknown> = {\n mastra: ctx.mastra,\n requestContext: ctx.requestContext,\n customRouteAuthConfig: ctx.customRouteAuthConfig,\n };\n const get = (key: string) => variables[key];\n if (base === null || base === undefined) {\n return { get, req: ctx.rawRequest };\n }\n if (typeof base === 'object' && typeof (base as { get?: unknown }).get !== 'function') {\n Object.defineProperty(base, 'get', { value: get, configurable: true });\n }\n return base;\n};\n\nconst adaptToMastraAuthRequest = (request: MastraAuthRequest): MastraAuthRequest => {\n if (!(request instanceof Request)) {\n return request;\n }\n\n return {\n raw: request,\n headers: request.headers,\n header: name => request.headers.get(name) ?? undefined,\n };\n};\n\nexport interface GetAuthenticatedUserOptions {\n mastra: Mastra;\n token: string;\n request: MastraAuthRequest;\n}\n\nexport const getAuthenticatedUser = async <TUser = unknown>({\n mastra,\n token,\n request,\n}: GetAuthenticatedUserOptions): Promise<TUser | null> => {\n const normalizedToken = token.replace(/^Bearer\\s+/i, '').trim();\n if (!normalizedToken) {\n return null;\n }\n\n const authConfig = mastra.getServer()?.auth;\n if (!authConfig || typeof authConfig.authenticateToken !== 'function') {\n return null;\n }\n\n return (await authConfig.authenticateToken(normalizedToken, request)) as TUser | null;\n};\n\n/**\n * Check if an auth config object supports transparent session refresh.\n * Returns true if the auth provider implements the necessary ISessionProvider methods.\n */\nexport function supportsSessionRefresh(\n authConfig: MastraAuthConfig | IMastraAuthProvider,\n): authConfig is (MastraAuthConfig | IMastraAuthProvider) &\n Pick<ISessionProvider, 'refreshSession' | 'getSessionIdFromRequest' | 'getSessionHeaders'> {\n return (\n typeof (authConfig as any).getSessionIdFromRequest === 'function' &&\n typeof (authConfig as any).refreshSession === 'function' &&\n typeof (authConfig as any).getSessionHeaders === 'function'\n );\n}\n\n/**\n * Single auth middleware: authenticate → authorize.\n * Skip checks (dev playground, unprotected path, public path) are evaluated once.\n */\nexport const coreAuthMiddleware = async (ctx: AuthMiddlewareContext): Promise<AuthResult> => {\n const {\n path,\n method,\n getHeader,\n mastra,\n authConfig,\n customRouteAuthConfig,\n requestContext,\n rawRequest,\n token,\n requiresAuth,\n } = ctx;\n\n // ── Skip checks (evaluated once) ──\n\n // Only bypass auth for dev playground when no real auth provider is configured.\n // When auth IS configured (has authenticateToken), we need the full auth flow\n // so user/roles/permissions are set in requestContext.\n const hasAuthProvider = typeof authConfig.authenticateToken === 'function';\n if (!hasAuthProvider && isDevPlaygroundRequest(path, method, getHeader, authConfig, customRouteAuthConfig)) {\n return pass;\n }\n\n if (!isProtectedPath(path, method, authConfig, customRouteAuthConfig)) {\n return pass;\n }\n\n // When a route explicitly requires auth (requiresAuth: true), skip the\n // public-path bypass so the user is still authenticated and permissions\n // are injected into the request context.\n if (\n !requiresAuth &&\n (canAccessPublicly(path, method, authConfig) || isCustomRoutePublic(path, method, customRouteAuthConfig))\n ) {\n return pass;\n }\n\n // ── Authentication ──\n\n let user: unknown;\n let refreshHeaders: Record<string, string> | undefined;\n const authRequest = adaptToMastraAuthRequest(rawRequest);\n\n type ConsumePendingResponseHeadersFn = (request: typeof authRequest) => Record<string, string> | undefined;\n const mergePendingProviderHeaders = (request: typeof authRequest = authRequest) => {\n const consume = (authConfig as { consumePendingResponseHeaders?: ConsumePendingResponseHeadersFn })\n .consumePendingResponseHeaders;\n if (typeof consume !== 'function') return;\n let pending: Record<string, string> | undefined;\n try {\n pending = consume.call(authConfig, request);\n } catch {\n // Forwarding a rotated cookie is best-effort; never fail auth over it.\n return;\n }\n if (!pending) return;\n refreshHeaders = { ...(refreshHeaders ?? {}), ...pending };\n };\n\n try {\n if (typeof authConfig.authenticateToken === 'function') {\n user = await authConfig.authenticateToken(token ?? '', authRequest);\n mergePendingProviderHeaders();\n } else {\n throw new Error('No token verification method configured');\n }\n\n // If authentication failed, attempt transparent session refresh before returning 401.\n // This handles expired access tokens without requiring client-side refresh logic.\n if (!user && supportsSessionRefresh(authConfig) && rawRequest instanceof Request) {\n let retryHttpError: HTTPException | undefined;\n try {\n const sessionId = authConfig.getSessionIdFromRequest(rawRequest);\n if (sessionId) {\n const newSession = await authConfig.refreshSession(sessionId);\n if (newSession) {\n // Refresh succeeded — build updated session headers and re-authenticate.\n // We create a synthetic request with the new session cookie so\n // authenticateToken (which reads cookies from the request) picks up\n // the refreshed session instead of the expired one.\n refreshHeaders = authConfig.getSessionHeaders(newSession);\n const refreshedCookie = Object.entries(refreshHeaders)\n .filter(([k]) => k.toLowerCase() === 'set-cookie')\n .map(([, v]) => v.split(';')[0]) // Extract name=value before attributes\n .join('; ');\n if (refreshedCookie) {\n const refreshedRequest = new Request(rawRequest.url, {\n method: rawRequest.method,\n headers: new Headers(rawRequest.headers),\n });\n refreshedRequest.headers.set('Cookie', refreshedCookie);\n // Pass the refreshed cookie value as the token so authenticateToken\n // picks up the new session instead of the stale original.\n // Auth providers typically read cookies from the request object, but\n // some may also inspect the token parameter directly.\n const cookieValue = refreshedCookie.includes('=')\n ? refreshedCookie.split('=').slice(1).join('=')\n : refreshedCookie;\n try {\n const retryAuthRequest = adaptToMastraAuthRequest(refreshedRequest);\n user = await authConfig.authenticateToken(cookieValue, retryAuthRequest);\n mergePendingProviderHeaders(retryAuthRequest);\n } catch (retryErr) {\n retryHttpError = retryErr instanceof HTTPException ? retryErr : undefined;\n throw retryErr;\n }\n }\n if (!user) {\n refreshHeaders = undefined;\n }\n }\n }\n } catch (refreshErr) {\n refreshHeaders = undefined;\n // An explicit HTTP error from the retried authenticateToken goes to the outer handler.\n if (retryHttpError === refreshErr) throw refreshErr;\n mastra.getLogger()?.debug('Session refresh failed, falling back to 401', {\n error: refreshErr instanceof Error ? { message: refreshErr.message } : refreshErr,\n });\n }\n }\n\n if (!user) {\n return { action: 'error', status: 401, body: { error: 'Invalid or expired token' }, headers: refreshHeaders };\n }\n\n requestContext.set(MASTRA_USER_KEY, user);\n // Backward-compat: also write the legacy `'user'` key so existing\n // middleware and integrations that read `requestContext.get('user')`\n // (including built-in FGA route enforcement, memory handlers, and the\n // documented public surface) keep working. New code should prefer\n // `MASTRA_USER_KEY` to avoid collisions with caller-supplied keys.\n requestContext.set('user', user);\n\n // Store the raw auth token so downstream code (e.g., editor MCP client\n // resolution) can forward it when connecting to auth-protected MCP servers.\n // The token may arrive via Authorization header, apiKey query param, or\n // cookie (SimpleAuth sets `mastra-token`). Check all sources so the\n // forwarded value is available regardless of how the user authenticated.\n let effectiveToken = token;\n if (!effectiveToken && rawRequest instanceof Request) {\n const cookieHeader = rawRequest.headers.get('cookie');\n if (cookieHeader) {\n const match = cookieHeader.match(/mastra-token=([^;]+)/);\n if (match?.[1]) effectiveToken = match[1];\n }\n }\n if (effectiveToken) {\n requestContext.set(MASTRA_AUTH_TOKEN_KEY, effectiveToken);\n }\n\n if (typeof authConfig.mapUserToResourceId === 'function') {\n try {\n const resourceId = authConfig.mapUserToResourceId(user);\n // CompositeAuth validates the authenticating provider's mapper. It can\n // return undefined when that provider never configured a mapper.\n if (resourceId !== undefined || !(authConfig instanceof CompositeAuth)) {\n if (typeof resourceId !== 'string' || !resourceId.trim()) {\n throw new Error('mapUserToResourceId must return a non-empty string for the authenticated user');\n }\n requestContext.set(MASTRA_RESOURCE_ID_KEY, resourceId);\n }\n } catch (mapError) {\n mastra.getLogger()?.error('mapUserToResourceId failed', {\n error: mapError instanceof Error ? { message: mapError.message, stack: mapError.stack } : mapError,\n });\n return {\n action: 'error',\n status: 500,\n body: { error: 'Failed to map authenticated user to a resource ID' },\n headers: refreshHeaders,\n };\n }\n }\n\n try {\n // Determine which RBAC provider to use based on auth mode\n const authMode = requestContext.get(MASTRA_AUTH_MODE_KEY);\n const serverConfig = mastra.getServer();\n const studioConfig = mastra.getStudio?.();\n // Use studio RBAC if this is a studio request, otherwise use server RBAC\n const rbacProvider = (authMode === 'studio' ? (studioConfig?.rbac ?? serverConfig?.rbac) : serverConfig?.rbac) as\n | IRBACProvider<EEUser>\n | undefined;\n\n if (rbacProvider) {\n if (!user || typeof user !== 'object' || !('id' in user)) {\n mastra.getLogger()?.warn('RBAC: authenticated user missing required \"id\" field, skipping permission loading');\n } else {\n const permissions = await rbacProvider.getPermissions(user as EEUser);\n requestContext.set(MASTRA_USER_PERMISSIONS_KEY, permissions);\n // Backward-compat alias for callers reading the legacy key.\n requestContext.set('userPermissions', permissions);\n\n const roles = await rbacProvider.getRoles(user as EEUser);\n requestContext.set(MASTRA_USER_ROLES_KEY, roles);\n // Backward-compat alias for callers reading the legacy key.\n requestContext.set('userRoles', roles);\n }\n }\n } catch (rbacError) {\n mastra.getLogger()?.error('RBAC: failed to load user permissions/roles', {\n error: rbacError instanceof Error ? { message: rbacError.message, stack: rbacError.stack } : rbacError,\n });\n }\n } catch (err) {\n mastra.getLogger()?.error('Authentication error', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n });\n // Explicit HTTP errors from auth callbacks keep their status/message; anything else is redacted.\n // The HTTPException message is sent to the client, so callers must keep it safe (no internal details).\n if (err instanceof HTTPException && err.status >= 400 && err.status <= 599) {\n return { action: 'error', status: err.status, body: { error: err.message }, headers: refreshHeaders };\n }\n return { action: 'error', status: 401, body: { error: 'Invalid or expired token' }, headers: refreshHeaders };\n }\n\n // ── Authorization ──\n\n const authorizationError = await authorizeAuthenticatedUser({\n path,\n method,\n user,\n mastra,\n authConfig,\n customRouteAuthConfig,\n requestContext,\n rawRequest,\n buildAuthorizeContext: ctx.buildAuthorizeContext,\n });\n if (authorizationError) {\n return { action: 'error', ...authorizationError, headers: refreshHeaders };\n }\n\n return refreshHeaders ? { action: 'next', headers: refreshHeaders } : pass;\n};\n\nexport interface AuthorizeAuthenticatedUserContext {\n path: string;\n method: string;\n user: unknown;\n mastra: Mastra;\n authConfig: MastraAuthConfig;\n customRouteAuthConfig?: Map<string, boolean>;\n requestContext: AuthMiddlewareContext['requestContext'];\n rawRequest: MastraAuthRequest;\n buildAuthorizeContext: () => unknown;\n}\n\n/**\n * The authorization step of server auth for an already authenticated user:\n * `authorizeUser`, `authorize(path, method, user)`, `rules`, or the RBAC default rules.\n * Returns null when the user may access `method path`.\n */\nexport const authorizeAuthenticatedUser = async (\n ctx: AuthorizeAuthenticatedUserContext,\n): Promise<{ status: number; body: Record<string, unknown> } | null> => {\n const { path, method, user, mastra, authConfig, requestContext, rawRequest } = ctx;\n const denied = { status: 403, body: { error: 'Access denied' } };\n\n if ('authorizeUser' in authConfig && typeof authConfig.authorizeUser === 'function') {\n try {\n const isAuthorized = await authConfig.authorizeUser(user, adaptToMastraAuthRequest(rawRequest));\n return isAuthorized ? null : denied;\n } catch (err) {\n mastra.getLogger()?.error('Authorization error in authorizeUser', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n });\n return { status: 500, body: { error: 'Authorization error' } };\n }\n }\n\n if ('authorize' in authConfig && typeof authConfig.authorize === 'function') {\n try {\n const authorizeCtx = withAuthorizeVariables(ctx.buildAuthorizeContext(), {\n mastra,\n requestContext,\n customRouteAuthConfig: ctx.customRouteAuthConfig,\n rawRequest,\n });\n const isAuthorized = await authConfig.authorize(path, method, user, authorizeCtx as any);\n return isAuthorized ? null : denied;\n } catch (err) {\n mastra.getLogger()?.error('Authorization error in authorize', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n path,\n method,\n });\n return { status: 500, body: { error: 'Authorization error' } };\n }\n }\n\n if ('rules' in authConfig && authConfig.rules && authConfig.rules.length > 0) {\n return (await checkRules(authConfig.rules, path, method, user)) ? null : denied;\n }\n\n // No explicit authorization configured (authorizeUser, authorize, or rules)\n // Check if RBAC is configured - if not, allow authenticated users through\n // (auth-only mode = authenticated users get full access)\n const rbacProvider =\n requestContext.get(MASTRA_AUTH_MODE_KEY) === 'studio'\n ? (mastra.getStudio?.()?.rbac ?? mastra.getServer()?.rbac)\n : mastra.getServer()?.rbac;\n if (rbacProvider) {\n if (defaultAuthConfig.rules && defaultAuthConfig.rules.length > 0) {\n return (await checkRules(defaultAuthConfig.rules, path, method, user)) ? null : denied;\n }\n return denied;\n }\n\n return null;\n};\n\n// Check authorization rules\nexport const checkRules = async (\n rules: MastraAuthConfig['rules'],\n path: string,\n method: string,\n user: unknown,\n): Promise<boolean> => {\n // Go through rules in order (first match wins)\n for (const i in rules || []) {\n const rule = rules?.[i]!;\n // Check if rule applies to this path\n if (!pathMatchesRule(path, rule.path)) {\n continue;\n }\n\n // Check if rule applies to this method\n if (rule.methods && !matchesOrIncludes(rule.methods, method)) {\n continue;\n }\n\n // Rule matches, check conditions\n const condition = rule.condition;\n if (typeof condition === 'function') {\n const allowed = await Promise.resolve()\n .then(() => condition(user))\n .catch(() => false);\n\n if (allowed) {\n return true;\n }\n } else if (rule.allow) {\n return true;\n }\n }\n\n // No matching rules, deny by default\n return false;\n};\n"],"mappings":";;;;AAGA,MAAa,oBAAsC;CACjD,WAAW,CAAC,QAAQ;CACpB,QAAQ,CAAC,QAAQ,aAAa;CAE9B,OAAO,CAEL;EACE,YAAW,SAAQ;GACjB,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;IAC7C,IAAI,aAAa,MACf,OAAO,CAAC,CAAC,KAAK;IAGhB,IAAI,UAAU,MACZ,OAAO,KAAK,SAAS;GAEzB;GACA,OAAO;EACT;EACA,OAAO;CACT,CACF;AACF;;;;;;;;;;ACcA,SAAgB,MAAM,OAAwB,OAAgC;CAC5E,IAAI,iBAAiB,QAAQ,OAAO;EAAE,MAAM;EAAO,SAAS;CAAM;CAElE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,OAAiB,CAAC;CACxB,IAAI,UAAU;CACd,MAAM,MAAM,MAAM,MAAM,GAAG;CAE3B,IAAI,MAAM,IAAI,MAAM;CAEpB,OAAQ,MAAM,IAAI,MAAM,GAAI;EAC1B,IAAI,IAAI;EACR,IAAI,MAAM,KAAK;GACb,KAAK,KAAK,CAAC;GACX,WAAW,IAAI,OAAO,MAAM,eAAe;EAC7C,OAAO,IAAI,MAAM,KAAK;GACpB,IAAI,IAAI,QAAQ,KAAK,CAAC;GACtB,MAAM,IAAI,QAAQ,KAAK,CAAC;GACxB,KAAK,KAAK,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC;GAC5D,WAAW,CAAC,CAAC,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AK,MAAM,EAAE,OAAO,sBAAsB;EAAE;CAC/D;CAGF,IAAI,WAAW,cAAc,WAAW,SAAS,WAAW,MAAM,SAAS,GACzE,OAAQ,MAAM,WAAW,WAAW,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAO;CAU3E,IAHE,eAAe,IAAA,kBAAwB,MAAM,WACxC,OAAO,YAAY,CAAC,EAAE,QAAQ,OAAO,UAAU,CAAC,EAAE,OACnD,OAAO,UAAU,CAAC,EAAE,MACR;EAChB,IAAI,kBAAkB,SAAS,kBAAkB,MAAM,SAAS,GAC9D,OAAQ,MAAM,WAAW,kBAAkB,OAAO,MAAM,QAAQ,IAAI,IAAK,OAAO;EAElF,OAAO;CACT;CAEA,OAAO;AACT;AAGA,MAAa,aAAa,OACxB,OACA,MACA,QACA,SACqB;CAErB,KAAK,MAAM,KAAK,SAAS,CAAC,GAAG;EAC3B,MAAM,OAAO,QAAQ;EAErB,IAAI,CAAC,gBAAgB,MAAM,KAAK,IAAI,GAClC;EAIF,IAAI,KAAK,WAAW,CAAC,kBAAkB,KAAK,SAAS,MAAM,GACzD;EAIF,MAAM,YAAY,KAAK;EACvB,IAAI,OAAO,cAAc,YAKnB;OAAA,MAJkB,QAAQ,QAAQ,CAAC,CACpC,WAAW,UAAU,IAAI,CAAC,CAAC,CAC3B,YAAY,KAAK,GAGlB,OAAO;EAAA,OAEJ,IAAI,KAAK,OACd,OAAO;CAEX;CAGA,OAAO;AACT"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-CylvUIZm.cjs","names":["HTTPException","MASTRA_USER_KEY","MASTRA_AUTH_TOKEN_KEY","CompositeAuth","MASTRA_RESOURCE_ID_KEY","MASTRA_AUTH_MODE_KEY","MASTRA_USER_PERMISSIONS_KEY","MASTRA_USER_ROLES_KEY"],"sources":["../src/server/auth/defaults.ts","../src/server/auth/path-pattern.ts","../src/server/auth/helpers.ts"],"sourcesContent":["import type { MastraAuthConfig } from '@mastra/core/server';\n\n// Default configuration that can be extended by clients\nexport const defaultAuthConfig: MastraAuthConfig = {\n protected: ['/api/*'],\n public: ['/api', '/api/auth/*'],\n // Simple rule system\n rules: [\n // Admin users can do anything\n {\n condition: user => {\n if (typeof user === 'object' && user !== null) {\n if ('isAdmin' in user) {\n return !!user.isAdmin;\n }\n\n if ('role' in user) {\n return user.role === 'admin';\n }\n }\n return false;\n },\n allow: true,\n },\n ],\n};\n","/**\n * Path pattern matching utility\n * Inlined from regexparam v3.0.0 (MIT License)\n * https://github.com/lukeed/regexparam\n *\n * Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport interface ParsedPattern {\n keys: string[] | false;\n pattern: RegExp;\n}\n\n/**\n * Parse a route pattern into a RegExp\n * Supports:\n * - Named parameters: /users/:id\n * - Optional parameters: /users/:id?\n * - Wildcards: /files/*\n * - Mixed patterns: /api/:version/users/:id\n */\nexport function parse(input: string | RegExp, loose?: boolean): ParsedPattern {\n if (input instanceof RegExp) return { keys: false, pattern: input };\n\n let c: string;\n let o: number;\n let tmp: string | undefined;\n let ext: number;\n const keys: string[] = [];\n let pattern = '';\n const arr = input.split('/');\n\n arr[0] || arr.shift();\n\n while ((tmp = arr.shift())) {\n c = tmp[0]!;\n if (c === '*') {\n keys.push(c);\n pattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';\n } else if (c === ':') {\n o = tmp.indexOf('?', 1);\n ext = tmp.indexOf('.', 1);\n keys.push(tmp.substring(1, ~o ? o : ~ext ? ext : tmp.length));\n pattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';\n if (~ext) pattern += (~o ? '?' : '') + '\\\\' + tmp.substring(ext);\n } else {\n pattern += '/' + tmp;\n }\n }\n\n return {\n keys: keys,\n pattern: new RegExp('^' + pattern + (loose ? '(?=$|/)' : '/?$'), 'i'),\n };\n}\n\n/**\n * Test if a path matches a pattern\n */\nexport function matchPath(path: string, pattern: string | RegExp): boolean {\n const { pattern: regex } = parse(pattern);\n return regex.test(path);\n}\n","import type { ISessionProvider } from '@mastra/core/auth';\nimport type { IRBACProvider, EEUser } from '@mastra/core/auth/ee';\nimport type { Mastra } from '@mastra/core/mastra';\nimport { CompositeAuth } from '@mastra/core/server';\nimport type { ApiRoute, IMastraAuthProvider, MastraAuthConfig, MastraAuthRequest } from '@mastra/core/server';\n\nimport {\n MASTRA_RESOURCE_ID_KEY,\n MASTRA_USER_KEY,\n MASTRA_USER_PERMISSIONS_KEY,\n MASTRA_USER_ROLES_KEY,\n MASTRA_AUTH_TOKEN_KEY,\n MASTRA_AUTH_MODE_KEY,\n} from '../constants';\nimport { HTTPException } from '../http-exception';\nimport { defaultAuthConfig } from './defaults';\nimport { parse } from './path-pattern';\n\n// Re-export request-context key constants so custom middleware can read namespaced\n// auth state without importing internal paths.\nexport { MASTRA_USER_KEY, MASTRA_USER_PERMISSIONS_KEY, MASTRA_USER_ROLES_KEY } from '../constants';\n\n/**\n * Check if a route is a registered custom route that requires authentication.\n * Returns true only if the route is explicitly registered with requiresAuth: true.\n * Returns false if the route is not in the config or has requiresAuth: false.\n */\nexport const isProtectedCustomRoute = (\n path: string,\n method: string,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n if (!customRouteAuthConfig) {\n return false;\n }\n\n // Check exact match first (fast path for static routes)\n const exactRouteKey = `${method}:${path}`;\n if (customRouteAuthConfig.has(exactRouteKey)) {\n return customRouteAuthConfig.get(exactRouteKey) === true;\n }\n\n // Check exact match for ALL method\n const allRouteKey = `ALL:${path}`;\n if (customRouteAuthConfig.has(allRouteKey)) {\n return customRouteAuthConfig.get(allRouteKey) === true;\n }\n\n // Check pattern matches for dynamic routes (e.g., '/users/:id')\n for (const [routeKey, requiresAuth] of customRouteAuthConfig.entries()) {\n const colonIndex = routeKey.indexOf(':');\n if (colonIndex === -1) {\n continue; // Skip malformed keys\n }\n\n const routeMethod = routeKey.substring(0, colonIndex);\n const routePattern = routeKey.substring(colonIndex + 1);\n\n // Check if method matches (exact match or ALL)\n if (routeMethod !== method && routeMethod !== 'ALL') {\n continue;\n }\n\n // Check if path matches the pattern\n if (pathMatchesPattern(path, routePattern)) {\n return requiresAuth === true;\n }\n }\n\n return false; // Not in config = not a protected custom route\n};\n\n/**\n * Find a matching custom API route for the given path and method.\n * Returns the matched route and any extracted path parameters.\n */\nexport const findMatchingCustomRoute = (\n path: string,\n method: string,\n apiRoutes?: ApiRoute[],\n): { route: ApiRoute; params: Record<string, string> } | undefined => {\n if (!apiRoutes) return undefined;\n\n for (const route of apiRoutes) {\n if (route.method !== method && route.method !== 'ALL') continue;\n\n const { keys, pattern: regex } = parse(route.path);\n const match = regex.exec(path);\n if (!match) continue;\n\n const params: Record<string, string> = {};\n if (keys && keys.length > 0) {\n for (let i = 0; i < keys.length; i++) {\n if (match[i + 1] !== undefined) {\n params[keys[i]!] = match[i + 1]!;\n }\n }\n }\n\n return { route, params };\n }\n\n return undefined;\n};\n\n/**\n * Check if request is from dev playground\n * @param getHeader - Function to get header value from request\n * @param customRouteAuthConfig - Map of custom route auth configurations\n */\nexport const isDevPlaygroundRequest = (\n path: string,\n method: string,\n getHeader: (name: string) => string | undefined,\n authConfig: MastraAuthConfig,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n const protectedAccess = [...(defaultAuthConfig.protected || []), ...(authConfig.protected || [])];\n return (\n process.env.MASTRA_DEV === 'true' &&\n // Allow if path doesn't match protected patterns AND is not a protected custom route\n ((!isAnyMatch(path, method, protectedAccess) && !isProtectedCustomRoute(path, method, customRouteAuthConfig)) ||\n // Or if has playground header\n getHeader('x-mastra-dev-playground') === 'true')\n );\n};\n\nexport const isCustomRoutePublic = (\n path: string,\n method: string,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n if (!customRouteAuthConfig) {\n return false;\n }\n\n // Check exact match first (fast path for static routes)\n const exactRouteKey = `${method}:${path}`;\n if (customRouteAuthConfig.has(exactRouteKey)) {\n return !customRouteAuthConfig.get(exactRouteKey); // True when route opts out of auth\n }\n\n // Check exact match for ALL method\n const allRouteKey = `ALL:${path}`;\n if (customRouteAuthConfig.has(allRouteKey)) {\n return !customRouteAuthConfig.get(allRouteKey);\n }\n\n // Check pattern matches for dynamic routes (e.g., '/users/:id').\n // Any matching pattern that requires auth wins over overlapping public patterns.\n let matchedPublic = false;\n for (const [routeKey, requiresAuth] of customRouteAuthConfig.entries()) {\n const colonIndex = routeKey.indexOf(':');\n if (colonIndex === -1) {\n continue; // Skip malformed keys\n }\n\n const routeMethod = routeKey.substring(0, colonIndex);\n const routePattern = routeKey.substring(colonIndex + 1);\n\n // Check if method matches (exact match or ALL)\n if (routeMethod !== method && routeMethod !== 'ALL') {\n continue;\n }\n\n if (pathMatchesPattern(path, routePattern)) {\n if (requiresAuth) {\n return false;\n }\n matchedPublic = true;\n }\n }\n\n return matchedPublic;\n};\n\n// NOTE: This uses isProtectedCustomRoute (default-allow for unknown paths) rather than\n// !isCustomRoutePublic (default-deny). This is intentional — all registered server and\n// custom routes are auth-checked via registerRoute/checkRouteAuth regardless of this\n// function. The '/api/*' protected pattern exists as a user-facing override mechanism.\n// The old default-deny logic incorrectly blocked non-API paths (e.g. '/', '/agents')\n// which prevented the studio login page from loading in production.\nexport const isProtectedPath = (\n path: string,\n method: string,\n authConfig: MastraAuthConfig,\n customRouteAuthConfig?: Map<string, boolean>,\n): boolean => {\n const protectedAccess = [...(defaultAuthConfig.protected || []), ...(authConfig.protected || [])];\n return isAnyMatch(path, method, protectedAccess) || isProtectedCustomRoute(path, method, customRouteAuthConfig);\n};\n\nexport const canAccessPublicly = (path: string, method: string, authConfig: MastraAuthConfig): boolean => {\n // Check if this path+method combination is publicly accessible\n const publicAccess = [...(defaultAuthConfig.public || []), ...(authConfig.public || [])];\n\n return isAnyMatch(path, method, publicAccess);\n};\n\nconst isAnyMatch = (\n path: string,\n method: string,\n patterns: MastraAuthConfig['protected'] | MastraAuthConfig['public'],\n): boolean => {\n if (!patterns) {\n return false;\n }\n\n for (const patternPathOrMethod of patterns) {\n if (patternPathOrMethod instanceof RegExp) {\n if (patternPathOrMethod.test(path)) {\n return true;\n }\n }\n\n if (typeof patternPathOrMethod === 'string' && pathMatchesPattern(path, patternPathOrMethod)) {\n return true;\n }\n\n if (Array.isArray(patternPathOrMethod) && patternPathOrMethod.length === 2) {\n const [pattern, methodOrMethods] = patternPathOrMethod;\n if (pathMatchesPattern(path, pattern) && matchesOrIncludes(methodOrMethods, method)) {\n return true;\n }\n }\n }\n\n return false;\n};\n\nexport const pathMatchesPattern = (path: string, pattern: string): boolean => {\n // Use regexparam for battle-tested path matching\n // Supports:\n // - Exact paths: '/api/users'\n // - Wildcards: '/api/agents/*' matches '/api/agents/123'\n // - Path parameters: '/users/:id' matches '/users/123'\n // - Optional parameters: '/users/:id?' matches '/users' and '/users/123'\n // - Mixed patterns: '/api/:version/users/:id/profile'\n const { pattern: regex } = parse(pattern);\n return regex.test(path);\n};\n\nexport const pathMatchesRule = (path: string, rulePath: string | RegExp | string[] | undefined): boolean => {\n if (!rulePath) return true; // No path specified means all paths\n\n if (typeof rulePath === 'string') {\n return pathMatchesPattern(path, rulePath);\n }\n\n if (rulePath instanceof RegExp) {\n return rulePath.test(path);\n }\n\n if (Array.isArray(rulePath)) {\n return rulePath.some(p => pathMatchesPattern(path, p));\n }\n\n return false;\n};\n\nexport const matchesOrIncludes = (values: string | string[], value: string): boolean => {\n if (typeof values === 'string') {\n return values === value;\n }\n\n if (Array.isArray(values)) {\n return values.includes(value);\n }\n\n return false;\n};\n\n// ── Core auth middleware ──\n// Framework-agnostic auth logic extracted from adapter middlewares.\n// Each adapter builds an AuthMiddlewareContext and delegates to coreAuthMiddleware.\n\nexport interface AuthMiddlewareContext {\n path: string;\n method: string;\n getHeader: (name: string) => string | undefined;\n mastra: Mastra;\n authConfig: MastraAuthConfig;\n customRouteAuthConfig?: Map<string, boolean>;\n requestContext: { get: (key: string) => unknown; set: (key: string, value: unknown) => void };\n rawRequest: MastraAuthRequest;\n token: string | null;\n buildAuthorizeContext: () => unknown;\n /** When true, force authentication even if the path matches a public pattern. */\n requiresAuth?: boolean;\n}\n\nexport type AuthResult =\n | { action: 'next'; headers?: Record<string, string> }\n | { action: 'error'; status: number; body: Record<string, unknown>; headers?: Record<string, string> };\n\nconst pass: AuthResult = { action: 'next' };\n\n/**\n * Lets an app's `authorize(path, method, user, context)` read `context.get('requestContext')` and\n * `context.get('mastra')` on every adapter, as it can on Hono, so per-caller values (the Knowledge scope) bind\n * the same way everywhere. Hono and NestJS contexts already answer `get`; Express, Fastify and Koa pass a web\n * Request, Elysia its own context, and adapters with no builder pass nothing.\n */\nconst withAuthorizeVariables = (\n base: unknown,\n ctx: Pick<AuthMiddlewareContext, 'mastra' | 'requestContext' | 'customRouteAuthConfig' | 'rawRequest'>,\n): unknown => {\n const variables: Record<string, unknown> = {\n mastra: ctx.mastra,\n requestContext: ctx.requestContext,\n customRouteAuthConfig: ctx.customRouteAuthConfig,\n };\n const get = (key: string) => variables[key];\n if (base === null || base === undefined) {\n return { get, req: ctx.rawRequest };\n }\n if (typeof base === 'object' && typeof (base as { get?: unknown }).get !== 'function') {\n Object.defineProperty(base, 'get', { value: get, configurable: true });\n }\n return base;\n};\n\nconst adaptToMastraAuthRequest = (request: MastraAuthRequest): MastraAuthRequest => {\n if (!(request instanceof Request)) {\n return request;\n }\n\n return {\n raw: request,\n headers: request.headers,\n header: name => request.headers.get(name) ?? undefined,\n };\n};\n\nexport interface GetAuthenticatedUserOptions {\n mastra: Mastra;\n token: string;\n request: MastraAuthRequest;\n}\n\nexport const getAuthenticatedUser = async <TUser = unknown>({\n mastra,\n token,\n request,\n}: GetAuthenticatedUserOptions): Promise<TUser | null> => {\n const normalizedToken = token.replace(/^Bearer\\s+/i, '').trim();\n if (!normalizedToken) {\n return null;\n }\n\n const authConfig = mastra.getServer()?.auth;\n if (!authConfig || typeof authConfig.authenticateToken !== 'function') {\n return null;\n }\n\n return (await authConfig.authenticateToken(normalizedToken, request)) as TUser | null;\n};\n\n/**\n * Check if an auth config object supports transparent session refresh.\n * Returns true if the auth provider implements the necessary ISessionProvider methods.\n */\nexport function supportsSessionRefresh(\n authConfig: MastraAuthConfig | IMastraAuthProvider,\n): authConfig is (MastraAuthConfig | IMastraAuthProvider) &\n Pick<ISessionProvider, 'refreshSession' | 'getSessionIdFromRequest' | 'getSessionHeaders'> {\n return (\n typeof (authConfig as any).getSessionIdFromRequest === 'function' &&\n typeof (authConfig as any).refreshSession === 'function' &&\n typeof (authConfig as any).getSessionHeaders === 'function'\n );\n}\n\n/**\n * Single auth middleware: authenticate → authorize.\n * Skip checks (dev playground, unprotected path, public path) are evaluated once.\n */\nexport const coreAuthMiddleware = async (ctx: AuthMiddlewareContext): Promise<AuthResult> => {\n const {\n path,\n method,\n getHeader,\n mastra,\n authConfig,\n customRouteAuthConfig,\n requestContext,\n rawRequest,\n token,\n requiresAuth,\n } = ctx;\n\n // ── Skip checks (evaluated once) ──\n\n // Only bypass auth for dev playground when no real auth provider is configured.\n // When auth IS configured (has authenticateToken), we need the full auth flow\n // so user/roles/permissions are set in requestContext.\n const hasAuthProvider = typeof authConfig.authenticateToken === 'function';\n if (!hasAuthProvider && isDevPlaygroundRequest(path, method, getHeader, authConfig, customRouteAuthConfig)) {\n return pass;\n }\n\n if (!isProtectedPath(path, method, authConfig, customRouteAuthConfig)) {\n return pass;\n }\n\n // When a route explicitly requires auth (requiresAuth: true), skip the\n // public-path bypass so the user is still authenticated and permissions\n // are injected into the request context.\n if (\n !requiresAuth &&\n (canAccessPublicly(path, method, authConfig) || isCustomRoutePublic(path, method, customRouteAuthConfig))\n ) {\n return pass;\n }\n\n // ── Authentication ──\n\n let user: unknown;\n let refreshHeaders: Record<string, string> | undefined;\n const authRequest = adaptToMastraAuthRequest(rawRequest);\n\n type ConsumePendingResponseHeadersFn = (request: typeof authRequest) => Record<string, string> | undefined;\n const mergePendingProviderHeaders = (request: typeof authRequest = authRequest) => {\n const consume = (authConfig as { consumePendingResponseHeaders?: ConsumePendingResponseHeadersFn })\n .consumePendingResponseHeaders;\n if (typeof consume !== 'function') return;\n let pending: Record<string, string> | undefined;\n try {\n pending = consume.call(authConfig, request);\n } catch {\n // Forwarding a rotated cookie is best-effort; never fail auth over it.\n return;\n }\n if (!pending) return;\n refreshHeaders = { ...(refreshHeaders ?? {}), ...pending };\n };\n\n try {\n if (typeof authConfig.authenticateToken === 'function') {\n user = await authConfig.authenticateToken(token ?? '', authRequest);\n mergePendingProviderHeaders();\n } else {\n throw new Error('No token verification method configured');\n }\n\n // If authentication failed, attempt transparent session refresh before returning 401.\n // This handles expired access tokens without requiring client-side refresh logic.\n if (!user && supportsSessionRefresh(authConfig) && rawRequest instanceof Request) {\n let retryHttpError: HTTPException | undefined;\n try {\n const sessionId = authConfig.getSessionIdFromRequest(rawRequest);\n if (sessionId) {\n const newSession = await authConfig.refreshSession(sessionId);\n if (newSession) {\n // Refresh succeeded — build updated session headers and re-authenticate.\n // We create a synthetic request with the new session cookie so\n // authenticateToken (which reads cookies from the request) picks up\n // the refreshed session instead of the expired one.\n refreshHeaders = authConfig.getSessionHeaders(newSession);\n const refreshedCookie = Object.entries(refreshHeaders)\n .filter(([k]) => k.toLowerCase() === 'set-cookie')\n .map(([, v]) => v.split(';')[0]) // Extract name=value before attributes\n .join('; ');\n if (refreshedCookie) {\n const refreshedRequest = new Request(rawRequest.url, {\n method: rawRequest.method,\n headers: new Headers(rawRequest.headers),\n });\n refreshedRequest.headers.set('Cookie', refreshedCookie);\n // Pass the refreshed cookie value as the token so authenticateToken\n // picks up the new session instead of the stale original.\n // Auth providers typically read cookies from the request object, but\n // some may also inspect the token parameter directly.\n const cookieValue = refreshedCookie.includes('=')\n ? refreshedCookie.split('=').slice(1).join('=')\n : refreshedCookie;\n try {\n const retryAuthRequest = adaptToMastraAuthRequest(refreshedRequest);\n user = await authConfig.authenticateToken(cookieValue, retryAuthRequest);\n mergePendingProviderHeaders(retryAuthRequest);\n } catch (retryErr) {\n retryHttpError = retryErr instanceof HTTPException ? retryErr : undefined;\n throw retryErr;\n }\n }\n if (!user) {\n refreshHeaders = undefined;\n }\n }\n }\n } catch (refreshErr) {\n refreshHeaders = undefined;\n // An explicit HTTP error from the retried authenticateToken goes to the outer handler.\n if (retryHttpError === refreshErr) throw refreshErr;\n mastra.getLogger()?.debug('Session refresh failed, falling back to 401', {\n error: refreshErr instanceof Error ? { message: refreshErr.message } : refreshErr,\n });\n }\n }\n\n if (!user) {\n return { action: 'error', status: 401, body: { error: 'Invalid or expired token' }, headers: refreshHeaders };\n }\n\n requestContext.set(MASTRA_USER_KEY, user);\n // Backward-compat: also write the legacy `'user'` key so existing\n // middleware and integrations that read `requestContext.get('user')`\n // (including built-in FGA route enforcement, memory handlers, and the\n // documented public surface) keep working. New code should prefer\n // `MASTRA_USER_KEY` to avoid collisions with caller-supplied keys.\n requestContext.set('user', user);\n\n // Store the raw auth token so downstream code (e.g., editor MCP client\n // resolution) can forward it when connecting to auth-protected MCP servers.\n // The token may arrive via Authorization header, apiKey query param, or\n // cookie (SimpleAuth sets `mastra-token`). Check all sources so the\n // forwarded value is available regardless of how the user authenticated.\n let effectiveToken = token;\n if (!effectiveToken && rawRequest instanceof Request) {\n const cookieHeader = rawRequest.headers.get('cookie');\n if (cookieHeader) {\n const match = cookieHeader.match(/mastra-token=([^;]+)/);\n if (match?.[1]) effectiveToken = match[1];\n }\n }\n if (effectiveToken) {\n requestContext.set(MASTRA_AUTH_TOKEN_KEY, effectiveToken);\n }\n\n if (typeof authConfig.mapUserToResourceId === 'function') {\n try {\n const resourceId = authConfig.mapUserToResourceId(user);\n // CompositeAuth validates the authenticating provider's mapper. It can\n // return undefined when that provider never configured a mapper.\n if (resourceId !== undefined || !(authConfig instanceof CompositeAuth)) {\n if (typeof resourceId !== 'string' || !resourceId.trim()) {\n throw new Error('mapUserToResourceId must return a non-empty string for the authenticated user');\n }\n requestContext.set(MASTRA_RESOURCE_ID_KEY, resourceId);\n }\n } catch (mapError) {\n mastra.getLogger()?.error('mapUserToResourceId failed', {\n error: mapError instanceof Error ? { message: mapError.message, stack: mapError.stack } : mapError,\n });\n return {\n action: 'error',\n status: 500,\n body: { error: 'Failed to map authenticated user to a resource ID' },\n headers: refreshHeaders,\n };\n }\n }\n\n try {\n // Determine which RBAC provider to use based on auth mode\n const authMode = requestContext.get(MASTRA_AUTH_MODE_KEY);\n const serverConfig = mastra.getServer();\n const studioConfig = mastra.getStudio?.();\n // Use studio RBAC if this is a studio request, otherwise use server RBAC\n const rbacProvider = (authMode === 'studio' ? (studioConfig?.rbac ?? serverConfig?.rbac) : serverConfig?.rbac) as\n | IRBACProvider<EEUser>\n | undefined;\n\n if (rbacProvider) {\n if (!user || typeof user !== 'object' || !('id' in user)) {\n mastra.getLogger()?.warn('RBAC: authenticated user missing required \"id\" field, skipping permission loading');\n } else {\n const permissions = await rbacProvider.getPermissions(user as EEUser);\n requestContext.set(MASTRA_USER_PERMISSIONS_KEY, permissions);\n // Backward-compat alias for callers reading the legacy key.\n requestContext.set('userPermissions', permissions);\n\n const roles = await rbacProvider.getRoles(user as EEUser);\n requestContext.set(MASTRA_USER_ROLES_KEY, roles);\n // Backward-compat alias for callers reading the legacy key.\n requestContext.set('userRoles', roles);\n }\n }\n } catch (rbacError) {\n mastra.getLogger()?.error('RBAC: failed to load user permissions/roles', {\n error: rbacError instanceof Error ? { message: rbacError.message, stack: rbacError.stack } : rbacError,\n });\n }\n } catch (err) {\n mastra.getLogger()?.error('Authentication error', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n });\n // Explicit HTTP errors from auth callbacks keep their status/message; anything else is redacted.\n // The HTTPException message is sent to the client, so callers must keep it safe (no internal details).\n if (err instanceof HTTPException && err.status >= 400 && err.status <= 599) {\n return { action: 'error', status: err.status, body: { error: err.message }, headers: refreshHeaders };\n }\n return { action: 'error', status: 401, body: { error: 'Invalid or expired token' }, headers: refreshHeaders };\n }\n\n // ── Authorization ──\n\n const authorizationError = await authorizeAuthenticatedUser({\n path,\n method,\n user,\n mastra,\n authConfig,\n customRouteAuthConfig,\n requestContext,\n rawRequest,\n buildAuthorizeContext: ctx.buildAuthorizeContext,\n });\n if (authorizationError) {\n return { action: 'error', ...authorizationError, headers: refreshHeaders };\n }\n\n return refreshHeaders ? { action: 'next', headers: refreshHeaders } : pass;\n};\n\nexport interface AuthorizeAuthenticatedUserContext {\n path: string;\n method: string;\n user: unknown;\n mastra: Mastra;\n authConfig: MastraAuthConfig;\n customRouteAuthConfig?: Map<string, boolean>;\n requestContext: AuthMiddlewareContext['requestContext'];\n rawRequest: MastraAuthRequest;\n buildAuthorizeContext: () => unknown;\n}\n\n/**\n * The authorization step of server auth for an already authenticated user:\n * `authorizeUser`, `authorize(path, method, user)`, `rules`, or the RBAC default rules.\n * Returns null when the user may access `method path`.\n */\nexport const authorizeAuthenticatedUser = async (\n ctx: AuthorizeAuthenticatedUserContext,\n): Promise<{ status: number; body: Record<string, unknown> } | null> => {\n const { path, method, user, mastra, authConfig, requestContext, rawRequest } = ctx;\n const denied = { status: 403, body: { error: 'Access denied' } };\n\n if ('authorizeUser' in authConfig && typeof authConfig.authorizeUser === 'function') {\n try {\n const isAuthorized = await authConfig.authorizeUser(user, adaptToMastraAuthRequest(rawRequest));\n return isAuthorized ? null : denied;\n } catch (err) {\n mastra.getLogger()?.error('Authorization error in authorizeUser', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n });\n return { status: 500, body: { error: 'Authorization error' } };\n }\n }\n\n if ('authorize' in authConfig && typeof authConfig.authorize === 'function') {\n try {\n const authorizeCtx = withAuthorizeVariables(ctx.buildAuthorizeContext(), {\n mastra,\n requestContext,\n customRouteAuthConfig: ctx.customRouteAuthConfig,\n rawRequest,\n });\n const isAuthorized = await authConfig.authorize(path, method, user, authorizeCtx as any);\n return isAuthorized ? null : denied;\n } catch (err) {\n mastra.getLogger()?.error('Authorization error in authorize', {\n error: err instanceof Error ? { message: err.message, stack: err.stack } : err,\n path,\n method,\n });\n return { status: 500, body: { error: 'Authorization error' } };\n }\n }\n\n if ('rules' in authConfig && authConfig.rules && authConfig.rules.length > 0) {\n return (await checkRules(authConfig.rules, path, method, user)) ? null : denied;\n }\n\n // No explicit authorization configured (authorizeUser, authorize, or rules)\n // Check if RBAC is configured - if not, allow authenticated users through\n // (auth-only mode = authenticated users get full access)\n const rbacProvider =\n requestContext.get(MASTRA_AUTH_MODE_KEY) === 'studio'\n ? (mastra.getStudio?.()?.rbac ?? mastra.getServer()?.rbac)\n : mastra.getServer()?.rbac;\n if (rbacProvider) {\n if (defaultAuthConfig.rules && defaultAuthConfig.rules.length > 0) {\n return (await checkRules(defaultAuthConfig.rules, path, method, user)) ? null : denied;\n }\n return denied;\n }\n\n return null;\n};\n\n// Check authorization rules\nexport const checkRules = async (\n rules: MastraAuthConfig['rules'],\n path: string,\n method: string,\n user: unknown,\n): Promise<boolean> => {\n // Go through rules in order (first match wins)\n for (const i in rules || []) {\n const rule = rules?.[i]!;\n // Check if rule applies to this path\n if (!pathMatchesRule(path, rule.path)) {\n continue;\n }\n\n // Check if rule applies to this method\n if (rule.methods && !matchesOrIncludes(rule.methods, method)) {\n continue;\n }\n\n // Rule matches, check conditions\n const condition = rule.condition;\n if (typeof condition === 'function') {\n const allowed = await Promise.resolve()\n .then(() => condition(user))\n .catch(() => false);\n\n if (allowed) {\n return true;\n }\n } else if (rule.allow) {\n return true;\n }\n }\n\n // No matching rules, deny by default\n return false;\n};\n"],"mappings":";;;;AAGA,MAAa,oBAAsC;CACjD,WAAW,CAAC,QAAQ;CACpB,QAAQ,CAAC,QAAQ,aAAa;CAE9B,OAAO,CAEL;EACE,YAAW,SAAQ;GACjB,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;IAC7C,IAAI,aAAa,MACf,OAAO,CAAC,CAAC,KAAK;IAGhB,IAAI,UAAU,MACZ,OAAO,KAAK,SAAS;GAEzB;GACA,OAAO;EACT;EACA,OAAO;CACT,CACF;AACF;;;;;;;;;;ACcA,SAAgB,MAAM,OAAwB,OAAgC;CAC5E,IAAI,iBAAiB,QAAQ,OAAO;EAAE,MAAM;EAAO,SAAS;CAAM;CAElE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,OAAiB,CAAC;CACxB,IAAI,UAAU;CACd,MAAM,MAAM,MAAM,MAAM,GAAG;CAE3B,IAAI,MAAM,IAAI,MAAM;CAEpB,OAAQ,MAAM,IAAI,MAAM,GAAI;EAC1B,IAAI,IAAI;EACR,IAAI,MAAM,KAAK;GACb,KAAK,KAAK,CAAC;GACX,WAAW,IAAI,OAAO,MAAM,eAAe;EAC7C,OAAO,IAAI,MAAM,KAAK;GACpB,IAAI,IAAI,QAAQ,KAAK,CAAC;GACtB,MAAM,IAAI,QAAQ,KAAK,CAAC;GACxB,KAAK,KAAK,IAAI,UAAU,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC;GAC5D,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM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