@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.
- package/dist/agent-mcp-BVExL8rZ.d.mts +109 -0
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/agent-mcp-luzfXK-P.d.ts +109 -0
- package/dist/agent-runtime.cjs +5 -3
- package/dist/agent-runtime.d.mts +4 -5
- package/dist/agent-runtime.d.ts +4 -5
- package/dist/agent-runtime.mjs +4 -2
- package/dist/api/route-manager.cjs +7 -7
- package/dist/api/route-manager.d.mts +15 -10
- package/dist/api/route-manager.d.ts +15 -10
- package/dist/api/route-manager.mjs +6 -6
- package/dist/api/runtime.cjs +7 -5
- package/dist/api/runtime.d.mts +7 -66
- package/dist/api/runtime.d.ts +7 -66
- package/dist/api/runtime.mjs +7 -5
- package/dist/api.cjs +9 -9
- package/dist/api.d.mts +8 -9
- package/dist/api.d.ts +8 -9
- package/dist/api.mjs +8 -8
- package/dist/{app-q4rmZlXK.d.mts → app-BukwkFIu.d.mts} +52 -12
- package/dist/{app-DgotYGbq.d.ts → app-Yfa2dsFy.d.ts} +52 -12
- package/dist/app-markdown.cjs +6 -6
- package/dist/app-markdown.d.mts +5 -6
- package/dist/app-markdown.d.ts +5 -6
- package/dist/app-markdown.mjs +5 -5
- package/dist/{chunk-XV5DJTBX.mjs → chunk-276VJSM6.mjs} +627 -260
- package/dist/{chunk-36MK5YCW.cjs → chunk-2YTDKNH3.cjs} +547 -240
- package/dist/{chunk-VHANUNEG.mjs → chunk-35GKZR22.mjs} +2 -2
- package/dist/{chunk-LR5QSC2P.mjs → chunk-35WV46VL.mjs} +399 -92
- package/dist/{chunk-UX5S4JEO.cjs → chunk-42NHY7HW.cjs} +57 -7
- package/dist/{chunk-U4PTAHW3.mjs → chunk-4E5AEDKY.mjs} +7 -11
- package/dist/{chunk-NGVORZVZ.mjs → chunk-4E5WBPEG.mjs} +73 -351
- package/dist/{chunk-AQZFOP7S.mjs → chunk-4GLOOWKE.mjs} +5 -5
- package/dist/{chunk-7BT4H4P7.cjs → chunk-4NU4GGTC.cjs} +2 -2
- package/dist/{chunk-AGC75XAE.mjs → chunk-4WCZJQUO.mjs} +55 -5
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-QCFFHV5H.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/chunk-75RZHGLS.cjs +135 -0
- package/dist/{chunk-P64MIF5B.cjs → chunk-ADEA7PN3.cjs} +483 -60
- package/dist/{chunk-YQVSHTMR.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-TA5G2HWD.cjs → chunk-AO6RYU5N.cjs} +31 -28
- package/dist/{chunk-MOKLYNHV.cjs → chunk-BO36SELV.cjs} +6 -6
- package/dist/{chunk-7Y6ZNFPX.mjs → chunk-BPOF5U4N.mjs} +17 -7
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-TDFPACVX.cjs → chunk-CBJJH36A.cjs} +50 -25
- package/dist/{chunk-VKNHTSAP.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
- package/dist/{chunk-ATK2R4CH.cjs → chunk-D227TIEN.cjs} +14 -4
- package/dist/{chunk-QGYRXFU2.cjs → chunk-D2BB47NB.cjs} +8 -8
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-ODBZYBAB.cjs → chunk-DZ5ZVB2K.cjs} +1 -1
- package/dist/{chunk-ROUTX2E5.cjs → chunk-ECKF2BAM.cjs} +18 -5
- package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
- package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
- package/dist/{chunk-XXJU7FCC.cjs → chunk-EUV4YR3V.cjs} +2 -2
- package/dist/{chunk-HR5KPHC2.mjs → chunk-EWET4D2Y.mjs} +1 -1
- package/dist/{chunk-PXKIEXZD.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-MIDIZJZC.cjs → chunk-FO427P6I.cjs} +22 -12
- package/dist/{chunk-AWC4VUZL.cjs → chunk-GQ3Z3IZI.cjs} +14 -14
- package/dist/{chunk-JDPAKVS4.mjs → chunk-GQRWBCWK.mjs} +8 -5
- package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
- package/dist/{chunk-WNNYOOIB.mjs → chunk-HOXTWRGB.mjs} +1 -1
- package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
- package/dist/{chunk-QJ3J6MZT.cjs → chunk-JNUWCDTF.cjs} +8 -8
- package/dist/{chunk-BTAG7LI7.cjs → chunk-JZVADIOD.cjs} +2 -2
- package/dist/{chunk-EM6SBQKM.cjs → chunk-KIIMAWOJ.cjs} +37 -2
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-GOABMOX3.mjs → chunk-LSZAVSGY.mjs} +468 -45
- package/dist/{chunk-2NQQ5H5G.cjs → chunk-M7MKQXAF.cjs} +2 -1
- package/dist/{chunk-GNSDTTWZ.mjs → chunk-MKYBIIAQ.mjs} +30 -5
- package/dist/{chunk-ZHPHJPQP.cjs → chunk-MRMI32SN.cjs} +88 -366
- package/dist/{chunk-7M52YUMY.cjs → chunk-N2NAS2AM.cjs} +2 -2
- package/dist/{chunk-SJVKK4JE.cjs → chunk-NMHWYWDR.cjs} +1144 -777
- package/dist/chunk-NRDBW4MP.mjs +45 -0
- package/dist/{chunk-657WJNRY.mjs → chunk-O6I6VWKK.mjs} +20 -5
- package/dist/{chunk-O27L4YAA.mjs → chunk-O6WAEAX3.mjs} +2 -2
- package/dist/chunk-OFZUJMCU.mjs +601 -0
- package/dist/{chunk-ZKP7C2B6.mjs → chunk-OHLSEQ57.mjs} +22 -13
- package/dist/{chunk-X242HVD5.mjs → chunk-OO7GXVSR.mjs} +1 -1
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-3ATMYLLJ.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-LHODW25H.mjs → chunk-QORUJDIV.mjs} +2 -2
- package/dist/{chunk-UBO4SGH4.mjs → chunk-RHAZ22ZN.mjs} +2 -1
- package/dist/{chunk-G26MUMKL.cjs → chunk-S6VYG6XU.cjs} +23 -8
- package/dist/{chunk-6VVL3MHY.mjs → chunk-SC2WYWPF.mjs} +1 -1
- package/dist/{chunk-MPEYMSCF.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-LMJ7VRHZ.mjs → chunk-T4OGRVNS.mjs} +13 -3
- package/dist/{chunk-T5CERMEH.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-Z2YLTERK.cjs → chunk-TE2G5ION.cjs} +6 -6
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-PQDFUSXD.cjs → chunk-UVW64BCB.cjs} +44 -35
- package/dist/{chunk-VCCUOMQN.mjs → chunk-VILIPRS6.mjs} +1 -1
- package/dist/{chunk-A5FGU2WU.cjs → chunk-VQLJWDVW.cjs} +19 -23
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-K3F2E6GS.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/chunk-WWFTAUFG.cjs +45 -0
- package/dist/{chunk-ZUSJDQ2Q.mjs → chunk-WWIKMBRN.mjs} +1 -1
- package/dist/{chunk-3VSKDFAT.mjs → chunk-WZ77PUAM.mjs} +1 -1
- package/dist/{chunk-CLJYVZAD.mjs → chunk-XCMCS4DA.mjs} +11 -1
- package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
- package/dist/{chunk-DZ4DTRJ5.cjs → chunk-YKX5BK66.cjs} +7 -7
- package/dist/chunk-YSLWRWWP.cjs +601 -0
- package/dist/{chunk-LI2LMOLR.mjs → chunk-YWMZUGIS.mjs} +18 -5
- package/dist/chunk-ZLAT2CWY.mjs +135 -0
- package/dist/{chunk-XF7Q24PF.mjs → chunk-ZMMBIVQM.mjs} +35 -0
- package/dist/{chunk-U74I55WB.cjs → chunk-ZWM5KGAA.cjs} +19 -9
- package/dist/{client-plugins-CLObcuCq.d.mts → client-plugins-C3mK9Pol.d.mts} +300 -7
- package/dist/{client-plugins-DZjHC4Mi.d.ts → client-plugins-r1mOtSC1.d.ts} +300 -7
- package/dist/client-plugins.d.mts +4 -5
- package/dist/client-plugins.d.ts +4 -5
- package/dist/client.cjs +5 -5
- package/dist/client.d.mts +8 -9
- package/dist/client.d.ts +8 -9
- package/dist/client.mjs +4 -4
- package/dist/config.d.mts +4 -5
- package/dist/config.d.ts +4 -5
- package/dist/{devtools-RNXCTS4R.mjs → devtools-ERIKFEXX.mjs} +11 -10
- package/dist/{devtools-HU6Y2MNV.cjs → devtools-JZJJY5CK.cjs} +12 -11
- package/dist/docs.cjs +15 -14
- package/dist/docs.d.mts +41 -4
- package/dist/docs.d.ts +41 -4
- package/dist/docs.mjs +14 -13
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
- package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
- package/dist/index.cjs +51 -44
- package/dist/index.d.mts +20 -21
- package/dist/index.d.ts +20 -21
- package/dist/index.mjs +50 -43
- package/dist/integrations.cjs +7 -3
- package/dist/integrations.d.mts +4 -5
- package/dist/integrations.d.ts +4 -5
- package/dist/integrations.mjs +6 -2
- package/dist/internal/app-markdown-runtime.cjs +5 -5
- package/dist/internal/app-markdown-runtime.d.mts +5 -6
- package/dist/internal/app-markdown-runtime.d.ts +5 -6
- package/dist/internal/app-markdown-runtime.mjs +4 -4
- package/dist/internal/build-runtime.cjs +32 -30
- package/dist/internal/build-runtime.d.mts +6 -7
- package/dist/internal/build-runtime.d.ts +6 -7
- package/dist/internal/build-runtime.mjs +31 -29
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +4 -5
- package/dist/internal/compression-runtime.d.ts +4 -5
- package/dist/internal/config-runtime.cjs +12 -11
- package/dist/internal/config-runtime.d.mts +5 -6
- package/dist/internal/config-runtime.d.ts +5 -6
- package/dist/internal/config-runtime.mjs +11 -10
- package/dist/internal/isolated-boundary.cjs +3 -2
- package/dist/internal/isolated-boundary.d.mts +1 -1
- package/dist/internal/isolated-boundary.d.ts +1 -1
- package/dist/internal/isolated-boundary.mjs +2 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +63 -25
- package/dist/internal/production-runtime.d.mts +117 -37
- package/dist/internal/production-runtime.d.ts +117 -37
- package/dist/internal/production-runtime.mjs +65 -27
- package/dist/internal/server-tree.cjs +12 -0
- package/dist/internal/server-tree.d.mts +27 -0
- package/dist/internal/server-tree.d.ts +27 -0
- package/dist/internal/server-tree.mjs +12 -0
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +4 -5
- package/dist/markdown.d.ts +4 -5
- package/dist/markdown.mjs +3 -3
- package/dist/middleware.cjs +7 -7
- package/dist/middleware.d.mts +6 -7
- package/dist/middleware.d.ts +6 -7
- package/dist/middleware.mjs +6 -6
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +7 -8
- package/dist/navigation.d.ts +7 -8
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-HSAQFXSS.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-4XGPNIK4.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
- package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +28 -26
- package/dist/plugin.d.mts +4 -5
- package/dist/plugin.d.ts +4 -5
- package/dist/plugin.mjs +27 -25
- package/dist/{production-runtime-CysZl3EV.d.mts → production-runtime-CCeVZXst.d.mts} +4 -4
- package/dist/{production-runtime-BU5ETAK9.d.ts → production-runtime-DPnsggY3.d.ts} +4 -4
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan-CKr4ltOd.d.mts → render-plan-BuGaPFe6.d.mts} +1 -1
- package/dist/{render-plan-D72O1qm4.d.ts → render-plan-Cw4f5E_R.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +10 -4
- package/dist/renderer/react/server.d.mts +2 -1
- package/dist/renderer/react/server.d.ts +2 -1
- package/dist/renderer/react/server.mjs +7 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +6 -7
- package/dist/renderer-client.d.ts +6 -7
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +2 -0
- package/dist/renderer.d.ts +2 -0
- package/dist/{request-DbyOYI2j.d.ts → request-Bkg-hERy.d.ts} +1 -1
- package/dist/{request-Be83WafN.d.mts → request-CsGARcAw.d.mts} +1 -1
- package/dist/request.d.mts +5 -6
- package/dist/request.d.ts +5 -6
- package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
- package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
- package/dist/{route-rendering-CtVMpV-k.d.ts → route-rendering-BUZMH_64.d.ts} +1 -1
- package/dist/{route-rendering-BG56SzvJ.d.mts → route-rendering-f11yh5dp.d.mts} +1 -1
- package/dist/{router-D94-SDlW.d.ts → router-B8CR9GbD.d.ts} +1 -1
- package/dist/{router-ALUvm8gC.d.mts → router-Cp6yRE8A.d.mts} +1 -1
- package/dist/routes.d.mts +4 -5
- package/dist/routes.d.ts +4 -5
- package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
- package/dist/runtime-CAEv36S_.d.mts +69 -0
- package/dist/runtime-CQVsT330.d.ts +69 -0
- package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +4 -4
- package/dist/server-fn.mjs +3 -3
- package/dist/server-plugins.d.mts +5 -6
- package/dist/server-plugins.d.ts +5 -6
- package/dist/server-query.cjs +5 -5
- package/dist/server-query.mjs +4 -4
- package/dist/server.cjs +47 -45
- package/dist/server.d.mts +13 -14
- package/dist/server.d.ts +13 -14
- package/dist/server.mjs +30 -28
- package/dist/{spa-router-CxK3USIz.d.ts → spa-router-BuciWGCZ.d.ts} +3 -3
- package/dist/{spa-router-DbxNRKOB.d.mts → spa-router-DwbqGkGj.d.mts} +3 -3
- package/dist/testing.cjs +9 -9
- package/dist/testing.d.mts +4 -5
- package/dist/testing.d.ts +4 -5
- package/dist/testing.mjs +7 -7
- package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
- package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
- package/dist/{utils-4wVRcpOw.d.mts → utils-B9V0S_yL.d.mts} +1 -1
- package/dist/{utils-311Y8eoK.d.ts → utils-CaoWKtYM.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +28 -26
- package/dist/vite.d.mts +4 -5
- package/dist/vite.d.ts +4 -5
- package/dist/vite.mjs +27 -25
- package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
- package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.mjs +2 -2
- package/package.json +9 -1
- package/dist/chunk-M64YUMA4.cjs +0 -58
- package/dist/chunk-QLQ32WC4.mjs +0 -58
- package/dist/layers-4PNE2HOY.cjs +0 -18
- package/dist/metadata-2HSU2i_w.d.mts +0 -52
- package/dist/metadata-Cjs8JMRM.d.ts +0 -52
- package/dist/types-DFbjpjXX.d.mts +0 -105
- package/dist/types-DFbjpjXX.d.ts +0 -105
- package/dist/{chunk-2F2ER724.cjs → chunk-BPMATOP2.cjs} +2 -2
- package/dist/{chunk-IHNMMXHV.mjs → chunk-OTC5BDGO.mjs} +3 -3
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunk4WQ6PGSJcjs = require('./chunk-4WQ6PGSJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunk75RZHGLScjs = require('./chunk-75RZHGLS.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
19
|
+
|
|
20
|
+
// src/agent-mcp.ts
|
|
21
|
+
var FARM_DEFAULT_MCP_PATH = "/mcp";
|
|
22
|
+
var FARM_DEFAULT_MCP_PROTOCOL_VERSIONS = [
|
|
23
|
+
"2025-11-25",
|
|
24
|
+
"2025-06-18",
|
|
25
|
+
"2025-03-26",
|
|
26
|
+
"2024-11-05"
|
|
27
|
+
];
|
|
28
|
+
var FARM_DEFAULT_MCP_DESCRIPTION = "Read-only access to this site's public pages: list, search, and read them as Markdown.";
|
|
29
|
+
var READ_ONLY = {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
idempotentHint: true,
|
|
33
|
+
openWorldHint: false
|
|
34
|
+
};
|
|
35
|
+
var PAGE_SCHEMA = {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
path: { type: "string", description: `The page's path, such as "/about".` },
|
|
39
|
+
title: { type: "string" },
|
|
40
|
+
url: { type: "string", description: "The page's absolute URL." },
|
|
41
|
+
description: { type: "string" }
|
|
42
|
+
},
|
|
43
|
+
required: ["path", "title", "url"]
|
|
44
|
+
};
|
|
45
|
+
var PAGES_OUTPUT_SCHEMA = {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: { pages: { type: "array", items: PAGE_SCHEMA } },
|
|
48
|
+
required: ["pages"]
|
|
49
|
+
};
|
|
50
|
+
var FARM_DEFAULT_MCP_TOOLS = [
|
|
51
|
+
{
|
|
52
|
+
name: "list_pages",
|
|
53
|
+
title: "List pages",
|
|
54
|
+
description: "List this site's public pages with each page's path, title, URL, and description. Pass a page's path to read_page to read it as Markdown.",
|
|
55
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
56
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
57
|
+
annotations: READ_ONLY
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "search_pages",
|
|
61
|
+
title: "Search pages",
|
|
62
|
+
description: "Search this site's public pages by title, description, and path. Every word of the query must match. Returns the matching pages, best match first.",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
query: {
|
|
67
|
+
type: "string",
|
|
68
|
+
minLength: 1,
|
|
69
|
+
maxLength: 200,
|
|
70
|
+
description: 'Words to look for, such as "pricing" or "getting started".'
|
|
71
|
+
},
|
|
72
|
+
limit: {
|
|
73
|
+
type: "integer",
|
|
74
|
+
minimum: 1,
|
|
75
|
+
maximum: 50,
|
|
76
|
+
default: 10,
|
|
77
|
+
description: "The most pages to return."
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: ["query"],
|
|
81
|
+
additionalProperties: false
|
|
82
|
+
},
|
|
83
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
84
|
+
annotations: READ_ONLY
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "read_page",
|
|
88
|
+
title: "Read a page",
|
|
89
|
+
description: `Read one of this site's public pages as Markdown. Takes a path from list_pages or search_pages, such as "/" or "/about".`,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
path: {
|
|
94
|
+
type: "string",
|
|
95
|
+
minLength: 1,
|
|
96
|
+
maxLength: 2048,
|
|
97
|
+
description: `The page's path, such as "/about", or its full URL on this site.`
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
required: ["path"],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
},
|
|
103
|
+
annotations: READ_ONLY
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
function collectFarmDefaultMCPPages(sources, options) {
|
|
107
|
+
const readable = [];
|
|
108
|
+
for (const source of sources) {
|
|
109
|
+
const module = isRecord(source.module) ? source.module : void 0;
|
|
110
|
+
if (_optionalChain([module, 'optionalAccess', _ => _.__farmRouteGuard])) continue;
|
|
111
|
+
if (!_chunkEUV4YR3Vcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, source.pattern)) continue;
|
|
112
|
+
readable.push({ pattern: source.pattern, metadata: _optionalChain([module, 'optionalAccess', _2 => _2.metadata]) });
|
|
113
|
+
}
|
|
114
|
+
return _chunk4WQ6PGSJcjs.collectFarmLlmsTxtPages.call(void 0, readable, {
|
|
115
|
+
origin: options.origin,
|
|
116
|
+
basePath: options.basePath,
|
|
117
|
+
markdown: options.markdown
|
|
118
|
+
}).map((page) => ({
|
|
119
|
+
path: page.path,
|
|
120
|
+
title: page.title,
|
|
121
|
+
url: `${options.origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0, page.path, options.basePath)}`,
|
|
122
|
+
...page.description ? { description: page.description } : {},
|
|
123
|
+
markdownUrl: `${options.origin}${_chunkI57LW5VZcjs.applyFarmBasePath.call(void 0,
|
|
124
|
+
_chunkEUV4YR3Vcjs.getFarmMarkdownMirrorPath.call(void 0, page.path),
|
|
125
|
+
options.basePath
|
|
126
|
+
)}`
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmDefaultMCPPages, "collectFarmDefaultMCPPages");
|
|
130
|
+
function createFarmDefaultMCPServer(app, farmVersion) {
|
|
131
|
+
const name = typeof _optionalChain([app, 'optionalAccess', _3 => _3.name]) === "string" && app.name.trim() ? app.name.trim() : "farm-app";
|
|
132
|
+
const version = typeof _optionalChain([app, 'optionalAccess', _4 => _4.version]) === "string" && app.version.trim() ? app.version.trim() : farmVersion;
|
|
133
|
+
return {
|
|
134
|
+
name,
|
|
135
|
+
version,
|
|
136
|
+
description: FARM_DEFAULT_MCP_DESCRIPTION,
|
|
137
|
+
protocolVersions: [...FARM_DEFAULT_MCP_PROTOCOL_VERSIONS],
|
|
138
|
+
path: FARM_DEFAULT_MCP_PATH
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmDefaultMCPServer, "createFarmDefaultMCPServer");
|
|
142
|
+
function resolveFarmDefaultMCPServer(server) {
|
|
143
|
+
if (!server) return void 0;
|
|
144
|
+
if (_chunk75RZHGLScjs._listFarmMCPCatalogs.call(void 0, ).length > 0 || _chunk75RZHGLScjs._listFarmRegisteredMCPServers.call(void 0, ).length > 0) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
return server;
|
|
148
|
+
}
|
|
149
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveFarmDefaultMCPServer, "resolveFarmDefaultMCPServer");
|
|
150
|
+
function isFarmDefaultMCPPathname(pathname, basePath) {
|
|
151
|
+
const path = _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, pathname, basePath);
|
|
152
|
+
return path === FARM_DEFAULT_MCP_PATH || path === `${FARM_DEFAULT_MCP_PATH}/`;
|
|
153
|
+
}
|
|
154
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmDefaultMCPPathname, "isFarmDefaultMCPPathname");
|
|
155
|
+
function farmConfigMountsMCP(config) {
|
|
156
|
+
const { mcp } = config;
|
|
157
|
+
if (isRecord(mcp) && mcp.enabled !== false) return true;
|
|
158
|
+
return Boolean(
|
|
159
|
+
_optionalChain([config, 'access', _5 => _5.plugins, 'optionalAccess', _6 => _6.some, 'call', _7 => _7((plugin) => isRecord(plugin) && plugin.name === "farm:api-mcp")])
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, farmConfigMountsMCP, "farmConfigMountsMCP");
|
|
163
|
+
function isRecord(value) {
|
|
164
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
165
|
+
}
|
|
166
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, isRecord, "isRecord");
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
exports.FARM_DEFAULT_MCP_PATH = FARM_DEFAULT_MCP_PATH; exports.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS = FARM_DEFAULT_MCP_PROTOCOL_VERSIONS; exports.FARM_DEFAULT_MCP_DESCRIPTION = FARM_DEFAULT_MCP_DESCRIPTION; exports.FARM_DEFAULT_MCP_TOOLS = FARM_DEFAULT_MCP_TOOLS; exports.collectFarmDefaultMCPPages = collectFarmDefaultMCPPages; exports.createFarmDefaultMCPServer = createFarmDefaultMCPServer; exports.resolveFarmDefaultMCPServer = resolveFarmDefaultMCPServer; exports.isFarmDefaultMCPPathname = isFarmDefaultMCPPathname; exports.farmConfigMountsMCP = farmConfigMountsMCP;
|
|
@@ -15,7 +15,7 @@ var _chunkLSKZMJMPcjs = require('./chunk-LSKZMJMP.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
@@ -66,7 +66,7 @@ function mergePluginAPIRoutes(existing, plugins, expected, options = {}) {
|
|
|
66
66
|
endpoints: { ...route.endpoints }
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
const api = createPluginLocalAPI(existing, options.bodySizeLimit);
|
|
69
|
+
const api = createPluginLocalAPI(existing, options.bodySizeLimit, options.dispatch);
|
|
70
70
|
for (const definition of _chunkIWZKTWHZcjs.resolvePluginRoutes.call(void 0, plugins, { api })) {
|
|
71
71
|
_chunkWMAPPDMMcjs.registerAPIRouteShape.call(void 0, shapes, definition.path, `plugin:${definition.path}`, "app");
|
|
72
72
|
let route = routes.get(definition.path);
|
|
@@ -101,7 +101,18 @@ ${actualSignature || "(none)"}`
|
|
|
101
101
|
return result;
|
|
102
102
|
}
|
|
103
103
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergePluginAPIRoutes, "mergePluginAPIRoutes");
|
|
104
|
-
|
|
104
|
+
var DISPATCH_DROPPED_HEADERS = [
|
|
105
|
+
"accept-encoding",
|
|
106
|
+
"connection",
|
|
107
|
+
"content-length",
|
|
108
|
+
"keep-alive",
|
|
109
|
+
"proxy-connection",
|
|
110
|
+
"te",
|
|
111
|
+
"trailer",
|
|
112
|
+
"transfer-encoding",
|
|
113
|
+
"upgrade"
|
|
114
|
+
];
|
|
115
|
+
function createPluginLocalAPI(routes, bodySizeLimit, dispatch) {
|
|
105
116
|
const endpoints = /* @__PURE__ */ new Map();
|
|
106
117
|
for (const route of routes) {
|
|
107
118
|
for (const method of route.methods) {
|
|
@@ -119,8 +130,12 @@ function createPluginLocalAPI(routes, bodySizeLimit) {
|
|
|
119
130
|
}),
|
|
120
131
|
output: endpoint.__output,
|
|
121
132
|
mcp: endpoint.__mcp === true ? true : endpoint.__mcp ? Object.freeze({ ...endpoint.__mcp }) : void 0,
|
|
122
|
-
invoke(request, params = {}) {
|
|
123
|
-
|
|
133
|
+
async invoke(request, params = {}) {
|
|
134
|
+
if (!dispatch)
|
|
135
|
+
return invokeAPIRouteEndpoint(endpoint, request, { ...params }, bodySizeLimit);
|
|
136
|
+
const headers = new Headers(request.headers);
|
|
137
|
+
for (const name of DISPATCH_DROPPED_HEADERS) headers.delete(name);
|
|
138
|
+
return dispatch(new Request(request, { headers }));
|
|
124
139
|
}
|
|
125
140
|
});
|
|
126
141
|
endpoints.set(`${normalizedMethod} ${route.path}`, descriptor);
|
|
@@ -186,11 +201,11 @@ function isFarmAPIPathname(pathname, serverBasePath = _chunkS3A45T7Fcjs.DEFAULT_
|
|
|
186
201
|
return basePath !== "/" && (pathname === basePath || pathname.startsWith(`${basePath}/`));
|
|
187
202
|
}
|
|
188
203
|
_chunkS3JO3N4Hcjs.__name.call(void 0, isFarmAPIPathname, "isFarmAPIPathname");
|
|
189
|
-
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit =
|
|
204
|
+
async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLimit = _chunkKIIMAWOJcjs.DEFAULT_FARM_SERVER_BODY_SIZE_LIMIT) {
|
|
190
205
|
try {
|
|
191
|
-
request = await
|
|
206
|
+
request = await _chunkKIIMAWOJcjs.bufferFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
192
207
|
} catch (error) {
|
|
193
|
-
const response2 =
|
|
208
|
+
const response2 = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
194
209
|
if (response2) return response2;
|
|
195
210
|
throw error;
|
|
196
211
|
}
|
|
@@ -9,7 +9,7 @@ var _chunkCMGMGHUZcjs = require('./chunk-CMGMGHUZ.cjs');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
@@ -136,10 +136,10 @@ function createFarmWorkflowRequestHandler(options) {
|
|
|
136
136
|
try {
|
|
137
137
|
payload = await readWorkflowPayload(
|
|
138
138
|
request,
|
|
139
|
-
|
|
139
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, options.server).bodySizeLimit
|
|
140
140
|
);
|
|
141
141
|
} catch (error) {
|
|
142
|
-
const response =
|
|
142
|
+
const response = _chunkKIIMAWOJcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
143
143
|
if (response) return response;
|
|
144
144
|
if (error instanceof SyntaxError) {
|
|
145
145
|
return Response.json({ error: "Invalid workflow request body." }, { status: 400 });
|
|
@@ -220,7 +220,7 @@ async function prepareFarmWorkflowsForNitro(config) {
|
|
|
220
220
|
createNitroWorkflowHTTPHandler(
|
|
221
221
|
workflowConfig,
|
|
222
222
|
workflows,
|
|
223
|
-
|
|
223
|
+
_chunkKIIMAWOJcjs.resolveFarmServerConfig.call(void 0, config.server)
|
|
224
224
|
),
|
|
225
225
|
"utf8"
|
|
226
226
|
);
|
|
@@ -591,7 +591,7 @@ async function readWorkflowPayload(request, bodySizeLimit) {
|
|
|
591
591
|
if (request.method === "GET" || request.method === "HEAD") {
|
|
592
592
|
return _chunkQNPEUFHQcjs.searchParamsToObject.call(void 0, url.searchParams);
|
|
593
593
|
}
|
|
594
|
-
const bytes = await
|
|
594
|
+
const bytes = await _chunkKIIMAWOJcjs.readFarmRequestBody.call(void 0, request, bodySizeLimit);
|
|
595
595
|
const text = new TextDecoder().decode(bytes);
|
|
596
596
|
if (!text) return {};
|
|
597
597
|
const contentType = (request.headers.get("content-type") || "").split(";", 1)[0].trim().toLowerCase();
|
|
@@ -34,15 +34,42 @@ async function loadFarmDevModule(server, id, environmentName = "ssr") {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadFarmDevModule, "loadFarmDevModule");
|
|
37
|
+
function invalidateFarmDevDependents(server, file, targets, environmentName = "ssr") {
|
|
38
|
+
const environment = server.environments[environmentName];
|
|
39
|
+
const graph = _optionalChain([environment, 'optionalAccess', _6 => _6.moduleGraph]);
|
|
40
|
+
if (!graph || targets.size === 0) return [];
|
|
41
|
+
const posix = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (filePath) => filePath.replace(/\\/g, "/"), "posix");
|
|
42
|
+
const byFile = new Map([...targets].map((target) => [posix(target), target]));
|
|
43
|
+
const reached = /* @__PURE__ */ new Set();
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
const queue = [..._nullishCoalesce(graph.getModulesByFile(posix(file)), () => ( []))];
|
|
46
|
+
while (queue.length > 0) {
|
|
47
|
+
const node = queue.pop();
|
|
48
|
+
if (seen.has(node)) continue;
|
|
49
|
+
seen.add(node);
|
|
50
|
+
const target = node.file ? byFile.get(posix(node.file)) : void 0;
|
|
51
|
+
if (target) reached.add(target);
|
|
52
|
+
queue.push(...node.importers);
|
|
53
|
+
}
|
|
54
|
+
if (reached.size === 0) return [];
|
|
55
|
+
const evaluatedModules = _optionalChain([environment, 'access', _7 => _7.runner, 'optionalAccess', _8 => _8.evaluatedModules]);
|
|
56
|
+
for (const node of seen) {
|
|
57
|
+
graph.invalidateModule(node);
|
|
58
|
+
const evaluated = node.id ? _optionalChain([evaluatedModules, 'optionalAccess', _9 => _9.getModuleById, 'call', _10 => _10(node.id)]) : void 0;
|
|
59
|
+
if (evaluated) evaluatedModules.invalidateModule(evaluated);
|
|
60
|
+
}
|
|
61
|
+
return [...reached];
|
|
62
|
+
}
|
|
63
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, invalidateFarmDevDependents, "invalidateFarmDevDependents");
|
|
37
64
|
function invalidateFailedFarmDevModules(server) {
|
|
38
65
|
for (const entry of Object.values(server.environments)) {
|
|
39
66
|
const environment = entry;
|
|
40
67
|
const failures = failedModules.get(environment);
|
|
41
|
-
if (!_optionalChain([failures, 'optionalAccess',
|
|
68
|
+
if (!_optionalChain([failures, 'optionalAccess', _11 => _11.size])) continue;
|
|
42
69
|
const runner = environment.runner;
|
|
43
70
|
for (const [id, failed] of failures) {
|
|
44
71
|
const evaluated = runner.evaluatedModules.getModuleById(id);
|
|
45
|
-
if (_optionalChain([evaluated, 'optionalAccess',
|
|
72
|
+
if (_optionalChain([evaluated, 'optionalAccess', _12 => _12.promise]) !== failed) continue;
|
|
46
73
|
const transformed = environment.moduleGraph.getModuleById(id);
|
|
47
74
|
if (transformed) environment.moduleGraph.invalidateModule(transformed);
|
|
48
75
|
if (evaluated) runner.evaluatedModules.invalidateModule(evaluated);
|
|
@@ -64,4 +91,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, toFileModuleUrl, "toFileModuleUrl");
|
|
|
64
91
|
|
|
65
92
|
|
|
66
93
|
|
|
67
|
-
|
|
94
|
+
|
|
95
|
+
exports.FarmDevEnvironmentError = FarmDevEnvironmentError; exports.loadFarmDevModule = loadFarmDevModule; exports.invalidateFarmDevDependents = invalidateFarmDevDependents; exports.invalidateFailedFarmDevModules = invalidateFailedFarmDevModules; exports.toFileModuleUrl = toFileModuleUrl;
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
matchAPIRouteAtBasePath,
|
|
18
18
|
mergePluginAPIRoutes,
|
|
19
19
|
resolveAPIRouteEndpoint
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-O6I6VWKK.mjs";
|
|
21
21
|
import {
|
|
22
22
|
registerAPIRouteShape
|
|
23
23
|
} from "./chunk-W3B4PKAW.mjs";
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
loadFarmDevModule,
|
|
33
33
|
toFileModuleUrl
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-KMTGADN3.mjs";
|
|
35
35
|
import {
|
|
36
36
|
logger
|
|
37
37
|
} from "./chunk-KI3MESHB.mjs";
|
|
@@ -68,6 +68,15 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
68
68
|
this.i18n = options.i18n;
|
|
69
69
|
this.bodySizeLimit = options.bodySizeLimit;
|
|
70
70
|
this.basePath = options.basePath;
|
|
71
|
+
this.dispatch = options.dispatch;
|
|
72
|
+
}
|
|
73
|
+
/** Every file the current handlers were loaded from: route files and root routes files. */
|
|
74
|
+
getSourceFiles() {
|
|
75
|
+
const files = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const sources of this.endpointSources.values()) {
|
|
77
|
+
for (const { filePath } of sources.values()) files.add(filePath);
|
|
78
|
+
}
|
|
79
|
+
return files;
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* Discover route.ts files in /app/api and explicit endpoints in root routes.ts
|
|
@@ -94,7 +103,8 @@ var _APIRouteManager = class _APIRouteManager {
|
|
|
94
103
|
}
|
|
95
104
|
this.routes = new Map(
|
|
96
105
|
mergePluginAPIRoutes([...this.routes.values()], this.plugins, void 0, {
|
|
97
|
-
bodySizeLimit: this.bodySizeLimit
|
|
106
|
+
bodySizeLimit: this.bodySizeLimit,
|
|
107
|
+
dispatch: this.dispatch
|
|
98
108
|
}).map((route) => [route.path, route])
|
|
99
109
|
);
|
|
100
110
|
} catch (error) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
var _chunkSVRTJOUFcjs = require('./chunk-SVRTJOUF.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -107,7 +107,7 @@ function resolveServerActionsConfig(config) {
|
|
|
107
107
|
const allowedOrigins = (_nullishCoalesce(_optionalChain([config, 'optionalAccess', _ => _.allowedOrigins]), () => ( []))).map(
|
|
108
108
|
(value) => _chunkSVRTJOUFcjs.normalizeAllowedOriginPattern.call(void 0, value, SERVER_ACTION_ALLOWED_ORIGINS_LABEL)
|
|
109
109
|
);
|
|
110
|
-
const bodySizeLimit =
|
|
110
|
+
const bodySizeLimit = _chunkKIIMAWOJcjs.parseBodySizeLimit.call(void 0,
|
|
111
111
|
_nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.bodySizeLimit]), () => ( DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT)),
|
|
112
112
|
"serverActions.bodySizeLimit"
|
|
113
113
|
);
|
|
@@ -15,10 +15,10 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
15
15
|
var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -1181,11 +1181,11 @@ function shouldReturnMarkdown(request) {
|
|
|
1181
1181
|
if (url.pathname.endsWith(".md")) return true;
|
|
1182
1182
|
const accept = request.headers.get("accept");
|
|
1183
1183
|
const markdown = Math.max(
|
|
1184
|
-
|
|
1185
|
-
|
|
1184
|
+
_chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/markdown"),
|
|
1185
|
+
_chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/plain")
|
|
1186
1186
|
);
|
|
1187
1187
|
if (markdown <= 0) return false;
|
|
1188
|
-
return markdown >=
|
|
1188
|
+
return markdown >= _chunkEUV4YR3Vcjs.farmAcceptQuality.call(void 0, accept, "text/html", { wildcards: true });
|
|
1189
1189
|
}
|
|
1190
1190
|
_chunkS3JO3N4Hcjs.__name.call(void 0, shouldReturnMarkdown, "shouldReturnMarkdown");
|
|
1191
1191
|
function escapeAttribute(value) {
|
|
@@ -1947,7 +1947,7 @@ function createFarmDocsHandler(docs, options) {
|
|
|
1947
1947
|
ETag: etag,
|
|
1948
1948
|
"X-Content-Type-Options": "nosniff"
|
|
1949
1949
|
});
|
|
1950
|
-
if (
|
|
1950
|
+
if (_chunkKIIMAWOJcjs.matchesFarmIfNoneMatch.call(void 0, request.headers.get("if-none-match"), etag)) {
|
|
1951
1951
|
return new Response(null, { status: 304, headers });
|
|
1952
1952
|
}
|
|
1953
1953
|
if (request.method === "HEAD") return new Response(null, { status: 200, headers });
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
collectFarmLlmsTxtPages
|
|
3
|
+
} from "./chunk-DTSROJ5J.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getFarmMarkdownMirrorPath,
|
|
6
|
+
isFarmMarkdownMirrorExposed
|
|
7
|
+
} from "./chunk-WWIKMBRN.mjs";
|
|
8
|
+
import {
|
|
9
|
+
_listFarmMCPCatalogs,
|
|
10
|
+
_listFarmRegisteredMCPServers
|
|
11
|
+
} from "./chunk-ZLAT2CWY.mjs";
|
|
12
|
+
import {
|
|
13
|
+
applyFarmBasePath,
|
|
14
|
+
stripFarmBasePath
|
|
15
|
+
} from "./chunk-4RB44K6Z.mjs";
|
|
16
|
+
import {
|
|
17
|
+
__name
|
|
18
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
19
|
+
|
|
20
|
+
// src/agent-mcp.ts
|
|
21
|
+
var FARM_DEFAULT_MCP_PATH = "/mcp";
|
|
22
|
+
var FARM_DEFAULT_MCP_PROTOCOL_VERSIONS = [
|
|
23
|
+
"2025-11-25",
|
|
24
|
+
"2025-06-18",
|
|
25
|
+
"2025-03-26",
|
|
26
|
+
"2024-11-05"
|
|
27
|
+
];
|
|
28
|
+
var FARM_DEFAULT_MCP_DESCRIPTION = "Read-only access to this site's public pages: list, search, and read them as Markdown.";
|
|
29
|
+
var READ_ONLY = {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
idempotentHint: true,
|
|
33
|
+
openWorldHint: false
|
|
34
|
+
};
|
|
35
|
+
var PAGE_SCHEMA = {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
path: { type: "string", description: `The page's path, such as "/about".` },
|
|
39
|
+
title: { type: "string" },
|
|
40
|
+
url: { type: "string", description: "The page's absolute URL." },
|
|
41
|
+
description: { type: "string" }
|
|
42
|
+
},
|
|
43
|
+
required: ["path", "title", "url"]
|
|
44
|
+
};
|
|
45
|
+
var PAGES_OUTPUT_SCHEMA = {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: { pages: { type: "array", items: PAGE_SCHEMA } },
|
|
48
|
+
required: ["pages"]
|
|
49
|
+
};
|
|
50
|
+
var FARM_DEFAULT_MCP_TOOLS = [
|
|
51
|
+
{
|
|
52
|
+
name: "list_pages",
|
|
53
|
+
title: "List pages",
|
|
54
|
+
description: "List this site's public pages with each page's path, title, URL, and description. Pass a page's path to read_page to read it as Markdown.",
|
|
55
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
56
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
57
|
+
annotations: READ_ONLY
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "search_pages",
|
|
61
|
+
title: "Search pages",
|
|
62
|
+
description: "Search this site's public pages by title, description, and path. Every word of the query must match. Returns the matching pages, best match first.",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
query: {
|
|
67
|
+
type: "string",
|
|
68
|
+
minLength: 1,
|
|
69
|
+
maxLength: 200,
|
|
70
|
+
description: 'Words to look for, such as "pricing" or "getting started".'
|
|
71
|
+
},
|
|
72
|
+
limit: {
|
|
73
|
+
type: "integer",
|
|
74
|
+
minimum: 1,
|
|
75
|
+
maximum: 50,
|
|
76
|
+
default: 10,
|
|
77
|
+
description: "The most pages to return."
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: ["query"],
|
|
81
|
+
additionalProperties: false
|
|
82
|
+
},
|
|
83
|
+
outputSchema: PAGES_OUTPUT_SCHEMA,
|
|
84
|
+
annotations: READ_ONLY
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "read_page",
|
|
88
|
+
title: "Read a page",
|
|
89
|
+
description: `Read one of this site's public pages as Markdown. Takes a path from list_pages or search_pages, such as "/" or "/about".`,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
path: {
|
|
94
|
+
type: "string",
|
|
95
|
+
minLength: 1,
|
|
96
|
+
maxLength: 2048,
|
|
97
|
+
description: `The page's path, such as "/about", or its full URL on this site.`
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
required: ["path"],
|
|
101
|
+
additionalProperties: false
|
|
102
|
+
},
|
|
103
|
+
annotations: READ_ONLY
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
function collectFarmDefaultMCPPages(sources, options) {
|
|
107
|
+
const readable = [];
|
|
108
|
+
for (const source of sources) {
|
|
109
|
+
const module = isRecord(source.module) ? source.module : void 0;
|
|
110
|
+
if (module?.__farmRouteGuard) continue;
|
|
111
|
+
if (!isFarmMarkdownMirrorExposed(options.markdown, source.pattern)) continue;
|
|
112
|
+
readable.push({ pattern: source.pattern, metadata: module?.metadata });
|
|
113
|
+
}
|
|
114
|
+
return collectFarmLlmsTxtPages(readable, {
|
|
115
|
+
origin: options.origin,
|
|
116
|
+
basePath: options.basePath,
|
|
117
|
+
markdown: options.markdown
|
|
118
|
+
}).map((page) => ({
|
|
119
|
+
path: page.path,
|
|
120
|
+
title: page.title,
|
|
121
|
+
url: `${options.origin}${applyFarmBasePath(page.path, options.basePath)}`,
|
|
122
|
+
...page.description ? { description: page.description } : {},
|
|
123
|
+
markdownUrl: `${options.origin}${applyFarmBasePath(
|
|
124
|
+
getFarmMarkdownMirrorPath(page.path),
|
|
125
|
+
options.basePath
|
|
126
|
+
)}`
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
__name(collectFarmDefaultMCPPages, "collectFarmDefaultMCPPages");
|
|
130
|
+
function createFarmDefaultMCPServer(app, farmVersion) {
|
|
131
|
+
const name = typeof app?.name === "string" && app.name.trim() ? app.name.trim() : "farm-app";
|
|
132
|
+
const version = typeof app?.version === "string" && app.version.trim() ? app.version.trim() : farmVersion;
|
|
133
|
+
return {
|
|
134
|
+
name,
|
|
135
|
+
version,
|
|
136
|
+
description: FARM_DEFAULT_MCP_DESCRIPTION,
|
|
137
|
+
protocolVersions: [...FARM_DEFAULT_MCP_PROTOCOL_VERSIONS],
|
|
138
|
+
path: FARM_DEFAULT_MCP_PATH
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
__name(createFarmDefaultMCPServer, "createFarmDefaultMCPServer");
|
|
142
|
+
function resolveFarmDefaultMCPServer(server) {
|
|
143
|
+
if (!server) return void 0;
|
|
144
|
+
if (_listFarmMCPCatalogs().length > 0 || _listFarmRegisteredMCPServers().length > 0) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
return server;
|
|
148
|
+
}
|
|
149
|
+
__name(resolveFarmDefaultMCPServer, "resolveFarmDefaultMCPServer");
|
|
150
|
+
function isFarmDefaultMCPPathname(pathname, basePath) {
|
|
151
|
+
const path = stripFarmBasePath(pathname, basePath);
|
|
152
|
+
return path === FARM_DEFAULT_MCP_PATH || path === `${FARM_DEFAULT_MCP_PATH}/`;
|
|
153
|
+
}
|
|
154
|
+
__name(isFarmDefaultMCPPathname, "isFarmDefaultMCPPathname");
|
|
155
|
+
function farmConfigMountsMCP(config) {
|
|
156
|
+
const { mcp } = config;
|
|
157
|
+
if (isRecord(mcp) && mcp.enabled !== false) return true;
|
|
158
|
+
return Boolean(
|
|
159
|
+
config.plugins?.some((plugin) => isRecord(plugin) && plugin.name === "farm:api-mcp")
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
__name(farmConfigMountsMCP, "farmConfigMountsMCP");
|
|
163
|
+
function isRecord(value) {
|
|
164
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
165
|
+
}
|
|
166
|
+
__name(isRecord, "isRecord");
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
FARM_DEFAULT_MCP_PATH,
|
|
170
|
+
FARM_DEFAULT_MCP_PROTOCOL_VERSIONS,
|
|
171
|
+
FARM_DEFAULT_MCP_DESCRIPTION,
|
|
172
|
+
FARM_DEFAULT_MCP_TOOLS,
|
|
173
|
+
collectFarmDefaultMCPPages,
|
|
174
|
+
createFarmDefaultMCPServer,
|
|
175
|
+
resolveFarmDefaultMCPServer,
|
|
176
|
+
isFarmDefaultMCPPathname,
|
|
177
|
+
farmConfigMountsMCP
|
|
178
|
+
};
|