@farm.js/core 0.1.35 → 0.1.37

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 (285) hide show
  1. package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
  5. package/dist/agent-runtime.cjs +6 -4
  6. package/dist/agent-runtime.d.mts +1 -1
  7. package/dist/agent-runtime.d.ts +1 -1
  8. package/dist/agent-runtime.mjs +5 -3
  9. package/dist/api/client.cjs +3 -3
  10. package/dist/api/client.mjs +2 -2
  11. package/dist/api/route-manager.cjs +9 -9
  12. package/dist/api/route-manager.d.mts +10 -4
  13. package/dist/api/route-manager.d.ts +10 -4
  14. package/dist/api/route-manager.mjs +8 -8
  15. package/dist/api/runtime.cjs +6 -6
  16. package/dist/api/runtime.d.mts +4 -62
  17. package/dist/api/runtime.d.ts +4 -62
  18. package/dist/api/runtime.mjs +5 -5
  19. package/dist/api.cjs +13 -12
  20. package/dist/api.d.mts +3 -3
  21. package/dist/api.d.ts +3 -3
  22. package/dist/api.mjs +12 -11
  23. package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
  24. package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
  25. package/dist/app-markdown.cjs +6 -4
  26. package/dist/app-markdown.d.mts +3 -3
  27. package/dist/app-markdown.d.ts +3 -3
  28. package/dist/app-markdown.mjs +5 -3
  29. package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
  30. package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
  31. package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
  32. package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
  33. package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
  34. package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
  35. package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
  36. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  37. package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
  38. package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
  39. package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
  40. package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
  41. package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
  42. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  43. package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
  44. package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
  45. package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
  46. package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
  47. package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
  48. package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
  49. package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
  50. package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
  51. package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
  52. package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
  53. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  54. package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
  55. package/dist/chunk-CI6E3UOH.cjs +314 -0
  56. package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
  57. package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
  58. package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
  59. package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
  60. package/dist/chunk-DTSROJ5J.mjs +367 -0
  61. package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
  62. package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
  63. package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
  64. package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
  65. package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
  66. package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
  67. package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
  68. package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
  69. package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
  70. package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
  71. package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
  72. package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
  73. package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
  74. package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
  75. package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
  76. package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
  77. package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
  78. package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
  79. package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
  80. package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
  81. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  82. package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
  83. package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
  84. package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
  85. package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
  86. package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
  87. package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
  88. package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
  89. package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
  90. package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
  91. package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
  92. package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
  93. package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
  94. package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
  95. package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
  96. package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
  97. package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
  98. package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
  99. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  100. package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
  101. package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
  102. package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
  103. package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
  104. package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
  105. package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
  106. package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
  107. package/dist/chunk-SGBZPZUW.mjs +75 -0
  108. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  109. package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
  110. package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
  111. package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
  112. package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
  113. package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
  114. package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
  115. package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
  116. package/dist/chunk-UH6QN5NL.mjs +178 -0
  117. package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
  118. package/dist/chunk-UXHS27O6.cjs +75 -0
  119. package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
  120. package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
  121. package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
  122. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  123. package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  124. package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
  125. package/dist/chunk-WRPHYQVY.mjs +109 -0
  126. package/dist/chunk-WT4TGLXT.cjs +109 -0
  127. package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
  128. package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
  129. package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
  130. package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
  131. package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
  132. package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
  133. package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
  134. package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
  135. package/dist/client-plugins.d.mts +1 -1
  136. package/dist/client-plugins.d.ts +1 -1
  137. package/dist/client.cjs +8 -8
  138. package/dist/client.d.mts +5 -5
  139. package/dist/client.d.ts +5 -5
  140. package/dist/client.mjs +7 -7
  141. package/dist/config.d.mts +1 -1
  142. package/dist/config.d.ts +1 -1
  143. package/dist/{devtools-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
  144. package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
  145. package/dist/docs.cjs +13 -12
  146. package/dist/docs.d.mts +2 -2
  147. package/dist/docs.d.ts +2 -2
  148. package/dist/docs.mjs +12 -11
  149. package/dist/headers.cjs +4 -4
  150. package/dist/headers.mjs +3 -3
  151. package/dist/i18n/client.cjs +11 -11
  152. package/dist/i18n/client.mjs +3 -3
  153. package/dist/image/server.cjs +3 -3
  154. package/dist/image/server.mjs +2 -2
  155. package/dist/image/sharp.cjs +10 -10
  156. package/dist/image/sharp.mjs +2 -2
  157. package/dist/index.cjs +61 -54
  158. package/dist/index.d.mts +14 -14
  159. package/dist/index.d.ts +14 -14
  160. package/dist/index.mjs +60 -53
  161. package/dist/integrations.cjs +8 -4
  162. package/dist/integrations.d.mts +1 -1
  163. package/dist/integrations.d.ts +1 -1
  164. package/dist/integrations.mjs +7 -3
  165. package/dist/internal/app-markdown-runtime.cjs +5 -3
  166. package/dist/internal/app-markdown-runtime.d.mts +19 -5
  167. package/dist/internal/app-markdown-runtime.d.ts +19 -5
  168. package/dist/internal/app-markdown-runtime.mjs +4 -2
  169. package/dist/internal/build-runtime.cjs +38 -34
  170. package/dist/internal/build-runtime.d.mts +3 -3
  171. package/dist/internal/build-runtime.d.ts +3 -3
  172. package/dist/internal/build-runtime.mjs +37 -33
  173. package/dist/internal/cli-runtime.cjs +17 -16
  174. package/dist/internal/cli-runtime.mjs +16 -15
  175. package/dist/internal/client-error-overlay.cjs +4 -4
  176. package/dist/internal/client-error-overlay.mjs +1 -1
  177. package/dist/internal/client-runtime.cjs +2 -2
  178. package/dist/internal/client-runtime.mjs +1 -1
  179. package/dist/internal/compression-runtime.d.mts +1 -1
  180. package/dist/internal/compression-runtime.d.ts +1 -1
  181. package/dist/internal/config-runtime.cjs +11 -10
  182. package/dist/internal/config-runtime.d.mts +2 -2
  183. package/dist/internal/config-runtime.d.ts +2 -2
  184. package/dist/internal/config-runtime.mjs +10 -9
  185. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  186. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  187. package/dist/internal/isolated-boundary.cjs +2 -2
  188. package/dist/internal/isolated-boundary.d.mts +0 -1
  189. package/dist/internal/isolated-boundary.d.ts +0 -1
  190. package/dist/internal/isolated-boundary.mjs +1 -1
  191. package/dist/internal/metadata-image-runtime.cjs +3 -3
  192. package/dist/internal/metadata-image-runtime.mjs +2 -2
  193. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  194. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  195. package/dist/internal/production-runtime.cjs +27 -48
  196. package/dist/internal/production-runtime.d.mts +67 -27
  197. package/dist/internal/production-runtime.d.ts +67 -27
  198. package/dist/internal/production-runtime.mjs +34 -55
  199. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  200. package/dist/layers-VUWIOFEO.cjs +18 -0
  201. package/dist/markdown.cjs +1 -1
  202. package/dist/markdown.d.mts +1 -1
  203. package/dist/markdown.d.ts +1 -1
  204. package/dist/markdown.mjs +1 -1
  205. package/dist/middleware.cjs +10 -10
  206. package/dist/middleware.d.mts +6 -4
  207. package/dist/middleware.d.ts +6 -4
  208. package/dist/middleware.mjs +9 -9
  209. package/dist/navigation.cjs +7 -7
  210. package/dist/navigation.d.mts +4 -4
  211. package/dist/navigation.d.ts +4 -4
  212. package/dist/navigation.mjs +6 -6
  213. package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
  214. package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
  215. package/dist/plugin.cjs +31 -28
  216. package/dist/plugin.d.mts +1 -1
  217. package/dist/plugin.d.ts +1 -1
  218. package/dist/plugin.mjs +30 -27
  219. package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
  220. package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
  221. package/dist/query/client.cjs +9 -9
  222. package/dist/query/client.mjs +4 -4
  223. package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
  224. package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
  225. package/dist/renderer/react/server.cjs +3 -3
  226. package/dist/renderer/react/server.mjs +1 -1
  227. package/dist/renderer-client.cjs +12 -12
  228. package/dist/renderer-client.d.mts +3 -3
  229. package/dist/renderer-client.d.ts +3 -3
  230. package/dist/renderer-client.mjs +4 -4
  231. package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
  232. package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
  233. package/dist/request.cjs +3 -3
  234. package/dist/request.d.mts +2 -2
  235. package/dist/request.d.ts +2 -2
  236. package/dist/request.mjs +2 -2
  237. package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
  238. package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
  239. package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
  240. package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
  241. package/dist/routes.cjs +2 -2
  242. package/dist/routes.d.mts +1 -1
  243. package/dist/routes.d.ts +1 -1
  244. package/dist/routes.mjs +1 -1
  245. package/dist/runtime-CA3Ei5k_.d.ts +69 -0
  246. package/dist/runtime-DJDaCMd_.d.mts +69 -0
  247. package/dist/server-action-security.cjs +3 -3
  248. package/dist/server-action-security.mjs +2 -2
  249. package/dist/server-fn.cjs +5 -5
  250. package/dist/server-fn.mjs +4 -4
  251. package/dist/server-plugins.cjs +5 -5
  252. package/dist/server-plugins.d.mts +2 -2
  253. package/dist/server-plugins.d.ts +2 -2
  254. package/dist/server-plugins.mjs +4 -4
  255. package/dist/server-query.cjs +6 -6
  256. package/dist/server-query.mjs +5 -5
  257. package/dist/server.cjs +57 -54
  258. package/dist/server.d.mts +7 -7
  259. package/dist/server.d.ts +7 -7
  260. package/dist/server.mjs +35 -32
  261. package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
  262. package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
  263. package/dist/testing.cjs +13 -13
  264. package/dist/testing.d.mts +1 -1
  265. package/dist/testing.d.ts +1 -1
  266. package/dist/testing.mjs +10 -10
  267. package/dist/theme/server.cjs +4 -4
  268. package/dist/theme/server.mjs +3 -3
  269. package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
  270. package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
  271. package/dist/version.cjs +2 -2
  272. package/dist/version.mjs +1 -1
  273. package/dist/vite.cjs +31 -28
  274. package/dist/vite.d.mts +1 -1
  275. package/dist/vite.d.ts +1 -1
  276. package/dist/vite.mjs +30 -27
  277. package/dist/workflows.cjs +3 -3
  278. package/dist/workflows.mjs +2 -2
  279. package/package.json +1 -1
  280. package/types/middleware.d.ts +5 -1
  281. package/dist/chunk-FXEF4PPL.mjs +0 -47
  282. package/dist/chunk-XD32KALF.cjs +0 -47
  283. package/dist/layers-4PNE2HOY.cjs +0 -18
  284. /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
  285. /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
@@ -5,12 +5,13 @@ import {
5
5
  withProductionNodeEnv
6
6
  } from "./chunk-655RLQQL.mjs";
7
7
  import {
8
- generateNativeMCPPluginSource
9
- } from "./chunk-FXEF4PPL.mjs";
8
+ generateNativeMCPPluginSource,
9
+ layoutsCanCoverSamePage
10
+ } from "./chunk-WRPHYQVY.mjs";
10
11
  import {
11
12
  compileFarmDocsAdapterEdgeManifest,
12
13
  createFarmDocsAPIHandler
13
- } from "./chunk-SOMHP6GF.mjs";
14
+ } from "./chunk-XOPOIFTJ.mjs";
14
15
  import {
15
16
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
16
17
  createFarmDocsHandler,
@@ -20,7 +21,7 @@ import {
20
21
  loadFarmDocsPage,
21
22
  resolveFarmDocsContentDir,
22
23
  toFarmDocsMarkdownPage
23
- } from "./chunk-PDOCJ6RY.mjs";
24
+ } from "./chunk-O6WAEAX3.mjs";
24
25
  import {
25
26
  generateFarmDocsSearchClientRuntime,
26
27
  isFarmDocsSearchEnabled,
@@ -28,7 +29,7 @@ import {
28
29
  } from "./chunk-UP4CW6WP.mjs";
29
30
  import {
30
31
  FARM_PRERENDER_ENV
31
- } from "./chunk-3KZS4SUS.mjs";
32
+ } from "./chunk-MCIZVNOQ.mjs";
32
33
  import {
33
34
  loadFarmDocsEngine
34
35
  } from "./chunk-2VQKKQ6D.mjs";
