@mastra/server 1.45.0 → 1.46.0-alpha.0

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 (113) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{api-schema-manifest-MVG5MVVM.js → api-schema-manifest-3MIPI77N.js} +3 -3
  3. package/dist/{api-schema-manifest-MVG5MVVM.js.map → api-schema-manifest-3MIPI77N.js.map} +1 -1
  4. package/dist/{api-schema-manifest-2YIXHU7U.cjs → api-schema-manifest-LFSM6XAL.cjs} +4 -4
  5. package/dist/{api-schema-manifest-2YIXHU7U.cjs.map → api-schema-manifest-LFSM6XAL.cjs.map} +1 -1
  6. package/dist/{chunk-M2ZGNEQS.cjs → chunk-73MURMD2.cjs} +4 -4
  7. package/dist/{chunk-M2ZGNEQS.cjs.map → chunk-73MURMD2.cjs.map} +1 -1
  8. package/dist/{chunk-DZD7RZYY.cjs → chunk-7DKSWNOM.cjs} +30 -11
  9. package/dist/chunk-7DKSWNOM.cjs.map +1 -0
  10. package/dist/{chunk-4DBFKPAF.js → chunk-BYCLHKAC.js} +3 -3
  11. package/dist/{chunk-4DBFKPAF.js.map → chunk-BYCLHKAC.js.map} +1 -1
  12. package/dist/{chunk-3B4FDRBB.js → chunk-C4U5EL4H.js} +4 -4
  13. package/dist/{chunk-3B4FDRBB.js.map → chunk-C4U5EL4H.js.map} +1 -1
  14. package/dist/{chunk-SB4KSDPH.js → chunk-CYOIFE4C.js} +15 -15
  15. package/dist/{chunk-SB4KSDPH.js.map → chunk-CYOIFE4C.js.map} +1 -1
  16. package/dist/{chunk-42FE4BWR.cjs → chunk-DEK4ZGUR.cjs} +4 -4
  17. package/dist/{chunk-42FE4BWR.cjs.map → chunk-DEK4ZGUR.cjs.map} +1 -1
  18. package/dist/{chunk-EP6T47YP.cjs → chunk-DULEYONH.cjs} +5 -5
  19. package/dist/{chunk-EP6T47YP.cjs.map → chunk-DULEYONH.cjs.map} +1 -1
  20. package/dist/{chunk-5ZC7LW3V.js → chunk-E345K7K7.js} +3 -3
  21. package/dist/{chunk-5ZC7LW3V.js.map → chunk-E345K7K7.js.map} +1 -1
  22. package/dist/{chunk-IZBO5ZFX.js → chunk-F5EEKLC4.js} +3 -3
  23. package/dist/{chunk-IZBO5ZFX.js.map → chunk-F5EEKLC4.js.map} +1 -1
  24. package/dist/{chunk-7FVXBMNI.js → chunk-J2LKP5LL.js} +3 -3
  25. package/dist/{chunk-7FVXBMNI.js.map → chunk-J2LKP5LL.js.map} +1 -1
  26. package/dist/{chunk-KLIW4CDU.cjs → chunk-JY2LHUT4.cjs} +4 -4
  27. package/dist/{chunk-KLIW4CDU.cjs.map → chunk-JY2LHUT4.cjs.map} +1 -1
  28. package/dist/{chunk-HL75U57J.cjs → chunk-K3FM6RLZ.cjs} +5 -5
  29. package/dist/{chunk-HL75U57J.cjs.map → chunk-K3FM6RLZ.cjs.map} +1 -1
  30. package/dist/{chunk-C2TGZEHN.cjs → chunk-KBSTGVA4.cjs} +3 -3
  31. package/dist/{chunk-C2TGZEHN.cjs.map → chunk-KBSTGVA4.cjs.map} +1 -1
  32. package/dist/{chunk-3PNIWKRR.cjs → chunk-M5DAKMVZ.cjs} +4 -4
  33. package/dist/{chunk-3PNIWKRR.cjs.map → chunk-M5DAKMVZ.cjs.map} +1 -1
  34. package/dist/{chunk-L5AY5PSX.js → chunk-MLLGO6XZ.js} +3 -3
  35. package/dist/{chunk-L5AY5PSX.js.map → chunk-MLLGO6XZ.js.map} +1 -1
  36. package/dist/{chunk-4VTU4GJA.js → chunk-NEPOKWAA.js} +3 -3
  37. package/dist/{chunk-4VTU4GJA.js.map → chunk-NEPOKWAA.js.map} +1 -1
  38. package/dist/{chunk-WW4CXOPU.js → chunk-PLWZVSGT.js} +3 -3
  39. package/dist/{chunk-WW4CXOPU.js.map → chunk-PLWZVSGT.js.map} +1 -1
  40. package/dist/{chunk-LRSOJJ5T.js → chunk-PUW3RA3B.js} +3 -3
  41. package/dist/{chunk-LRSOJJ5T.js.map → chunk-PUW3RA3B.js.map} +1 -1
  42. package/dist/{chunk-TOVVJNOF.js → chunk-PVID56QD.js} +3 -3
  43. package/dist/{chunk-TOVVJNOF.js.map → chunk-PVID56QD.js.map} +1 -1
  44. package/dist/{chunk-JGWDTZ4A.cjs → chunk-QGCSJMS7.cjs} +3 -3
  45. package/dist/{chunk-JGWDTZ4A.cjs.map → chunk-QGCSJMS7.cjs.map} +1 -1
  46. package/dist/{chunk-3ARFTVAY.cjs → chunk-S2HKHYJ3.cjs} +4 -4
  47. package/dist/{chunk-3ARFTVAY.cjs.map → chunk-S2HKHYJ3.cjs.map} +1 -1
  48. package/dist/{chunk-E4AD2HA2.js → chunk-TPGA2ZTS.js} +3 -3
  49. package/dist/{chunk-E4AD2HA2.js.map → chunk-TPGA2ZTS.js.map} +1 -1
  50. package/dist/{chunk-W4OKTHH6.js → chunk-TS5QYSEZ.js} +4 -4
  51. package/dist/{chunk-W4OKTHH6.js.map → chunk-TS5QYSEZ.js.map} +1 -1
  52. package/dist/{chunk-HGFJZ44K.cjs → chunk-UD7JBYUI.cjs} +11 -11
  53. package/dist/{chunk-HGFJZ44K.cjs.map → chunk-UD7JBYUI.cjs.map} +1 -1
  54. package/dist/{chunk-VJDD2ULL.cjs → chunk-UITLSJUW.cjs} +5 -5
  55. package/dist/{chunk-VJDD2ULL.cjs.map → chunk-UITLSJUW.cjs.map} +1 -1
  56. package/dist/{chunk-LGWHUDLR.cjs → chunk-UVJZRFSY.cjs} +105 -105
  57. package/dist/{chunk-LGWHUDLR.cjs.map → chunk-UVJZRFSY.cjs.map} +1 -1
  58. package/dist/{chunk-B5QILEDQ.js → chunk-WKSF3TVK.js} +31 -12
  59. package/dist/chunk-WKSF3TVK.js.map +1 -0
  60. package/dist/{chunk-XQNAOZJ6.cjs → chunk-WMVLRIPB.cjs} +5 -5
  61. package/dist/{chunk-XQNAOZJ6.cjs.map → chunk-WMVLRIPB.cjs.map} +1 -1
  62. package/dist/{chunk-WX7XEIYG.cjs → chunk-XOQEKMY2.cjs} +12 -12
  63. package/dist/{chunk-WX7XEIYG.cjs.map → chunk-XOQEKMY2.cjs.map} +1 -1
  64. package/dist/{chunk-ERGSG4B4.js → chunk-ZZOHO2FT.js} +3 -3
  65. package/dist/{chunk-ERGSG4B4.js.map → chunk-ZZOHO2FT.js.map} +1 -1
  66. package/dist/{dist-RII2Y4S4.js → dist-7DWILFVQ.js} +7 -4
  67. package/dist/{dist-RII2Y4S4.js.map → dist-7DWILFVQ.js.map} +1 -1
  68. package/dist/{dist-V3SVSSXI.cjs → dist-FN5GSHL2.cjs} +7 -4
  69. package/dist/{dist-V3SVSSXI.cjs.map → dist-FN5GSHL2.cjs.map} +1 -1
  70. package/dist/docs/SKILL.md +1 -1
  71. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  72. package/dist/server/handlers/a2a.cjs +14 -14
  73. package/dist/server/handlers/a2a.js +1 -1
  74. package/dist/server/handlers/agent-builder.cjs +17 -17
  75. package/dist/server/handlers/agent-builder.js +1 -1
  76. package/dist/server/handlers/agents.cjs +46 -46
  77. package/dist/server/handlers/agents.d.ts.map +1 -1
  78. package/dist/server/handlers/agents.js +1 -1
  79. package/dist/server/handlers/conversations.cjs +5 -5
  80. package/dist/server/handlers/conversations.js +1 -1
  81. package/dist/server/handlers/editor-builder.cjs +6 -6
  82. package/dist/server/handlers/editor-builder.js +1 -1
  83. package/dist/server/handlers/favorites-enrichment.cjs +4 -4
  84. package/dist/server/handlers/favorites-enrichment.js +1 -1
  85. package/dist/server/handlers/responses.cjs +4 -4
  86. package/dist/server/handlers/responses.js +1 -1
  87. package/dist/server/handlers/scores.cjs +7 -7
  88. package/dist/server/handlers/scores.js +1 -1
  89. package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
  90. package/dist/server/handlers/stored-agent-favorites.js +1 -1
  91. package/dist/server/handlers/stored-agents.cjs +10 -10
  92. package/dist/server/handlers/stored-agents.js +1 -1
  93. package/dist/server/handlers/stored-skill-favorites.cjs +3 -3
  94. package/dist/server/handlers/stored-skill-favorites.js +1 -1
  95. package/dist/server/handlers/stored-skills.cjs +7 -7
  96. package/dist/server/handlers/stored-skills.js +1 -1
  97. package/dist/server/handlers/system.cjs +3 -3
  98. package/dist/server/handlers/system.js +1 -1
  99. package/dist/server/handlers/tools.cjs +6 -6
  100. package/dist/server/handlers/tools.js +1 -1
  101. package/dist/server/handlers.cjs +14 -14
  102. package/dist/server/handlers.js +7 -7
  103. package/dist/server/server-adapter/index.cjs +22 -13
  104. package/dist/server/server-adapter/index.cjs.map +1 -1
  105. package/dist/server/server-adapter/index.d.ts +1 -0
  106. package/dist/server/server-adapter/index.d.ts.map +1 -1
  107. package/dist/server/server-adapter/index.js +11 -3
  108. package/dist/server/server-adapter/index.js.map +1 -1
  109. package/dist/server/server-adapter/serialize.d.ts +22 -0
  110. package/dist/server/server-adapter/serialize.d.ts.map +1 -0
  111. package/package.json +5 -5
  112. package/dist/chunk-B5QILEDQ.js.map +0 -1
  113. package/dist/chunk-DZD7RZYY.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.46.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added the AUTO_BLOCK_EXTERNAL_PROVIDERS environment variable. When set to `true` or `1`, Mastra Studio hides all external model providers (OpenAI, Anthropic, Gemini, etc.) and the built-in gateways, showing only the custom gateways you register. This lets enterprise deployments that route through their own gateway present just that gateway in the model picker. ([#18153](https://github.com/mastra-ai/mastra/pull/18153))
8
+
9
+ ```bash
10
+ AUTO_BLOCK_EXTERNAL_PROVIDERS=true
11
+ ```
12
+
13
+ ### Patch Changes
14
+
15
+ - The HTTP signal/message routes adapt to the agent's new `accepted` contract: they await `accepted` to derive the authoritative `runId` (falling back to the caller's `runId` or the stored signal id for `persist`/`discard`) while preserving the `{ accepted: true; runId: string }` wire shape. A setup/misconfig rejection tagged `ErrorCategory.USER` now maps to a `400` instead of a generic `500`. ([#18237](https://github.com/mastra-ai/mastra/pull/18237))
16
+
17
+ - Added a `serializeStreamChunk` helper to `@mastra/server/server-adapter` that server adapters use to safely serialize stream chunks. It converts values that JSON cannot represent (BigInt to string, circular references to "[Circular]") and reports a serialization error instead of throwing, so one bad chunk can no longer terminate an HTTP stream. Part of the fix for [#17821](https://github.com/mastra-ai/mastra/issues/17821) ([#17843](https://github.com/mastra-ai/mastra/pull/17843))
18
+
19
+ - Updated dependencies [[`5bd72d2`](https://github.com/mastra-ai/mastra/commit/5bd72d255f45b5ea8ab342643bd463814a980a24), [`1cc9ee1`](https://github.com/mastra-ai/mastra/commit/1cc9ee1ba51db53020a735626d33017a60b4b5b3), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`30ebaf0`](https://github.com/mastra-ai/mastra/commit/30ebaf07bed5f4d30f2f257836c15d1bf7e40aae), [`5704634`](https://github.com/mastra-ai/mastra/commit/5704634b22133167dea337a942a34f57aaa3fa14), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`c0eda2b`](https://github.com/mastra-ai/mastra/commit/c0eda2bcd91a228427314b12c91d8b147f3a739f), [`c0eda2b`](https://github.com/mastra-ai/mastra/commit/c0eda2bcd91a228427314b12c91d8b147f3a739f), [`b13925b`](https://github.com/mastra-ai/mastra/commit/b13925bfa91aa8700f56fa54a9ce707ee7e4ba62), [`bf94ec6`](https://github.com/mastra-ai/mastra/commit/bf94ec68192d9f16e46ef7e5ac36370aeeddf35d), [`a29f371`](https://github.com/mastra-ai/mastra/commit/a29f371aef629ac8562661524a497127e93b5131), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`073f910`](https://github.com/mastra-ai/mastra/commit/073f910481e7d94b95ba3830f96531774ae95d33), [`ebbe1d3`](https://github.com/mastra-ai/mastra/commit/ebbe1d31a965a3adb0e728758f326b8122b4b55f), [`1f97ce5`](https://github.com/mastra-ai/mastra/commit/1f97ce5695463bebb4eaacf501da6fb403e20885), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`64f58c0`](https://github.com/mastra-ai/mastra/commit/64f58c04e78b40137497d47f781e897e416f22a5), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`ebbe1d3`](https://github.com/mastra-ai/mastra/commit/ebbe1d31a965a3adb0e728758f326b8122b4b55f), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`8e25a78`](https://github.com/mastra-ai/mastra/commit/8e25a78e0597575f0b0729bae8c5e190c84869b5), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`a5b22d3`](https://github.com/mastra-ai/mastra/commit/a5b22d314d62a68d801886a8d3d0eb6c089473db), [`417baae`](https://github.com/mastra-ai/mastra/commit/417baae40b995db5819c845036947f0c27dc1c00), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858), [`74955f9`](https://github.com/mastra-ai/mastra/commit/74955f9120cde8b1d8ce4399232b4033236be858)]:
20
+ - @mastra/core@1.46.0-alpha.0
21
+
3
22
  ## 1.45.0
4
23
 
5
24
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { SERVER_ROUTES } from './chunk-SB4KSDPH.js';
1
+ import { SERVER_ROUTES } from './chunk-CYOIFE4C.js';
2
2
  import { schemaToJsonSchema } from './chunk-BRC4XSFG.js';
3
3
 
4
4
  // src/server/server-adapter/api-schema-manifest.ts
@@ -52,5 +52,5 @@ function buildApiSchemaManifest(routes = SERVER_ROUTES) {
52
52
  }
53
53
 
54
54
  export { buildApiSchemaManifest };
55
- //# sourceMappingURL=api-schema-manifest-MVG5MVVM.js.map
56
- //# sourceMappingURL=api-schema-manifest-MVG5MVVM.js.map
55
+ //# sourceMappingURL=api-schema-manifest-3MIPI77N.js.map
56
+ //# sourceMappingURL=api-schema-manifest-3MIPI77N.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":[],"mappings":";;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAAS,kBAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AACrB,EAAA,OAAO,MAAM,OAAA,CAAQ,IAAI,IAAI,IAAA,CAAK,IAAA,CAAK,OAAO,CAAA,GAAI,IAAA;AACpD;AAEA,SAAS,mBAAmB,cAAA,EAAiE;AAC3F,EAAA,IAAI,CAAC,cAAA,EAAgB,OAAO,EAAE,MAAM,SAAA,EAAU;AAE9C,EAAA,MAAM,IAAA,GAAO,WAAW,cAAc,CAAA;AACtC,EAAA,IAAI,IAAA,KAAS,OAAA,EAAS,OAAO,EAAE,MAAM,OAAA,EAAQ;AAC7C,EAAA,IAAI,IAAA,KAAS,QAAA,EAAU,OAAO,EAAE,MAAM,QAAA,EAAS;AAE/C,EAAA,MAAM,UAAA,GACJ,cAAA,CAAe,UAAA,IAAc,CAAC,KAAA,CAAM,OAAA,CAAQ,cAAA,CAAe,UAAU,CAAA,GAAI,cAAA,CAAe,UAAA,GAAa,EAAC;AAC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;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-MVG5MVVM.js","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":[],"mappings":";;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAAS,kBAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AACrB,EAAA,OAAO,MAAM,OAAA,CAAQ,IAAI,IAAI,IAAA,CAAK,IAAA,CAAK,OAAO,CAAA,GAAI,IAAA;AACpD;AAEA,SAAS,mBAAmB,cAAA,EAAiE;AAC3F,EAAA,IAAI,CAAC,cAAA,EAAgB,OAAO,EAAE,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AA,IACL,OAAA,EAAS,CAAA;AAAA,IACT,QAAQ,MAAA,CAAO,MAAA,CAAO,eAAe,CAAA,CAAE,IAAI,CAAA,KAAA,KAAS;AAClD,MAAA,MAAM,cAAA,GAAiB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-3MIPI77N.js","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkLGWHUDLR_cjs = require('./chunk-LGWHUDLR.cjs');
3
+ var chunkUVJZRFSY_cjs = require('./chunk-UVJZRFSY.cjs');
4
4
  var chunkG54X6VE6_cjs = require('./chunk-G54X6VE6.cjs');
5
5
 
6
6
  // src/server/server-adapter/api-schema-manifest.ts
@@ -34,7 +34,7 @@ function inferResponseShape(responseSchema) {
34
34
  function isManifestRoute(route) {
35
35
  return route.responseType === "json" && !route.deprecated;
36
36
  }
37
- function buildApiSchemaManifest(routes = chunkLGWHUDLR_cjs.SERVER_ROUTES) {
37
+ function buildApiSchemaManifest(routes = chunkUVJZRFSY_cjs.SERVER_ROUTES) {
38
38
  return {
39
39
  version: 1,
40
40
  routes: routes.filter(isManifestRoute).map((route) => {
@@ -54,5 +54,5 @@ function buildApiSchemaManifest(routes = chunkLGWHUDLR_cjs.SERVER_ROUTES) {
54
54
  }
55
55
 
56
56
  exports.buildApiSchemaManifest = buildApiSchemaManifest;
57
- //# sourceMappingURL=api-schema-manifest-2YIXHU7U.cjs.map
58
- //# sourceMappingURL=api-schema-manifest-2YIXHU7U.cjs.map
57
+ //# sourceMappingURL=api-schema-manifest-LFSM6XAL.cjs.map
58
+ //# sourceMappingURL=api-schema-manifest-LFSM6XAL.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":["schemaToJsonSchema","SERVER_ROUTES"],"mappings":";;;;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAASA,oCAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAAA,OAAO,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAK,KAAA,GAAwB,MAAA;AAChG;AAEA,SAAS,WAAW,MAAA,EAAkE;AACpF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AACrB,EAAA,OAAO,MAAM,OAAA,CAAQ,IAAI,IAAI,IAAA,CAAK,IAAA,CAAK,OAAO,CAAA,GAAI,IAAA;AACpD;AAEA,SAAS,mBAAmB,cAAA,EAAiE;AAC3F,EAAA,IAAI,CAAC,cAAA,EAAgB,OAAO,EAAE,MAAM,SAA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,OAAA,EAAS,CAAA;AAAA,IACT,QAAQ,MAAA,CAAO,MAAA,CAAO,eAAe,CAAA,CAAE,IAAI,CAAA,KAAA,KAAS;AAClD,MAAA,MAAM,cAAA,GAAiB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-2YIXHU7U.cjs","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/server/server-adapter/api-schema-manifest.ts"],"names":["schemaToJsonSchema","SERVER_ROUTES"],"mappings":";;;;;;AA2BA,SAAS,cAAc,MAAA,EAA4D;AACjF,EAAA,OAAO,MAAA,GAASA,oCAAA,CAAmB,MAAM,CAAA,GAAI,MAAA;AAC/C;AAEA,SAAS,aAAa,KAAA,EAAyC;AAC7D,EAA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iBAAA,EAAmB,YAAA,EAAc,kBAAA,EAAmB;AAAA,EACrE;AACA,EAAA,IAAI,cAAA,CAAe,wBAAwB,aAAA,CAAc,MAAA,KAAW,GAAG,OAAO,EAAE,MAAM,QAAA,EAAS;AAC/F,EAAA,OAAO,EAAE,MAAM,QAAA,EAAS;AAC1B;AAEA,SAAS,gBAAgB,KAAA,EAA6B;AACpD,EAAA,OAAO,KAAA,CAAM,YAAA,KAAiB,MAAA,IAAU,CAAC,KAAA,CAAM,UAAA;AACjD;AAEO,SAAS,sBAAA,CAAuB,SAAiCC,+BAAA,EAAkC;AACxG,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,CAAA;AAAA,IACT,QAAQ,MAAA,CAAO,MAAA,CAAO,eAAe,CAAA,CAAE,IAAI,CAAA,KAAA,KAAS;AAClD,MAAA,MAAM,cAAA,GAAiB,aAAA,CAAc,KAAA,CAAM,cAAc,CAAA;AACzD,MAAA,OAAO;AAAA,QACL,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,MAAM,KAAA,CAAM,IAAA;AAAA,QACZ,cAAc,KAAA,CAAM,YAAA;AAAA,QACpB,eAAA,EAAiB,aAAA,CAAc,KAAA,CAAM,eAAe,CAAA;AAAA,QACpD,gBAAA,EAAkB,aAAA,CAAc,KAAA,CAAM,gBAAgB,CAAA;AAAA,QACtD,UAAA,EAAY,aAAA,CAAc,KAAA,CAAM,UAAU,CAAA;AAAA,QAC1C,cAAA;AAAA,QACA,aAAA,EAAe,mBAAmB,cAAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-LFSM6XAL.cjs","sourcesContent":["import type { JSONSchema7 } from '@mastra/schema-compat';\nimport { schemaToJsonSchema } from './openapi-utils';\nimport { SERVER_ROUTES } from './routes/index';\nimport type { ServerRoute } from './routes/index';\n\nexport interface ApiSchemaResponseShape {\n kind: 'array' | 'record' | 'object-property' | 'single' | 'unknown';\n listProperty?: string;\n paginationProperty?: string;\n}\n\nexport interface ApiSchemaManifestRoute {\n method: string;\n path: string;\n responseType: string;\n pathParamSchema?: JSONSchema7;\n queryParamSchema?: JSONSchema7;\n bodySchema?: JSONSchema7;\n responseSchema?: JSONSchema7;\n responseShape: ApiSchemaResponseShape;\n}\n\nexport interface ApiSchemaManifest {\n version: 1;\n routes: ApiSchemaManifestRoute[];\n}\n\nfunction convertSchema(schema: ServerRoute['bodySchema']): JSONSchema7 | undefined {\n return schema ? schemaToJsonSchema(schema) : undefined;\n}\n\nfunction asJsonSchema(value: unknown): JSONSchema7 | undefined {\n return value && typeof value === 'object' && !Array.isArray(value) ? (value as JSONSchema7) : undefined;\n}\n\nfunction schemaType(schema: JSONSchema7 | undefined): JSONSchema7['type'] | undefined {\n const type = schema?.type;\n return Array.isArray(type) ? type.find(Boolean) : type;\n}\n\nfunction inferResponseShape(responseSchema: JSONSchema7 | undefined): ApiSchemaResponseShape {\n if (!responseSchema) return { kind: 'unknown' };\n\n const type = schemaType(responseSchema);\n if (type === 'array') return { kind: 'array' };\n if (type !== 'object') return { kind: 'single' };\n\n const properties =\n responseSchema.properties && !Array.isArray(responseSchema.properties) ? responseSchema.properties : {};\n const propertyNames = Object.keys(properties);\n const paginationProperty = 'page' in properties ? 'page' : 'pagination' in properties ? 'pagination' : undefined;\n const listProperty = Object.entries(properties).find(\n ([, property]) => schemaType(asJsonSchema(property)) === 'array',\n )?.[0];\n\n if (listProperty && (paginationProperty || propertyNames.length <= 2)) {\n return { kind: 'object-property', listProperty, paginationProperty };\n }\n if (responseSchema.additionalProperties && propertyNames.length === 0) return { kind: 'record' };\n return { kind: 'single' };\n}\n\nfunction isManifestRoute(route: ServerRoute): boolean {\n return route.responseType === 'json' && !route.deprecated;\n}\n\nexport function buildApiSchemaManifest(routes: readonly ServerRoute[] = SERVER_ROUTES): ApiSchemaManifest {\n return {\n version: 1,\n routes: routes.filter(isManifestRoute).map(route => {\n const responseSchema = convertSchema(route.responseSchema);\n return {\n method: route.method,\n path: route.path,\n responseType: route.responseType,\n pathParamSchema: convertSchema(route.pathParamSchema),\n queryParamSchema: convertSchema(route.queryParamSchema),\n bodySchema: convertSchema(route.bodySchema),\n responseSchema,\n responseShape: inferResponseShape(responseSchema),\n };\n }),\n };\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunk3ARFTVAY_cjs = require('./chunk-3ARFTVAY.cjs');
3
+ var chunkS2HKHYJ3_cjs = require('./chunk-S2HKHYJ3.cjs');
4
4
  var chunkKGUHJRHZ_cjs = require('./chunk-KGUHJRHZ.cjs');
5
5
 
6
6
  // src/server/handlers/favorites-enrichment.ts
7
7
  async function prepareFavoritesEnrichment(mastra, requestContext, entityType, entityIds) {
8
- if (!await chunk3ARFTVAY_cjs.isBuilderFeatureEnabled(mastra, "favorites")) return null;
8
+ if (!await chunkS2HKHYJ3_cjs.isBuilderFeatureEnabled(mastra, "favorites")) return null;
9
9
  const userId = chunkKGUHJRHZ_cjs.getCallerAuthorId(requestContext);
10
10
  if (!userId) return null;
11
11
  const storage = mastra.getStorage();
@@ -35,5 +35,5 @@ async function enrichOrStripFavorites(mastra, requestContext, entityType, record
35
35
  exports.enrichOrStripFavorites = enrichOrStripFavorites;
36
36
  exports.prepareFavoritesEnrichment = prepareFavoritesEnrichment;
37
37
  exports.stripFavoriteFields = stripFavoriteFields;
38
- //# sourceMappingURL=chunk-M2ZGNEQS.cjs.map
39
- //# sourceMappingURL=chunk-M2ZGNEQS.cjs.map
38
+ //# sourceMappingURL=chunk-73MURMD2.cjs.map
39
+ //# sourceMappingURL=chunk-73MURMD2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/handlers/favorites-enrichment.ts"],"names":["isBuilderFeatureEnabled","getCallerAuthorId"],"mappings":";;;;;;AAyBA,eAAsB,0BAAA,CACpB,MAAA,EACA,cAAA,EACA,UAAA,EACA,SAAA,EACqC;AACrC,EAAA,IAAI,CAAE,MAAMA,yCAAA,CAAwB,MAAA,EAAQ,WAAW,GA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file":"chunk-M2ZGNEQS.cjs","sourcesContent":["import type { Mastra } from '@mastra/core';\nimport type { RequestContext } from '@mastra/core/di';\nimport type { FavoritesStorage, StorageFavoriteEntityType } from '@mastra/core/storage';\n\nimport { getCallerAuthorId } from './authorship';\nimport { isBuilderFeatureEnabled } from './editor-builder';\n\n/**\n * Result of `prepareFavoritesEnrichment` — `null` when the `favorites` EE feature is off.\n * When non-null the caller may use `starredIds` to set `isFavorited` on records\n * and may pass `userId` along to storage list paths for pin-favorited-first\n * sorting (`pinFavoritedFor`).\n */\nexport type FavoritesEnrichmentContext = {\n userId: string;\n starredIds: Set<string>;\n favoritesStore: FavoritesStorage;\n} | null;\n\n/**\n * Resolve the EE feature flag plus the caller's favorited set for a list of\n * candidate entity IDs in one shot. Soft-gated: returns `null` if the feature\n * is off or there's no caller — handlers should drop `isFavorited` / `favoriteCount`\n * fields and ignore `?favoritedOnly=true` in that case.\n */\nexport async function prepareFavoritesEnrichment(\n mastra: Mastra,\n requestContext: RequestContext,\n entityType: StorageFavoriteEntityType,\n entityIds: string[],\n): Promise<FavoritesEnrichmentContext> {\n if (!(await isBuilderFeatureEnabled(mastra, 'favorites'))) return null;\n\n const userId = getCallerAuthorId(requestContext);\n if (!userId) return null;\n\n const storage = mastra.getStorage();\n if (!storage) return null;\n const favoritesStore = await storage.getStore('favorites');\n if (!favoritesStore) return null;\n\n const starredIds =\n entityIds.length === 0\n ? new Set<string>()\n : await favoritesStore.isFavoritedBatch({ userId, entityType, entityIds });\n return { userId, starredIds, favoritesStore };\n}\n\n/**\n * Strip the favorites EE fields from a record. Used when the feature is off so\n * stale values from storage do not leak through the API.\n */\nexport function stripFavoriteFields<T extends object>(record: T): T {\n if ('isFavorited' in record || 'favoriteCount' in record) {\n const copy = { ...record } as Record<string, unknown>;\n delete copy.isFavorited;\n delete copy.favoriteCount;\n return copy as T;\n }\n return record;\n}\n\n/**\n * Convenience for single-entity handlers (GET / POST / PATCH): annotate\n * `isFavorited` from the caller's favorites set when enrichment is available,\n * otherwise strip both favorite fields. `favoriteCount` is the canonical\n * mirrored counter and is left in place so callers can render share-count UI\n * (it's identical across viewers).\n */\nexport async function enrichOrStripFavorites<T extends { id: string }>(\n mastra: Mastra,\n requestContext: RequestContext,\n entityType: StorageFavoriteEntityType,\n record: T,\n): Promise<T> {\n const enrichment = await prepareFavoritesEnrichment(mastra, requestContext, entityType, [record.id]);\n if (enrichment) {\n return { ...record, isFavorited: enrichment.starredIds.has(record.id) };\n }\n return stripFavoriteFields(record);\n}\n"]}
1
+ {"version":3,"sources":["../src/server/handlers/favorites-enrichment.ts"],"names":["isBuilderFeatureEnabled","getCallerAuthorId"],"mappings":";;;;;;AAyBA,eAAsB,0BAAA,CACpB,MAAA,EACA,cAAA,EACA,UAAA,EACA,SAAA,EACqC;AACrC,EAAA,IAAI,CAAE,MAAMA,yCAAA,CAAwB,MAAA,EAAQ,WAAW,GAAI,OAAO,IAAA;AAElE,EAAA,MAAM,MAAA,GAASC,oCAAkB,cAAc,CAAA;AAC/C,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,MAAM,OAAA,GAAU,OAAO,UAAA,EAAW;AAClC,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,MAAM,cAAA,GAAiB,MAAM,OAAA,CAAQ,QAAA,CAAS,WAAW,CAAA;AACzD,EAAA,IAAI,CAAC,gBAAgB,OAAO,IAAA;AAE5B,EAAA,MAAM,UAAA,GACJ,SAAA,CAAU,MAAA,KAAW,CAAA,uBACb,GAAA,EAAY,GAChB,MAAM,cAAA,CAAe,gBAAA,CAAiB,EAAE,MAAA,EAAQ,UAAA,EAAY,WAAW,CAAA;AAC7E,EAAA,OAAO,EAAE,MAAA,EAAQ,UAAA,EAAY,cAAA,EAAe;AAC9C;AAMO,SAAS,oBAAsC,MAAA,EAAc;AAClE,EAAA,IAAI,aAAA,IAAiB,MAAA,IAAU,eAAA,IAAmB,MAAA,EAAQ;AACxD,IAAA,MAAM,IAAA,GAAO,EAAE,GAAG,MAAA,EAAO;AACzB,IAAA,OAAO,IAAA,CAAK,WAAA;AACZ,IAAA,OAAO,IAAA,CAAK,aAAA;AACZ,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,MAAA;AACT;AASA,eAAsB,sBAAA,CACpB,MAAA,EACA,cAAA,EACA,UAAA,EACA,MAAA,EACY;AACZ,EAAA,MAAM,UAAA,GAAa,MAAM,0BAAA,CAA2B,MAAA,EAAQ,gBAAgB,UAAA,EAAY,CAAC,MAAA,CAAO,EAAE,CAAC,CAAA;AACnG,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,OAAO,EAAE,GAAG,MAAA,EAAQ,WAAA,EAAa,WAAW,UAAA,CAAW,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA,EAAE;AAAA,EACxE;AACA,EAAA,OAAO,oBAAoB,MAAM,CAAA;AACnC","file":"chunk-73MURMD2.cjs","sourcesContent":["import type { Mastra } from '@mastra/core';\nimport type { RequestContext } from '@mastra/core/di';\nimport type { FavoritesStorage, StorageFavoriteEntityType } from '@mastra/core/storage';\n\nimport { getCallerAuthorId } from './authorship';\nimport { isBuilderFeatureEnabled } from './editor-builder';\n\n/**\n * Result of `prepareFavoritesEnrichment` — `null` when the `favorites` EE feature is off.\n * When non-null the caller may use `starredIds` to set `isFavorited` on records\n * and may pass `userId` along to storage list paths for pin-favorited-first\n * sorting (`pinFavoritedFor`).\n */\nexport type FavoritesEnrichmentContext = {\n userId: string;\n starredIds: Set<string>;\n favoritesStore: FavoritesStorage;\n} | null;\n\n/**\n * Resolve the EE feature flag plus the caller's favorited set for a list of\n * candidate entity IDs in one shot. Soft-gated: returns `null` if the feature\n * is off or there's no caller — handlers should drop `isFavorited` / `favoriteCount`\n * fields and ignore `?favoritedOnly=true` in that case.\n */\nexport async function prepareFavoritesEnrichment(\n mastra: Mastra,\n requestContext: RequestContext,\n entityType: StorageFavoriteEntityType,\n entityIds: string[],\n): Promise<FavoritesEnrichmentContext> {\n if (!(await isBuilderFeatureEnabled(mastra, 'favorites'))) return null;\n\n const userId = getCallerAuthorId(requestContext);\n if (!userId) return null;\n\n const storage = mastra.getStorage();\n if (!storage) return null;\n const favoritesStore = await storage.getStore('favorites');\n if (!favoritesStore) return null;\n\n const starredIds =\n entityIds.length === 0\n ? new Set<string>()\n : await favoritesStore.isFavoritedBatch({ userId, entityType, entityIds });\n return { userId, starredIds, favoritesStore };\n}\n\n/**\n * Strip the favorites EE fields from a record. Used when the feature is off so\n * stale values from storage do not leak through the API.\n */\nexport function stripFavoriteFields<T extends object>(record: T): T {\n if ('isFavorited' in record || 'favoriteCount' in record) {\n const copy = { ...record } as Record<string, unknown>;\n delete copy.isFavorited;\n delete copy.favoriteCount;\n return copy as T;\n }\n return record;\n}\n\n/**\n * Convenience for single-entity handlers (GET / POST / PATCH): annotate\n * `isFavorited` from the caller's favorites set when enrichment is available,\n * otherwise strip both favorite fields. `favoriteCount` is the canonical\n * mirrored counter and is left in place so callers can render share-count UI\n * (it's identical across viewers).\n */\nexport async function enrichOrStripFavorites<T extends { id: string }>(\n mastra: Mastra,\n requestContext: RequestContext,\n entityType: StorageFavoriteEntityType,\n record: T,\n): Promise<T> {\n const enrichment = await prepareFavoritesEnrichment(mastra, requestContext, entityType, [record.id]);\n if (enrichment) {\n return { ...record, isFavorited: enrichment.starredIds.has(record.id) };\n }\n return stripFavoriteFields(record);\n}\n"]}
@@ -1032,14 +1032,19 @@ var STREAM_GENERATE_LEGACY_ROUTE = chunkG54X6VE6_cjs.createRoute({
1032
1032
  });
1033
1033
  async function buildProvidersList(mastra) {
1034
1034
  const allProviders = {};
1035
- for (const [id, provider] of Object.entries(llm.PROVIDER_REGISTRY)) {
1036
- allProviders[id] = provider;
1035
+ const blockExternalProviders = process.env.AUTO_BLOCK_EXTERNAL_PROVIDERS === "true" || process.env.AUTO_BLOCK_EXTERNAL_PROVIDERS === "1";
1036
+ const defaultGatewayIds = new Set(llm.defaultGateways.map((gateway) => gateway.id));
1037
+ if (!blockExternalProviders) {
1038
+ for (const [id, provider] of Object.entries(llm.PROVIDER_REGISTRY)) {
1039
+ allProviders[id] = provider;
1040
+ }
1037
1041
  }
1038
1042
  if (mastra) {
1039
1043
  const allGateways = mastra.listGateways();
1040
1044
  if (allGateways) {
1041
1045
  for (const gateway of Object.values(allGateways)) {
1042
1046
  if (gateway.id === "models.dev") continue;
1047
+ if (blockExternalProviders && defaultGatewayIds.has(gateway.id)) continue;
1043
1048
  try {
1044
1049
  const gatewayProviders = await gateway.fetchProviders();
1045
1050
  for (const [providerId, config] of Object.entries(gatewayProviders)) {
@@ -1179,6 +1184,12 @@ var sendAgentSignalResponseSchema = v4.z.object({
1179
1184
  runId: v4.z.string(),
1180
1185
  signal: v4.z.any().optional()
1181
1186
  });
1187
+ function handleSignalRoutingError(error$1, defaultMessage) {
1188
+ if (error$1 instanceof error.MastraError && error$1.category === error.ErrorCategory.USER && !error$1.status && !error$1.details?.status) {
1189
+ throw new chunk64ITUOXI_cjs.HTTPException(400, { message: error$1.message, cause: error$1 });
1190
+ }
1191
+ return chunkZ7LCIYK7_cjs.handleError(error$1, defaultMessage);
1192
+ }
1182
1193
  var sendAgentMessageResponseSchema = sendAgentSignalResponseSchema;
1183
1194
  var SEND_AGENT_SIGNAL_ROUTE = chunkG54X6VE6_cjs.createRoute({
1184
1195
  method: "POST",
@@ -1242,7 +1253,9 @@ var SEND_AGENT_SIGNAL_ROUTE = chunkG54X6VE6_cjs.createRoute({
1242
1253
  ...effectiveThreadId ? { threadId: effectiveThreadId } : {},
1243
1254
  ...ifActive ? { ifActive } : {}
1244
1255
  });
1245
- return result2.signal === void 0 ? { accepted: result2.accepted, runId: result2.runId } : { accepted: result2.accepted, runId: result2.runId, signal: result2.signal };
1256
+ const settled2 = await result2.accepted;
1257
+ const settledRunId2 = "runId" in settled2 ? settled2.runId : runId;
1258
+ return result2.signal === void 0 ? { accepted: true, runId: settledRunId2 } : { accepted: true, runId: settledRunId2, signal: result2.signal };
1246
1259
  }
1247
1260
  if (!effectiveResourceId || !effectiveThreadId) {
1248
1261
  throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "resourceId and threadId are required when runId is not provided" });
@@ -1253,9 +1266,11 @@ var SEND_AGENT_SIGNAL_ROUTE = chunkG54X6VE6_cjs.createRoute({
1253
1266
  ...ifActive ? { ifActive } : {},
1254
1267
  ...ifIdleWithContext
1255
1268
  });
1256
- return result.signal === void 0 ? { accepted: result.accepted, runId: result.runId } : { accepted: result.accepted, runId: result.runId, signal: result.signal };
1269
+ const settled = await result.accepted;
1270
+ const settledRunId = "runId" in settled ? settled.runId : result.signal?.id;
1271
+ return result.signal === void 0 ? { accepted: true, runId: settledRunId } : { accepted: true, runId: settledRunId, signal: result.signal };
1257
1272
  } catch (error) {
1258
- return chunkZ7LCIYK7_cjs.handleError(error, "error sending agent signal");
1273
+ return handleSignalRoutingError(error, "error sending agent signal");
1259
1274
  }
1260
1275
  }
1261
1276
  });
@@ -1308,7 +1323,9 @@ async function handleAgentMessageRoute({
1308
1323
  ...effectiveThreadId ? { threadId: effectiveThreadId } : {},
1309
1324
  ...ifActive ? { ifActive } : {}
1310
1325
  });
1311
- return result2.signal === void 0 ? { accepted: result2.accepted, runId: result2.runId } : { accepted: result2.accepted, runId: result2.runId, signal: result2.signal };
1326
+ const settled2 = await result2.accepted;
1327
+ const settledRunId2 = settled2 && "runId" in settled2 ? settled2.runId : runId;
1328
+ return result2.signal === void 0 ? { accepted: true, runId: settledRunId2 } : { accepted: true, runId: settledRunId2, signal: result2.signal };
1312
1329
  }
1313
1330
  if (!effectiveResourceId || !effectiveThreadId) {
1314
1331
  throw new chunk64ITUOXI_cjs.HTTPException(400, { message: "resourceId and threadId are required when runId is not provided" });
@@ -1319,7 +1336,9 @@ async function handleAgentMessageRoute({
1319
1336
  ...ifActive ? { ifActive } : {},
1320
1337
  ...ifIdleWithContext
1321
1338
  });
1322
- return result.signal === void 0 ? { accepted: result.accepted, runId: result.runId } : { accepted: result.accepted, runId: result.runId, signal: result.signal };
1339
+ const settled = await result.accepted;
1340
+ const settledRunId = settled && "runId" in settled ? settled.runId : result.signal?.id;
1341
+ return result.signal === void 0 ? { accepted: true, runId: settledRunId } : { accepted: true, runId: settledRunId, signal: result.signal };
1323
1342
  }
1324
1343
  var SEND_AGENT_MESSAGE_ROUTE = chunkG54X6VE6_cjs.createRoute({
1325
1344
  method: "POST",
@@ -1337,7 +1356,7 @@ var SEND_AGENT_MESSAGE_ROUTE = chunkG54X6VE6_cjs.createRoute({
1337
1356
  try {
1338
1357
  return await handleAgentMessageRoute({ ...params, methodName: "sendMessage" });
1339
1358
  } catch (error) {
1340
- return chunkZ7LCIYK7_cjs.handleError(error, "error sending agent message");
1359
+ return handleSignalRoutingError(error, "error sending agent message");
1341
1360
  }
1342
1361
  }
1343
1362
  });
@@ -1357,7 +1376,7 @@ var QUEUE_AGENT_MESSAGE_ROUTE = chunkG54X6VE6_cjs.createRoute({
1357
1376
  try {
1358
1377
  return await handleAgentMessageRoute({ ...params, methodName: "queueMessage" });
1359
1378
  } catch (error) {
1360
- return chunkZ7LCIYK7_cjs.handleError(error, "error queueing agent message");
1379
+ return handleSignalRoutingError(error, "error queueing agent message");
1361
1380
  }
1362
1381
  }
1363
1382
  });
@@ -2505,5 +2524,5 @@ exports.getSerializedProcessors = getSerializedProcessors;
2505
2524
  exports.getSerializedSkillsFromAgent = getSerializedSkillsFromAgent;
2506
2525
  exports.getWorkspaceToolsFromAgent = getWorkspaceToolsFromAgent;
2507
2526
  exports.isProviderConnected = isProviderConnected;
2508
- //# sourceMappingURL=chunk-DZD7RZYY.cjs.map
2509
- //# sourceMappingURL=chunk-DZD7RZYY.cjs.map
2527
+ //# sourceMappingURL=chunk-7DKSWNOM.cjs.map
2528
+ //# sourceMappingURL=chunk-7DKSWNOM.cjs.map