@farm.js/core 0.1.34 → 0.1.36

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 (282) hide show
  1. package/dist/agent-mcp-BVExL8rZ.d.mts +109 -0
  2. package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
  3. package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
  4. package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
  5. package/dist/agent-runtime.cjs +5 -3
  6. package/dist/agent-runtime.d.mts +4 -5
  7. package/dist/agent-runtime.d.ts +4 -5
  8. package/dist/agent-runtime.mjs +4 -2
  9. package/dist/api/route-manager.cjs +7 -7
  10. package/dist/api/route-manager.d.mts +15 -10
  11. package/dist/api/route-manager.d.ts +15 -10
  12. package/dist/api/route-manager.mjs +6 -6
  13. package/dist/api/runtime.cjs +7 -5
  14. package/dist/api/runtime.d.mts +7 -66
  15. package/dist/api/runtime.d.ts +7 -66
  16. package/dist/api/runtime.mjs +7 -5
  17. package/dist/api.cjs +9 -9
  18. package/dist/api.d.mts +8 -9
  19. package/dist/api.d.ts +8 -9
  20. package/dist/api.mjs +8 -8
  21. package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
  22. package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
  23. package/dist/app-markdown.cjs +6 -6
  24. package/dist/app-markdown.d.mts +5 -6
  25. package/dist/app-markdown.d.ts +5 -6
  26. package/dist/app-markdown.mjs +5 -5
  27. package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
  28. package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
  29. package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
  30. package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
  31. package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
  32. package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
  33. package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
  34. package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
  35. package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
  36. package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
  37. package/dist/chunk-4WQ6PGSJ.cjs +367 -0
  38. package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
  39. package/dist/chunk-6SJ2KJTA.mjs +314 -0
  40. package/dist/chunk-75RZHGLS.cjs +135 -0
  41. package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
  42. package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
  43. package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
  44. package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
  45. package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
  46. package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
  47. package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
  48. package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
  49. package/dist/chunk-CI6E3UOH.cjs +314 -0
  50. package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
  51. package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
  52. package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
  53. package/dist/chunk-DTSROJ5J.mjs +367 -0
  54. package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
  55. package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
  56. package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
  57. package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
  58. package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
  59. package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
  60. package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
  61. package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
  62. package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
  63. package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
  64. package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
  65. package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
  66. package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
  67. package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
  68. package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
  69. package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
  70. package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
  71. package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
  72. package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
  73. package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
  74. package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
  75. package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
  76. package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
  77. package/dist/chunk-NRDBW4MP.mjs +45 -0
  78. package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
  79. package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
  80. package/dist/chunk-OFZUJMCU.mjs +601 -0
  81. package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
  82. package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
  83. package/dist/chunk-PTZ2TVNE.cjs +178 -0
  84. package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
  85. package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
  86. package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
  87. package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
  88. package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
  89. package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
  90. package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
  91. package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
  92. package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
  93. package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
  94. package/dist/chunk-UH6QN5NL.mjs +178 -0
  95. package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
  96. package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
  97. package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
  98. package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
  99. package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
  100. package/dist/chunk-WWFTAUFG.cjs +45 -0
  101. package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
  102. package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
  103. package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
  104. package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
  105. package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
  106. package/dist/chunk-YSLWRWWP.cjs +601 -0
  107. package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
  108. package/dist/chunk-ZLAT2CWY.mjs +135 -0
  109. package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
  110. package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
  111. package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
  112. package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
  113. package/dist/client-plugins.d.mts +4 -5
  114. package/dist/client-plugins.d.ts +4 -5
  115. package/dist/client.cjs +5 -5
  116. package/dist/client.d.mts +8 -9
  117. package/dist/client.d.ts +8 -9
  118. package/dist/client.mjs +4 -4
  119. package/dist/config.d.mts +4 -5
  120. package/dist/config.d.ts +4 -5
  121. package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
  122. package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
  123. package/dist/docs.cjs +15 -14
  124. package/dist/docs.d.mts +41 -4
  125. package/dist/docs.d.ts +41 -4
  126. package/dist/docs.mjs +14 -13
  127. package/dist/i18n/client.d.mts +2 -2
  128. package/dist/i18n/client.d.ts +2 -2
  129. package/dist/i18n/index.d.mts +3 -3
  130. package/dist/i18n/index.d.ts +3 -3
  131. package/dist/i18n/server.d.mts +5 -5
  132. package/dist/i18n/server.d.ts +5 -5
  133. package/dist/image/server.cjs +3 -3
  134. package/dist/image/server.mjs +2 -2
  135. package/dist/image/sharp.cjs +10 -10
  136. package/dist/image/sharp.mjs +2 -2
  137. package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
  138. package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
  139. package/dist/index.cjs +51 -44
  140. package/dist/index.d.mts +20 -21
  141. package/dist/index.d.ts +20 -21
  142. package/dist/index.mjs +50 -43
  143. package/dist/integrations.cjs +7 -3
  144. package/dist/integrations.d.mts +4 -5
  145. package/dist/integrations.d.ts +4 -5
  146. package/dist/integrations.mjs +6 -2
  147. package/dist/internal/app-markdown-runtime.cjs +5 -5
  148. package/dist/internal/app-markdown-runtime.d.mts +5 -6
  149. package/dist/internal/app-markdown-runtime.d.ts +5 -6
  150. package/dist/internal/app-markdown-runtime.mjs +4 -4
  151. package/dist/internal/build-runtime.cjs +32 -30
  152. package/dist/internal/build-runtime.d.mts +6 -7
  153. package/dist/internal/build-runtime.d.ts +6 -7
  154. package/dist/internal/build-runtime.mjs +31 -29
  155. package/dist/internal/cli-runtime.cjs +17 -16
  156. package/dist/internal/cli-runtime.mjs +16 -15
  157. package/dist/internal/client-error-overlay.cjs +6 -6
  158. package/dist/internal/client-error-overlay.mjs +2 -2
  159. package/dist/internal/client-runtime.cjs +2 -2
  160. package/dist/internal/client-runtime.mjs +1 -1
  161. package/dist/internal/compression-runtime.d.mts +4 -5
  162. package/dist/internal/compression-runtime.d.ts +4 -5
  163. package/dist/internal/config-runtime.cjs +12 -11
  164. package/dist/internal/config-runtime.d.mts +5 -6
  165. package/dist/internal/config-runtime.d.ts +5 -6
  166. package/dist/internal/config-runtime.mjs +11 -10
  167. package/dist/internal/isolated-boundary.cjs +3 -2
  168. package/dist/internal/isolated-boundary.d.mts +1 -1
  169. package/dist/internal/isolated-boundary.d.ts +1 -1
  170. package/dist/internal/isolated-boundary.mjs +2 -1
  171. package/dist/internal/metadata-image-runtime.cjs +3 -3
  172. package/dist/internal/metadata-image-runtime.mjs +2 -2
  173. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  174. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  175. package/dist/internal/production-runtime.cjs +63 -25
  176. package/dist/internal/production-runtime.d.mts +117 -37
  177. package/dist/internal/production-runtime.d.ts +117 -37
  178. package/dist/internal/production-runtime.mjs +65 -27
  179. package/dist/internal/server-tree.cjs +12 -0
  180. package/dist/internal/server-tree.d.mts +27 -0
  181. package/dist/internal/server-tree.d.ts +27 -0
  182. package/dist/internal/server-tree.mjs +12 -0
  183. package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
  184. package/dist/layers-VUWIOFEO.cjs +18 -0
  185. package/dist/markdown.cjs +4 -4
  186. package/dist/markdown.d.mts +4 -5
  187. package/dist/markdown.d.ts +4 -5
  188. package/dist/markdown.mjs +3 -3
  189. package/dist/middleware.cjs +7 -7
  190. package/dist/middleware.d.mts +6 -7
  191. package/dist/middleware.d.ts +6 -7
  192. package/dist/middleware.mjs +6 -6
  193. package/dist/navigation.cjs +5 -5
  194. package/dist/navigation.d.mts +7 -8
  195. package/dist/navigation.d.ts +7 -8
  196. package/dist/navigation.mjs +4 -4
  197. package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
  198. package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
  199. package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
  200. package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
  201. package/dist/observability.d.mts +1 -1
  202. package/dist/observability.d.ts +1 -1
  203. package/dist/plugin.cjs +28 -26
  204. package/dist/plugin.d.mts +4 -5
  205. package/dist/plugin.d.ts +4 -5
  206. package/dist/plugin.mjs +27 -25
  207. package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
  208. package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
  209. package/dist/query/client.cjs +6 -6
  210. package/dist/query/client.mjs +2 -2
  211. package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
  212. package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
  213. package/dist/renderer/react/server.cjs +10 -4
  214. package/dist/renderer/react/server.d.mts +2 -1
  215. package/dist/renderer/react/server.d.ts +2 -1
  216. package/dist/renderer/react/server.mjs +7 -1
  217. package/dist/renderer-client.cjs +5 -5
  218. package/dist/renderer-client.d.mts +6 -7
  219. package/dist/renderer-client.d.ts +6 -7
  220. package/dist/renderer-client.mjs +2 -2
  221. package/dist/renderer.d.mts +2 -0
  222. package/dist/renderer.d.ts +2 -0
  223. package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
  224. package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
  225. package/dist/request.d.mts +5 -6
  226. package/dist/request.d.ts +5 -6
  227. package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
  228. package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
  229. package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
  230. package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
  231. package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
  232. package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
  233. package/dist/routes.d.mts +4 -5
  234. package/dist/routes.d.ts +4 -5
  235. package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
  236. package/dist/runtime-CAEv36S_.d.mts +69 -0
  237. package/dist/runtime-CQVsT330.d.ts +69 -0
  238. package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
  239. package/dist/server-action-security.cjs +3 -3
  240. package/dist/server-action-security.mjs +2 -2
  241. package/dist/server-fn.cjs +4 -4
  242. package/dist/server-fn.mjs +3 -3
  243. package/dist/server-plugins.d.mts +5 -6
  244. package/dist/server-plugins.d.ts +5 -6
  245. package/dist/server-query.cjs +5 -5
  246. package/dist/server-query.mjs +4 -4
  247. package/dist/server.cjs +47 -45
  248. package/dist/server.d.mts +13 -14
  249. package/dist/server.d.ts +13 -14
  250. package/dist/server.mjs +30 -28
  251. package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
  252. package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
  253. package/dist/testing.cjs +9 -9
  254. package/dist/testing.d.mts +4 -5
  255. package/dist/testing.d.ts +4 -5
  256. package/dist/testing.mjs +7 -7
  257. package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
  258. package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
  259. package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
  260. package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
  261. package/dist/version.cjs +2 -2
  262. package/dist/version.mjs +1 -1
  263. package/dist/vite.cjs +28 -26
  264. package/dist/vite.d.mts +4 -5
  265. package/dist/vite.d.ts +4 -5
  266. package/dist/vite.mjs +27 -25
  267. package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
  268. package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
  269. package/dist/workflows.cjs +3 -3
  270. package/dist/workflows.d.mts +1 -1
  271. package/dist/workflows.d.ts +1 -1
  272. package/dist/workflows.mjs +2 -2
  273. package/package.json +9 -1
  274. package/dist/chunk-M64YUMA4.cjs +0 -58
  275. package/dist/chunk-QLQ32WC4.mjs +0 -58
  276. package/dist/layers-4PNE2HOY.cjs +0 -18
  277. package/dist/metadata-2HSU2i_w.d.mts +0 -52
  278. package/dist/metadata-Cjs8JMRM.d.ts +0 -52
  279. package/dist/types-DFbjpjXX.d.mts +0 -105
  280. package/dist/types-DFbjpjXX.d.ts +0 -105
  281. package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
  282. package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