@@ -37,7 +38,7 @@ import {
37
38
  getDeployTargetForPreset,
38
39
  hasCustomFarmRouteContext,
39
40
  resolveDeployOutputPath
40
- } from "./chunk-6DU6UFUE.mjs";
41
+ } from "./chunk-EXG5LD6B.mjs";
41
42
  import {
42
43
  resolveFarmInstrumentationFile
43
44
  } from "./chunk-ZZSRYEYU.mjs";
@@ -76,15 +77,16 @@ import {
76
77
  resolveFarmIsolatedClientHydrationMode,
77
78
  resolveFarmNotFoundComponentPath,
78
79
  usesFarmServerTree
79
- } from "./chunk-4KU5Q7C2.mjs";
80
+ } from "./chunk-4P6ULFMD.mjs";
80
81
  import {
81
82
  findRequestBoundSourceBlockers,
82
83
  generateFarmTypeArtifacts,
83
84
  parseRouteRenderingDirective,
84
85
  resolveRouteRenderingConfigFromFile
85
- } from "./chunk-2G2NNLE2.mjs";
86
+ } from "./chunk-CQMVIOYP.mjs";
86
87
  import {
87
88
  FARM_API_CATALOG_PATH,
89
+ FARM_APP_MANIFEST_LEGACY_PATH,
88
90
  FARM_APP_MANIFEST_PATH,
89
91
  HOISTED_HEAD_ELEMENT,
90
92
  getRouteDirectoryDepth,
@@ -93,7 +95,12 @@ import {
93
95
  resolveFarmAppManifestInput,
94
96
  routeBoundaryCoversDirectory,
95
97
  stripRouteGroups
96
- } from "./chunk-6ETPZTJI.mjs";
98
+ } from "./chunk-LBGILORX.mjs";
99
+ import {
100
+ FARM_DEFAULT_MCP_PATH,
101
+ createFarmDefaultMCPServer,
102
+ farmConfigMountsMCP
103
+ } from "./chunk-UH6QN5NL.mjs";
97
104
  import {
98
105
  isFarmPreviewDeploymentEnvironment
99
106
  } from "./chunk-BOYNDCZL.mjs";
