@mastra/server 1.38.0 → 1.39.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 (202) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/_types/@mastra_schema-compat/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +11 -8
  3. package/dist/{api-schema-manifest-E3RU6MLF.cjs → api-schema-manifest-ALHYYJMN.cjs} +4 -4
  4. package/dist/{api-schema-manifest-E3RU6MLF.cjs.map → api-schema-manifest-ALHYYJMN.cjs.map} +1 -1
  5. package/dist/{api-schema-manifest-DNC2KIKD.js → api-schema-manifest-PQ6VZTB3.js} +3 -3
  6. package/dist/{api-schema-manifest-DNC2KIKD.js.map → api-schema-manifest-PQ6VZTB3.js.map} +1 -1
  7. package/dist/chunk-2ONW75MN.cjs +477 -0
  8. package/dist/chunk-2ONW75MN.cjs.map +1 -0
  9. package/dist/{chunk-CJMJQR2K.cjs → chunk-3APAH25G.cjs} +4 -4
  10. package/dist/{chunk-CJMJQR2K.cjs.map → chunk-3APAH25G.cjs.map} +1 -1
  11. package/dist/{chunk-PXYR3D6L.cjs → chunk-3D55EABW.cjs} +3 -9
  12. package/dist/chunk-3D55EABW.cjs.map +1 -0
  13. package/dist/{chunk-WXJSYUBX.cjs → chunk-3KXE2KXE.cjs} +4 -4
  14. package/dist/{chunk-WXJSYUBX.cjs.map → chunk-3KXE2KXE.cjs.map} +1 -1
  15. package/dist/{chunk-APV6QKRZ.cjs → chunk-4W7KQRF5.cjs} +28 -28
  16. package/dist/{chunk-APV6QKRZ.cjs.map → chunk-4W7KQRF5.cjs.map} +1 -1
  17. package/dist/{chunk-L33BLLID.cjs → chunk-544IXGBW.cjs} +168 -166
  18. package/dist/chunk-544IXGBW.cjs.map +1 -0
  19. package/dist/{chunk-VH6QCEN7.cjs → chunk-5DDUXRAY.cjs} +102 -102
  20. package/dist/{chunk-VH6QCEN7.cjs.map → chunk-5DDUXRAY.cjs.map} +1 -1
  21. package/dist/{chunk-DNKTFFOV.cjs → chunk-5WB7PKHN.cjs} +4 -4
  22. package/dist/{chunk-DNKTFFOV.cjs.map → chunk-5WB7PKHN.cjs.map} +1 -1
  23. package/dist/{chunk-ODIMB6T6.cjs → chunk-6MP52DMQ.cjs} +7 -7
  24. package/dist/{chunk-ODIMB6T6.cjs.map → chunk-6MP52DMQ.cjs.map} +1 -1
  25. package/dist/{chunk-3LUN33E7.cjs → chunk-76ONC2XD.cjs} +85 -19
  26. package/dist/chunk-76ONC2XD.cjs.map +1 -0
  27. package/dist/{chunk-TLMAHJTC.cjs → chunk-77IY4RTO.cjs} +16 -16
  28. package/dist/{chunk-TLMAHJTC.cjs.map → chunk-77IY4RTO.cjs.map} +1 -1
  29. package/dist/{chunk-5PCUNLFX.js → chunk-AEH5OCIH.js} +3 -3
  30. package/dist/{chunk-5PCUNLFX.js.map → chunk-AEH5OCIH.js.map} +1 -1
  31. package/dist/{chunk-WADS7CD7.js → chunk-AW5INHG7.js} +4 -4
  32. package/dist/{chunk-WADS7CD7.js.map → chunk-AW5INHG7.js.map} +1 -1
  33. package/dist/{chunk-P7FVOCQB.cjs → chunk-AX6REP5O.cjs} +4 -4
  34. package/dist/{chunk-P7FVOCQB.cjs.map → chunk-AX6REP5O.cjs.map} +1 -1
  35. package/dist/{chunk-4DVNH3KJ.js → chunk-B5NMA52D.js} +4 -4
  36. package/dist/{chunk-4DVNH3KJ.js.map → chunk-B5NMA52D.js.map} +1 -1
  37. package/dist/{chunk-4T6DC425.js → chunk-CBG6LUEW.js} +3 -3
  38. package/dist/{chunk-4T6DC425.js.map → chunk-CBG6LUEW.js.map} +1 -1
  39. package/dist/{chunk-SDBN3DIS.cjs → chunk-D5M3VILP.cjs} +26 -26
  40. package/dist/{chunk-SDBN3DIS.cjs.map → chunk-D5M3VILP.cjs.map} +1 -1
  41. package/dist/{chunk-Z2ZMHHQW.js → chunk-E7AEYMKH.js} +3 -3
  42. package/dist/{chunk-Z2ZMHHQW.js.map → chunk-E7AEYMKH.js.map} +1 -1
  43. package/dist/{chunk-J6OD53OV.js → chunk-ESJTIVEQ.js} +12 -3
  44. package/dist/chunk-ESJTIVEQ.js.map +1 -0
  45. package/dist/{chunk-T2FBYRYD.cjs → chunk-ET7KSUVJ.cjs} +12 -2
  46. package/dist/chunk-ET7KSUVJ.cjs.map +1 -0
  47. package/dist/{chunk-T6IXA4ZQ.js → chunk-FQCCUWMS.js} +3 -3
  48. package/dist/{chunk-T6IXA4ZQ.js.map → chunk-FQCCUWMS.js.map} +1 -1
  49. package/dist/{chunk-QRIHD5UO.js → chunk-G2CL5JMK.js} +5 -5
  50. package/dist/{chunk-QRIHD5UO.js.map → chunk-G2CL5JMK.js.map} +1 -1
  51. package/dist/{chunk-XDOMY4VL.cjs → chunk-GAERIPY2.cjs} +5 -5
  52. package/dist/{chunk-XDOMY4VL.cjs.map → chunk-GAERIPY2.cjs.map} +1 -1
  53. package/dist/{chunk-QM3NYDZZ.js → chunk-HEBNJ6KJ.js} +4 -4
  54. package/dist/{chunk-QM3NYDZZ.js.map → chunk-HEBNJ6KJ.js.map} +1 -1
  55. package/dist/{chunk-AT5ZCHIV.cjs → chunk-HGREXGI2.cjs} +3 -3
  56. package/dist/{chunk-AT5ZCHIV.cjs.map → chunk-HGREXGI2.cjs.map} +1 -1
  57. package/dist/{chunk-RBONVWGZ.js → chunk-HJVMQDSZ.js} +9 -3
  58. package/dist/chunk-HJVMQDSZ.js.map +1 -0
  59. package/dist/{chunk-MFYZWOKE.cjs → chunk-IGE7NPFH.cjs} +5 -5
  60. package/dist/{chunk-MFYZWOKE.cjs.map → chunk-IGE7NPFH.cjs.map} +1 -1
  61. package/dist/{chunk-UFYCA27U.js → chunk-IONXSX77.js} +5 -3
  62. package/dist/chunk-IONXSX77.js.map +1 -0
  63. package/dist/{chunk-RTYOFB6W.cjs → chunk-IU3ZRZSG.cjs} +5 -3
  64. package/dist/chunk-IU3ZRZSG.cjs.map +1 -0
  65. package/dist/{chunk-76I5G5W5.js → chunk-JMEMSVJ5.js} +4 -9
  66. package/dist/chunk-JMEMSVJ5.js.map +1 -0
  67. package/dist/{chunk-56F2IRK3.js → chunk-K6XESXNQ.js} +3 -3
  68. package/dist/{chunk-56F2IRK3.js.map → chunk-K6XESXNQ.js.map} +1 -1
  69. package/dist/{chunk-43KD3CRE.cjs → chunk-LBVQK4LO.cjs} +16 -5
  70. package/dist/chunk-LBVQK4LO.cjs.map +1 -0
  71. package/dist/{chunk-IJFPP2XB.js → chunk-LNBKA6IA.js} +69 -4
  72. package/dist/chunk-LNBKA6IA.js.map +1 -0
  73. package/dist/{chunk-BKYFKSJI.js → chunk-LPYCF5B2.js} +3 -3
  74. package/dist/{chunk-BKYFKSJI.js.map → chunk-LPYCF5B2.js.map} +1 -1
  75. package/dist/{chunk-DRXZDKLU.js → chunk-LQQCTO6D.js} +3 -3
  76. package/dist/{chunk-DRXZDKLU.js.map → chunk-LQQCTO6D.js.map} +1 -1
  77. package/dist/{chunk-HX5BGP6D.cjs → chunk-LYF4J3JE.cjs} +17 -17
  78. package/dist/{chunk-HX5BGP6D.cjs.map → chunk-LYF4J3JE.cjs.map} +1 -1
  79. package/dist/chunk-NQLS4Z3W.js +472 -0
  80. package/dist/chunk-NQLS4Z3W.js.map +1 -0
  81. package/dist/{chunk-KSZXXQHZ.js → chunk-NTE3Q3BA.js} +3 -3
  82. package/dist/{chunk-KSZXXQHZ.js.map → chunk-NTE3Q3BA.js.map} +1 -1
  83. package/dist/{chunk-5FPJ4RT4.js → chunk-OCWY55IQ.js} +3 -3
  84. package/dist/{chunk-5FPJ4RT4.js.map → chunk-OCWY55IQ.js.map} +1 -1
  85. package/dist/{chunk-GPAQ47NG.cjs → chunk-QVFQUBC7.cjs} +9 -3
  86. package/dist/chunk-QVFQUBC7.cjs.map +1 -0
  87. package/dist/{chunk-7GOHECZP.js → chunk-SEAEQN2H.js} +3 -3
  88. package/dist/{chunk-7GOHECZP.js.map → chunk-SEAEQN2H.js.map} +1 -1
  89. package/dist/{chunk-6XSS54BL.cjs → chunk-THXUZHS6.cjs} +7 -7
  90. package/dist/{chunk-6XSS54BL.cjs.map → chunk-THXUZHS6.cjs.map} +1 -1
  91. package/dist/{chunk-M7HLT2GO.js → chunk-UOQHTFYI.js} +3 -3
  92. package/dist/{chunk-M7HLT2GO.js.map → chunk-UOQHTFYI.js.map} +1 -1
  93. package/dist/{chunk-5SK4SJJH.js → chunk-V4G7MSFL.js} +3 -3
  94. package/dist/{chunk-5SK4SJJH.js.map → chunk-V4G7MSFL.js.map} +1 -1
  95. package/dist/{chunk-XB6H6LOM.js → chunk-VSB4S6R5.js} +3 -3
  96. package/dist/{chunk-XB6H6LOM.js.map → chunk-VSB4S6R5.js.map} +1 -1
  97. package/dist/{chunk-4DGDQWQQ.cjs → chunk-VWFP6O2W.cjs} +14 -14
  98. package/dist/{chunk-4DGDQWQQ.cjs.map → chunk-VWFP6O2W.cjs.map} +1 -1
  99. package/dist/{chunk-ZNMKBPTN.cjs → chunk-WUPBIK5J.cjs} +15 -15
  100. package/dist/{chunk-ZNMKBPTN.cjs.map → chunk-WUPBIK5J.cjs.map} +1 -1
  101. package/dist/{chunk-F27R55RI.cjs → chunk-XGFN7MMF.cjs} +4 -4
  102. package/dist/{chunk-F27R55RI.cjs.map → chunk-XGFN7MMF.cjs.map} +1 -1
  103. package/dist/{chunk-YW252K6H.js → chunk-XNGC2C6Z.js} +20 -18
  104. package/dist/chunk-XNGC2C6Z.js.map +1 -0
  105. package/dist/{chunk-7GSR7HQ2.js → chunk-Y5CIOSHU.js} +4 -4
  106. package/dist/{chunk-7GSR7HQ2.js.map → chunk-Y5CIOSHU.js.map} +1 -1
  107. package/dist/{chunk-OJNVSXOF.js → chunk-YH4WGIEH.js} +16 -5
  108. package/dist/chunk-YH4WGIEH.js.map +1 -0
  109. package/dist/{chunk-NSXV3FWO.cjs → chunk-ZIWTQGJV.cjs} +20 -20
  110. package/dist/{chunk-NSXV3FWO.cjs.map → chunk-ZIWTQGJV.cjs.map} +1 -1
  111. package/dist/constants-DVRTNEGY-A5OAGF3M.js +3 -0
  112. package/dist/{constants-SPS7MR4D-YRZDDIPO.js.map → constants-DVRTNEGY-A5OAGF3M.js.map} +1 -1
  113. package/dist/{constants-SPS7MR4D-ZMHAFWSH.cjs → constants-DVRTNEGY-ZGCNETZ3.cjs} +8 -8
  114. package/dist/{constants-SPS7MR4D-ZMHAFWSH.cjs.map → constants-DVRTNEGY-ZGCNETZ3.cjs.map} +1 -1
  115. package/dist/{dist-HIWM6H43.js → dist-LWX2CRMH.js} +304 -125
  116. package/dist/dist-LWX2CRMH.js.map +1 -0
  117. package/dist/{dist-LZYJXHUM.cjs → dist-QFLLP7OJ.cjs} +336 -157
  118. package/dist/dist-QFLLP7OJ.cjs.map +1 -0
  119. package/dist/docs/SKILL.md +1 -1
  120. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  121. package/dist/{observational-memory-TJFOX3YN-A2QE2E3I.cjs → observational-memory-G52HNRHE-73KIWQ2G.cjs} +31 -31
  122. package/dist/{observational-memory-TJFOX3YN-A2QE2E3I.cjs.map → observational-memory-G52HNRHE-73KIWQ2G.cjs.map} +1 -1
  123. package/dist/{observational-memory-TJFOX3YN-P3KG2OXA.js → observational-memory-G52HNRHE-RHA4V77M.js} +4 -4
  124. package/dist/{observational-memory-TJFOX3YN-P3KG2OXA.js.map → observational-memory-G52HNRHE-RHA4V77M.js.map} +1 -1
  125. package/dist/server/auth/helpers.d.ts +3 -4
  126. package/dist/server/auth/helpers.d.ts.map +1 -1
  127. package/dist/server/auth/index.cjs +15 -15
  128. package/dist/server/auth/index.js +1 -1
  129. package/dist/server/handlers/a2a.cjs +14 -14
  130. package/dist/server/handlers/a2a.js +1 -1
  131. package/dist/server/handlers/agent-builder.cjs +17 -17
  132. package/dist/server/handlers/agent-builder.js +1 -1
  133. package/dist/server/handlers/agent-versions.cjs +8 -8
  134. package/dist/server/handlers/agent-versions.js +1 -1
  135. package/dist/server/handlers/agents.cjs +45 -45
  136. package/dist/server/handlers/agents.d.ts +4 -0
  137. package/dist/server/handlers/agents.d.ts.map +1 -1
  138. package/dist/server/handlers/agents.js +1 -1
  139. package/dist/server/handlers/auth.cjs +12 -12
  140. package/dist/server/handlers/auth.js +1 -1
  141. package/dist/server/handlers/conversations.cjs +5 -5
  142. package/dist/server/handlers/conversations.js +1 -1
  143. package/dist/server/handlers/memory.cjs +27 -27
  144. package/dist/server/handlers/memory.d.ts.map +1 -1
  145. package/dist/server/handlers/memory.js +1 -1
  146. package/dist/server/handlers/responses.cjs +4 -4
  147. package/dist/server/handlers/responses.js +1 -1
  148. package/dist/server/handlers/scorer-versions.cjs +8 -8
  149. package/dist/server/handlers/scorer-versions.js +1 -1
  150. package/dist/server/handlers/scores.cjs +7 -7
  151. package/dist/server/handlers/scores.js +1 -1
  152. package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
  153. package/dist/server/handlers/stored-agent-favorites.js +1 -1
  154. package/dist/server/handlers/stored-agents.cjs +12 -8
  155. package/dist/server/handlers/stored-agents.d.ts +26 -0
  156. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  157. package/dist/server/handlers/stored-agents.js +1 -1
  158. package/dist/server/handlers/stored-scorers.cjs +6 -6
  159. package/dist/server/handlers/stored-scorers.js +1 -1
  160. package/dist/server/handlers/system.cjs +3 -3
  161. package/dist/server/handlers/system.js +1 -1
  162. package/dist/server/handlers/tools.cjs +6 -6
  163. package/dist/server/handlers/tools.js +1 -1
  164. package/dist/server/handlers/workflows.cjs +27 -27
  165. package/dist/server/handlers/workflows.js +1 -1
  166. package/dist/server/handlers.cjs +18 -18
  167. package/dist/server/handlers.js +9 -9
  168. package/dist/server/schemas/agents.d.ts +2 -0
  169. package/dist/server/schemas/agents.d.ts.map +1 -1
  170. package/dist/server/schemas/index.cjs +119 -115
  171. package/dist/server/schemas/index.js +5 -5
  172. package/dist/server/schemas/stored-agents.d.ts +17 -0
  173. package/dist/server/schemas/stored-agents.d.ts.map +1 -1
  174. package/dist/server/server-adapter/index.cjs +23 -16
  175. package/dist/server/server-adapter/index.cjs.map +1 -1
  176. package/dist/server/server-adapter/index.d.ts.map +1 -1
  177. package/dist/server/server-adapter/index.js +11 -4
  178. package/dist/server/server-adapter/index.js.map +1 -1
  179. package/dist/server/server-adapter/routes/stored-agents.d.ts +2 -1
  180. package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -1
  181. package/dist/working-memory-state-J7ASTNXX-JNDYMEET.js +3 -0
  182. package/dist/working-memory-state-J7ASTNXX-JNDYMEET.js.map +1 -0
  183. package/dist/working-memory-state-J7ASTNXX-WEIO7C67.cjs +24 -0
  184. package/dist/working-memory-state-J7ASTNXX-WEIO7C67.cjs.map +1 -0
  185. package/package.json +5 -5
  186. package/dist/chunk-3LUN33E7.cjs.map +0 -1
  187. package/dist/chunk-43KD3CRE.cjs.map +0 -1
  188. package/dist/chunk-76I5G5W5.js.map +0 -1
  189. package/dist/chunk-GPAQ47NG.cjs.map +0 -1
  190. package/dist/chunk-IJFPP2XB.js.map +0 -1
  191. package/dist/chunk-J6OD53OV.js.map +0 -1
  192. package/dist/chunk-L33BLLID.cjs.map +0 -1
  193. package/dist/chunk-OJNVSXOF.js.map +0 -1
  194. package/dist/chunk-PXYR3D6L.cjs.map +0 -1
  195. package/dist/chunk-RBONVWGZ.js.map +0 -1
  196. package/dist/chunk-RTYOFB6W.cjs.map +0 -1
  197. package/dist/chunk-T2FBYRYD.cjs.map +0 -1
  198. package/dist/chunk-UFYCA27U.js.map +0 -1
  199. package/dist/chunk-YW252K6H.js.map +0 -1
  200. package/dist/constants-SPS7MR4D-YRZDDIPO.js +0 -3
  201. package/dist/dist-HIWM6H43.js.map +0 -1
  202. package/dist/dist-LZYJXHUM.cjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @mastra/server
