@farm.js/core 0.1.63 → 0.1.65
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-handler-OV4WRFBL.cjs → agent-mcp-handler-OXT73ZBY.cjs} +5 -5
- package/dist/{agent-mcp-handler-7QMX2LUY.mjs → agent-mcp-handler-QLFDDTYN.mjs} +4 -4
- package/dist/{agent-mcp.d-CCQ-wKwg.d.mts → agent-mcp.d-CO_ABmNK.d.mts} +1 -1
- package/dist/{agent-mcp.d-DOJCBSh9.d.ts → agent-mcp.d-QD2WZ9BS.d.ts} +1 -1
- package/dist/agent-runtime.d.mts +1 -1
- package/dist/agent-runtime.d.ts +1 -1
- package/dist/analyzer-GHWK46LX.cjs +16 -0
- package/dist/{analyzer-WNPQPWFR.mjs → analyzer-PE33SK5W.mjs} +3 -2
- package/dist/api/route-manager.d.mts +3 -3
- package/dist/api/route-manager.d.ts +3 -3
- package/dist/api/runtime.d.mts +2 -2
- package/dist/api/runtime.d.ts +2 -2
- package/dist/api.d.mts +3 -3
- package/dist/api.d.ts +3 -3
- package/dist/{app-manifest.d-BaA0omsv.d.mts → app-manifest.d-BpKxiU_E.d.mts} +1 -1
- package/dist/{app-manifest.d-poayV4lq.d.ts → app-manifest.d-DDmNkYQQ.d.ts} +1 -1
- package/dist/app-markdown.cjs +4 -4
- package/dist/app-markdown.d.mts +2 -2
- package/dist/app-markdown.d.ts +2 -2
- package/dist/app-markdown.mjs +3 -3
- package/dist/{app.d-DdWxeIGU.d.mts → app.d-kuoVWhWM.d.mts} +4 -4
- package/dist/{app.d-D4Dn03E3.d.ts → app.d-x68Cwr0_.d.ts} +4 -4
- package/dist/{chunk-LT4VAF5Z.cjs → chunk-2C5L5RPM.cjs} +7 -6
- package/dist/{chunk-BA2IA32Q.mjs → chunk-2L54YV25.mjs} +13 -11
- package/dist/{chunk-5IKQ7BIR.cjs → chunk-32RPJAAS.cjs} +16 -16
- package/dist/{chunk-QN5WRQSQ.cjs → chunk-3KJPIO5D.cjs} +610 -3102
- package/dist/{chunk-EENTT56C.mjs → chunk-6X5NKNBE.mjs} +43 -38
- package/dist/{chunk-RFYL5OLP.mjs → chunk-72JSHQQQ.mjs} +1 -1
- package/dist/{chunk-LA45FN37.mjs → chunk-7GYCZRTH.mjs} +386 -2878
- package/dist/chunk-7QVRWGBL.cjs +3704 -0
- package/dist/{chunk-PRFNLQSP.cjs → chunk-7XGWBPQQ.cjs} +4 -4
- package/dist/{chunk-FNHN3RBD.cjs → chunk-A3G5IY2W.cjs} +1 -1
- package/dist/{chunk-EYLC6GD6.cjs → chunk-C7DCMGC4.cjs} +12 -12
- package/dist/chunk-CJNAUEVC.mjs +34 -0
- package/dist/{chunk-LFFSDZ4Y.cjs → chunk-CZF4XIRZ.cjs} +3 -3
- package/dist/{chunk-7FFW7DC4.mjs → chunk-E2TSYUHV.mjs} +4 -4
- package/dist/{chunk-55U5QIXQ.mjs → chunk-FIR62CR3.mjs} +1 -1
- package/dist/{chunk-MEQN6DDA.cjs → chunk-FJWN7RV4.cjs} +5 -5
- package/dist/{chunk-VVTJTMGQ.cjs → chunk-GL7N5UHF.cjs} +4 -4
- package/dist/{chunk-4DIKLG56.mjs → chunk-GRBJ7VKH.mjs} +1 -1
- package/dist/{chunk-UR25Z5Z6.mjs → chunk-HCGWDRZO.mjs} +1 -1
- package/dist/{chunk-GPKBUME5.mjs → chunk-HKNYNSOK.mjs} +2 -2
- package/dist/{chunk-U6WCUVSV.cjs → chunk-IMK32ERL.cjs} +23 -21
- package/dist/chunk-IOEXXZK3.mjs +88 -0
- package/dist/{chunk-IOF4KXMP.mjs → chunk-IP2KHSGF.mjs} +205 -26
- package/dist/{chunk-YSXTNSXS.mjs → chunk-K7OZAVOI.mjs} +7 -6
- package/dist/{chunk-KVW2M6PI.mjs → chunk-KL7SHLQB.mjs} +1 -1
- package/dist/{chunk-UZZ6IEQP.mjs → chunk-MESQF2JC.mjs} +2 -2
- package/dist/{chunk-DZPR2W6U.cjs → chunk-O6L3YYPM.cjs} +5 -5
- package/dist/{chunk-6BJJYOFL.cjs → chunk-OLIGNTWU.cjs} +7 -7
- package/dist/{chunk-5L7I6AMY.cjs → chunk-OSFIUSYK.cjs} +5 -5
- package/dist/{chunk-LA6O5EL2.mjs → chunk-Q75QPLBA.mjs} +1 -1
- package/dist/{chunk-O5FCWI6O.mjs → chunk-QHRCR44V.mjs} +2 -2
- package/dist/{chunk-E72UD6ME.mjs → chunk-RVGSVQWT.mjs} +1 -1
- package/dist/{chunk-Z74NNER4.cjs → chunk-T4M52BA5.cjs} +164 -159
- package/dist/{chunk-PCXIJKPM.mjs → chunk-TNBJ4LZG.mjs} +2 -2
- package/dist/{chunk-PAKCHVUS.mjs → chunk-TPA2PV5J.mjs} +3 -35
- package/dist/{chunk-Y2YBNQ3D.cjs → chunk-TRIDJQ6A.cjs} +6 -6
- package/dist/{chunk-PVJX4UPA.cjs → chunk-TZOGZKI7.cjs} +411 -295
- package/dist/{chunk-O27PLNQZ.cjs → chunk-UJ3R2AH2.cjs} +4 -4
- package/dist/{chunk-BPNOYILC.cjs → chunk-UVV3I5QA.cjs} +3 -35
- package/dist/{chunk-CBDRR3J3.mjs → chunk-VHHLKIDZ.mjs} +166 -50
- package/dist/{chunk-T4TBK5NY.mjs → chunk-VQ4NWOWO.mjs} +2 -2
- package/dist/{chunk-ZZ2QKCKW.mjs → chunk-WAY6LOQH.mjs} +1 -1
- package/dist/chunk-WBTHHTBO.cjs +88 -0
- package/dist/{chunk-IWRLV46X.cjs → chunk-WMTBBQHY.cjs} +4 -4
- package/dist/{chunk-LWWDTBGL.cjs → chunk-WNXVWXG3.cjs} +2 -2
- package/dist/{chunk-CI4UNQHO.cjs → chunk-XBSKPLHF.cjs} +2 -2
- package/dist/{chunk-QAS7KE7J.cjs → chunk-Y5TOT5F6.cjs} +5 -5
- package/dist/{chunk-ANXU3D32.cjs → chunk-YD4J37RN.cjs} +403 -32
- package/dist/{chunk-XICXQXYE.mjs → chunk-YUW7F6SK.mjs} +2 -2
- package/dist/chunk-ZAUOOGER.mjs +3704 -0
- package/dist/{chunk-DPE53XWL.mjs → chunk-ZEXE4TGY.mjs} +1 -1
- package/dist/chunk-ZIHWAN55.cjs +34 -0
- package/dist/{chunk-GVOMPU3Y.cjs → chunk-ZQQK4U66.cjs} +213 -34
- package/dist/{chunk-S2NUYHRY.mjs → chunk-ZX2JHEWW.mjs} +384 -13
- package/dist/{client-component.d-CSEFlHfG.d.mts → client-component.d-D74pqdea.d.mts} +2 -2
- package/dist/{client-component.d-CQLvqLAJ.d.ts → client-component.d-D8VcypQA.d.ts} +2 -2
- package/dist/{client-plugins.d-BgPUYPc9.d.ts → client-plugins.d-CXElzotB.d.ts} +8 -1
- package/dist/{client-plugins.d-BTF0gZm4.d.mts → client-plugins.d-D4-6hNx7.d.mts} +8 -1
- package/dist/client-plugins.d.mts +1 -1
- package/dist/client-plugins.d.ts +1 -1
- package/dist/client.d.mts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/{devtools-HDKTYIZF.mjs → devtools-PUVZB3F2.mjs} +7 -6
- package/dist/{devtools-ZHN5JLVI.cjs → devtools-SGYOG36E.cjs} +8 -7
- package/dist/docs.cjs +10 -9
- package/dist/docs.d.mts +2 -2
- package/dist/docs.d.ts +2 -2
- package/dist/docs.mjs +9 -8
- package/dist/environment/vite.cjs +9 -2
- package/dist/environment/vite.d.mts +3 -0
- package/dist/environment/vite.d.ts +3 -0
- package/dist/environment/vite.mjs +8 -1
- package/dist/index.cjs +29 -27
- package/dist/{index.d-Coow7bD4.d.ts → index.d-A_x10zGS.d.ts} +1 -1
- package/dist/{index.d-Dbjx0ku7.d.mts → index.d-SSgYDv4D.d.mts} +1 -1
- package/dist/index.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.mjs +28 -26
- package/dist/integrations.d.mts +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/internal/app-markdown-runtime.cjs +3 -3
- package/dist/internal/app-markdown-runtime.d.mts +2 -2
- package/dist/internal/app-markdown-runtime.d.ts +2 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +27 -25
- package/dist/internal/build-runtime.d.mts +3 -3
- package/dist/internal/build-runtime.d.ts +3 -3
- package/dist/internal/build-runtime.mjs +26 -24
- package/dist/internal/cli-runtime.cjs +10 -9
- package/dist/internal/cli-runtime.mjs +9 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +4 -4
- package/dist/internal/client-runtime.d.ts +4 -4
- package/dist/internal/compression-runtime.d.mts +1 -1
- package/dist/internal/compression-runtime.d.ts +1 -1
- package/dist/internal/config-runtime.cjs +9 -8
- package/dist/internal/config-runtime.d.mts +4 -4
- package/dist/internal/config-runtime.d.ts +4 -4
- package/dist/internal/config-runtime.mjs +8 -7
- package/dist/internal/infra-analytics-runtime.cjs +9 -9
- package/dist/internal/infra-analytics-runtime.mjs +7 -7
- package/dist/internal/native-server-fns.cjs +5 -4
- package/dist/internal/native-server-fns.mjs +4 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +11 -11
- package/dist/internal/production-runtime.d.mts +20 -12
- package/dist/internal/production-runtime.d.ts +20 -12
- package/dist/internal/production-runtime.mjs +10 -10
- package/dist/markdown.cjs +2 -2
- package/dist/markdown.d.mts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.mjs +1 -1
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.d.ts +3 -3
- package/dist/mobile.d.mts +2 -2
- package/dist/mobile.d.ts +2 -2
- package/dist/{native-tree-Z2WYUJEV.cjs → native-tree-HE2FLS72.cjs} +3 -3
- package/dist/{native-tree-AS5L3ID3.mjs → native-tree-YF2DSPKM.mjs} +2 -2
- package/dist/{navigation-delegate.d-Ca_BV0Wu.d.mts → navigation-delegate.d-DQVYKoaZ.d.mts} +1 -1
- package/dist/{navigation-delegate.d-aHiPI6GL.d.ts → navigation-delegate.d-GghbHJuK.d.ts} +1 -1
- package/dist/navigation.d.mts +4 -4
- package/dist/navigation.d.ts +4 -4
- package/dist/plugin.cjs +18 -17
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.d.ts +3 -3
- package/dist/plugin.mjs +17 -16
- package/dist/{production-runtime.d-C0rF7a10.d.ts → production-runtime.d-Bzns3NW9.d.ts} +1 -1
- package/dist/{production-runtime.d-CnAsSWgF.d.mts → production-runtime.d-DiFa5vHW.d.mts} +1 -1
- package/dist/{render-plan.d-BxeITFT1.d.ts → render-plan.d-CL_Ikfg_.d.ts} +1 -1
- package/dist/{render-plan.d-Z-93m5GZ.d.mts → render-plan.d-CcF0MeCf.d.mts} +1 -1
- package/dist/renderer-client.d.mts +4 -4
- package/dist/renderer-client.d.ts +4 -4
- package/dist/{request.d-X7Q1vmGF.d.ts → request.d-B1RnTLri.d.ts} +1 -1
- package/dist/{request.d-8_fMFNEb.d.mts → request.d-DarDOCk9.d.mts} +1 -1
- package/dist/request.d.mts +2 -2
- package/dist/request.d.ts +2 -2
- package/dist/{route-rendering.d-BUr3Jp8S.d.ts → route-rendering.d-BTUYCIj4.d.ts} +1 -1
- package/dist/{route-rendering.d-BInmBmul.d.mts → route-rendering.d-D_2Ual0-.d.mts} +1 -1
- package/dist/{router.d-crorSRiW.d.ts → router.d-CMANF6da.d.ts} +1 -1
- package/dist/{router.d-CZQmbpHx.d.mts → router.d-Cuv1jntg.d.mts} +1 -1
- package/dist/{routes.d-BknKQcTu.d.ts → routes.d-B6yFe6jm.d.ts} +1 -1
- package/dist/{routes.d-D1IrO9KK.d.mts → routes.d-c2HKfrfL.d.mts} +1 -1
- package/dist/routes.d.mts +1 -1
- package/dist/routes.d.ts +1 -1
- package/dist/{rsc-pipeline-3MPRULGA.mjs → rsc-pipeline-T3PWURLJ.mjs} +9 -8
- package/dist/{rsc-pipeline-RHEZNBFQ.cjs → rsc-pipeline-V4ANLRAA.cjs} +10 -9
- package/dist/{runtime-OZKFZQCU.cjs → runtime-5AROV2C3.cjs} +29 -17
- package/dist/{runtime-X5UR7VHP.mjs → runtime-LRIQ3XH7.mjs} +26 -14
- package/dist/{runtime.d-CCsjTZJW.d.ts → runtime.d-C3RQUj6_.d.ts} +1 -1
- package/dist/{runtime.d-CETtpLb-.d.mts → runtime.d-wvh4ngU0.d.mts} +1 -1
- package/dist/server-plugins.d.mts +2 -2
- package/dist/server-plugins.d.ts +2 -2
- package/dist/server.cjs +42 -41
- package/dist/server.d.mts +9 -9
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +26 -25
- package/dist/{spa-router.d-CtSHzXlC.d.mts → spa-router.d-WU_qS5gJ.d.mts} +2 -2
- package/dist/{spa-router.d-CCADbSqJ.d.ts → spa-router.d-m8H_Kl_B.d.ts} +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/{utils.d-CjyE-npA.d.ts → utils.d-C9dQD5Zg.d.ts} +1 -1
- package/dist/{utils.d-zFPHKFFJ.d.mts → utils.d-W9IiEqmW.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +21 -19
- package/dist/vite.d.mts +4 -4
- package/dist/vite.d.ts +4 -4
- package/dist/vite.mjs +20 -18
- package/package.json +1 -1
- package/dist/analyzer-KEA5JVDR.cjs +0 -15
- package/dist/chunk-NK2VWS7P.cjs +0 -954
- package/dist/chunk-ZQ5BDNKW.mjs +0 -954
|
@@ -10,9 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-LLZSYFOM.mjs";
|
|
11
11
|
import {
|
|
12
12
|
_readFarmRenderedHtml
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K7OZAVOI.mjs";
|
|
14
14
|
|
|
15
15
|
// src/mobile/native-tree.ts
|
|
16
|
+
var URLENCODED = "application/x-www-form-urlencoded";
|
|
17
|
+
var MULTIPART = "multipart/form-data";
|
|
18
|
+
var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["text", "email", "password", "number", "search", "tel", "url"]);
|
|
19
|
+
var CONTROL_TAGS = /* @__PURE__ */ new Set(["input", "textarea", "select", "button"]);
|
|
16
20
|
var VIEW_TAGS = new Set(
|
|
17
21
|
"div section main article header footer nav aside figure ul ol li hr".split(" ")
|
|
18
22
|
);
|
|
@@ -118,15 +122,29 @@ function settleLineHeight(style) {
|
|
|
118
122
|
}
|
|
119
123
|
return rest;
|
|
120
124
|
}
|
|
125
|
+
function labelText(element) {
|
|
126
|
+
const text = (node) => typeof node === "string" ? node : CONTROL_TAGS.has(node.tag) || node.tag === "option" ? " " : node.children.map(text).join("");
|
|
127
|
+
return text(element).replace(/\s+/g, " ").trim();
|
|
128
|
+
}
|
|
129
|
+
function findNode(node, test) {
|
|
130
|
+
for (const child of node.children ?? []) {
|
|
131
|
+
if (typeof child === "string") continue;
|
|
132
|
+
if (test(child)) return child;
|
|
133
|
+
const found = findNode(child, test);
|
|
134
|
+
if (found) return found;
|
|
135
|
+
}
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
121
138
|
var Converter = class {
|
|
122
139
|
/**
|
|
123
140
|
* `sheets`: the page's stylesheets. Without them, a class the Tailwind table does not know is
|
|
124
141
|
* reported; with them, only one a layered (Tailwind) rule styles is, since a class no rule
|
|
125
142
|
* styles has no effect in a browser either.
|
|
126
143
|
*/
|
|
127
|
-
constructor(pageUrl, sheets) {
|
|
144
|
+
constructor(pageUrl, sheets, labels = /* @__PURE__ */ new Map()) {
|
|
128
145
|
this.pageUrl = pageUrl;
|
|
129
146
|
this.sheets = sheets;
|
|
147
|
+
this.labels = labels;
|
|
130
148
|
this.unsupported = [];
|
|
131
149
|
/** Off while reading the ancestors above the page, which pass down text styles only. */
|
|
132
150
|
this.reporting = true;
|
|
@@ -176,14 +194,75 @@ var Converter = class {
|
|
|
176
194
|
return void 0;
|
|
177
195
|
}
|
|
178
196
|
}
|
|
197
|
+
/** A form's or button's action: absolute http(s), without a fragment; empty means this page. */
|
|
198
|
+
formUrl(value, what) {
|
|
199
|
+
let url;
|
|
200
|
+
try {
|
|
201
|
+
url = new URL(value ?? "", this.pageUrl);
|
|
202
|
+
} catch {
|
|
203
|
+
this.problem(`${what} "${value}"`);
|
|
204
|
+
return void 0;
|
|
205
|
+
}
|
|
206
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
207
|
+
this.problem(`${what} "${value}"`);
|
|
208
|
+
return void 0;
|
|
209
|
+
}
|
|
210
|
+
url.hash = "";
|
|
211
|
+
return url.href;
|
|
212
|
+
}
|
|
213
|
+
method(value, what) {
|
|
214
|
+
const method = value?.toLowerCase();
|
|
215
|
+
if (method === void 0 || method === "") return void 0;
|
|
216
|
+
if (method === "get" || method === "post") return method;
|
|
217
|
+
this.problem(`${what} method "${value}"`);
|
|
218
|
+
return void 0;
|
|
219
|
+
}
|
|
220
|
+
enctype(value, what) {
|
|
221
|
+
const enctype = value?.toLowerCase();
|
|
222
|
+
if (enctype === void 0 || enctype === "") return void 0;
|
|
223
|
+
if (enctype === URLENCODED || enctype === MULTIPART) return enctype;
|
|
224
|
+
this.problem(`${what} enctype "${value}"`);
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
/** What a submit button sends besides its form's fields, and where. */
|
|
228
|
+
submitter(element) {
|
|
229
|
+
const { name, value, formaction, formmethod, formenctype, formtarget } = element.attributes;
|
|
230
|
+
if (formtarget && formtarget !== "_self") this.problem(`<${element.tag}> formtarget`);
|
|
231
|
+
const action = formaction === void 0 ? void 0 : this.formUrl(formaction, `<${element.tag}> formaction`);
|
|
232
|
+
const method = this.method(formmethod, `<${element.tag}>`);
|
|
233
|
+
const enctype = this.enctype(formenctype, `<${element.tag}>`);
|
|
234
|
+
return {
|
|
235
|
+
...name ? { name, value: value ?? "" } : {},
|
|
236
|
+
...action ? { action } : {},
|
|
237
|
+
...method ? { method } : {},
|
|
238
|
+
...enctype ? { enctype } : {}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/** A `<label>` that wraps a field draws as a box: its text, then the field. */
|
|
242
|
+
holdsControl(element) {
|
|
243
|
+
return element.children.some(
|
|
244
|
+
(child) => typeof child !== "string" && (CONTROL_TAGS.has(child.tag) || this.holdsControl(child))
|
|
245
|
+
);
|
|
246
|
+
}
|
|
179
247
|
node(type, element, style, dark) {
|
|
180
248
|
const changed = dark && Object.fromEntries(Object.entries(dark).filter(([key, value]) => style?.[key] !== value));
|
|
181
|
-
|
|
249
|
+
const node = {
|
|
182
250
|
type,
|
|
183
251
|
tag: element.tag,
|
|
184
252
|
...style && Object.keys(style).length > 0 ? { style } : {},
|
|
185
253
|
...changed && Object.keys(changed).length > 0 ? { dark: changed } : {}
|
|
186
254
|
};
|
|
255
|
+
const { role } = element.attributes;
|
|
256
|
+
const level = /^h([1-6])$/.exec(element.tag)?.[1] ?? (role === "heading" ? element.attributes["aria-level"] ?? "2" : void 0);
|
|
257
|
+
if (type === "Text" && level && Number(level) >= 1 && Number(level) <= 6) {
|
|
258
|
+
node.heading = Number(level);
|
|
259
|
+
}
|
|
260
|
+
const label = element.attributes["aria-label"]?.trim();
|
|
261
|
+
if (label) node.label = label;
|
|
262
|
+
if (element.attributes["aria-hidden"] === "true" || role === "presentation" || role === "none" || element.tag === "img" && element.attributes.alt === "") {
|
|
263
|
+
node.hidden = true;
|
|
264
|
+
}
|
|
265
|
+
return node;
|
|
187
266
|
}
|
|
188
267
|
/** Inline content: runs of text, nested inline elements, and line breaks. */
|
|
189
268
|
inline(content, inherited) {
|
|
@@ -266,7 +345,7 @@ var Converter = class {
|
|
|
266
345
|
pending = [];
|
|
267
346
|
};
|
|
268
347
|
for (const child of content) {
|
|
269
|
-
if (typeof child === "string" || INLINE_TAGS.has(child.tag) && !this.isBlockLink(child)) {
|
|
348
|
+
if (typeof child === "string" || INLINE_TAGS.has(child.tag) && !this.isBlockLink(child) && !(child.tag === "label" && this.holdsControl(child))) {
|
|
270
349
|
pending.push(child);
|
|
271
350
|
continue;
|
|
272
351
|
}
|
|
@@ -277,8 +356,31 @@ var Converter = class {
|
|
|
277
356
|
flush();
|
|
278
357
|
return nodes;
|
|
279
358
|
}
|
|
359
|
+
/** `<input type="submit">`: a button whose label is its value. */
|
|
360
|
+
submitButton(element, passed, box, boxDark) {
|
|
361
|
+
const node = this.node("Pressable", element, box, boxDark);
|
|
362
|
+
const label = this.text(
|
|
363
|
+
{ tag: "#text", attributes: {}, children: [] },
|
|
364
|
+
[element.attributes.value ?? "Submit"],
|
|
365
|
+
passed
|
|
366
|
+
);
|
|
367
|
+
if (label) node.children = [label];
|
|
368
|
+
if (element.attributes.disabled !== void 0) node.disabled = true;
|
|
369
|
+
else node.submit = this.submitter(element);
|
|
370
|
+
return node;
|
|
371
|
+
}
|
|
280
372
|
element(element, inherited, flexItem = false) {
|
|
281
373
|
if (SKIPPED_TAGS.has(element.tag)) return void 0;
|
|
374
|
+
if (element.attributes.form !== void 0 && CONTROL_TAGS.has(element.tag)) {
|
|
375
|
+
this.problem(`<${element.tag}> form="${element.attributes.form}"`);
|
|
376
|
+
}
|
|
377
|
+
if (element.tag === "input" && element.attributes.type?.toLowerCase() === "hidden") {
|
|
378
|
+
const { name, value, disabled } = element.attributes;
|
|
379
|
+
if (this.form && name && disabled === void 0) {
|
|
380
|
+
this.form.fields.push({ name, value: value ?? "" });
|
|
381
|
+
}
|
|
382
|
+
return void 0;
|
|
383
|
+
}
|
|
282
384
|
const own = this.stylesOf(element);
|
|
283
385
|
if (own.style.display === "none") return void 0;
|
|
284
386
|
const passed = {
|
|
@@ -296,6 +398,15 @@ var Converter = class {
|
|
|
296
398
|
const box = current(withoutText(own.style), passed.style.color);
|
|
297
399
|
const boxDark = current(withoutText(own.dark), passed.dark.color ?? passed.style.color);
|
|
298
400
|
const flex = own.style.display === "flex";
|
|
401
|
+
if (element.tag === "label" && this.holdsControl(element)) {
|
|
402
|
+
const node = this.node("View", element, box, boxDark);
|
|
403
|
+
const children = this.blocks(element.children, passed, flex);
|
|
404
|
+
if (children.length > 0) node.children = children;
|
|
405
|
+
const text = labelText(element);
|
|
406
|
+
const field = findNode(node, (child) => child.type === "TextInput");
|
|
407
|
+
if (text && field && !field.label) field.label = text;
|
|
408
|
+
return node;
|
|
409
|
+
}
|
|
299
410
|
const textBox = flexItem && INLINE_TAGS.has(element.tag) && element.tag !== "a" && element.tag !== "br";
|
|
300
411
|
if (BLOCK_TEXT_TAGS.has(element.tag) || textBox) {
|
|
301
412
|
if (element.children.some((child) => typeof child !== "string" && !INLINE_TAGS.has(child.tag))) {
|
|
@@ -311,21 +422,76 @@ var Converter = class {
|
|
|
311
422
|
if (!node.src) this.problem("<img> without src");
|
|
312
423
|
return node;
|
|
313
424
|
}
|
|
425
|
+
if (element.tag === "form") {
|
|
426
|
+
if (this.form) {
|
|
427
|
+
this.problem("<form> inside a form");
|
|
428
|
+
return void 0;
|
|
429
|
+
}
|
|
430
|
+
const { action, method, enctype, target } = element.attributes;
|
|
431
|
+
if (target && target !== "_self") this.problem(`<form> target="${target}"`);
|
|
432
|
+
const node = this.node("View", element, box, boxDark);
|
|
433
|
+
const form = {
|
|
434
|
+
action: this.formUrl(action, "<form> action") ?? "",
|
|
435
|
+
method: this.method(method, "<form>") ?? "get"
|
|
436
|
+
};
|
|
437
|
+
if (this.enctype(enctype, "<form>") === MULTIPART) form.enctype = MULTIPART;
|
|
438
|
+
this.form = { fields: [] };
|
|
439
|
+
try {
|
|
440
|
+
const children = this.blocks(element.children, passed, flex);
|
|
441
|
+
if (children.length > 0) node.children = children;
|
|
442
|
+
if (this.form.fields.length > 0) form.fields = this.form.fields;
|
|
443
|
+
} finally {
|
|
444
|
+
this.form = void 0;
|
|
445
|
+
}
|
|
446
|
+
node.form = form;
|
|
447
|
+
return node;
|
|
448
|
+
}
|
|
314
449
|
if (element.tag === "input" || element.tag === "textarea") {
|
|
450
|
+
const { attributes } = element;
|
|
451
|
+
const type = element.tag === "input" ? (attributes.type ?? "text").toLowerCase() : "text";
|
|
452
|
+
if (!this.form) this.problem(`<${element.tag}> has no form to submit it`);
|
|
453
|
+
if (type === "submit") return this.submitButton(element, passed, box, boxDark);
|
|
454
|
+
if (!TEXT_INPUT_TYPES.has(type)) this.problem(`<input type="${type}">`);
|
|
315
455
|
const node = this.node(
|
|
316
456
|
"TextInput",
|
|
317
457
|
element,
|
|
318
458
|
settleLineHeight({ ...passed.style, ...box }),
|
|
319
459
|
boxDark
|
|
320
460
|
);
|
|
321
|
-
if (
|
|
322
|
-
|
|
461
|
+
if (attributes.name) node.name = attributes.name;
|
|
462
|
+
if (!node.label && attributes.id && this.labels.has(attributes.id)) {
|
|
463
|
+
node.label = this.labels.get(attributes.id);
|
|
464
|
+
}
|
|
465
|
+
if (type !== "text") node.inputType = type;
|
|
466
|
+
if (element.tag === "textarea") node.multiline = true;
|
|
467
|
+
if (attributes.placeholder) node.placeholder = attributes.placeholder;
|
|
468
|
+
const value = element.tag === "textarea" ? textContent(element) : attributes.value;
|
|
323
469
|
if (value) node.value = value;
|
|
470
|
+
if (attributes.required !== void 0) node.required = true;
|
|
471
|
+
if (attributes.disabled !== void 0) node.disabled = true;
|
|
472
|
+
if (attributes.readonly !== void 0) node.readOnly = true;
|
|
473
|
+
const maxLength = Number(attributes.maxlength);
|
|
474
|
+
if (attributes.maxlength && Number.isInteger(maxLength) && maxLength >= 0) {
|
|
475
|
+
node.maxLength = maxLength;
|
|
476
|
+
}
|
|
324
477
|
return node;
|
|
325
478
|
}
|
|
326
|
-
if (element.tag === "
|
|
479
|
+
if (element.tag === "button") {
|
|
480
|
+
const type = (element.attributes.type ?? "submit").toLowerCase();
|
|
481
|
+
if (!this.form) {
|
|
482
|
+
this.problem("<button> has no link or form to submit");
|
|
483
|
+
} else if (type !== "submit") {
|
|
484
|
+
this.problem(`<button type="${type}">`);
|
|
485
|
+
}
|
|
327
486
|
const node = this.node("Pressable", element, box, boxDark);
|
|
328
|
-
|
|
487
|
+
node.children = this.blocks(element.children, passed, flex);
|
|
488
|
+
if (element.attributes.disabled !== void 0) node.disabled = true;
|
|
489
|
+
else node.submit = this.submitter(element);
|
|
490
|
+
return node;
|
|
491
|
+
}
|
|
492
|
+
if (element.tag === "a") {
|
|
493
|
+
const node = this.node("Pressable", element, box, boxDark);
|
|
494
|
+
node.href = this.url(element.attributes.href);
|
|
329
495
|
node.children = this.blocks(element.children, passed, flex);
|
|
330
496
|
return node;
|
|
331
497
|
}
|
|
@@ -420,9 +586,18 @@ function parsedStylesheet(css) {
|
|
|
420
586
|
}
|
|
421
587
|
function createFarmNativeTree(html, pageUrl, stylesheets) {
|
|
422
588
|
const title = /<title\b[^>]*>([\s\S]*?)<\/title>/i.exec(html)?.[1];
|
|
423
|
-
const document = parseHtml(_readFarmRenderedHtml(html));
|
|
589
|
+
const document = parseHtml(_readFarmRenderedHtml(html, { keepAriaHidden: true }));
|
|
424
590
|
const page = find(document, (element) => element.attributes.id === "__farm_page__") ?? find(document, (element) => element.attributes.id === "root") ?? find(document, (element) => element.tag === "body") ?? document;
|
|
425
|
-
const
|
|
591
|
+
const labels = /* @__PURE__ */ new Map();
|
|
592
|
+
const collectLabels = (element) => {
|
|
593
|
+
if (element.tag === "label" && element.attributes.for) {
|
|
594
|
+
const text = labelText(element);
|
|
595
|
+
if (text) labels.set(element.attributes.for, text);
|
|
596
|
+
}
|
|
597
|
+
for (const child of element.children) if (typeof child !== "string") collectLabels(child);
|
|
598
|
+
};
|
|
599
|
+
collectLabels(page);
|
|
600
|
+
const converter = new Converter(pageUrl, stylesheets?.map(parsedStylesheet), labels);
|
|
426
601
|
const ancestors = [];
|
|
427
602
|
for (let element = page.parent; element; element = element.parent) ancestors.unshift(element);
|
|
428
603
|
const inherited = { style: {}, dark: {} };
|
|
@@ -478,20 +653,22 @@ async function createFarmNativeTreeResponse(options) {
|
|
|
478
653
|
const headers = new Headers(options.request.headers);
|
|
479
654
|
headers.set("accept", "text/html");
|
|
480
655
|
headers.delete("accept-encoding");
|
|
656
|
+
headers.set("x-farm-native-tree", "1");
|
|
657
|
+
const submitted = options.request.method === "POST";
|
|
658
|
+
const init = submitted ? { method: "POST", headers, body: options.request.body, duplex: "half" } : { method: "GET", headers };
|
|
481
659
|
const page = await options.renderPage(
|
|
482
|
-
new Request(options.request.url, {
|
|
483
|
-
method: "GET",
|
|
484
|
-
headers,
|
|
485
|
-
signal: options.request.signal
|
|
486
|
-
})
|
|
660
|
+
new Request(options.request.url, { ...init, signal: options.request.signal })
|
|
487
661
|
);
|
|
662
|
+
const cookies = page.headers.getSetCookie?.() ?? [];
|
|
488
663
|
const type = page.headers.get("content-type") ?? "";
|
|
489
|
-
|
|
664
|
+
const drawn = page.status === 200 || submitted && page.status >= 400 && page.status < 500;
|
|
665
|
+
if (!drawn || !type.includes("text/html")) return page;
|
|
490
666
|
const html = await page.text();
|
|
491
|
-
const
|
|
667
|
+
const requestUrl = new URL(options.request.url);
|
|
668
|
+
const pageUrl = options.origin ? new URL(requestUrl.pathname + requestUrl.search, options.origin) : requestUrl;
|
|
492
669
|
const load = options.loadStylesheet ?? (async (href) => {
|
|
493
670
|
const response = await options.renderPage(
|
|
494
|
-
new Request(new URL(href,
|
|
671
|
+
new Request(new URL(href, requestUrl), {
|
|
495
672
|
headers: { accept: "text/css,*/*;q=0.1", cookie: headers.get("cookie") ?? "" },
|
|
496
673
|
signal: options.request.signal
|
|
497
674
|
})
|
|
@@ -507,12 +684,13 @@ async function createFarmNativeTreeResponse(options) {
|
|
|
507
684
|
root: { type: "View", tag: "#root" },
|
|
508
685
|
unsupported: [`stylesheet "${source.href}" could not be read`]
|
|
509
686
|
};
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
687
|
+
const out2 = new Headers({
|
|
688
|
+
"Content-Type": `${FARM_NATIVE_TREE_CONTENT_TYPE}; charset=utf-8`,
|
|
689
|
+
Vary: "Accept",
|
|
690
|
+
"Cache-Control": "no-store"
|
|
515
691
|
});
|
|
692
|
+
for (const cookie of cookies) out2.append("Set-Cookie", cookie);
|
|
693
|
+
return new Response(JSON.stringify(tree2), { headers: out2 });
|
|
516
694
|
}
|
|
517
695
|
stylesheets.push(css);
|
|
518
696
|
}
|
|
@@ -520,11 +698,12 @@ async function createFarmNativeTreeResponse(options) {
|
|
|
520
698
|
const out = new Headers({
|
|
521
699
|
"Content-Type": `${FARM_NATIVE_TREE_CONTENT_TYPE}; charset=utf-8`,
|
|
522
700
|
Vary: "Accept",
|
|
523
|
-
|
|
701
|
+
// The answer to a POST is that submission's result, never a cacheable page.
|
|
702
|
+
"Cache-Control": (submitted ? void 0 : page.headers.get("cache-control")) ?? "no-store"
|
|
524
703
|
});
|
|
525
|
-
for (const cookie of
|
|
704
|
+
for (const cookie of cookies) out.append("Set-Cookie", cookie);
|
|
526
705
|
return new Response(options.request.method === "HEAD" ? null : JSON.stringify(tree), {
|
|
527
|
-
status:
|
|
706
|
+
status: page.status,
|
|
528
707
|
headers: out
|
|
529
708
|
});
|
|
530
709
|
}
|
|
@@ -892,13 +892,14 @@ function extractHtmlTitle(html) {
|
|
|
892
892
|
function readHtmlContentRegion(html) {
|
|
893
893
|
return extractHtmlBody(_readFarmRenderedHtml(html));
|
|
894
894
|
}
|
|
895
|
-
function _readFarmRenderedHtml(html) {
|
|
895
|
+
function _readFarmRenderedHtml(html, options = {}) {
|
|
896
896
|
const streamed = readStreamedBoundaryInstructions(html);
|
|
897
897
|
return removeHiddenElements(
|
|
898
898
|
resolveStreamedBoundaries(
|
|
899
899
|
html.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi, ""),
|
|
900
900
|
streamed
|
|
901
|
-
).replace(/<!--[\s\S]*?-->/g, "")
|
|
901
|
+
).replace(/<!--[\s\S]*?-->/g, ""),
|
|
902
|
+
options.keepAriaHidden
|
|
902
903
|
);
|
|
903
904
|
}
|
|
904
905
|
function extractHtmlBody(html) {
|
|
@@ -1182,7 +1183,7 @@ var VOID_TAGS = /* @__PURE__ */ new Set([
|
|
|
1182
1183
|
"track",
|
|
1183
1184
|
"wbr"
|
|
1184
1185
|
]);
|
|
1185
|
-
function removeHiddenElements(html) {
|
|
1186
|
+
function removeHiddenElements(html, keepAriaHidden = false) {
|
|
1186
1187
|
if (!/hidden/i.test(html)) return html;
|
|
1187
1188
|
const openingTag = /<([a-zA-Z][\w:-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
|
|
1188
1189
|
let closingTags;
|
|
@@ -1191,7 +1192,7 @@ function removeHiddenElements(html) {
|
|
|
1191
1192
|
let match;
|
|
1192
1193
|
while (match = openingTag.exec(html)) {
|
|
1193
1194
|
const [tag, name, attributes] = match;
|
|
1194
|
-
if (!isHiddenElement(attributes)) continue;
|
|
1195
|
+
if (!isHiddenElement(attributes, keepAriaHidden)) continue;
|
|
1195
1196
|
const start = match.index;
|
|
1196
1197
|
let end = start + tag.length;
|
|
1197
1198
|
if (!VOID_TAGS.has(name.toLowerCase()) && !isSelfClosingTag(tag)) {
|
|
@@ -1206,13 +1207,13 @@ function removeHiddenElements(html) {
|
|
|
1206
1207
|
}
|
|
1207
1208
|
return result + html.slice(cursor);
|
|
1208
1209
|
}
|
|
1209
|
-
function isHiddenElement(attributes) {
|
|
1210
|
+
function isHiddenElement(attributes, keepAriaHidden = false) {
|
|
1210
1211
|
const attribute = /([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
|
|
1211
1212
|
let match;
|
|
1212
1213
|
while (match = attribute.exec(attributes)) {
|
|
1213
1214
|
const name = match[1].toLowerCase();
|
|
1214
1215
|
const value = (match[2] ?? match[3] ?? match[4] ?? "").trim().toLowerCase();
|
|
1215
|
-
if (name === "aria-hidden" && value === "true") return true;
|
|
1216
|
+
if (name === "aria-hidden" && value === "true" && !keepAriaHidden) return true;
|
|
1216
1217
|
if (name === "hidden" && value !== "until-found") return true;
|
|
1217
1218
|
}
|
|
1218
1219
|
return false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectFarmLlmsTxtPages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KL7SHLQB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getFarmMarkdownMirrorPath,
|
|
6
6
|
isFarmMarkdownMirrorExposed
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-K7OZAVOI.mjs";
|
|
8
8
|
import {
|
|
9
9
|
_listFarmMCPCatalogs,
|
|
10
10
|
_listFarmRegisteredMCPServers
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFJWN7RV4cjs = require('./chunk-FJWN7RV4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
@@ -166,12 +166,12 @@ function createFarmDefaultSitemap(sources, options) {
|
|
|
166
166
|
for (const source of sources) {
|
|
167
167
|
const path = source.pattern;
|
|
168
168
|
if (path.includes("[") || path.includes("(") || entries.has(path)) continue;
|
|
169
|
-
if (include.length && !include.some((pattern) =>
|
|
169
|
+
if (include.length && !include.some((pattern) => _chunk2C5L5RPMcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
|
|
170
170
|
continue;
|
|
171
171
|
}
|
|
172
|
-
if (exclude.some((pattern) =>
|
|
172
|
+
if (exclude.some((pattern) => _chunk2C5L5RPMcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
|
|
173
173
|
const module = isRecord(source.module) ? source.module : void 0;
|
|
174
|
-
if (
|
|
174
|
+
if (_chunkFJWN7RV4cjs.isFarmMetadataNoIndex.call(void 0, _optionalChain([module, 'optionalAccess', _2 => _2.metadata]))) continue;
|
|
175
175
|
if (_optionalChain([module, 'optionalAccess', _3 => _3.__farmRouteGuard])) continue;
|
|
176
176
|
entries.set(path, {
|
|
177
177
|
url: new URL(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, path, options.basePath), base).href,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkY5TOT5F6cjs = require('./chunk-Y5TOT5F6.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
@@ -36,10 +36,10 @@ async function handleFarmDefaultMCPRequest(request, context) {
|
|
|
36
36
|
return transportError(403, "Cross-origin requests are not allowed.");
|
|
37
37
|
}
|
|
38
38
|
const protocolHeader = request.headers.get("mcp-protocol-version");
|
|
39
|
-
if (protocolHeader && !
|
|
39
|
+
if (protocolHeader && !_chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(protocolHeader.trim())) {
|
|
40
40
|
return transportError(
|
|
41
41
|
400,
|
|
42
|
-
`Unsupported MCP-Protocol-Version: ${protocolHeader.slice(0, 32)}. Supported: ${
|
|
42
|
+
`Unsupported MCP-Protocol-Version: ${protocolHeader.slice(0, 32)}. Supported: ${_chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.join(", ")}.`
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
const contentType = _nullishCoalesce(request.headers.get("content-type"), () => ( ""));
|
|
@@ -95,7 +95,7 @@ async function dispatch(method, params, request, context) {
|
|
|
95
95
|
switch (method) {
|
|
96
96
|
case "initialize": {
|
|
97
97
|
const requested = isRecord(params) ? params.protocolVersion : void 0;
|
|
98
|
-
const protocolVersion = typeof requested === "string" &&
|
|
98
|
+
const protocolVersion = typeof requested === "string" && _chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS.includes(requested) ? requested : _chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_PROTOCOL_VERSIONS[0];
|
|
99
99
|
return {
|
|
100
100
|
protocolVersion,
|
|
101
101
|
capabilities: { tools: { listChanged: false } },
|
|
@@ -103,7 +103,7 @@ async function dispatch(method, params, request, context) {
|
|
|
103
103
|
name: context.server.name,
|
|
104
104
|
version: context.server.version,
|
|
105
105
|
...context.server.title ? { title: context.server.title } : {},
|
|
106
|
-
description:
|
|
106
|
+
description: _chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_DESCRIPTION
|
|
107
107
|
},
|
|
108
108
|
instructions: INSTRUCTIONS
|
|
109
109
|
};
|
|
@@ -111,7 +111,7 @@ async function dispatch(method, params, request, context) {
|
|
|
111
111
|
case "ping":
|
|
112
112
|
return {};
|
|
113
113
|
case "tools/list":
|
|
114
|
-
return { tools:
|
|
114
|
+
return { tools: _chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_TOOLS };
|
|
115
115
|
case "tools/call":
|
|
116
116
|
return callTool(params, request, context);
|
|
117
117
|
default:
|
|
@@ -122,7 +122,7 @@ async function callTool(params, request, context) {
|
|
|
122
122
|
if (!isRecord(params) || typeof params.name !== "string") {
|
|
123
123
|
throw new FarmMCPRequestError(INVALID_PARAMS, "tools/call needs a tool name.");
|
|
124
124
|
}
|
|
125
|
-
const tool =
|
|
125
|
+
const tool = _chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_TOOLS.find(({ name }) => name === params.name);
|
|
126
126
|
if (!tool) {
|
|
127
127
|
throw new FarmMCPRequestError(INVALID_PARAMS, `Unknown tool: ${params.name.slice(0, 64)}`);
|
|
128
128
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkC7DCMGC4cjs = require('./chunk-C7DCMGC4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
|
|
@@ -75,7 +75,7 @@ function resolveFarmInfraAnalytics(env = processEnv()) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
function classifyFarmInfraAgent(userAgent) {
|
|
78
|
-
return
|
|
78
|
+
return _chunk2C5L5RPMcjs.classifyFarmAgent.call(void 0, userAgent);
|
|
79
79
|
}
|
|
80
80
|
function routeTemplate(pattern) {
|
|
81
81
|
return typeof pattern === "string" && pattern.length <= 256 && /^\/(?!\/)[a-zA-Z0-9_./:[\]()*-]*$/.test(pattern) ? pattern : "/[unmatched]";
|
|
@@ -273,7 +273,7 @@ function requestEvent(metadata, method, status, durationMs) {
|
|
|
273
273
|
id: uuid(),
|
|
274
274
|
requestId: metadata.id,
|
|
275
275
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
276
|
-
route: routeTemplate(
|
|
276
|
+
route: routeTemplate(_chunkC7DCMGC4cjs.getFarmRouteLabel.call(void 0, metadata.route)),
|
|
277
277
|
agent: metadata.agent,
|
|
278
278
|
kind: "request",
|
|
279
279
|
method,
|
|
@@ -286,7 +286,7 @@ function toolEvent(metadata, event) {
|
|
|
286
286
|
id: uuid(),
|
|
287
287
|
requestId: metadata.id,
|
|
288
288
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
289
|
-
route: routeTemplate(
|
|
289
|
+
route: routeTemplate(_chunkC7DCMGC4cjs.getFarmRouteLabel.call(void 0, metadata.route)),
|
|
290
290
|
agent: metadata.agent,
|
|
291
291
|
kind: "mcp.tool",
|
|
292
292
|
tool: event.tool,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FARM_RSC_INSTALL_HINT,
|
|
3
3
|
findFarmAppPackageDir
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HCGWDRZO.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createFarmDevLoopbackPlugin
|
|
7
7
|
} from "./chunk-FN5UEC7I.mjs";
|
|
8
8
|
import {
|
|
9
9
|
resolveDeployOutputPath
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2L54YV25.mjs";
|
|
11
11
|
import {
|
|
12
12
|
farmDesktopDevGuardPlugin,
|
|
13
13
|
loadFarmReactPlugin
|