@@ -1,9 +1,12 @@
1
+ import {
2
+ FARM_DEFAULT_MCP_TOOLS
3
+ } from "./chunk-UH6QN5NL.mjs";
1
4
  import {
2
5
  DEFAULT_ERROR_STYLES
3
6
  } from "./chunk-XAXTTBUT.mjs";
4
7
  import {
5
8
  serializeFarmLlmsTxt
6
- } from "./chunk-NGVORZVZ.mjs";
9
+ } from "./chunk-DTSROJ5J.mjs";
7
10
  import {
8
11
  emitFarmAgentRead
9
12
  } from "./chunk-MVL2RAJW.mjs";
@@ -14,15 +17,20 @@ import {
14
17
  omitFarmResponseBody
15
18
  } from "./chunk-5WI2S4CO.mjs";
16
19
  import {
17
- _listFarmMCPCatalogs
18
- } from "./chunk-QLQ32WC4.mjs";
20
+ _listFarmMCPCatalogs,
21
+ _listFarmRegisteredMCPServers
22
+ } from "./chunk-ZLAT2CWY.mjs";
23
+ import {
24
+ createFarmWeakETag,
25
+ matchesFarmIfNoneMatch
26
+ } from "./chunk-ZMMBIVQM.mjs";
19
27
  import {
20
28
  resolveFarmAPIServerBasePath,
21
29
  resolveFarmAPIServerRoutePath
22
30
  } from "./chunk-BTHHUD7Q.mjs";