@@ -113,7 +120,7 @@ import {
113
120
  } from "./chunk-GHFS7RUB.mjs";
114
121
  import {
115
122
  getFarmAppDirectories
116
- } from "./chunk-JHWOVJ3M.mjs";
123
+ } from "./chunk-BUGNQIHC.mjs";
117
124
  import {
118
125
  REACT_RENDERER,
119
126
  getFarmRendererCapabilities,
@@ -125,7 +132,7 @@ import {
125
132
  } from "./chunk-DAATZTKJ.mjs";
126
133
  import {
127
134
  applyFarmCspHashesToHtml
128
- } from "./chunk-UJD4PHYB.mjs";
135
+ } from "./chunk-4E5WBPEG.mjs";
129
136
  import {
130
137
  applyFarmCronVercelCrons,
131
138
  createFarmCronCloudflareConfig,
@@ -137,7 +144,7 @@ import {
137
144
  } from "./chunk-4OOBRCJX.mjs";
138
145
  import {
139
146
  isFarmMarkdownPageFile
140
- } from "./chunk-4JHOT46A.mjs";
147
+ } from "./chunk-TPLJVC7E.mjs";
141
148
  import {
142
149
  resolveFarmMdxComponentsModulePath,
143
150
  resolveMdxConfig
@@ -148,24 +155,25 @@ import {
148
155
  import {
149
156
  applyFarmWorkflowVercelCrons,
150
157
  prepareFarmWorkflowsForNitro
151
- } from "./chunk-6WCPV6G2.mjs";
158
+ } from "./chunk-Q2KB32T4.mjs";
152
159
  import {
160
+ FARM_INTEGRATION_API_BASE_PATH_KEY,
153
161
  getFarmIntegrationPluginServerRuntime,
154
162
  getIntegrationProviders
155
- } from "./chunk-HMIJDL7S.mjs";
163
+ } from "./chunk-Z5BEWYVO.mjs";
156
164
  import {
157
165
  appendMiddlewareDirectory,
158
166
  appendMiddlewareRoutePath,
159
167
  compareMiddlewareRouteLocations
160
- } from "./chunk-6TJOML4E.mjs";
168
+ } from "./chunk-NFMDCAOS.mjs";
161
169
  import {
162
170
  compileMiddlewareConfig,
163
171
  matchesCompiledMiddlewareConfig,
164
172
  matchesMiddlewareRoute
165
- } from "./chunk-JG6DJF5A.mjs";
173
+ } from "./chunk-HZFM2LWQ.mjs";
166
174
  import {
167
175
  APIRouteManager
168
- } from "./chunk-22LTEMGQ.mjs";
176
+ } from "./chunk-VXAWRDK7.mjs";
169
177
  import {
170
178
  readFarmI18nCatalogs
171
179
  } from "./chunk-QCFBDFRS.mjs";