2
2
 
3
+ ## 1.39.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `GET /stored/agents/:storedAgentId/dependents` endpoint that lists agents ([#17183](https://github.com/mastra-ai/mastra/pull/17183))
8
+ referencing a stored agent as a sub-agent.
9
+
10
+ ```ts
11
+ const { dependents, hiddenCount } = await client.getStoredAgent(id).dependents();
12
+ // { dependents: [{ id: 'parent-1', name: 'Triager' }], hiddenCount: 2 }
13
+ ```
14
+
15
+ - `dependents` — caller-readable agents (public agents and the caller's own private
16
+ agents) with `id` + `name`.
17
+ - `hiddenCount` — cross-workspace dependents the caller cannot read, only surfaced
18
+ when the target agent is public.
19
+
20
+ Access mirrors `GET /stored/agents/:storedAgentId` — 404 when the caller cannot
21
+ read the target.
22
+
23
+ ### Patch Changes
24
+
25
+ - Fixed memory status incorrectly reporting memory as enabled for agents without memory configured. The /api/memory/status endpoint now returns false for a resolved agent that has no memory, even when the Mastra instance has storage configured. Previously, Studio would render memory UI for such agents. ([#17506](https://github.com/mastra-ai/mastra/pull/17506))
26
+
27
+ - Fixed subscribed client tools so browser-executed tool results continue through the existing thread subscription instead of opening and canceling a second stream. This prevents closed-stream errors in apps like Agent Builder when multiple client tools run during one response. ([#17532](https://github.com/mastra-ai/mastra/pull/17532))
28
+
29
+ - Updated dependencies [[`c973db4`](https://github.com/mastra-ai/mastra/commit/c973db428df1b564ff0c35d4b2a90e8f4f1e13fd), [`552285e`](https://github.com/mastra-ai/mastra/commit/552285e5af43cfc680a0972032cab8de8776c6a0), [`77e686c`](https://github.com/mastra-ai/mastra/commit/77e686c264e493e99ae5024e4dfe3ea5d5a09718), [`ece8dba`](https://github.com/mastra-ai/mastra/commit/ece8dba7ec1a5089eee8c33167cd762bfa91e509), [`e751af2`](https://github.com/mastra-ai/mastra/commit/e751af219433fbf4c7035b2d771b4c9ec8813b05), [`e2a8380`](https://github.com/mastra-ai/mastra/commit/e2a838017a7657850404c1e94c70d79ffdc6f14a), [`be3f1cd`](https://github.com/mastra-ai/mastra/commit/be3f1cd81f0e2a649e8eac15a024d542d814aef8), [`a34d9db`](https://github.com/mastra-ai/mastra/commit/a34d9dbc39fedb722f271318e9355ecee70489ab)]:
30
+ - @mastra/core@1.39.0-alpha.0
31
+
3
32
  ## 1.38.0
4
33
 
5
34
  ### Minor Changes
@@ -1549,16 +1549,16 @@ declare interface EventSourceMessage {
1549
1549
  * implementation in that browsers will default this to `message`, whereas this parser will
1550
1550
  * leave this as `undefined` if not explicitly declared.
1551
1551
  */
1552
- event?: string | undefined
1552
+ event?: string | undefined;
1553
1553
  /**
1554
1554
  * ID of the message, if any was provided by the server. Can be used by clients to keep the
1555
1555
  * last received message ID in sync when reconnecting.
1556
1556
  */
1557
- id?: string | undefined
1557
+ id?: string | undefined;
1558
1558
  /**
1559
1559
  * The data received for this message
1560
1560
  */
1561
- data: string
1561
+ data: string;
1562
1562
  }
1563
1563
 
1564
1564
  /**
@@ -1582,8 +1582,11 @@ declare interface EventSourceMessage {
1582
1582
  *
1583
1583
  * @public
1584
1584
  */
1585
- declare class EventSourceParserStream extends TransformStream<string, EventSourceMessage> {
1586
- constructor({onError, onRetry, onComment}?: StreamOptions)
1585
+ declare class EventSourceParserStream extends TransformStream<
1586
+ string,
1587
+ EventSourceMessage
1588
+ > {
1589
+ constructor({ onError, onRetry, onComment }?: StreamOptions);
1587
1590
  }
1588
1591
 
1589
1592
  /**
@@ -6830,19 +6833,19 @@ declare interface StreamOptions {
6830
6833
  *
6831
6834
  * @defaultValue `undefined`
6832
6835
  */
6833
- onError?: ('terminate' | ((error: Error) => void)) | undefined
6836
+ onError?: ("terminate" | ((error: Error) => void)) | undefined;
6834
6837
  /**
6835
6838
  * Callback for when a reconnection interval is sent from the server.
6836
6839
  *
6837
6840
  * @param retry - The number of milliseconds to wait before reconnecting.
6838
6841
  */
6839
- onRetry?: ((retry: number) => void) | undefined
6842
+ onRetry?: ((retry: number) => void) | undefined;
6840
6843
  /**
6841
6844
  * Callback for when a comment is encountered in the stream.
6842
6845
  *
6843
6846
  * @param comment - The comment encountered in the stream.
6844
6847
  */
6845
- onComment?: ((comment: string) => void) | undefined
6848
+ onComment?: ((comment: string) => void) | undefined;
6846
6849
  }
6847
6850
 
6848
6851
  /**
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkL33BLLID_cjs = require('./chunk-L33BLLID.cjs');
3
+ var chunk544IXGBW_cjs = require('./chunk-544IXGBW.cjs');
4
4
  var chunkRZR7PLFW_cjs = require('./chunk-RZR7PLFW.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 = chunkL33BLLID_cjs.SERVER_ROUTES) {
37
+ function buildApiSchemaManifest(routes = chunk544IXGBW_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 = chunkL33BLLID_cjs.SERVER_ROUTES) {
54
54
  }
55
55
 
56
56
  exports.buildApiSchemaManifest = buildApiSchemaManifest;
57
- //# sourceMappingURL=api-schema-manifest-E3RU6MLF.cjs.map
58
- //# sourceMappingURL=api-schema-manifest-E3RU6MLF.cjs.map
57
+ //# sourceMappingURL=api-schema-manifest-ALHYYJMN.cjs.map
58
+ //# sourceMappingURL=api-schema-manifest-ALHYYJMN.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,GA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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-E3RU6MLF.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,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;AACxG,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA;AAC5C,EAAA,MAAM,qBAAqB,MAAA,IAAU,UAAA,GAAa,MAAA,GAAS,YAAA,IAAgB,aAAa,YAAA,GAAe,MAAA;AACvG,EAAA,MA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AAc;AAAA,OAClD;AAAA,IACF,CAAC;AAAA,GACH;AACF","file":"api-schema-manifest-ALHYYJMN.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,4 +1,4 @@
1
- import { SERVER_ROUTES } from './chunk-YW252K6H.js';
1
+ import { SERVER_ROUTES } from './chunk-XNGC2C6Z.js';
2
2
  import { schemaToJsonSchema } from './chunk-YQL3TXSD.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-DNC2KIKD.js.map
56
- //# sourceMappingURL=api-schema-manifest-DNC2KIKD.js.map
55
+ //# sourceMappingURL=api-schema-manifest-PQ6VZTB3.js.map
56
+ //# sourceMappingURL=api-schema-manifest-PQ6VZTB3.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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AA,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,SAAiC,aAAA,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-DNC2KIKD.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,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;AACxG,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,IAAA,CAAK,UAAU,CAAA;AAC5C,EAAA,MAAM,qBAAqB,MAAA,IAAU,UAAA,GAAa,MAAA,GAAS,YAAA,IAAgB,aAAa,YAAA,GAAe,MAAA;AACvG,EAAA,MAAM,YAAA,GAAe,MAAA,CAAO,OA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;AAAA,GACH;AACF","file":"api-schema-manifest-PQ6VZTB3.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"]}
@@ -0,0 +1,477 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+
5
+ // ../memory/dist/chunk-WCGXQIEN.js
6
+
7
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.3/c2a1d77e3f595587fc71d833e2045f3b897998b15167d647e8b9eeaae17f7bb2/node_modules/diff/libesm/diff/base.js
8
+ var Diff = class {
9
+ diff(oldStr, newStr, options = {}) {
10
+ let callback;
11
+ if (typeof options === "function") {
12
+ callback = options;
13
+ options = {};
14
+ } else if ("callback" in options) {
15
+ callback = options.callback;
16
+ }
17
+ const oldString = this.castInput(oldStr, options);
18
+ const newString = this.castInput(newStr, options);
19
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
20
+ const newTokens = this.removeEmpty(this.tokenize(newString, options));
21
+ return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
22
+ }
23
+ diffWithOptionsObj(oldTokens, newTokens, options, callback) {
24
+ var _a;
25
+ const done = (value) => {
26
+ value = this.postProcess(value, options);
27
+ if (callback) {
28
+ setTimeout(function() {
29
+ callback(value);
30
+ }, 0);
31
+ return void 0;
32
+ } else {
33
+ return value;
34
+ }
35
+ };
36
+ const newLen = newTokens.length, oldLen = oldTokens.length;
37
+ let editLength = 1;
38
+ let maxEditLength = newLen + oldLen;
39
+ if (options.maxEditLength != null) {
40
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
41
+ }
42
+ const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
43
+ const abortAfterTimestamp = Date.now() + maxExecutionTime;
44
+ const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
45
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
46
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
47
+ return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
48
+ }
49
+ let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
50
+ const execEditLength = () => {
51
+ for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
52
+ let basePath;
53
+ const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
54
+ if (removePath) {
55
+ bestPath[diagonalPath - 1] = void 0;
56
+ }
57
+ let canAdd = false;
58
+ if (addPath) {
59
+ const addPathNewPos = addPath.oldPos - diagonalPath;
60
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
61
+ }
62
+ const canRemove = removePath && removePath.oldPos + 1 < oldLen;
63
+ if (!canAdd && !canRemove) {
64
+ bestPath[diagonalPath] = void 0;
65
+ continue;
66
+ }
67
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
68
+ basePath = this.addToPath(addPath, true, false, 0, options);
69
+ } else {
70
+ basePath = this.addToPath(removePath, false, true, 1, options);
71
+ }
72
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
73
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
74
+ return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
75
+ } else {
76
+ bestPath[diagonalPath] = basePath;
77
+ if (basePath.oldPos + 1 >= oldLen) {
78
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
79
+ }
80
+ if (newPos + 1 >= newLen) {
81
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
82
+ }
83
+ }
84
+ }
85
+ editLength++;
86
+ };
87
+ if (callback) {
88
+ (function exec() {
89
+ setTimeout(function() {
90
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
91
+ return callback(void 0);
92
+ }
93
+ if (!execEditLength()) {
94
+ exec();
95
+ }
96
+ }, 0);
97
+ })();
98
+ } else {
99
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
100
+ const ret = execEditLength();
101
+ if (ret) {
102
+ return ret;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ addToPath(path, added, removed, oldPosInc, options) {
108
+ const last = path.lastComponent;
109
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
110
+ return {
111
+ oldPos: path.oldPos + oldPosInc,
112
+ lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
113
+ };
114
+ } else {
115
+ return {
116
+ oldPos: path.oldPos + oldPosInc,
117
+ lastComponent: { count: 1, added, removed, previousComponent: last }
118
+ };
119
+ }
120
+ }
121
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
122
+ const newLen = newTokens.length, oldLen = oldTokens.length;
123
+ let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
124
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
125
+ newPos++;
126
+ oldPos++;
127
+ commonCount++;
128
+ if (options.oneChangePerToken) {
129
+ basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
130
+ }
131
+ }
132
+ if (commonCount && !options.oneChangePerToken) {
133
+ basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
134
+ }
135
+ basePath.oldPos = oldPos;
136
+ return newPos;
137
+ }
138
+ equals(left, right, options) {
139
+ if (options.comparator) {
140
+ return options.comparator(left, right);
141
+ } else {
142
+ return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
143
+ }
144
+ }
145
+ removeEmpty(array) {
146
+ const ret = [];
147
+ for (let i = 0; i < array.length; i++) {
148
+ if (array[i]) {
149
+ ret.push(array[i]);
150
+ }
151
+ }
152
+ return ret;
153
+ }
154
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
155
+ castInput(value, options) {
156
+ return value;
157
+ }
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
159
+ tokenize(value, options) {
160
+ return Array.from(value);
161
+ }
162
+ join(chars) {
163
+ return chars.join("");
164
+ }
165
+ postProcess(changeObjects, options) {
166
+ return changeObjects;
167
+ }
168
+ get useLongestToken() {
169
+ return false;
170
+ }
171
+ buildValues(lastComponent, newTokens, oldTokens) {
172
+ const components = [];
173
+ let nextComponent;
174
+ while (lastComponent) {
175
+ components.push(lastComponent);
176
+ nextComponent = lastComponent.previousComponent;
177
+ delete lastComponent.previousComponent;
178
+ lastComponent = nextComponent;
179
+ }
180
+ components.reverse();
181
+ const componentLen = components.length;
182
+ let componentPos = 0, newPos = 0, oldPos = 0;
183
+ for (; componentPos < componentLen; componentPos++) {
184
+ const component = components[componentPos];
185
+ if (!component.removed) {
186
+ if (!component.added && this.useLongestToken) {
187
+ let value = newTokens.slice(newPos, newPos + component.count);
188
+ value = value.map(function(value2, i) {
189
+ const oldValue = oldTokens[oldPos + i];
190
+ return oldValue.length > value2.length ? oldValue : value2;
191
+ });
192
+ component.value = this.join(value);
193
+ } else {
194
+ component.value = this.join(newTokens.slice(newPos, newPos + component.count));
195
+ }
196
+ newPos += component.count;
197
+ if (!component.added) {
198
+ oldPos += component.count;
199
+ }
200
+ } else {
201
+ component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
202
+ oldPos += component.count;
203
+ }
204
+ }
205
+ return components;
206
+ }
207
+ };
208
+
209
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.3/c2a1d77e3f595587fc71d833e2045f3b897998b15167d647e8b9eeaae17f7bb2/node_modules/diff/libesm/diff/line.js
210
+ var LineDiff = class extends Diff {
211
+ constructor() {
212
+ super(...arguments);
213
+ this.tokenize = tokenize;
214
+ }
215
+ equals(left, right, options) {
216
+ if (options.ignoreWhitespace) {
217
+ if (!options.newlineIsToken || !left.includes("\n")) {
218
+ left = left.trim();
219
+ }
220
+ if (!options.newlineIsToken || !right.includes("\n")) {
221
+ right = right.trim();
222
+ }
223
+ } else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
224
+ if (left.endsWith("\n")) {
225
+ left = left.slice(0, -1);
226
+ }
227
+ if (right.endsWith("\n")) {
228
+ right = right.slice(0, -1);
229
+ }
230
+ }
231
+ return super.equals(left, right, options);
232
+ }
233
+ };
234
+ var lineDiff = new LineDiff();
235
+ function diffLines(oldStr, newStr, options) {
236
+ return lineDiff.diff(oldStr, newStr, options);
237
+ }
238
+ function tokenize(value, options) {
239
+ if (options.stripTrailingCr) {
240
+ value = value.replace(/\r\n/g, "\n");
241
+ }
242
+ const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
243
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
244
+ linesAndNewlines.pop();
245
+ }
246
+ for (let i = 0; i < linesAndNewlines.length; i++) {
247
+ const line = linesAndNewlines[i];
248
+ if (i % 2 && !options.newlineIsToken) {
249
+ retLines[retLines.length - 1] += line;
250
+ } else {
251
+ retLines.push(line);
252
+ }
253
+ }
254
+ return retLines;
255
+ }
256
+
257
+ // ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.3/c2a1d77e3f595587fc71d833e2045f3b897998b15167d647e8b9eeaae17f7bb2/node_modules/diff/libesm/patch/create.js
258
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
259
+ let optionsObj;
260
+ if (!options) {
261
+ optionsObj = {};
262
+ } else if (typeof options === "function") {
263
+ optionsObj = { callback: options };
264
+ } else {
265
+ optionsObj = options;
266
+ }
267
+ if (typeof optionsObj.context === "undefined") {
268
+ optionsObj.context = 4;
269
+ }
270
+ const context = optionsObj.context;
271
+ if (optionsObj.newlineIsToken) {
272
+ throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
273
+ }
274
+ if (!optionsObj.callback) {
275
+ return diffLinesResultToPatch(diffLines(oldStr, newStr, optionsObj));
276
+ } else {
277
+ const { callback } = optionsObj;
278
+ diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff) => {
279
+ const patch = diffLinesResultToPatch(diff);
280
+ callback(patch);
281
+ } }));
282
+ }
283
+ function diffLinesResultToPatch(diff) {
284
+ if (!diff) {
285
+ return;
286
+ }
287
+ diff.push({ value: "", lines: [] });
288
+ function contextLines(lines) {
289
+ return lines.map(function(entry) {
290
+ return " " + entry;
291
+ });
292
+ }
293
+ const hunks = [];
294
+ let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
295
+ for (let i = 0; i < diff.length; i++) {
296
+ const current = diff[i], lines = current.lines || splitLines(current.value);
297
+ current.lines = lines;
298
+ if (current.added || current.removed) {
299
+ if (!oldRangeStart) {
300
+ const prev = diff[i - 1];
301
+ oldRangeStart = oldLine;
302
+ newRangeStart = newLine;
303
+ if (prev) {
304
+ curRange = context > 0 ? contextLines(prev.lines.slice(-context)) : [];
305
+ oldRangeStart -= curRange.length;
306
+ newRangeStart -= curRange.length;
307
+ }
308
+ }
309
+ for (const line of lines) {
310
+ curRange.push((current.added ? "+" : "-") + line);
311
+ }
312
+ if (current.added) {
313
+ newLine += lines.length;
314
+ } else {
315
+ oldLine += lines.length;
316
+ }
317
+ } else {
318
+ if (oldRangeStart) {
319
+ if (lines.length <= context * 2 && i < diff.length - 2) {
320
+ for (const line of contextLines(lines)) {
321
+ curRange.push(line);
322
+ }
323
+ } else {
324
+ const contextSize = Math.min(lines.length, context);
325
+ for (const line of contextLines(lines.slice(0, contextSize))) {
326
+ curRange.push(line);
327
+ }
328
+ const hunk = {
329
+ oldStart: oldRangeStart,
330
+ oldLines: oldLine - oldRangeStart + contextSize,
331
+ newStart: newRangeStart,
332
+ newLines: newLine - newRangeStart + contextSize,
333
+ lines: curRange
334
+ };
335
+ hunks.push(hunk);
336
+ oldRangeStart = 0;
337
+ newRangeStart = 0;
338
+ curRange = [];
339
+ }
340
+ }
341
+ oldLine += lines.length;
342
+ newLine += lines.length;
343
+ }
344
+ }
345
+ for (const hunk of hunks) {
346
+ for (let i = 0; i < hunk.lines.length; i++) {
347
+ if (hunk.lines[i].endsWith("\n")) {
348
+ hunk.lines[i] = hunk.lines[i].slice(0, -1);
349
+ } else {
350
+ hunk.lines.splice(i + 1, 0, "\");
351
+ i++;
352
+ }
353
+ }
354
+ }
355
+ return {
356
+ oldFileName,
357
+ newFileName,
358
+ oldHeader,
359
+ newHeader,
360
+ hunks
361
+ };
362
+ }
363
+ }
364
+ function splitLines(text) {
365
+ const hasTrailingNl = text.endsWith("\n");
366
+ const result = text.split("\n").map((line) => line + "\n");
367
+ if (hasTrailingNl) {
368
+ result.pop();
369
+ } else {
370
+ result.push(result.pop().slice(0, -1));
371
+ }
372
+ return result;
373
+ }
374
+
375
+ // ../memory/dist/chunk-WCGXQIEN.js
376
+ var WORKING_MEMORY_STATE_ID = "working-memory";
377
+ var WORKING_MEMORY_STATE_PROCESSOR_ID = "working-memory-state";
378
+ var WorkingMemoryStateProcessor = class {
379
+ constructor(memory, memoryConfig) {
380
+ this.memory = memory;
381
+ this.memoryConfig = memoryConfig;
382
+ }
383
+ memory;
384
+ memoryConfig;
385
+ id = WORKING_MEMORY_STATE_PROCESSOR_ID;
386
+ stateId = WORKING_MEMORY_STATE_ID;
387
+ async computeStateSignal(args) {
388
+ const template = await this.memory.getWorkingMemoryTemplate({ memoryConfig: this.memoryConfig });
389
+ if (!template) return;
390
+ const data = await this.memory.getWorkingMemory({
391
+ threadId: args.threadId,
392
+ resourceId: args.resourceId,
393
+ memoryConfig: this.memoryConfig
394
+ });
395
+ const contents = data?.trim();
396
+ if (!contents) return;
397
+ const cacheKey = stableWorkingMemoryCacheKey({ format: template.format, data: contents });
398
+ const shouldMakeSnapshot = !args.contextWindow.hasSnapshot;
399
+ if (args.tracking?.currentCacheKey === cacheKey && !shouldMakeSnapshot) return;
400
+ const mergedConfig = this.memory.getMergedThreadConfig(this.memoryConfig);
401
+ const scope = mergedConfig.workingMemory?.scope ?? "resource";
402
+ const deltaCandidate = template.format === "markdown" && !shouldMakeSnapshot ? buildMarkdownDelta({
403
+ lastSnapshot: args.lastSnapshot,
404
+ deltasSinceSnapshot: args.deltasSinceSnapshot,
405
+ nextContents: contents
406
+ }) : void 0;
407
+ if (deltaCandidate) {
408
+ return {
409
+ id: WORKING_MEMORY_STATE_ID,
410
+ mode: "delta",
411
+ cacheKey,
412
+ tagName: "working-memory",
413
+ contents: deltaCandidate.contents,
414
+ delta: deltaCandidate.contents,
415
+ // Stash the full post-edit text on the signal so the next turn can
416
+ // diff against the most recently emitted state instead of the older
417
+ // snapshot. Invisible to the model.
418
+ value: contents,
419
+ attributes: {
420
+ format: template.format,
421
+ scope,
422
+ patch: "unified-diff"
423
+ }
424
+ };
425
+ }
426
+ return {
427
+ id: WORKING_MEMORY_STATE_ID,
428
+ mode: "snapshot",
429
+ cacheKey,
430
+ tagName: "working-memory",
431
+ contents,
432
+ // Mirror contents in value so the first delta after a snapshot has a
433
+ // typed prior-state to diff against without falling back to contents.
434
+ value: contents,
435
+ attributes: {
436
+ format: template.format,
437
+ scope
438
+ }
439
+ };
440
+ }
441
+ };
442
+ function stableWorkingMemoryCacheKey(input) {
443
+ const hash = crypto.createHash("sha256");
444
+ hash.update(input.format);
445
+ hash.update("\0");
446
+ hash.update(input.data ?? "");
447
+ return `sha256:${hash.digest("hex")}`;
448
+ }
449
+ function buildMarkdownDelta(args) {
450
+ const { lastSnapshot, deltasSinceSnapshot, nextContents } = args;
451
+ const latestDelta = deltasSinceSnapshot.at(-1);
452
+ const prior = pickStringValue(readSignalValue(latestDelta)) ?? pickStringValue(readSignalValue(lastSnapshot)) ?? (typeof lastSnapshot?.contents === "string" ? lastSnapshot.contents : void 0);
453
+ if (!prior) return;
454
+ const patch = renderHunksOnly(prior, nextContents);
455
+ return { contents: patch };
456
+ }
457
+ function pickStringValue(value) {
458
+ return typeof value === "string" ? value : void 0;
459
+ }
460
+ function readSignalValue(signal) {
461
+ return signal?.metadata?.value;
462
+ }
463
+ function renderHunksOnly(prior, next) {
464
+ const { hunks } = structuredPatch("", "", prior, next, "", "", { context: 0 });
465
+ return hunks.map((hunk) => {
466
+ const header = `@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`;
467
+ const lines = hunk.lines.filter((line) => !line.startsWith("\"));
468
+ return [header, ...lines].join("\n");
469
+ }).join("\n");
470
+ }
471
+
472
+ exports.WORKING_MEMORY_STATE_ID = WORKING_MEMORY_STATE_ID;
473
+ exports.WORKING_MEMORY_STATE_PROCESSOR_ID = WORKING_MEMORY_STATE_PROCESSOR_ID;
474
+ exports.WorkingMemoryStateProcessor = WorkingMemoryStateProcessor;
475
+ exports.stableWorkingMemoryCacheKey = stableWorkingMemoryCacheKey;
476
+ //# sourceMappingURL=chunk-2ONW75MN.cjs.map
477
+ //# sourceMappingURL=chunk-2ONW75MN.cjs.map