23
31
  import {
24
32
  FARM_VERSION
25
- } from "./chunk-X242HVD5.mjs";
33
+ } from "./chunk-OO7GXVSR.mjs";
26
34
  import {
27
35
  localizeFarmPathname
28
36
  } from "./chunk-L3KT7IXV.mjs";
@@ -33,6 +41,184 @@ import {
33
41
  __name
34
42
  } from "./chunk-LPEX4YW6.mjs";
35
43
 
44
+ // src/routing/route-groups.ts
45
+ function isRouteGroupSegment(part) {
46
+ return part.startsWith("(") && part.endsWith(")");
47
+ }
48
+ __name(isRouteGroupSegment, "isRouteGroupSegment");
49
+ function formatRouteSegment(segment) {
50
+ if (!segment.isDynamic) return segment.segment;
51
+ if (segment.isCatchAll) {
52
+ return segment.isOptional ? `[[...${segment.segment}]]` : `[...${segment.segment}]`;
53
+ }
54
+ return `[${segment.segment}]`;
55
+ }
56
+ __name(formatRouteSegment, "formatRouteSegment");
57
+ function createRouteDirectoryPattern(route) {
58
+ const parts = route.filePath.replace(/\\/g, "/").split("/").filter(Boolean);
59
+ parts.pop();
60
+ if (parts.length === 0) return "/";
61
+ let segmentIndex = 0;
62
+ const directory = parts.map((part) => {
63
+ if (isRouteGroupSegment(part)) return part;
64
+ const segment = route.segments[segmentIndex++];
65
+ return segment ? formatRouteSegment(segment) : part;
66
+ });
67
+ return `/${directory.join("/")}`;
68
+ }
69
+ __name(createRouteDirectoryPattern, "createRouteDirectoryPattern");
70
+ function stripRouteGroups(pattern) {
71
+ if (!pattern.includes("(")) return pattern;
72
+ const parts = pattern.split("/").filter((part) => part && !isRouteGroupSegment(part));
73
+ return parts.length === 0 ? "/" : `/${parts.join("/")}`;
74
+ }
75
+ __name(stripRouteGroups, "stripRouteGroups");
76
+ function getRouteGroupScope(pattern) {
77
+ if (!pattern.includes("(")) return null;
78
+ const parts = pattern.split("/");
79
+ for (let index = parts.length - 1; index > 0; index--) {
80
+ if (isRouteGroupSegment(parts[index])) return parts.slice(0, index + 1).join("/");
81
+ }
82
+ return null;
83
+ }
84
+ __name(getRouteGroupScope, "getRouteGroupScope");
85
+ function isInRouteGroupScope(directory, scope) {
86
+ if (scope === null) return true;
87
+ if (typeof directory !== "string") return false;
88
+ return directory === scope || directory.startsWith(`${scope}/`);
89
+ }
90
+ __name(isInRouteGroupScope, "isInRouteGroupScope");
91
+ function getRouteDirectoryDepth(pattern) {
92
+ return pattern.split("/").filter(Boolean).length;
93
+ }
94
+ __name(getRouteDirectoryDepth, "getRouteDirectoryDepth");
95
+ function routeBoundaryCoversDirectory(boundaryPattern, directory) {
96
+ const boundaryUrl = stripRouteGroups(boundaryPattern);
97
+ const routeUrl = stripRouteGroups(directory);
98
+ return (boundaryUrl === "/" || routeUrl === boundaryUrl || routeUrl.startsWith(`${boundaryUrl.replace(/\/$/, "")}/`)) && isInRouteGroupScope(directory, getRouteGroupScope(boundaryPattern));
99
+ }
100
+ __name(routeBoundaryCoversDirectory, "routeBoundaryCoversDirectory");
101
+
102
+ // src/server/full-document.ts
103
+ var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
104
+ var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>|<script\b[^>]*\basync\b[^>]*><\/script>|<style\b[^>]*\bdata-precedence\b[^>]*>[\s\S]*?<\/style>)/i;
105
+ function peelDocumentPrefix(markup) {
106
+ let inner = markup.replace(/^\s+/, "");
107
+ let hoisted = "";
108
+ let match;
109
+ while (match = CONTENTS_WRAPPER.exec(inner) ?? HOISTED_HEAD_ELEMENT.exec(inner)) {
110
+ if (!/^<div/i.test(match[0])) hoisted += match[0];
111
+ inner = inner.slice(match[0].length).replace(/^\s+/, "");
112
+ }
113
+ return { inner, hoisted };
114
+ }
115
+ __name(peelDocumentPrefix, "peelDocumentPrefix");
116
+ function restoreHoistedHead(document, hoisted) {
117
+ if (!hoisted) return document;
118
+ if (/<head[\s>]/i.test(document)) {
119
+ return document.replace(/<head\b[^>]*>/i, (open) => open + hoisted);
120
+ }
121
+ return document.replace(/<html\b[^>]*>/i, (open) => `${open}<head>${hoisted}</head>`);
122
+ }
123
+ __name(restoreHoistedHead, "restoreHoistedHead");
124
+ function extractFarmFullDocument(markup) {
125
+ const { inner, hoisted } = peelDocumentPrefix(markup);
126
+ if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
127
+ const start = markup.search(/<!doctype|<html[\s>]/i);
128
+ const lower = markup.toLowerCase();
129
+ let closeIndex = lower.lastIndexOf("</html>");
130
+ if (lower.length !== markup.length) {
131
+ closeIndex = -1;
132
+ const closing = /<\/html>/gi;
133
+ let match;
134
+ while (match = closing.exec(markup)) closeIndex = match.index;
135
+ }
136
+ if (start < 0 || closeIndex < 0) return null;
137
+ const closeEnd = closeIndex + "</html>".length;
138
+ let document = markup.slice(start, closeEnd);
139
+ const streamedTail = markup.slice(closeEnd).replace(/^(?:\s*<\/div>)+/i, "").trim();
140
+ if (streamedTail) {
141
+ document = document.replace(/<\/body>/i, () => `${streamedTail}</body>`);
142
+ }
143
+ return restoreHoistedHead(document, hoisted);
144
+ }
145
+ __name(extractFarmFullDocument, "extractFarmFullDocument");
146
+ function classifyFarmDocumentPrefix(markup) {
147
+ const { inner } = peelDocumentPrefix(markup);
148
+ if (/^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner)) return "document";
149
+ return inner === "" ? "pending" : "fragment";
150
+ }
151
+ __name(classifyFarmDocumentPrefix, "classifyFarmDocumentPrefix");
152
+ function ensureFarmDocumentHead(markup) {
153
+ if (/<head[\s>]/i.test(markup)) return markup;
154
+ return markup.replace(/<html([^>]*)>/i, (_match, attributes) => {
155
+ return `<html${attributes}><head></head>`;
156
+ });
157
+ }
158
+ __name(ensureFarmDocumentHead, "ensureFarmDocumentHead");
159
+ function ensureFarmDocumentRoot(markup) {
160
+ if (/<body\b[^>]*>\s*<div\b[^>]*\sid=["']root["']/i.test(markup)) return markup;
161
+ return markup.replace(
162
+ /<body\b([^>]*)>/i,
163
+ (_match, attributes) => `<body${attributes}><div id="root">`
164
+ ).replace(/<\/body>/i, () => "</div></body>");
165
+ }
166
+ __name(ensureFarmDocumentRoot, "ensureFarmDocumentRoot");
167
+ function hasFarmDocumentIcon(markup) {
168
+ return /<link\b[^>]*\brel=["']?(?:shortcut )?icon\b/i.test(markup);
169
+ }
170
+ __name(hasFarmDocumentIcon, "hasFarmDocumentIcon");
171
+ function removeFarmDocumentTitles(markup) {
172
+ return markup.replace(/<title\b[^>]*>[\s\S]*?<\/title>\s*/gi, "");
173
+ }
174
+ __name(removeFarmDocumentTitles, "removeFarmDocumentTitles");
175
+ function ensureFarmDocumentMeta(markup, viewport = "") {
176
+ const head = /<head\b[^>]*>([\s\S]*?)<\/head>/i.exec(markup)?.[1] ?? "";
177
+ const hasNamedMeta = /* @__PURE__ */ __name((name) => new RegExp(`<meta\\b[^>]*\\bname=["']?${name}(?=["'\\s/>])`, "i").test(head), "hasNamedMeta");
178
+ const tags = [
179
+ /<meta\b[^>]*\bcharset\s*=/i.test(head) ? "" : '<meta charset="utf-8">',
180
+ ...(viewport.match(/<meta\b[^>]*>/gi) ?? []).filter((tag) => {
181
+ const name = /\bname="([\w-]+)"/.exec(tag)?.[1];
182
+ return !name || !hasNamedMeta(name);
183
+ })
184
+ ].filter(Boolean);
185
+ if (tags.length === 0) return markup;
186
+ return markup.replace(/<head\b[^>]*>/i, (open) => `${open}${tags.join("")}`);
187
+ }
188
+ __name(ensureFarmDocumentMeta, "ensureFarmDocumentMeta");
189
+ function composeFarmFullDocument(documentHtml, assets) {
190
+ let html = ensureFarmDocumentMeta(ensureFarmDocumentHead(documentHtml), assets.viewport);
191
+ if (assets.htmlAttributes) {
192
+ html = html.replace(/<html\b([^>]*)>/i, (_match, attrs) => {
193
+ let nextAttributes = attrs;
194
+ for (const name of assets.replaceHtmlAttributes ?? []) {
195
+ const escapedName = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
196
+ nextAttributes = nextAttributes.replace(
197
+ new RegExp("\\s+" + escapedName + `=(?:"[^"]*"|'[^']*'|[^\\s>]+)`, "gi"),
198
+ ""
199
+ );
200
+ }
201
+ return `<html${nextAttributes}${assets.htmlAttributes}>`;
202
+ });
203
+ }
204
+ html = ensureFarmDocumentRoot(html);
205
+ const headAssets = [
206
+ assets.fallbackIcon && !hasFarmDocumentIcon(html) ? '<link rel="icon" href="data:,">' : "",
207
+ assets.headAssets
208
+ ].filter(Boolean).join("\n ");
209
+ if (headAssets) {
210
+ html = html.replace(/<\/head>/i, () => ` ${headAssets}
211
+ </head>`);
212
+ }
213
+ if (assets.bodyFooter) {
214
+ html = html.replace(/<\/body>/i, () => ` ${assets.bodyFooter}
215
+ </body>`);
216
+ }
217
+ return /^\s*<!doctype/i.test(html) ? html : `<!DOCTYPE html>
218
+ ${html}`;
219
+ }
220
+ __name(composeFarmFullDocument, "composeFarmFullDocument");
221
+
36
222
  // src/i18n/alternates.ts
37
223
  function renderFarmLocaleAlternateLinks(pathname, config, options = {}) {
38
224
  if (config.routing === "none") return "";
@@ -228,6 +414,169 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
228
414
  }
229
415
  __name(createFarmMetadataRouteResponse, "createFarmMetadataRouteResponse");
230
416
 
417
+ // src/ai-catalog.ts
418
+ var FARM_AI_CATALOG_PATH = "/.well-known/ai-catalog.json";
419
+ var FARM_ARD_PATH = "/.well-known/ard.json";
420
+ var FARM_MCP_SERVER_CARD_SUFFIX = "/server-card";
421
+ var SERVER_CARD_SCHEMA = "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
422
+ var SERVER_CARD_TYPE = "application/mcp-server-card+json";
423
+ var AI_CATALOG_TYPE = "application/ai-catalog+json";
424
+ var CARD_DESCRIPTION_MAX = 100;
425
+ var REVERSE_DNS_NAME = /^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/;
426
+ function listFarmMCPServerSources(input) {
427
+ const sources = /* @__PURE__ */ new Map();
428
+ for (const { server, details } of _listFarmMCPCatalogs()) {
429
+ const endpoint = resolveFarmAPIServerRoutePath(server.path, input.apiServerBasePath);
430
+ if (sources.has(endpoint)) continue;
431
+ sources.set(endpoint, {
432
+ ...server,
433
+ protocolVersions: details?.protocolVersions,
434
+ endpoint,
435
+ local: true
436
+ });
437
+ }
438
+ for (const server of _listFarmRegisteredMCPServers()) {
439
+ const endpoint = server.path ? applyFarmBasePath(server.path, input.basePath) : server.url;
440
+ if (sources.has(endpoint)) continue;
441
+ sources.set(endpoint, { ...server, endpoint, local: Boolean(server.path) });
442
+ }
443
+ if (sources.size === 0 && input.defaultMCP) {
444
+ const server = input.defaultMCP();
445
+ if (server) {
446
+ const endpoint = applyFarmBasePath(server.path, input.basePath);
447
+ sources.set(endpoint, { ...server, endpoint, local: true });
448
+ }
449
+ }
450
+ return [...sources.values()];
451
+ }
452
+ __name(listFarmMCPServerSources, "listFarmMCPServerSources");
453
+ function serverCardLocation(endpoint) {
454
+ return `${endpoint.replace(/\/$/, "")}${FARM_MCP_SERVER_CARD_SUFFIX}`;
455
+ }
456
+ __name(serverCardLocation, "serverCardLocation");
457
+ function listFarmMCPServerCards(origin, input = {}) {
458
+ const host = new URL(origin).hostname;
459
+ return listFarmMCPServerSources(input).map((server) => {
460
+ const endpointUrl = server.local ? `${origin}${server.endpoint}` : server.endpoint;
461
+ const cardPath = server.local ? serverCardLocation(server.endpoint) : void 0;
462
+ const slug = cardSlug(server.name);
463
+ const description = truncate(server.description?.trim() || `MCP server for ${host}`);
464
+ const card = {
465
+ $schema: SERVER_CARD_SCHEMA,
466
+ // The card's name is reverse-DNS; a plain server name is namespaced by the host.
467
+ name: REVERSE_DNS_NAME.test(server.name) ? server.name : `${cardNamespace(host)}/${slug}`,
468
+ version: server.version,
469
+ description,
470
+ ...server.title ? { title: server.title } : {},
471
+ websiteUrl: `${origin}${applyFarmBasePath("/", input.basePath).replace(/(.)\/$/, "$1")}`,
472
+ remotes: [
473
+ {
474
+ type: "streamable-http",
475
+ url: endpointUrl,
476
+ ...server.protocolVersions?.length ? { supportedProtocolVersions: [...server.protocolVersions] } : {}
477
+ }
478
+ ]
479
+ };
480
+ return {
481
+ ...cardPath ? { cardPath } : {},
482
+ card,
483
+ entry: {
484
+ identifier: `urn:air:${host}:mcp:${slug}`,
485
+ type: SERVER_CARD_TYPE,
486
+ url: cardPath ? `${origin}${cardPath}` : serverCardLocation(endpointUrl),
487
+ displayName: server.title ?? server.name,
488
+ description,
489
+ version: server.version
490
+ }
491
+ };
492
+ });
493
+ }
494
+ __name(listFarmMCPServerCards, "listFarmMCPServerCards");
495
+ function listFarmMCPLlmsTxtLinks(origin, input = {}) {
496
+ const servers = listFarmMCPServerCards(origin, input);
497
+ if (!servers.length) return [];
498
+ return [
499
+ ...servers.map(({ card, entry }) => ({
500
+ title: entry.displayName,
501
+ url: card.remotes[0].url,
502
+ description: `${card.description} (Streamable HTTP MCP endpoint; server card at ${entry.url})`
503
+ })),
504
+ {
505
+ title: "AI catalog",
506
+ url: `${origin}${applyFarmBasePath(FARM_AI_CATALOG_PATH, input.basePath)}`,
507
+ description: "MCP server cards for this site"
508
+ }
509
+ ];
510
+ }
511
+ __name(listFarmMCPLlmsTxtLinks, "listFarmMCPLlmsTxtLinks");
512
+ function createFarmAiCatalogResponse(request, input = {}, requestUrl) {
513
+ let url;
514
+ try {
515
+ url = requestUrl ?? new URL(request.url);
516
+ } catch {
517
+ return null;
518
+ }
519
+ const { pathname } = url;
520
+ if (!pathname.endsWith(FARM_MCP_SERVER_CARD_SUFFIX) && !pathname.includes("/.well-known/")) {
521
+ return null;
522
+ }
523
+ const ard = pathname === applyFarmBasePath(FARM_ARD_PATH, input.basePath);
524
+ const catalogPath = ard || pathname === applyFarmBasePath(FARM_AI_CATALOG_PATH, input.basePath);
525
+ if (!catalogPath && !pathname.endsWith(FARM_MCP_SERVER_CARD_SUFFIX)) return null;
526
+ const servers = listFarmMCPServerCards(url.origin, input);
527
+ const card = catalogPath ? void 0 : servers.find((server) => server.cardPath === pathname);
528
+ if (!servers.length || !catalogPath && !card) return null;
529
+ const method = request.method.toUpperCase();
530
+ if (method === "OPTIONS") return new Response(null, { status: 204, headers: corsHeaders() });
531
+ if (method !== "GET" && method !== "HEAD") {
532
+ return new Response("Method Not Allowed", {
533
+ status: 405,
534
+ headers: { ...corsHeaders(), Allow: "GET, HEAD, OPTIONS", "Content-Type": "text/plain" }
535
+ });
536
+ }
537
+ const body = JSON.stringify(
538
+ card ? card.card : { specVersion: "1.0", entries: servers.map(({ entry }) => entry) }
539
+ );
540
+ const etag = createFarmWeakETag(body);
541
+ const headers = {
542
+ ...corsHeaders(),
543
+ "Content-Type": card ? `${SERVER_CARD_TYPE}; charset=utf-8` : ard ? "application/json; charset=utf-8" : `${AI_CATALOG_TYPE}; charset=utf-8`,
544
+ // The body names the request's origin, so caches revalidate rather than reuse it.
545
+ "Cache-Control": "public, max-age=0, must-revalidate",
546
+ ETag: etag,
547
+ "X-Content-Type-Options": "nosniff"
548
+ };
549
+ if (matchesFarmIfNoneMatch(request.headers.get("if-none-match"), etag)) {
550
+ return new Response(null, { status: 304, headers });
551
+ }
552
+ emitFarmAgentRead(request, card ? "mcp-server-card" : "ai-catalog", 200);
553
+ return new Response(method === "HEAD" ? null : body, { status: 200, headers });
554
+ }
555
+ __name(createFarmAiCatalogResponse, "createFarmAiCatalogResponse");
556
+ function corsHeaders() {
557
+ return {
558
+ "Access-Control-Allow-Origin": "*",
559
+ "Access-Control-Allow-Methods": "GET, HEAD, OPTIONS",
560
+ "Access-Control-Allow-Headers": "Content-Type, If-None-Match",
561
+ "Access-Control-Expose-Headers": "ETag"
562
+ };
563
+ }
564
+ __name(corsHeaders, "corsHeaders");
565
+ function cardNamespace(host) {
566
+ if (host.includes(":") || /^\d+(?:\.\d+){3}$/.test(host)) return "local";
567
+ return host.split(".").reverse().join(".");
568
+ }
569
+ __name(cardNamespace, "cardNamespace");
570
+ function cardSlug(name) {
571
+ const last = name.includes("/") ? name.slice(name.lastIndexOf("/") + 1) : name;
572
+ return last.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "mcp";
573
+ }
574
+ __name(cardSlug, "cardSlug");
575
+ function truncate(text) {
576
+ return text.length <= CARD_DESCRIPTION_MAX ? text : `${text.slice(0, CARD_DESCRIPTION_MAX - 1).trimEnd()}\u2026`;
577
+ }
578
+ __name(truncate, "truncate");
579
+
231
580
  // src/components/error-page.ts
232
581
  var ERROR_STATUS_TEXT = {
233
582
  400: "Bad Request",
@@ -521,7 +870,12 @@ function createFarmApiCatalogResponse(method, input, request) {
521
870
  __name(createFarmApiCatalogResponse, "createFarmApiCatalogResponse");
522
871
 
523
872
  // src/app-manifest.ts
524
- var FARM_APP_MANIFEST_PATH = "/.well-known/farmjs";
873
+ var FARM_APP_MANIFEST_PATH = "/.well-known/farmjs.json";
874
+ var FARM_APP_MANIFEST_LEGACY_PATH = "/.well-known/farmjs";
875
+ function isFarmAppManifestPath(pathname) {
876
+ return pathname === FARM_APP_MANIFEST_PATH || pathname === FARM_APP_MANIFEST_LEGACY_PATH;
877
+ }
878
+ __name(isFarmAppManifestPath, "isFarmAppManifestPath");
525
879
  var FARM_INFRA_SIGNATURE_HEADER = "farmjs-infra-signature";
526
880
  var SIGNED_PURPOSE = "farmjs-manifest-v1";
527
881
  var SIGNATURE_WINDOW_SECONDS = 300;
@@ -554,8 +908,8 @@ var SOURCES = {
554
908
  standalone: "defineTool",
555
909
  serverFunction: "serverFunction"
556
910
  };
557
- function createFarmAppManifest(input) {
558
- return {
911
+ function createFarmAppManifest(input, { full = false } = {}) {
912
+ const manifest = {
559
913
  schemaVersion: 1,
560
914
  app: {
561
915
  farm: FARM_VERSION,
@@ -565,37 +919,69 @@ function createFarmAppManifest(input) {
565
919
  },
566
920
  packages: input.packages,
567
921
  mcp: {
568
- servers: _listFarmMCPCatalogs().map(({ server, tools, details }) => ({
569
- name: server.name,
570
- version: server.version,
571
- path: server.path,
572
- resources: [...details?.resources ?? []],
573
- prompts: [...details?.prompts ?? []],
574
- tools: tools.map((tool) => {
575
- const schemas = details?.schemas?.[tool.name];
576
- const hints = Object.fromEntries(
577
- ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
578
- );
579
- return {
580
- name: tool.name,
581
- ...tool.title ? { title: tool.title } : {},
582
- ...tool.description ? { description: tool.description } : {},
583
- source: SOURCES[tool.kind],
584
- ...tool.kind === "endpoint" ? { method: tool.method, path: tool.path } : {},
585
- ...hints,
586
- ...schemas ? { inputSchema: schemas.input } : {},
587
- ...schemas?.output ? { outputSchema: schemas.output } : {}
588
- };
589
- })
590
- }))
922
+ servers: _listFarmMCPCatalogs().map(({ server, tools, details }) => {
923
+ const listed = full || details?.public === true;
924
+ return {
925
+ name: server.name,
926
+ version: server.version,
927
+ path: server.path,
928
+ authorization: details?.public === true ? "none" : "required",
929
+ resources: listed ? [...details?.resources ?? []] : [],
930
+ prompts: listed ? [...details?.prompts ?? []] : [],
931
+ tools: (listed ? tools : []).map((tool) => {
932
+ const schemas = details?.schemas?.[tool.name];
933
+ const hints = Object.fromEntries(
934
+ ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"].filter((hint) => typeof tool[hint] === "boolean").map((hint) => [hint, tool[hint]])
935
+ );
936
+ return {
937
+ name: tool.name,
938
+ ...tool.title ? { title: tool.title } : {},
939
+ ...tool.description ? { description: tool.description } : {},
940
+ source: SOURCES[tool.kind],
941
+ // MCP clients never see the route behind a tool; only Infra's view names it.
942
+ ...full && tool.kind === "endpoint" ? { method: tool.method, path: tool.path } : {},
943
+ ...hints,
944
+ ...schemas ? { inputSchema: schemas.input } : {},
945
+ ...schemas?.output ? { outputSchema: schemas.output } : {}
946
+ };
947
+ })
948
+ };
949
+ })
591
950
  },
592
951
  webmcp: input.webmcp,
593
952
  integrations: input.integrations,
594
953
  agent: input.agent,
595
954
  plugins: input.plugins
596
955
  };
956
+ manifest.mcp.servers.push(...listDefaultServer(input));
957
+ return manifest;
597
958
  }
598
959
  __name(createFarmAppManifest, "createFarmAppManifest");
960
+ function listDefaultServer(input) {
961
+ const server = input.defaultMCP?.();
962
+ if (!server) return [];
963
+ return [
964
+ {
965
+ name: server.name,
966
+ version: server.version,
967
+ path: server.path,
968
+ authorization: "none",
969
+ resources: [],
970
+ prompts: [],
971
+ tools: FARM_DEFAULT_MCP_TOOLS.map((tool) => ({
972
+ name: tool.name,
973
+ title: tool.title,
974
+ description: tool.description,
975
+ // Standalone tools with no endpoint behind them, like defineTool's.
976
+ source: "defineTool",
977
+ ...tool.annotations,
978
+ inputSchema: tool.inputSchema,
979
+ ..."outputSchema" in tool ? { outputSchema: tool.outputSchema } : {}
980
+ }))
981
+ }
982
+ ];
983
+ }
984
+ __name(listDefaultServer, "listDefaultServer");
599
985
  var encoder = new TextEncoder();
600
986
  var hex = /* @__PURE__ */ __name((bytes) => [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, "0")).join(""), "hex");
601
987
  async function sha256Hex(value) {
@@ -640,30 +1026,64 @@ function processEnv() {
640
1026
  return globalThis.process?.env ?? {};
641
1027
  }
642
1028
  __name(processEnv, "processEnv");
643
- async function createFarmAppManifestResponse(request, input, options) {
644
- if (request.method !== "GET" && request.method !== "HEAD") return null;
645
- if (!options.development) {
646
- const key = (options.env ?? processEnv()).FARMJS_API_KEY?.trim();
647
- if (!input.analytics || !key) return null;
648
- const signed = await verifyFarmInfraManifestSignature(
649
- request.headers.get(FARM_INFRA_SIGNATURE_HEADER),
650
- key
651
- );
652
- if (!signed)
653
- return new Response(null, { status: 404, headers: { "cache-control": "no-store" } });
1029
+ var CORS_HEADERS = {
1030
+ "access-control-allow-origin": "*",
1031
+ "access-control-allow-methods": "GET, HEAD, OPTIONS",
1032
+ "access-control-allow-headers": `If-None-Match, ${FARM_INFRA_SIGNATURE_HEADER}`,
1033
+ "access-control-expose-headers": "ETag"
1034
+ };
1035
+ async function createFarmAppManifestResponse(request, input, options = {}) {
1036
+ const method = request.method.toUpperCase();
1037
+ if (method === "OPTIONS") return new Response(null, { status: 204, headers: CORS_HEADERS });
1038
+ if (method !== "GET" && method !== "HEAD") {
1039
+ return new Response("Method Not Allowed", {
1040
+ status: 405,
1041
+ headers: { ...CORS_HEADERS, allow: "GET, HEAD, OPTIONS", "content-type": "text/plain" }
1042
+ });
654
1043
  }
655
- const body = JSON.stringify(createFarmAppManifest(input));
656
- return new Response(request.method === "HEAD" ? null : body, {
657
- headers: { "content-type": "application/json", "cache-control": "private, no-store" }
658
- });
1044
+ const signature = request.headers.get(FARM_INFRA_SIGNATURE_HEADER);
1045
+ const key = input.analytics ? (options.env ?? processEnv()).FARMJS_API_KEY?.trim() : void 0;
1046
+ const full = Boolean(
1047
+ signature && key && await verifyFarmInfraManifestSignature(signature, key)
1048
+ );
1049
+ const body = JSON.stringify(createFarmAppManifest(input, { full }));
1050
+ const etag = createFarmWeakETag(body);
1051
+ const headers = {
1052
+ ...CORS_HEADERS,
1053
+ "content-type": "application/json; charset=utf-8",
1054
+ // The full view is for Infra alone; shared caches keep the two views apart.
1055
+ "cache-control": full ? "private, no-store" : "public, max-age=0, must-revalidate",
1056
+ vary: FARM_INFRA_SIGNATURE_HEADER,
1057
+ etag,
1058
+ "x-content-type-options": "nosniff"
1059
+ };
1060
+ if (!full && matchesFarmIfNoneMatch(request.headers.get("if-none-match"), etag)) {
1061
+ return new Response(null, { status: 304, headers });
1062
+ }
1063
+ return new Response(method === "HEAD" ? null : body, { status: 200, headers });
659
1064
  }
660
1065
  __name(createFarmAppManifestResponse, "createFarmAppManifestResponse");
661
1066
 
662
1067
  export {
1068
+ formatRouteSegment,
1069
+ createRouteDirectoryPattern,
1070
+ stripRouteGroups,
1071
+ getRouteGroupScope,
1072
+ isInRouteGroupScope,
1073
+ getRouteDirectoryDepth,
1074
+ routeBoundaryCoversDirectory,
1075
+ HOISTED_HEAD_ELEMENT,
1076
+ extractFarmFullDocument,
1077
+ classifyFarmDocumentPrefix,
1078
+ removeFarmDocumentTitles,
1079
+ ensureFarmDocumentMeta,
1080
+ composeFarmFullDocument,
663
1081
  renderFarmLocaleAlternateLinks,
664
1082
  createLateRedirectRecovery,
665
1083
  createLateNotFoundRecovery,
666
1084
  createFarmMetadataRouteResponse,
1085
+ listFarmMCPLlmsTxtLinks,
1086
+ createFarmAiCatalogResponse,
667
1087
  resolveDefaultErrorStatus,
668
1088
  getDefaultErrorStatusText,
669
1089
  createDefaultErrorMarkup,
@@ -673,6 +1093,9 @@ export {
673
1093
  resolveFarmApiCatalogInput,
674
1094
  createFarmApiCatalogResponse,
675
1095
  FARM_APP_MANIFEST_PATH,
1096
+ FARM_APP_MANIFEST_LEGACY_PATH,
1097
+ isFarmAppManifestPath,
1098
+ FARM_INFRA_SIGNATURE_HEADER,
676
1099
  resolveFarmAppManifestInput,
677
1100
  createFarmAppManifestResponse
678
1101
  };
@@ -83,4 +83,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, parseInterceptionMarker, "parseInterceptio
83
83
 
84
84
 
85
85
 
86
- exports.isRouteSlotSegment = isRouteSlotSegment; exports.parseRouteSlotFile = parseRouteSlotFile; exports.createRouteSlotContainerId = createRouteSlotContainerId;
86
+
87
+ exports.isRouteSlotSegment = isRouteSlotSegment; exports.parseRouteSlotFile = parseRouteSlotFile; exports.createRouteSlotContainerId = createRouteSlotContainerId; exports.parseInterceptionMarker = parseInterceptionMarker;