@@ -190,6 +198,9 @@ import {
190
198
  resolveFarmAPIServerBasePath,
191
199
  resolveFarmAPIServerRoutePath
192
200
  } from "./chunk-BTHHUD7Q.mjs";
201
+ import {
202
+ FARM_VERSION
203
+ } from "./chunk-YCKO6FRS.mjs";
193
204
  import {
194
205
  getFarmPresetRuntime
195
206
  } from "./chunk-2A3EQHXX.mjs";
@@ -257,7 +268,7 @@ __name(resolveHashedClientJsSrc, "resolveHashedClientJsSrc");
257
268
  // src/nitro/universal-build.ts
258
269
  import os from "os";
259
270
  import path6 from "path";
260
- import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync } from "fs";
271
+ import { constants as fsConstants, existsSync as existsSync2, readFileSync, realpathSync, statSync } from "fs";
261
272
  import { fileURLToPath } from "url";
262
273
  import { builtinModules, createRequire } from "module";
263
274
  import { isDeepStrictEqual } from "util";
@@ -749,15 +760,32 @@ function createFarmNetlifyEntry(options) {
749
760
  import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
750
761
 
751
762
  const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
763
+ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
764
+ // What Nitro's entry sets when the response has no Cache-Control of its own.
765
+ const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
766
+
767
+ function isSharedCacheable(request, response) {
768
+ return (
769
+ response.status === 200 &&
770
+ !request.headers.has("cookie") &&
771
+ !request.headers.has("authorization") &&
772
+ !response.headers.has("set-cookie") &&
773
+ !PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
774
+ !CREDENTIAL_VARY.test(response.headers.get("vary") || "")
775
+ );
776
+ }
752
777
 
753
778
  export default async function farmNetlifyHandler(request, context) {
754
779
  const response = await nitroNetlifyHandler(request, context);
755
780
  if (
756
781
  response &&
757
782
  response.headers.has("netlify-cdn-cache-control") &&
758
- PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "")
783
+ !isSharedCacheable(request, response)
759
784
  ) {
760
785
  response.headers.delete("netlify-cdn-cache-control");
786
+ if (response.headers.get("cache-control") === NITRO_DEFAULT_CACHE_CONTROL) {
787
+ response.headers.set("cache-control", "private, no-store");
788
+ }
761
789
  }
762
790
  return response;
763
791
  }
@@ -766,10 +794,14 @@ export default async function farmNetlifyHandler(request, context) {
766
794
  __name(createFarmNetlifyEntry, "createFarmNetlifyEntry");
767
795
 
768
796
  // src/nitro/node-server-entry.ts
797
+ var FARM_NODE_ENV_MODULE_FILE = "farm-node-env.mjs";
798
+ var FARM_NODE_ENV_MODULE_SOURCE = `if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
799
+ `;
769
800
  function createFarmNodeServerEntry(options) {
770
801
  const serverConfig = JSON.stringify(options.server);
771
802
  const nitroEntryImport = `./${options.nitroEntryFile.replace(/^\.\//, "")}`;
772
803
  return `
804
+ import "./${FARM_NODE_ENV_MODULE_FILE}";
773
805
  import "#nitro/virtual/polyfills";
774
806
  import { NodeRequest, serve } from ${JSON.stringify(options.nodeAdapterModule)};
775
807
  import wsAdapter from ${JSON.stringify(options.websocketAdapterModule)};
@@ -3160,15 +3192,17 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3160
3192
  const cssImport = existsSync2(globalsCssPath) ? `import ${JSON.stringify(toImportPath(globalsCssPath))};` : "";
3161
3193
  const layoutImportStatements = [];
3162
3194
  const layoutRegistrations = [];
3195
+ const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
3163
3196
  layoutRoutes.forEach((layout, index) => {
3164
3197
  const relativePath = toImportPath(layout.modulePath);
3165
- if (!layout.hasIsolatedClientBoundaries) {
3198
+ const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => layoutsCanCoverSamePage(layout.pattern, pattern));
3199
+ if (rendersOnClient) {
3166
3200
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3167
3201
  }
3168
3202
  const groupScope = getRouteGroupScope(layout.pattern);
3169
3203
  const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(stripRouteGroups(layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3170
3204
  layoutRegistrations.push(
3171
- ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3205
+ ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3172
3206
  );
3173
3207
  });
3174
3208
  const layoutImports = layoutImportStatements.join("\n");
@@ -4998,6 +5032,28 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4998
5032
  };
4999
5033
  }
5000
5034
  __name(buildSSRInMemory, "buildSSRInMemory");
5035
+ function readFarmAppPackageIdentity(root) {
5036
+ try {
5037
+ return JSON.parse(readFileSync(path6.join(root, "package.json"), "utf8"));
5038
+ } catch {
5039
+ return {};
5040
+ }
5041
+ }
5042
+ __name(readFarmAppPackageIdentity, "readFarmAppPackageIdentity");
5043
+ function readFarmPageLastModified(pageRoutes) {
5044
+ const lastModified = {};
5045
+ for (const route of pageRoutes) {
5046
+ if (route.pattern.includes("[")) continue;
5047
+ try {
5048
+ lastModified[route.pattern] = statSync(
5049
+ route.markdownSourcePath ?? route.modulePath
5050
+ ).mtime.toISOString();
5051
+ } catch {
5052
+ }
5053
+ }
5054
+ return lastModified;
5055
+ }
5056
+ __name(readFarmPageLastModified, "readFarmPageLastModified");
5001
5057
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5002
5058
  const llmsTxt = agent?.llmsTxt;
5003
5059
  const ownedByFile = /* @__PURE__ */ __name((kind) => applicationMetadataRoutes.some(
@@ -5006,7 +5062,7 @@ function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5006
5062
  return [
5007
5063
  ...llmsTxt?.enabled || ownedByFile("llms") ? ["/llms.txt"] : [],
5008
5064
  ...llmsTxt?.enabled && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
5009
- ...ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5065
+ ...agent?.sitemap?.enabled || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5010
5066
  ...agent?.crawlers?.enabled || ownedByFile("robots") ? ["/robots.txt"] : []
5011
5067
  ];
5012
5068
  }
@@ -5072,7 +5128,7 @@ function matchLocalIntegrationRequest(request) {
5072
5128
  });` : "return null;"}
5073
5129
  }
