@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.
- package/dist/{metadata-BnLDsUOS.d.ts → agent-mcp-BC0bAGVF.d.mts} +45 -2
- package/dist/agent-mcp-handler-LPJ2CADR.mjs +19 -0
- package/dist/agent-mcp-handler-SJAHFSPI.cjs +19 -0
- package/dist/{metadata-WGpBYcGn.d.mts → agent-mcp-jyDHbQKe.d.ts} +45 -2
- package/dist/agent-runtime.cjs +6 -4
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/agent-runtime.mjs +5 -3
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +9 -9
- package/dist/api/route-manager.d.mts +10 -4
- package/dist/api/route-manager.d.ts +10 -4
- package/dist/api/route-manager.mjs +8 -8
- package/dist/api/runtime.cjs +6 -6
- package/dist/api/runtime.d.mts +4 -62
- package/dist/api/runtime.d.ts +4 -62
- package/dist/api/runtime.mjs +5 -5
- package/dist/api.cjs +13 -12
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/api.mjs +12 -11
- package/dist/{app-BXB3JZYc.d.ts → app-CKO3iN1c.d.ts} +17 -3
- package/dist/{app-D_j9AAVL.d.mts → app-Cbkj9ufe.d.mts} +17 -3
- package/dist/app-markdown.cjs +6 -4
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +5 -3
- package/dist/{chunk-F7JZENPF.cjs → chunk-3A4KGQYI.cjs} +38 -30
- package/dist/{chunk-4MMGO7YW.cjs → chunk-3IP27TCG.cjs} +43 -32
- package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
- package/dist/{chunk-UJD4PHYB.mjs → chunk-4E5WBPEG.mjs} +72 -354
- package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
- package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
- package/dist/{chunk-4KU5Q7C2.mjs → chunk-4P6ULFMD.mjs} +253 -67
- package/dist/chunk-4WQ6PGSJ.cjs +367 -0
- package/dist/{chunk-SMHH4VDG.mjs → chunk-4WVJLURN.mjs} +1 -1
- package/dist/{chunk-2F2ER724.cjs → chunk-5BXGGEC7.cjs} +27 -22
- package/dist/{chunk-3BHT4WMP.cjs → chunk-5D2JIPLH.cjs} +8 -8
- package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
- package/dist/{chunk-GFHLGIYC.cjs → chunk-6LGFV2CQ.cjs} +8 -8
- package/dist/chunk-6SJ2KJTA.mjs +314 -0
- package/dist/{chunk-PFQKNERH.cjs → chunk-6TJITR2B.cjs} +457 -218
- package/dist/{chunk-73MC7ZL6.cjs → chunk-75X755YZ.cjs} +2 -2
- package/dist/{chunk-3UH7MRCP.cjs → chunk-7DWNJI73.cjs} +13 -13
- package/dist/{chunk-7L5V3KQO.cjs → chunk-7O5M4UKW.cjs} +2 -2
- package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
- package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
- package/dist/{chunk-CP6X4AEU.mjs → chunk-AJQTP4OO.mjs} +1 -1
- package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
- package/dist/{chunk-EFCQPQMG.cjs → chunk-B5PFZLKV.cjs} +89 -8
- package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
- package/dist/{chunk-JHWOVJ3M.mjs → chunk-BUGNQIHC.mjs} +5 -0
- package/dist/{chunk-7GLPRTTF.cjs → chunk-CGBDNNSM.cjs} +2 -2
- package/dist/chunk-CI6E3UOH.cjs +314 -0
- package/dist/{chunk-2G2NNLE2.mjs → chunk-CQMVIOYP.mjs} +5 -5
- package/dist/{chunk-X6W5FFH6.cjs → chunk-CVH2BXPY.cjs} +8 -8
- package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
- package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
- package/dist/chunk-DTSROJ5J.mjs +367 -0
- package/dist/{chunk-DBNKI4NF.cjs → chunk-ECKF2BAM.cjs} +6 -2
- package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
- package/dist/{chunk-6DU6UFUE.mjs → chunk-EXG5LD6B.mjs} +16 -8
- package/dist/{chunk-HUMR6LSU.mjs → chunk-F5QO4FNE.mjs} +1 -1
- package/dist/{chunk-YULD7ICZ.mjs → chunk-FBOJ55OM.mjs} +1 -1
- package/dist/{chunk-IHNMMXHV.mjs → chunk-FGRYBX5X.mjs} +15 -10
- package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
- package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
- package/dist/{chunk-G5RT7EXW.mjs → chunk-HEVMCTSR.mjs} +21 -6
- package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
- package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
- package/dist/{chunk-UAORZ7QA.mjs → chunk-IAIYV4RZ.mjs} +2 -2
- package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
- package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
- package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
- package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
- package/dist/{chunk-F6Z3Y5KL.mjs → chunk-K3SAEIM3.mjs} +5 -2
- package/dist/{chunk-QAU5JD57.mjs → chunk-K4I4O5TS.mjs} +289 -50
- package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
- package/dist/{chunk-OMVAU7NT.cjs → chunk-KIIMAWOJ.cjs} +11 -1
- package/dist/{chunk-43FMW62B.mjs → chunk-KMTGADN3.mjs} +28 -0
- package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
- package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
- package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
- package/dist/{chunk-6ETPZTJI.mjs → chunk-LBGILORX.mjs} +116 -55
- package/dist/{chunk-IPXLADVO.cjs → chunk-LOFKRKO7.cjs} +122 -61
- package/dist/{chunk-ULAWS2PA.cjs → chunk-LPFV45AY.cjs} +29 -26
- package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
- package/dist/{chunk-RU3M2FIK.cjs → chunk-MRMI32SN.cjs} +87 -369
- package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
- package/dist/{chunk-XCACDAZZ.cjs → chunk-NDILNQ4L.cjs} +25 -10
- package/dist/{chunk-6TJOML4E.mjs → chunk-NFMDCAOS.mjs} +14 -11
- package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
- package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
- package/dist/{chunk-YC6V7PWE.cjs → chunk-NQ6QFZWD.cjs} +1 -1
- package/dist/{chunk-PDOCJ6RY.mjs → chunk-O6WAEAX3.mjs} +1 -1
- package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
- package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
- package/dist/chunk-PTZ2TVNE.cjs +178 -0
- package/dist/{chunk-6WCPV6G2.mjs → chunk-Q2KB32T4.mjs} +1 -1
- package/dist/{chunk-ICUQICNC.cjs → chunk-Q5FYSK45.cjs} +718 -532
- package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
- package/dist/{chunk-Q3VLETLE.mjs → chunk-RRMVL6CJ.mjs} +4 -4
- package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
- package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
- package/dist/{chunk-VFQT3LAO.cjs → chunk-SDOTRX3V.cjs} +5 -5
- package/dist/chunk-SGBZPZUW.mjs +75 -0
- package/dist/{chunk-BMWDEBXO.cjs → chunk-SHLXACIO.cjs} +31 -3
- package/dist/{chunk-ZXGAFZDO.cjs → chunk-T5OJPTVN.cjs} +2 -2
- package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
- package/dist/{chunk-VZJR7UTG.cjs → chunk-TE2G5ION.cjs} +2 -2
- package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
- package/dist/{chunk-4JHOT46A.mjs → chunk-TPLJVC7E.mjs} +86 -5
- package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
- package/dist/{chunk-XBML5KMG.cjs → chunk-U6MPZ35Q.cjs} +24 -14
- package/dist/chunk-UH6QN5NL.mjs +178 -0
- package/dist/{chunk-FTFYRMQQ.cjs → chunk-UJZLSXUB.cjs} +53 -28
- package/dist/chunk-UXHS27O6.cjs +75 -0
- package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
- package/dist/{chunk-22LTEMGQ.mjs → chunk-VXAWRDK7.mjs} +14 -4
- package/dist/{chunk-62XKI4Z3.cjs → chunk-W2YDNK66.cjs} +6 -3
- package/dist/{chunk-VPTDD5XF.cjs → chunk-WBKEZXWE.cjs} +5 -0
- package/dist/{chunk-EJQT6KZN.cjs → chunk-WC5UV2HQ.cjs} +2 -2
- package/dist/{chunk-SAZVVAJH.mjs → chunk-WQ7T2263.mjs} +18 -7
- package/dist/chunk-WRPHYQVY.mjs +109 -0
- package/dist/chunk-WT4TGLXT.cjs +109 -0
- package/dist/{chunk-SOMHP6GF.mjs → chunk-XOPOIFTJ.mjs} +2 -2
- package/dist/{chunk-3PXS2MHU.mjs → chunk-YCKO6FRS.mjs} +1 -1
- package/dist/{chunk-C35ZBVRD.mjs → chunk-YWMZUGIS.mjs} +6 -2
- package/dist/{chunk-HMIJDL7S.mjs → chunk-Z5BEWYVO.mjs} +31 -6
- package/dist/{chunk-OKZUAXHF.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
- package/dist/{chunk-Y7RKTKYI.mjs → chunk-ZMMBIVQM.mjs} +10 -0
- package/dist/{client-plugins-HIyulDym.d.ts → client-plugins-C8DjftDF.d.ts} +112 -5
- package/dist/{client-plugins-CvIslxWi.d.mts → client-plugins-CV4eJ9De.d.mts} +112 -5
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.mts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.mjs +7 -7
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{devtools-EAUY43BS.cjs → devtools-JXFQNWSH.cjs} +11 -10
- package/dist/{devtools-EE5RIBTH.mjs → devtools-KVOY2TCZ.mjs} +10 -9
- package/dist/docs.cjs +13 -12
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +12 -11
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +11 -11
- package/dist/i18n/client.mjs +3 -3
- 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.cjs +61 -54
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.mjs +60 -53
- package/dist/integrations.cjs +8 -4
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/integrations.mjs +7 -3
- package/dist/internal/app-markdown-runtime.cjs +5 -3
- package/dist/internal/app-markdown-runtime.d.mts +19 -5
- package/dist/internal/app-markdown-runtime.d.ts +19 -5
- package/dist/internal/app-markdown-runtime.mjs +4 -2
- package/dist/internal/build-runtime.cjs +38 -34
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +37 -33
- package/dist/internal/cli-runtime.cjs +17 -16
- package/dist/internal/cli-runtime.mjs +16 -15
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +2 -2
- package/dist/internal/client-runtime.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +11 -10
- package/dist/internal/config-runtime.d.mts +2 -2
- package/dist/internal/config-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.mjs +10 -9
- package/dist/internal/infra-analytics-runtime.cjs +5 -5
- package/dist/internal/infra-analytics-runtime.mjs +3 -3
- package/dist/internal/isolated-boundary.cjs +2 -2
- package/dist/internal/isolated-boundary.d.mts +0 -1
- package/dist/internal/isolated-boundary.d.ts +0 -1
- package/dist/internal/isolated-boundary.mjs +1 -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 +27 -48
- package/dist/internal/production-runtime.d.mts +67 -27
- package/dist/internal/production-runtime.d.ts +67 -27
- package/dist/internal/production-runtime.mjs +34 -55
- package/dist/{layers-BRQF5ETU.mjs → layers-UTB43B7A.mjs} +1 -1
- package/dist/layers-VUWIOFEO.cjs +18 -0
- package/dist/markdown.cjs +1 -1
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +6 -4
- package/dist/middleware.d.ts +6 -4
- package/dist/middleware.mjs +9 -9
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +6 -6
- package/dist/{nitro-OVPLKPE2.cjs → nitro-7F65EZZS.cjs} +3 -3
- package/dist/{nitro-MXRDCXWZ.mjs → nitro-MPZJGPXK.mjs} +2 -2
- package/dist/plugin.cjs +31 -28
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.mjs +30 -27
- package/dist/{production-runtime-Crq6CJ-2.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
- package/dist/{production-runtime-0sRnuYc-.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
- package/dist/query/client.cjs +9 -9
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-8ozZh2Qv.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
- package/dist/{render-plan-gs9GGPzw.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +12 -12
- package/dist/renderer-client.d.mts +3 -3
- package/dist/renderer-client.d.ts +3 -3
- package/dist/renderer-client.mjs +4 -4
- package/dist/{request-B5G8rLBH.d.ts → request-BNWr7r5e.d.ts} +1 -1
- package/dist/{request-fkhiynXe.d.mts → request-sKayKcop.d.mts} +1 -1
- package/dist/request.cjs +3 -3
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/request.mjs +2 -2
- package/dist/{route-rendering-lS5nUMua.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
- package/dist/{route-rendering-CLnS7AZj.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
- package/dist/{router-ifU8Dui1.d.mts → router-BK6K42Ij.d.mts} +1 -1
- package/dist/{router-4iuiYnOW.d.ts → router-DnW_2tQi.d.ts} +1 -1
- package/dist/routes.cjs +2 -2
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/routes.mjs +1 -1
- package/dist/runtime-CA3Ei5k_.d.ts +69 -0
- package/dist/runtime-DJDaCMd_.d.mts +69 -0
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +5 -5
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server-plugins.mjs +4 -4
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +57 -54
- package/dist/server.d.mts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.mjs +35 -32
- package/dist/{spa-router-Bq7VCOwx.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
- package/dist/{spa-router-DaJk5Re4.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
- package/dist/testing.cjs +13 -13
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.mjs +10 -10
- package/dist/theme/server.cjs +4 -4
- package/dist/theme/server.mjs +3 -3
- package/dist/{utils-BXLmFsVR.d.ts → utils-BwVcAfUR.d.ts} +1 -1
- package/dist/{utils-XJn0c9bj.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +31 -28
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +30 -27
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +1 -1
- package/types/middleware.d.ts +5 -1
- package/dist/chunk-FXEF4PPL.mjs +0 -47
- package/dist/chunk-XD32KALF.cjs +0 -47
- package/dist/layers-4PNE2HOY.cjs +0 -18
- /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
- /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkT5OJPTVNcjs = require('./chunk-T5OJPTVN.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
|
|
@@ -13,7 +13,7 @@ var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
|
|
|
13
13
|
var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkOW67PDDScjs = require('./chunk-OW67PDDS.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
|
|
@@ -70,13 +70,13 @@ async function _invokeServerFunction(value, input, request) {
|
|
|
70
70
|
throw new TypeError("Expected a function created with createServerFn or createServerQuery");
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
73
|
-
const data = await
|
|
73
|
+
const data = await _chunkT5OJPTVNcjs.runWithServerActionRequest.call(void 0, request, () => runner.run(input));
|
|
74
74
|
return { ok: true, data };
|
|
75
75
|
} catch (error) {
|
|
76
76
|
if (error instanceof ServerFnInputError) {
|
|
77
77
|
return { ok: false, reason: "input", error: error.cause };
|
|
78
78
|
}
|
|
79
|
-
if (
|
|
79
|
+
if (_chunkT5OJPTVNcjs.isServerFnFailure.call(void 0, error)) return { ok: false, reason: "failure", failure: error };
|
|
80
80
|
const redirect = _chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error);
|
|
81
81
|
if (redirect) {
|
|
82
82
|
return { ok: false, reason: "redirect", url: redirect.url, status: redirect.status };
|
|
@@ -117,9 +117,9 @@ function createServerFn(options) {
|
|
|
117
117
|
} catch (cause) {
|
|
118
118
|
throw labelInputErrors && isSchemaValidationFailure(cause) ? new ServerFnInputError(cause) : cause;
|
|
119
119
|
}
|
|
120
|
-
const executionContext =
|
|
121
|
-
const request = _nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _ => _.request]), () => (
|
|
122
|
-
const signal = _nullishCoalesce(_nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _2 => _2.signal]), () => ( _optionalChain([request, 'optionalAccess', _3 => _3.signal]))), () => (
|
|
120
|
+
const executionContext = _chunkT5OJPTVNcjs.getServerActionExecutionContext.call(void 0, );
|
|
121
|
+
const request = _nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _ => _.request]), () => ( _chunkOW67PDDScjs._resolveCurrentRequestForApp.call(void 0, )));
|
|
122
|
+
const signal = _nullishCoalesce(_nullishCoalesce(_optionalChain([executionContext, 'optionalAccess', _2 => _2.signal]), () => ( _optionalChain([request, 'optionalAccess', _3 => _3.signal]))), () => ( _chunkT5OJPTVNcjs.getServerActionSignal.call(void 0, )));
|
|
123
123
|
const handlerContext = {
|
|
124
124
|
input,
|
|
125
125
|
rawInput,
|
|
@@ -245,7 +245,7 @@ function createServerFnErrorHandler(definitions) {
|
|
|
245
245
|
throw new TypeError(`Server function error "${code}" is not declared`);
|
|
246
246
|
}
|
|
247
247
|
const parsed = parseServerFnFailureData(code, definition.data, data);
|
|
248
|
-
throw new (0,
|
|
248
|
+
throw new (0, _chunkT5OJPTVNcjs.ServerFnFailure)(code, parsed, {
|
|
249
249
|
status: definition.status,
|
|
250
250
|
message: _nullishCoalesce(definition.message, () => ( "Server function failed"))
|
|
251
251
|
});
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FARM_DEFAULT_MCP_DESCRIPTION,
|
|
3
|
+
FARM_DEFAULT_MCP_PROTOCOL_VERSIONS,
|
|
4
|
+
FARM_DEFAULT_MCP_TOOLS
|
|
5
|
+
} from "./chunk-UH6QN5NL.mjs";
|
|
6
|
+
import {
|
|
7
|
+
stripFarmBasePath
|
|
8
|
+
} from "./chunk-4RB44K6Z.mjs";
|
|
9
|
+
import {
|
|
10
|
+
__name
|
|
11
|
+
} from "./chunk-LPEX4YW6.mjs";
|
|
12
|
+
|
|
13
|
+
// src/agent-mcp-handler.ts
|
|
14
|
+
var INSTRUCTIONS = "This server reads the site's public pages. Call list_pages or search_pages to find a page, then read_page with its path to get the page as Markdown. It cannot change anything.";
|
|
15
|
+
var MAX_BODY_BYTES = 64 * 1024;
|
|
16
|
+
var MAX_BATCH = 16;
|
|
17
|
+
var READ_TIMEOUT_MS = 3e4;
|
|
18
|
+
var _FarmMCPRequestError = class _FarmMCPRequestError extends Error {
|
|
19
|
+
constructor(code, message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.code = code;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__name(_FarmMCPRequestError, "FarmMCPRequestError");
|
|
25
|
+
var FarmMCPRequestError = _FarmMCPRequestError;
|
|
26
|
+
var PARSE_ERROR = -32700;
|
|
27
|
+
var INVALID_REQUEST = -32600;
|
|
28
|
+
var METHOD_NOT_FOUND = -32601;
|
|
29
|
+
var INVALID_PARAMS = -32602;
|
|
30
|
+
var INTERNAL_ERROR = -32603;
|
|
31
|
+
var TRANSPORT_ERROR = -32e3;
|
|
32
|
+
async function handleFarmDefaultMCPRequest(request, context) {
|
|
33
|
+
const method = request.method.toUpperCase();
|
|
34
|
+
if (method !== "POST") {
|
|
35
|
+
return transportError(405, "Method not allowed. Send MCP requests with POST.", {
|
|
36
|
+
Allow: "POST"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const origin = request.headers.get("origin");
|
|
40
|
+
if (origin && !isSameOrigin(origin, request.url)) {
|
|
41
|
+
return transportError(403, "Cross-origin requests are not allowed.");
|
|
42
|
+
}
|
|
43
|
+
const protocolHeader = request.headers.get("mcp-protocol-version");
|
|
44
|
+
if (protocolHeader && !FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(protocolHeader.trim())) {
|
|
45
|
+
return transportError(
|
|
46
|
+
400,
|
|
47
|
+
`Unsupported MCP-Protocol-Version: ${protocolHeader.slice(0, 32)}. Supported: ${FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.join(", ")}.`
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const contentType = request.headers.get("content-type") ?? "";
|
|
51
|
+
if (!/^application\/json\s*(?:;|$)/i.test(contentType.trim())) {
|
|
52
|
+
return transportError(415, "Content-Type must be application/json.");
|
|
53
|
+
}
|
|
54
|
+
const text = await readBody(request);
|
|
55
|
+
if (text === null) return transportError(413, "The request body is too large.");
|
|
56
|
+
let message;
|
|
57
|
+
try {
|
|
58
|
+
message = JSON.parse(text);
|
|
59
|
+
} catch {
|
|
60
|
+
return json(400, rpcError(null, { code: PARSE_ERROR, message: "Parse error." }));
|
|
61
|
+
}
|
|
62
|
+
if (Array.isArray(message)) {
|
|
63
|
+
if (message.length === 0 || message.length > MAX_BATCH) {
|
|
64
|
+
return json(
|
|
65
|
+
400,
|
|
66
|
+
rpcError(null, { code: INVALID_REQUEST, message: "Invalid batch of JSON-RPC messages." })
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
const replies = (await Promise.all(message.map((item) => answerMessage(item, request, context)))).filter((reply2) => reply2 !== void 0);
|
|
70
|
+
return replies.length ? json(200, replies) : new Response(null, { status: 202 });
|
|
71
|
+
}
|
|
72
|
+
const reply = await answerMessage(message, request, context);
|
|
73
|
+
return reply === void 0 ? new Response(null, { status: 202 }) : json(200, reply);
|
|
74
|
+
}
|
|
75
|
+
__name(handleFarmDefaultMCPRequest, "handleFarmDefaultMCPRequest");
|
|
76
|
+
async function answerMessage(message, request, context) {
|
|
77
|
+
if (!isRecord(message) || message.jsonrpc !== "2.0") {
|
|
78
|
+
return rpcError(readId(message), { code: INVALID_REQUEST, message: "Invalid Request." });
|
|
79
|
+
}
|
|
80
|
+
const hasId = "id" in message;
|
|
81
|
+
if (typeof message.method !== "string") {
|
|
82
|
+
if (hasId && ("result" in message || "error" in message)) return void 0;
|
|
83
|
+
return rpcError(readId(message), { code: INVALID_REQUEST, message: "Invalid Request." });
|
|
84
|
+
}
|
|
85
|
+
if (!hasId) return void 0;
|
|
86
|
+
const id = readId(message);
|
|
87
|
+
if (id === void 0) {
|
|
88
|
+
return rpcError(null, { code: INVALID_REQUEST, message: "Invalid Request id." });
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const result = await dispatch(message.method, message.params, request, context);
|
|
92
|
+
return { jsonrpc: "2.0", id, result };
|
|
93
|
+
} catch (error) {
|
|
94
|
+
if (error instanceof FarmMCPRequestError) {
|
|
95
|
+
return rpcError(id, { code: error.code, message: error.message });
|
|
96
|
+
}
|
|
97
|
+
return rpcError(id, { code: INTERNAL_ERROR, message: "Internal error." });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
__name(answerMessage, "answerMessage");
|
|
101
|
+
async function dispatch(method, params, request, context) {
|
|
102
|
+
switch (method) {
|
|
103
|
+
case "initialize": {
|
|
104
|
+
const requested = isRecord(params) ? params.protocolVersion : void 0;
|
|
105
|
+
const protocolVersion = typeof requested === "string" && FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(requested) ? requested : FARM_DEFAULT_MCP_PROTOCOL_VERSIONS[0];
|
|
106
|
+
return {
|
|
107
|
+
protocolVersion,
|
|
108
|
+
capabilities: { tools: { listChanged: false } },
|
|
109
|
+
serverInfo: {
|
|
110
|
+
name: context.server.name,
|
|
111
|
+
version: context.server.version,
|
|
112
|
+
...context.server.title ? { title: context.server.title } : {},
|
|
113
|
+
description: FARM_DEFAULT_MCP_DESCRIPTION
|
|
114
|
+
},
|
|
115
|
+
instructions: INSTRUCTIONS
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
case "ping":
|
|
119
|
+
return {};
|
|
120
|
+
case "tools/list":
|
|
121
|
+
return { tools: FARM_DEFAULT_MCP_TOOLS };
|
|
122
|
+
case "tools/call":
|
|
123
|
+
return callTool(params, request, context);
|
|
124
|
+
default:
|
|
125
|
+
throw new FarmMCPRequestError(METHOD_NOT_FOUND, `Method not found: ${method.slice(0, 64)}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
__name(dispatch, "dispatch");
|
|
129
|
+
async function callTool(params, request, context) {
|
|
130
|
+
if (!isRecord(params) || typeof params.name !== "string") {
|
|
131
|
+
throw new FarmMCPRequestError(INVALID_PARAMS, "tools/call needs a tool name.");
|
|
132
|
+
}
|
|
133
|
+
const tool = FARM_DEFAULT_MCP_TOOLS.find(({ name }) => name === params.name);
|
|
134
|
+
if (!tool) {
|
|
135
|
+
throw new FarmMCPRequestError(INVALID_PARAMS, `Unknown tool: ${params.name.slice(0, 64)}`);
|
|
136
|
+
}
|
|
137
|
+
const args = params.arguments ?? {};
|
|
138
|
+
if (!isRecord(args)) return toolError("Arguments must be an object.");
|
|
139
|
+
const allowed = new Set(Object.keys(tool.inputSchema.properties));
|
|
140
|
+
const unknown = Object.keys(args).find((key) => !allowed.has(key));
|
|
141
|
+
if (unknown) return toolError(`Unknown argument: ${unknown.slice(0, 64)}.`);
|
|
142
|
+
if (tool.name === "list_pages") return pagesResult(await context.listPages());
|
|
143
|
+
if (tool.name === "search_pages") {
|
|
144
|
+
const query = args.query;
|
|
145
|
+
if (typeof query !== "string" || !query.trim() || query.length > 200) {
|
|
146
|
+
return toolError("query must be a non-empty string of at most 200 characters.");
|
|
147
|
+
}
|
|
148
|
+
const limit = args.limit ?? 10;
|
|
149
|
+
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1 || limit > 50) {
|
|
150
|
+
return toolError("limit must be a whole number from 1 to 50.");
|
|
151
|
+
}
|
|
152
|
+
return pagesResult(searchPages(await context.listPages(), query, limit));
|
|
153
|
+
}
|
|
154
|
+
const path = args.path;
|
|
155
|
+
if (typeof path !== "string" || !path.trim() || path.length > 2048) {
|
|
156
|
+
return toolError('path must be a page path such as "/about".');
|
|
157
|
+
}
|
|
158
|
+
const pagePath = toPagePath(path, request.url, context.basePath);
|
|
159
|
+
const pages = await context.listPages();
|
|
160
|
+
const page = pagePath ? pages.find((candidate) => candidate.path === pagePath) : void 0;
|
|
161
|
+
if (!page) {
|
|
162
|
+
return toolError(
|
|
163
|
+
`No public page at ${JSON.stringify(path.slice(0, 200))}. Call list_pages for the pages this server can read.`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const markdown = await readWithTimeout(context.readMarkdown, page.markdownUrl);
|
|
167
|
+
if (markdown === null) {
|
|
168
|
+
return toolError(`${page.path} did not answer with Markdown. Try again later.`);
|
|
169
|
+
}
|
|
170
|
+
return { content: [{ type: "text", text: markdown }] };
|
|
171
|
+
}
|
|
172
|
+
__name(callTool, "callTool");
|
|
173
|
+
function pagesResult(pages) {
|
|
174
|
+
const structured = {
|
|
175
|
+
pages: pages.map(({ path, title, url, description }) => ({
|
|
176
|
+
path,
|
|
177
|
+
title,
|
|
178
|
+
url,
|
|
179
|
+
...description ? { description } : {}
|
|
180
|
+
}))
|
|
181
|
+
};
|
|
182
|
+
return {
|
|
183
|
+
content: [{ type: "text", text: JSON.stringify(structured) }],
|
|
184
|
+
structuredContent: structured
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
__name(pagesResult, "pagesResult");
|
|
188
|
+
function toolError(text) {
|
|
189
|
+
return { content: [{ type: "text", text }], isError: true };
|
|
190
|
+
}
|
|
191
|
+
__name(toolError, "toolError");
|
|
192
|
+
function searchPages(pages, query, limit) {
|
|
193
|
+
const terms = query.toLowerCase().split(/\s+/).filter(Boolean).slice(0, 16);
|
|
194
|
+
return pages.map((page) => {
|
|
195
|
+
const title = page.title.toLowerCase();
|
|
196
|
+
const rest = `${page.description ?? ""} ${page.path}`.toLowerCase();
|
|
197
|
+
let score = 0;
|
|
198
|
+
for (const term of terms) {
|
|
199
|
+
if (title.includes(term)) score += 2;
|
|
200
|
+
else if (rest.includes(term)) score += 1;
|
|
201
|
+
else return null;
|
|
202
|
+
}
|
|
203
|
+
return { page, score };
|
|
204
|
+
}).filter((match) => match !== null).sort(
|
|
205
|
+
(left, right) => right.score - left.score || left.page.path.localeCompare(right.page.path)
|
|
206
|
+
).slice(0, limit).map(({ page }) => page);
|
|
207
|
+
}
|
|
208
|
+
__name(searchPages, "searchPages");
|
|
209
|
+
function toPagePath(input, requestUrl, basePath) {
|
|
210
|
+
let url;
|
|
211
|
+
try {
|
|
212
|
+
url = new URL(input.trim(), requestUrl);
|
|
213
|
+
} catch {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
if (url.origin !== new URL(requestUrl).origin) return null;
|
|
217
|
+
let path = url.pathname;
|
|
218
|
+
try {
|
|
219
|
+
path = decodeURI(path);
|
|
220
|
+
} catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
path = stripFarmBasePath(path, basePath);
|
|
224
|
+
if (path === "/index.md") return "/";
|
|
225
|
+
if (path.toLowerCase().endsWith(".md")) path = path.slice(0, -3) || "/";
|
|
226
|
+
return path.length > 1 ? path.replace(/\/+$/, "") || "/" : path;
|
|
227
|
+
}
|
|
228
|
+
__name(toPagePath, "toPagePath");
|
|
229
|
+
async function readWithTimeout(read, url) {
|
|
230
|
+
let timer;
|
|
231
|
+
const timedOut = new Promise((resolve) => {
|
|
232
|
+
timer = setTimeout(resolve, READ_TIMEOUT_MS, null);
|
|
233
|
+
});
|
|
234
|
+
try {
|
|
235
|
+
return await Promise.race([read(url), timedOut]);
|
|
236
|
+
} finally {
|
|
237
|
+
clearTimeout(timer);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
__name(readWithTimeout, "readWithTimeout");
|
|
241
|
+
async function readBody(request) {
|
|
242
|
+
const declared = Number(request.headers.get("content-length"));
|
|
243
|
+
if (Number.isFinite(declared) && declared > MAX_BODY_BYTES) {
|
|
244
|
+
await request.body?.cancel().catch(() => {
|
|
245
|
+
});
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
if (!request.body) return "";
|
|
249
|
+
const reader = request.body.getReader();
|
|
250
|
+
const chunks = [];
|
|
251
|
+
let size = 0;
|
|
252
|
+
for (; ; ) {
|
|
253
|
+
const { done, value } = await reader.read();
|
|
254
|
+
if (done) break;
|
|
255
|
+
size += value.byteLength;
|
|
256
|
+
if (size > MAX_BODY_BYTES) {
|
|
257
|
+
await reader.cancel().catch(() => {
|
|
258
|
+
});
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
chunks.push(value);
|
|
262
|
+
}
|
|
263
|
+
const body = new Uint8Array(size);
|
|
264
|
+
let offset = 0;
|
|
265
|
+
for (const chunk of chunks) {
|
|
266
|
+
body.set(chunk, offset);
|
|
267
|
+
offset += chunk.byteLength;
|
|
268
|
+
}
|
|
269
|
+
return new TextDecoder().decode(body);
|
|
270
|
+
}
|
|
271
|
+
__name(readBody, "readBody");
|
|
272
|
+
function isSameOrigin(origin, requestUrl) {
|
|
273
|
+
try {
|
|
274
|
+
return new URL(origin).host === new URL(requestUrl).host;
|
|
275
|
+
} catch {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
__name(isSameOrigin, "isSameOrigin");
|
|
280
|
+
function readId(message) {
|
|
281
|
+
if (!isRecord(message)) return null;
|
|
282
|
+
const { id } = message;
|
|
283
|
+
return typeof id === "string" || typeof id === "number" && Number.isFinite(id) || id === null ? id : void 0;
|
|
284
|
+
}
|
|
285
|
+
__name(readId, "readId");
|
|
286
|
+
function rpcError(id, error) {
|
|
287
|
+
return { jsonrpc: "2.0", id: id ?? null, error };
|
|
288
|
+
}
|
|
289
|
+
__name(rpcError, "rpcError");
|
|
290
|
+
function json(status, body) {
|
|
291
|
+
return new Response(JSON.stringify(body), {
|
|
292
|
+
status,
|
|
293
|
+
headers: {
|
|
294
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
295
|
+
"Cache-Control": "no-store",
|
|
296
|
+
"X-Content-Type-Options": "nosniff"
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
__name(json, "json");
|
|
301
|
+
function transportError(status, message, headers = {}) {
|
|
302
|
+
const response = json(status, rpcError(null, { code: TRANSPORT_ERROR, message }));
|
|
303
|
+
for (const [name, value] of Object.entries(headers)) response.headers.set(name, value);
|
|
304
|
+
return response;
|
|
305
|
+
}
|
|
306
|
+
__name(transportError, "transportError");
|
|
307
|
+
function isRecord(value) {
|
|
308
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
309
|
+
}
|
|
310
|
+
__name(isRecord, "isRecord");
|
|
311
|
+
|
|
312
|
+
export {
|
|
313
|
+
handleFarmDefaultMCPRequest
|
|
314
|
+
};
|