5074
5130
 
5075
- async function handleIntegrationRequest(request) {
5131
+ async function handleIntegrationRequest(request, ranMiddleware) {
5076
5132
  ${options.hasServerRuntimeIntegrations ? `return dispatchIntegrationRequests(
5077
5133
  serverRuntimeIntegrations,
5078
5134
  {
@@ -5081,6 +5137,7 @@ async function handleIntegrationRequest(request) {
5081
5137
  isProd: true,
5082
5138
  },
5083
5139
  request,
5140
+ { ranMiddleware },
5084
5141
  );` : `return { response: null, setCookies: [] };`}
5085
5142
  }
5086
5143
 
@@ -5361,6 +5418,10 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
5361
5418
  const servesAgentRobotsTxt = Boolean(config.agent?.crawlers?.enabled) && !applicationMetadataRoutes.some(
5362
5419
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5363
5420
  );
5421
+ const servesAgentSitemap = Boolean(config.agent?.sitemap?.enabled) && !applicationMetadataRoutes.some(
5422
+ (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
5423
+ );
5424
+ const servesDefaultMCP = config.agent?.mcp === true && !farmConfigMountsMCP(config) && !apiRoutes.some((route) => route.path === "/api/mcp");
5364
5425
  const servesAiCatalog = config.agent?.aiCatalog !== false;
5365
5426
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5366
5427
  const hasInfraAnalyticsRuntime = config.analytics !== false && resolveFarmInstrumentationRuntime(preset) === "nodejs";
@@ -5686,6 +5747,10 @@ function renderFarmRouteServerTree(element) { return element; }`;
5686
5747
  createFarmCacheKey,
5687
5748
  createFarmMetadataRouteResponse,
5688
5749
  createFarmAgentRobots,
5750
+ createFarmDefaultSitemap,
5751
+ collectFarmDefaultMCPPages,
5752
+ resolveFarmDefaultMCPServer,
5753
+ handleFarmDefaultMCPRequest,
5689
5754
  createFarmAiCatalogResponse,
5690
5755
  createFarmApiCatalogResponse,
5691
5756
  createFarmAppManifestResponse,
@@ -5762,7 +5827,7 @@ import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfig
5762
5827
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5763
5828
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5764
5829
  const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5765
- const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5830
+ const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5766
5831
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
5767
5832
  const mdxComponentsPath = typeof config.mdx?.components === "string" ? path6.isAbsolute(config.mdx.components) ? config.mdx.components : path6.join(config.root, config.mdx.components) : null;
5768
5833
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
@@ -6062,6 +6127,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
6062
6127
  );
6063
6128
  const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
6064
6129
  integrations: configuredIntegrations,
6130
+ ${JSON.stringify(FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))},
6065
6131
  });
6066
6132
  const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
6067
6133
  const configuredPlugins = [
@@ -6210,18 +6276,36 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
6210
6276
 
6211
6277
  // API routes bundled at build time
6212
6278
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
6213
- ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
6279
+ ]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
6280
+ // A plugin calling an app endpoint (an MCP tool, say) goes through the whole
6281
+ // pipeline, so the endpoint's middleware and integration guards run for it.
6282
+ function dispatchFarmPluginAPIRequest(request) {
6283
+ const url = new URL(request.url);
6284
+ url.pathname = applyFarmBasePath(url.pathname);
6285
+ return fetchFarmInnerRequest(url.href === request.url ? request : new Request(url, request));
6286
+ }
6287
+ // A request the app makes to itself (a Markdown page check, a plugin's endpoint call) enters
6288
+ // through this module's outer \`fetch\`, as a direct request does: plugin runtime hooks run and
6289
+ // it gets its own request context, so \`cookies()\` and \`headers()\` are its own, never the
6290
+ // caller's. It asks for an identity body: the caller reads it, and the outer response is
6291
+ // compressed once.
6292
+ function fetchFarmInnerRequest(request, context) {
6293
+ if (!request.headers.has("accept-encoding")) return fetch(request, context);
6294
+ const headers = new Headers(request.headers);
6295
+ headers.delete("accept-encoding");
6296
+ return fetch(new Request(request, { headers }), context);
6297
+ }
6214
6298
  const farmLocalAPIBasePath = ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))};
6215
6299
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6216
6300
  ${config.agent?.apiCatalog ? `const farmApiCatalogInput = ${JSON.stringify(resolveFarmApiCatalogInput(config))};
6217
- ` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
6301
+ ` : ""}${config.agent?.manifest !== false ? `const farmAppManifestInput = ${JSON.stringify(
6218
6302
  resolveFarmAppManifestInput(config, {
6219
6303
  build: config.deploymentId,
6220
6304
  packages: resolveFarmAppPackages(config.root),
6221
6305
  webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? collectFarmWebMCPTools(config.root, config.srcDir) : []
6222
6306
  })
6223
6307
  )};
6224
- ` : ""}
6308
+ ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}` : ""}
6225
6309
  function isFarmLocalAPIPathname(pathname) {
6226
6310
  return farmLocalAPIBasePath !== "/" &&
6227
6311
  (pathname === farmLocalAPIBasePath ||
@@ -6728,7 +6812,8 @@ function ensureFarmDocumentHead(markup) {
6728
6812
  }
6729
6813
 
6730
6814
  function ensureFarmDocumentRoot(markup) {
6731
- if (/\\sid=["']root["']/i.test(markup)) return markup;
6815
+ // Only a #root that opens the body is the container; page content can have id="root" too.
6816
+ if (/<body\\b[^>]*>\\s*<div\\b[^>]*\\sid=["']root["']/i.test(markup)) return markup;
6732
6817
  return markup
6733
6818
  .replace(/<body\\b([^>]*)>/i, function(_match, attributes) {
6734
6819
  return "<body" + attributes + '><div id="root">';
@@ -7107,7 +7192,7 @@ function createFarmAgentRobotsResponse(request) {
7107
7192
  "robots",
7108
7193
  createFarmAgentRobots({
7109
7194
  crawlers: farmAgentCrawlers,
7110
- sitemapPath: ${applicationMetadataRoutes.some(
7195
+ sitemapPath: ${servesAgentSitemap || applicationMetadataRoutes.some(
7111
7196
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
7112
7197
  ) ? JSON.stringify("/sitemap.xml") : "undefined"},
7113
7198
  metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
@@ -7120,6 +7205,70 @@ function createFarmAgentRobotsResponse(request) {
7120
7205
  );
7121
7206
  }
7122
7207
  ` : ""}
7208
+ ${servesAgentSitemap ? `// sitemap.xml from agent.sitemap, built the same way as in development. Each page's
7209
+ // lastmod is its file's modification time, read at build time.
7210
+ const farmAgentSitemapConfig = ${JSON.stringify(config.agent.sitemap)};
7211
+ const farmAgentSitemapLastModified = ${JSON.stringify(readFarmPageLastModified(pageRoutes))};
7212
+ function createFarmAgentSitemapResponse(request) {
7213
+ const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
7214
+ return createFarmMetadataRouteResponse(
7215
+ "sitemap",
7216
+ createFarmDefaultSitemap(
7217
+ pageRoutes.map((route) => ({
7218
+ pattern: route.pattern,
7219
+ module: route.module,
7220
+ lastModified: farmAgentSitemapLastModified[route.pattern],
7221
+ })),
7222
+ {
7223
+ origin: new URL(request.url).origin,
7224
+ config: farmAgentSitemapConfig,
7225
+ metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
7226
+ ? rootLayout.module.metadata.metadataBase
7227
+ : undefined,
7228
+ basePath: ${JSON.stringify(config.basePath)},
7229
+ },
7230
+ ),
7231
+ {},
7232
+ { method: request.method },
7233
+ );
7234
+ }
7235
+ ` : ""}
7236
+ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as in development. It steps
7237
+ // aside for a page route that answers /mcp and for any MCP server published or
7238
+ // registered at runtime, such as the docs engine's.
7239
+ const farmDefaultMCPServer = ${JSON.stringify(
7240
+ createFarmDefaultMCPServer(readFarmAppPackageIdentity(config.root), FARM_VERSION)
7241
+ )};
7242
+ let farmDefaultMCPRouteFree;
7243
+ function getFarmDefaultMCPServer() {
7244
+ if (farmDefaultMCPRouteFree === undefined) {
7245
+ farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(FARM_DEFAULT_MCP_PATH)});
7246
+ }
7247
+ return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
7248
+ }
7249
+ async function handleFarmDefaultMCP(request) {
7250
+ const origin = new URL(request.url).origin;
7251
+ return handleFarmDefaultMCPRequest(request, {
7252
+ server: getFarmDefaultMCPServer(),
7253
+ basePath: ${JSON.stringify(config.basePath)},
7254
+ listPages: () =>
7255
+ collectFarmDefaultMCPPages(
7256
+ pageRoutes.map((route) => ({ pattern: route.pattern, module: route.module })),
7257
+ { origin, basePath: ${JSON.stringify(config.basePath)}, markdown: farmMarkdownConfig },
7258
+ ),
7259
+ // A fresh request through this handler, so the caller's cookies never shape a page.
7260
+ // The handler sees paths below the base path, as the server passes them in.
7261
+ readMarkdown: (url) => {
7262
+ const page = new URL(url);
7263
+ page.pathname = stripFarmBasePath(page.pathname);
7264
+ return farmDefaultMCPReadMarkdown(page.href);
7265
+ },
7266
+ });
7267
+ }
7268
+ // \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
7269
+ // gets its own request context, as for a direct request.
7270
+ const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
7271
+ ` : ""}
7123
7272
  // Static pages and root metadata for llms.txt, built the same way as in development.
7124
7273
  function createFarmLlmsTxtContext(request, full) {
7125
7274
  const origin = new URL(request.url).origin;
@@ -7142,17 +7291,18 @@ function createFarmLlmsTxtContext(request, full) {
7142
7291
  rootMetadata: rootLayout && rootLayout.module && rootLayout.module.metadata,
7143
7292
  ${servesAiCatalog ? `mcp: listFarmMCPLlmsTxtLinks(origin, {
7144
7293
  basePath: ${JSON.stringify(config.basePath)},
7145
- apiServerBasePath: farmLocalAPIBasePath,
7294
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
7146
7295
  }),` : ""}
7147
7296
  }),
7148
- // llms-full.txt reads each page's .md mirror through this same handler,
7149
- // with a fresh request so the caller's cookies never shape its content.
7150
- // HEAD discards the body, so it reads nothing.
7297
+ // llms-full.txt reads each page's .md mirror through this module's outer
7298
+ // request entry, so plugin runtime hooks run and each read has a fresh request
7299
+ // context: the caller's cookies never shape its content. HEAD discards the
7300
+ // body, so it reads nothing.
7151
7301
  ...(full
7152
7302
  ? {
7153
7303
  markdown: request.method.toUpperCase() === "HEAD"
7154
7304
  ? async () => null
7155
- : createFarmLlmsMarkdownReader((page) => handleFarmRequest(page)),
7305
+ : createFarmLlmsMarkdownReader((page) => fetch(page)),
7156
7306
  }
7157
7307
  : {}),
7158
7308
  };
@@ -7823,7 +7973,11 @@ async function handleFarmRequestInContext(
7823
7973
  }
7824
7974
 
7825
7975
  ${hasServerRuntimeIntegrations ? `
7826
- const integrationDispatch = await handleIntegrationRequest(cloneFarmRequestWithContext(request));
7976
+ const farmIntegrationRanMiddleware = new Set();
7977
+ const integrationDispatch = await handleIntegrationRequest(
7978
+ cloneFarmRequestWithContext(request),
7979
+ farmIntegrationRanMiddleware,
7980
+ );
7827
7981
  if (integrationDispatch.response) {
7828
7982
  return integrationDispatch.response;
7829
7983
  }
@@ -7831,7 +7985,7 @@ async function handleFarmRequestInContext(
7831
7985
  // its rotated Set-Cookie values back here. They belong on whatever response
7832
7986
  // the page or API handler produces, so they ride the same deferred-header
7833
7987
  // channel the file middleware runner already uses.
7834
- const farmIntegrationSetCookies = integrationDispatch.setCookies;
7988
+ let farmIntegrationSetCookies = integrationDispatch.setCookies;
7835
7989
  ` : ""}
7836
7990
 
7837
7991
  ${hasMiddlewareRuntime ? `
@@ -7842,7 +7996,23 @@ async function handleFarmRequestInContext(
7842
7996
  if (middlewareResult.response) {
7843
7997
  return middlewareResult.response;
7844
7998
  }
7845
- request = middlewareResult.request;
7999
+ request = middlewareResult.request;${hasServerRuntimeIntegrations ? `
8000
+ // A ctx.rewrite() target is guarded as a direct request for it is: integration
8001
+ // guards (protectedRoutes) and routes see the rewritten URL, as in dev. Guards
8002
+ // that already ran for the original URL are skipped, so each runs once.
8003
+ if (request.url !== url.href) {
8004
+ const rewrittenDispatch = await handleIntegrationRequest(
8005
+ cloneFarmRequestWithContext(request),
8006
+ farmIntegrationRanMiddleware,
8007
+ );
8008
+ farmIntegrationSetCookies = [...farmIntegrationSetCookies, ...rewrittenDispatch.setCookies];
8009
+ if (rewrittenDispatch.response) {
8010
+ return applyProductionMiddlewareHeaders(
8011
+ rewrittenDispatch.response,
8012
+ withFarmIntegrationSetCookies(middlewareResult.headers, integrationDispatch.setCookies),
8013
+ );
8014
+ }
8015
+ }` : ""}
7846
8016
  const middlewareData = middlewareResult.data;
7847
8017
  const middlewareContext = middlewareResult.context;
7848
8018
  const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(middlewareResult.headers, farmIntegrationSetCookies)" : "middlewareResult.headers"};
@@ -7871,7 +8041,10 @@ async function handleFarmRequestInContext(
7871
8041
  // API routes, as in dev.
7872
8042
  const farmAiCatalogResponse = createFarmAiCatalogResponse(
7873
8043
  request,
7874
- { basePath: ${JSON.stringify(config.basePath)}, apiServerBasePath: farmLocalAPIBasePath },
8044
+ {
8045
+ basePath: ${JSON.stringify(config.basePath)},
8046
+ apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
8047
+ },
7875
8048
  url,
7876
8049
  );
7877
8050
  if (farmAiCatalogResponse) {
@@ -7919,7 +8092,13 @@ async function handleFarmRequestInContext(
7919
8092
  const match = matchPageRoute(getFarmRoutePathname(targetPathname));
7920
8093
  return match?.route?.markdownSource || null;
7921
8094
  },
7922
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8095
+ clientAddress: adapterContext?.clientAddress,
8096
+ // An anonymous visitor's request: guards never see the caller's address.
8097
+ renderPage: (targetRequest) =>
8098
+ fetchFarmInnerRequest(targetRequest, {
8099
+ ...adapterContext,
8100
+ clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
8101
+ }),
7923
8102
  });
7924
8103
  if (markdownSourceResponse) {
7925
8104
  return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
@@ -7939,7 +8118,7 @@ async function handleFarmRequestInContext(
7939
8118
  config: farmMarkdownConfig,
7940
8119
  routeExists: (targetPathname) =>
7941
8120
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
7942
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8121
+ renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
7943
8122
  apiServerBasePath: farmLocalAPIBasePath,
7944
8123
  });
7945
8124
  if (markdownResponse) {
@@ -8027,15 +8206,18 @@ async function handleFarmRequestInContext(
8027
8206
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
8028
8207
  }
8029
8208
  ` : ""}
8030
- ${config.analytics !== false ? `
8031
- // /.well-known/farmjs: the app's manifest, only for a request Farm Infra signed.
8032
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(FARM_APP_MANIFEST_PATH)}) {
8033
- const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
8034
- development: false,
8035
- });
8036
- if (farmAppManifest) {
8037
- return applyProductionMiddlewareHeaders(farmAppManifest, middlewareHeaders);
8038
- }
8209
+ ${config.agent?.manifest !== false ? `
8210
+ // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
8211
+ // public manifest; Farm Infra's signed request gets the full view.
8212
+ if (
8213
+ [${JSON.stringify(FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
8214
+ normalizeRuntimePath(routePathname),
8215
+ )
8216
+ ) {
8217
+ return applyProductionMiddlewareHeaders(
8218
+ await createFarmAppManifestResponse(request, farmAppManifestInput),
8219
+ middlewareHeaders,
8220
+ );
8039
8221
  }
8040
8222
  ` : ""}
8041
8223
  ${config.agent?.apiCatalog ? `
@@ -8056,6 +8238,15 @@ async function handleFarmRequestInContext(
8056
8238
  );
8057
8239
  }
8058
8240
  ` : ""}
8241
+ ${servesAgentSitemap ? `
8242
+ // agent.sitemap with no sitemap.ts: serve the generated file.
8243
+ if (normalizeRuntimePath(routePathname) === "/sitemap.xml") {
8244
+ return applyProductionMiddlewareHeaders(
8245
+ createFarmAgentSitemapResponse(request),
8246
+ middlewareHeaders,
8247
+ );
8248
+ }
8249
+ ` : ""}
8059
8250
  ${config.agent?.llmsTxt?.enabled ? `
8060
8251
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
8061
8252
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
@@ -8989,6 +9180,18 @@ async function handleFarmRequestInContext(
8989
9180
  }
8990
9181
  }
8991
9182
 
9183
+ ${servesDefaultMCP ? `
9184
+ // agent.mcp: no app route answered /mcp, so the default read-only server may.
9185
+ if (
9186
+ normalizeRuntimePath(routePathname) === ${JSON.stringify(FARM_DEFAULT_MCP_PATH)} &&
9187
+ getFarmDefaultMCPServer()
9188
+ ) {
9189
+ return applyProductionMiddlewareHeaders(
9190
+ await handleFarmDefaultMCP(request),
9191
+ middlewareHeaders,
9192
+ );
9193
+ }
9194
+ ` : ""}
8992
9195
  // 404 fallback - render proper HTML page
8993
9196
  return renderFarmNotFoundResponse();
8994
9197
 
@@ -9665,6 +9868,10 @@ function toFarmNodeResponse(request, response) {
9665
9868
  await fs.writeFile(nitroEntryPath, nitroEntryCode);
9666
9869
  const farmNodeServerEntryPath = preset === "node-server" ? path6.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
9667
9870
  if (farmNodeServerEntryPath && nodeAdapterModule) {
9871
+ await fs.writeFile(
9872
+ path6.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
9873
+ FARM_NODE_ENV_MODULE_SOURCE
9874
+ );
9668
9875
  await fs.writeFile(
9669
9876
  farmNodeServerEntryPath,
9670
9877
  createFarmNodeServerEntry({
@@ -10409,6 +10616,30 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs) {
10409
10616
  }
10410
10617
  __name(copyPrismaClientForVercel, "copyPrismaClientForVercel");
10411
10618
 
10619
+ // src/build/project-module-runner.ts
10620
+ async function createFarmProjectModuleSsrEnvironment() {
10621
+ const vite = await import("vite");
10622
+ const { ModuleRunner, createNodeImportMeta } = await import("vite/module-runner");
10623
+ return {
10624
+ dev: {
10625
+ createEnvironment(name, config) {
10626
+ return vite.createRunnableDevEnvironment(name, config, {
10627
+ runner: /* @__PURE__ */ __name((environment) => new ModuleRunner({
10628
+ transport: {
10629
+ ...vite.createServerModuleRunnerTransport({ channel: environment.hot }),
10630
+ timeout: 0
10631
+ },
10632
+ hmr: false,
10633
+ createImportMeta: createNodeImportMeta,
10634
+ sourcemapInterceptor: "node"
10635
+ }), "runner")
10636
+ });
10637
+ }
10638
+ }
10639
+ };
10640
+ }
10641
+ __name(createFarmProjectModuleSsrEnvironment, "createFarmProjectModuleSsrEnvironment");
10642
+
10412
10643
  // src/build/index.ts
10413
10644
  async function build(config, options = {}) {
10414
10645
  return withProductionNodeEnv(() => buildWithProductionNodeEnv(config, options));
@@ -10669,6 +10900,14 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10669
10900
  optimizeDeps: {
10670
10901
  ...viteConfig.optimizeDeps,
10671
10902
  noDiscovery: true
10903
+ },
10904
+ // An app or plugin that brings its own SSR environment keeps it.
10905
+ environments: viteConfig.environments?.ssr?.dev?.createEnvironment ? viteConfig.environments : {
10906
+ ...viteConfig.environments,
10907
+ ssr: {
10908
+ ...viteConfig.environments?.ssr,
10909
+ ...await createFarmProjectModuleSsrEnvironment()
10910
+ }
10672
10911
  }
10673
10912
  });
10674
10913
  }
@@ -10746,7 +10985,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10746
10985
  __name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
10747
10986
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10748
10987
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10749
- import("./nitro-MXRDCXWZ.mjs"),
10988
+ import("./nitro-MPZJGPXK.mjs"),
10750
10989
  import("nitro/builder")
10751
10990
  ]);
10752
10991
  let nitroConfig = await createNitroConfig(