@farming-labs/farmjs 0.2.119 → 0.2.121
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/README.md +25 -0
- package/dist/agent-skills.d.ts +13 -0
- package/dist/agent-skills.d.ts.map +1 -0
- package/dist/agent-skills.js +62 -0
- package/dist/agent-skills.js.map +1 -0
- package/dist/config-values.d.ts +9 -0
- package/dist/config-values.d.ts.map +1 -0
- package/dist/config-values.js +55 -0
- package/dist/config-values.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -6
- package/dist/config.js.map +1 -1
- package/dist/mdx-build-cache.d.ts +25 -0
- package/dist/mdx-build-cache.d.ts.map +1 -0
- package/dist/mdx-build-cache.js +140 -0
- package/dist/mdx-build-cache.js.map +1 -0
- package/dist/mdx-compiler-fingerprint.d.ts +5 -0
- package/dist/mdx-compiler-fingerprint.d.ts.map +1 -0
- package/dist/mdx-compiler-fingerprint.js +131 -0
- package/dist/mdx-compiler-fingerprint.js.map +1 -0
- package/dist/mdx-core.d.ts +4 -0
- package/dist/mdx-core.d.ts.map +1 -0
- package/dist/mdx-core.js +23 -0
- package/dist/mdx-core.js.map +1 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -2
- package/dist/react.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +55 -14
- package/dist/server.js.map +1 -1
- package/dist/shell-plugin.d.ts +7 -0
- package/dist/shell-plugin.d.ts.map +1 -0
- package/dist/shell-plugin.js +26 -0
- package/dist/shell-plugin.js.map +1 -0
- package/dist/shell.d.ts +11 -0
- package/dist/shell.d.ts.map +1 -0
- package/dist/shell.js +11 -0
- package/dist/shell.js.map +1 -0
- package/dist/vite.d.ts +9 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +83 -7
- package/dist/vite.js.map +1 -1
- package/package.json +9 -4
package/dist/mdx-core.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
let compilerEntry;
|
|
4
|
+
try {
|
|
5
|
+
compilerEntry = import.meta.resolve("@farming-labs/docs/mdx");
|
|
6
|
+
}
|
|
7
|
+
catch (error) {
|
|
8
|
+
// Fall back only when the older core lacks this export. A broken compiler
|
|
9
|
+
// must still report its error instead of silently loading another module.
|
|
10
|
+
if (error.code !== "ERR_PACKAGE_PATH_NOT_EXPORTED")
|
|
11
|
+
throw error;
|
|
12
|
+
}
|
|
13
|
+
// Farm requires Node >=22.13, which supports synchronous ESM loading. Avoid
|
|
14
|
+
// top-level await so existing CommonJS configs can still require the adapter.
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const helpers = compilerEntry
|
|
17
|
+
? require(fileURLToPath(compilerEntry))
|
|
18
|
+
: {
|
|
19
|
+
...require(fileURLToPath(import.meta.resolve("@farming-labs/docs"))),
|
|
20
|
+
...require(fileURLToPath(import.meta.resolve("@farming-labs/docs/server"))),
|
|
21
|
+
};
|
|
22
|
+
export const { applyDocsMarkdownHeadingAnchors, encodeDocsHeadingTocUrls, isolateDocsMarkdownPromptReferences, remarkCodeGroup, withDocsMarkdownRenderableHeadings, } = helpers;
|
|
23
|
+
//# sourceMappingURL=mdx-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-core.js","sourceRoot":"","sources":["../src/mdx-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAczC,IAAI,aAAiC,CAAC;AACtC,IAAI,CAAC;IACH,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAChE,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,0EAA0E;IAC1E,0EAA0E;IAC1E,IAAK,KAA+B,CAAC,IAAI,KAAK,+BAA+B;QAAE,MAAM,KAAK,CAAC;AAC7F,CAAC;AAED,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAY,aAAa;IACpC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,CAAC,CAAC;QACE,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC;QACpE,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;KAC5E,CAAC;AAEN,MAAM,CAAC,MAAM,EACX,+BAA+B,EAC/B,wBAAwB,EACxB,mCAAmC,EACnC,eAAe,EACf,kCAAkC,GACnC,GAAG,OAAO,CAAC"}
|
package/dist/react.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare function FarmDocsPage({ config, data, navigation, }: {
|
|
|
16
16
|
export declare function hydrateFarmDocs(input: {
|
|
17
17
|
config: DocsConfig;
|
|
18
18
|
data: DocsServerLoadResult;
|
|
19
|
+
/** The docs config module, when the server flagged values its JSON copy dropped. */
|
|
20
|
+
configModule?: unknown;
|
|
19
21
|
container?: Element | null;
|
|
20
22
|
}): Promise<Root>;
|
|
21
23
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAkBxD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhF;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,IAAI,EACJ,UAAU,GACX,EAAE;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACvC,2CAYA;AAgHD,wBAAsB,eAAe,CAAC,KAAK,EAAE;IAC3C,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,oFAAoF;IACpF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB"}
|
package/dist/react.js
CHANGED
|
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { startTransition, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { hydrateRoot } from "react-dom/client";
|
|
4
4
|
import { createFarmDocsNavigator, } from "./navigation.js";
|
|
5
|
+
import { restoreUnserializableValues } from "./config-values.js";
|
|
6
|
+
import FarmDocsShell from "@farming-labs/farmjs/shell";
|
|
5
7
|
import { FarmDocsPageRenderer } from "./page.js";
|
|
6
8
|
import { createFarmDocsPageModules } from "./page-modules.js";
|
|
7
9
|
// One chunk per Markdown page, loaded only for the page being shown. An eager
|
|
@@ -18,7 +20,7 @@ export function loadFarmDocsPageModule(data) {
|
|
|
18
20
|
}
|
|
19
21
|
export function FarmDocsPage({ config, data, navigation, }) {
|
|
20
22
|
const module = pageModules.get(data);
|
|
21
|
-
return (_jsx(FarmDocsPageRenderer, { config: config, data: data, Content: module?.default, navigation: navigation }));
|
|
23
|
+
return (_jsx(FarmDocsShell, { children: _jsx(FarmDocsPageRenderer, { config: config, data: data, Content: module?.default, navigation: navigation }) }));
|
|
22
24
|
}
|
|
23
25
|
function scrollToNavigationTarget(url) {
|
|
24
26
|
if (!url.hash) {
|
|
@@ -115,6 +117,9 @@ export async function hydrateFarmDocs(input) {
|
|
|
115
117
|
}
|
|
116
118
|
// Hydrate with the page's Markdown in hand, so the first render matches the server's.
|
|
117
119
|
await loadFarmDocsPageModule(input.data);
|
|
118
|
-
|
|
120
|
+
const config = input.configModule
|
|
121
|
+
? restoreUnserializableValues(input.config, input.configModule)
|
|
122
|
+
: input.config;
|
|
123
|
+
return hydrateRoot(container, _jsx(FarmDocsClient, { config: config, data: input.data }));
|
|
119
124
|
}
|
|
120
125
|
//# sourceMappingURL=react.js.map
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAa,MAAM,kBAAkB,CAAC;AAI1D,OAAO,EACL,uBAAuB,GAGxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAA0B,MA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AC;IACjB,OAAO,WAAW,CAAC,SAAS,EAAE,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI,CAAC,CAAC;AACtF,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,aAAa,EAAqB,MAAM,OAAO,CAAC;AA8E7E,OAAO,KAAK,EAAgD,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAanG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,aAAa,EAAqB,MAAM,OAAO,CAAC;AA8E7E,OAAO,KAAK,EAAgD,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAanG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EACL,eAAe,EAMhB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAiC,MAAM,cAAc,CAAC;AAI5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AA0I9D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IACzC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,GAAG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,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAED,UAAU,oBAAoB;IAC5B,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,UAAU,mBAAmB;IAC3B,YAAY,EAAE,aAAa,CAAC;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,oBAAoB,CAAA;KAAE,CAAC,CAAC;IAChF,oFAAoF;IACpF,sBAAsB,CAAC,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CACnB,QAAQ,EAAE,MAAM,KACb,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IAClF,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACtD;AAsiBD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,UAAU,CAioDxE;AAoMD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxC,OAAO,GAAE,6BAAkC,IAQQ,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA+F/F"}
|
package/dist/server.js
CHANGED
|
@@ -6,13 +6,34 @@ import { createElement } from "react";
|
|
|
6
6
|
import * as ReactDOMServer from "react-dom/server";
|
|
7
7
|
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsSearchFacets, buildDocsAgentDiscoverySpec, compactDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsContentChangeFeed, createDocsContentChangesHttpResponse, createDocsCacheableResponse, createDocsStandardsDiscoveryResponse, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, formatDocsLastModifiedDate, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsAgentManifestLinkHeader, getDocsDiscoveryLinkHeader, isDocsAgentDiscoveryRequest, isDocsContentChangesRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, normalizeDocsOkfTrustMetadataInput, parseDocsAgentFeedbackData, performDocsSearch, performDocsSearchWithMetadata, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveDocsSearchAudience, resolveDocsSearchError, resolveDocsSearchRequest, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsContentChangesConfig, resolveDocsRequestApiRoute, resolveDocsRetrievalLastModified, resolveDocsPublishedAgentSkill, resolveDocsStandardsDiscoveryRequest, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, withDocsOpenApiOperationCounts, } from "@farming-labs/docs";
|
|
8
8
|
import { buildApiReferenceOpenApiDocumentAsync, buildApiReferenceOperationPagesAsync, createApiReferenceOperationMarkdownResponse, createDocsMcpHttpHandler, readDocsSitemapManifest, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveDocsMcpConfig, resolveConfiguredAgentSkills, } from "@farming-labs/docs/server";
|
|
9
|
+
import { bundledAgentSkills, bundledRootDocuments } from "@farming-labs/docs/agent-skills-bundle";
|
|
9
10
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree, normalizeDocsFrontmatterLastmod, readFarmDocsLastModifiedManifest, resolveFarmDocsLastModified, } from "./content.js";
|
|
10
11
|
import farmDocsBrowserCss from "./browser-css.generated.js";
|
|
12
|
+
import { hasUnserializableValues } from "./config-values.js";
|
|
11
13
|
import { FARM_DOCS_NAVIGATION_HEADER } from "./runtime.js";
|
|
12
14
|
export { createFarmjsApiReference } from "./api-reference.js";
|
|
13
15
|
const FARM_DOCS_BROWSER_CSS_PATH = "/__farm_docs/browser.css";
|
|
16
|
+
const FARM_DOCS_BROWSER_CSS_LAYER = "farm-docs-adapter";
|
|
17
|
+
/**
|
|
18
|
+
* The theme's precompiled browser CSS carries Tailwind's preflight and utilities outside any
|
|
19
|
+
* cascade layer, and unlayered rules beat every layered one. Served as is, `.border` from it
|
|
20
|
+
* overrode a host app's own `border-l-4` in `@layer utilities`. Inside a layer declared before
|
|
21
|
+
* the host's stylesheets, it stays the lowest-priority default the host overrides, as it does
|
|
22
|
+
* when the host compiles the theme itself. `@property` rules stay top-level: they register custom
|
|
23
|
+
* properties and do not take part in the cascade.
|
|
24
|
+
*/
|
|
25
|
+
function layerFarmDocsBrowserCss(css) {
|
|
26
|
+
const properties = [];
|
|
27
|
+
const rules = css.replace(/@property\s+[^{]+\{[^}]*\}\s*/g, (rule) => {
|
|
28
|
+
properties.push(rule.trim());
|
|
29
|
+
return "";
|
|
30
|
+
});
|
|
31
|
+
return `${properties.join("\n")}\n@layer ${FARM_DOCS_BROWSER_CSS_LAYER} {\n${rules}\n}\n`;
|
|
32
|
+
}
|
|
33
|
+
let layeredFarmDocsBrowserCss;
|
|
14
34
|
function loadFarmDocsBrowserCss() {
|
|
15
|
-
|
|
35
|
+
layeredFarmDocsBrowserCss ??= layerFarmDocsBrowserCss(farmDocsBrowserCss);
|
|
36
|
+
return layeredFarmDocsBrowserCss;
|
|
16
37
|
}
|
|
17
38
|
async function renderFarmDocsMarkup(element) {
|
|
18
39
|
const server = ReactDOMServer;
|
|
@@ -470,7 +491,7 @@ function findPageInMap(contentMap, dirPrefix, slug) {
|
|
|
470
491
|
}
|
|
471
492
|
return null;
|
|
472
493
|
}
|
|
473
|
-
function readRootSkillDocument(contentMap, rootDir) {
|
|
494
|
+
function readRootSkillDocument(contentMap, rootDir, rootDocuments) {
|
|
474
495
|
if (contentMap) {
|
|
475
496
|
for (const key of ["/skill.md", "skill.md", "./skill.md"]) {
|
|
476
497
|
const raw = contentMap[key];
|
|
@@ -478,6 +499,8 @@ function readRootSkillDocument(contentMap, rootDir) {
|
|
|
478
499
|
return raw;
|
|
479
500
|
}
|
|
480
501
|
}
|
|
502
|
+
if (typeof rootDocuments?.["skill.md"] === "string")
|
|
503
|
+
return rootDocuments["skill.md"];
|
|
481
504
|
const candidate = path.join(rootDir, "skill.md");
|
|
482
505
|
try {
|
|
483
506
|
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
@@ -489,7 +512,7 @@ function readRootSkillDocument(contentMap, rootDir) {
|
|
|
489
512
|
}
|
|
490
513
|
return null;
|
|
491
514
|
}
|
|
492
|
-
function readRootAgentsDocument(contentMap, rootDir) {
|
|
515
|
+
function readRootAgentsDocument(contentMap, rootDir, rootDocuments) {
|
|
493
516
|
if (contentMap) {
|
|
494
517
|
for (const key of [
|
|
495
518
|
"/AGENTS.md",
|
|
@@ -504,6 +527,10 @@ function readRootAgentsDocument(contentMap, rootDir) {
|
|
|
504
527
|
return raw;
|
|
505
528
|
}
|
|
506
529
|
}
|
|
530
|
+
for (const fileName of ["AGENTS.md", "AGENT.md"]) {
|
|
531
|
+
if (typeof rootDocuments?.[fileName] === "string")
|
|
532
|
+
return rootDocuments[fileName];
|
|
533
|
+
}
|
|
507
534
|
for (const fileName of ["AGENTS.md", "AGENT.md"]) {
|
|
508
535
|
const candidate = path.join(rootDir, fileName);
|
|
509
536
|
try {
|
|
@@ -524,10 +551,14 @@ export function createDocsServer(config) {
|
|
|
524
551
|
const ordering = config.ordering;
|
|
525
552
|
const contentDirBase = config.contentDir ?? entry;
|
|
526
553
|
const rootDir = path.resolve(config.rootDir ?? process.cwd());
|
|
554
|
+
// Production builds snapshot the configured skills and root agent documents into these
|
|
555
|
+
// (agent-skills.ts), because a deployed function does not contain the project's files.
|
|
556
|
+
const preloadedAgentSkills = config._preloadedAgentSkills ?? bundledAgentSkills;
|
|
557
|
+
const rootAgentDocuments = config._preloadedRootDocuments ?? bundledRootDocuments;
|
|
527
558
|
let publishedAgentSkills;
|
|
528
559
|
function getPublishedAgentSkills() {
|
|
529
|
-
publishedAgentSkills ??= Array.isArray(
|
|
530
|
-
? Promise.resolve(
|
|
560
|
+
publishedAgentSkills ??= Array.isArray(preloadedAgentSkills)
|
|
561
|
+
? Promise.resolve(preloadedAgentSkills)
|
|
531
562
|
: resolveConfiguredAgentSkills(config.agent?.skills, { rootDir });
|
|
532
563
|
return publishedAgentSkills;
|
|
533
564
|
}
|
|
@@ -897,7 +928,9 @@ export function createDocsServer(config) {
|
|
|
897
928
|
return createDocsStandardsDiscoveryResponse({
|
|
898
929
|
request,
|
|
899
930
|
...discoveryOptions,
|
|
900
|
-
preferredSkillDocument: needsSkill
|
|
931
|
+
preferredSkillDocument: needsSkill
|
|
932
|
+
? readRootSkillDocument(preloaded, rootDir, rootAgentDocuments)
|
|
933
|
+
: null,
|
|
901
934
|
fallbackSkillDocument: needsSkill ? renderDocsSkillDocument(discoveryOptions) : "",
|
|
902
935
|
publishedSkills: needsSkill ? await getPublishedAgentSkills() : [],
|
|
903
936
|
agentCard: config.agent?.a2a,
|
|
@@ -955,7 +988,7 @@ export function createDocsServer(config) {
|
|
|
955
988
|
...discoveryOptions,
|
|
956
989
|
publishedSkills: [
|
|
957
990
|
await resolveDocsPublishedAgentSkill({
|
|
958
|
-
preferredDocument: readRootSkillDocument(preloaded, rootDir),
|
|
991
|
+
preferredDocument: readRootSkillDocument(preloaded, rootDir, rootAgentDocuments),
|
|
959
992
|
fallbackDocument: renderDocsSkillDocument(discoveryOptions),
|
|
960
993
|
}),
|
|
961
994
|
...(await getPublishedAgentSkills()),
|
|
@@ -1046,7 +1079,8 @@ export function createDocsServer(config) {
|
|
|
1046
1079
|
}
|
|
1047
1080
|
if (isDocsAgentsRequest(url, { apiRoute: discoveryApiRoute }) ||
|
|
1048
1081
|
resolveDocsAgentsFormat(url) === "agents") {
|
|
1049
|
-
const content = readRootAgentsDocument(preloaded, rootDir) ??
|
|
1082
|
+
const content = readRootAgentsDocument(preloaded, rootDir, rootAgentDocuments) ??
|
|
1083
|
+
renderDocsAgentsDocument(discoveryOptions);
|
|
1050
1084
|
return createDocsCacheableResponse({
|
|
1051
1085
|
request: event.request,
|
|
1052
1086
|
content,
|
|
@@ -1060,7 +1094,8 @@ export function createDocsServer(config) {
|
|
|
1060
1094
|
}
|
|
1061
1095
|
if (isDocsSkillRequest(url, { apiRoute: discoveryApiRoute }) ||
|
|
1062
1096
|
resolveDocsSkillFormat(url) === "skill") {
|
|
1063
|
-
const content = readRootSkillDocument(preloaded, rootDir) ??
|
|
1097
|
+
const content = readRootSkillDocument(preloaded, rootDir, rootAgentDocuments) ??
|
|
1098
|
+
renderDocsSkillDocument(discoveryOptions);
|
|
1064
1099
|
return createDocsCacheableResponse({
|
|
1065
1100
|
request: event.request,
|
|
1066
1101
|
content,
|
|
@@ -1826,7 +1861,7 @@ export function createDocsServer(config) {
|
|
|
1826
1861
|
openapi: openapiDiscovery,
|
|
1827
1862
|
};
|
|
1828
1863
|
const rootSkill = await resolveDocsPublishedAgentSkill({
|
|
1829
|
-
preferredDocument: readRootSkillDocument(preloaded, rootDir),
|
|
1864
|
+
preferredDocument: readRootSkillDocument(preloaded, rootDir, rootAgentDocuments),
|
|
1830
1865
|
fallbackDocument: renderDocsSkillDocument(skillOptions),
|
|
1831
1866
|
});
|
|
1832
1867
|
return [rootSkill, ...(await getPublishedAgentSkills())];
|
|
@@ -1885,6 +1920,8 @@ export function createDocsServer(config) {
|
|
|
1885
1920
|
? config.apiReference.path
|
|
1886
1921
|
: "api-reference";
|
|
1887
1922
|
const apiReferencePath = `/${configuredApiReferencePath.replace(/^\/+|\/+$/g, "")}`;
|
|
1923
|
+
// Unconfigured, the path belongs to the app, as with the other framework integrations.
|
|
1924
|
+
const apiReferenceEnabled = resolveApiReferenceConfig(config.apiReference).enabled;
|
|
1888
1925
|
const publicDocsPaths = new Set([
|
|
1889
1926
|
"/llms.txt",
|
|
1890
1927
|
"/llms-full.txt",
|
|
@@ -1909,8 +1946,8 @@ export function createDocsServer(config) {
|
|
|
1909
1946
|
pathname.startsWith(`${docsPath}/`) ||
|
|
1910
1947
|
pathname === apiPath ||
|
|
1911
1948
|
pathname.startsWith(`${apiPath}/`) ||
|
|
1912
|
-
|
|
1913
|
-
|
|
1949
|
+
(apiReferenceEnabled &&
|
|
1950
|
+
(pathname === apiReferencePath || pathname.startsWith(`${apiReferencePath}/`))) ||
|
|
1914
1951
|
publicDocsPaths.has(pathname) ||
|
|
1915
1952
|
pathname.startsWith("/.well-known/agent-skills/");
|
|
1916
1953
|
if (mcpConfig.enabled && mcpRoutes.has(pathname)) {
|
|
@@ -1955,7 +1992,7 @@ function serializeInlineJson(value) {
|
|
|
1955
1992
|
.replace(/\u2029/g, "\\u2029");
|
|
1956
1993
|
}
|
|
1957
1994
|
function createClientDocsConfig(config) {
|
|
1958
|
-
const { apiKey: _apiKey, rootDir: _rootDir, contentDir: _contentDir, _preloadedContent, _preloadedAgentSkills, socialImage, ...clientConfig } = config;
|
|
1995
|
+
const { apiKey: _apiKey, rootDir: _rootDir, contentDir: _contentDir, _preloadedContent, _preloadedAgentSkills, _preloadedRootDocuments, socialImage, ...clientConfig } = config;
|
|
1959
1996
|
const ai = clientConfig.ai && typeof clientConfig.ai === "object"
|
|
1960
1997
|
? {
|
|
1961
1998
|
...clientConfig.ai,
|
|
@@ -2046,6 +2083,8 @@ function renderThemeBootstrap(config) {
|
|
|
2046
2083
|
}
|
|
2047
2084
|
function renderFarmDocsDocument(input) {
|
|
2048
2085
|
const { config, data } = input;
|
|
2086
|
+
const markdownHref = `${input.origin ?? ""}${data.url.replace(/\/+$/, "")}.md`;
|
|
2087
|
+
const clientConfig = createClientDocsConfig(config);
|
|
2049
2088
|
const description = data.description ?? config.metadata?.description;
|
|
2050
2089
|
const themeName = config.theme?.name ?? "default";
|
|
2051
2090
|
const favicon = typeof config.favicon === "string" ? config.favicon : undefined;
|
|
@@ -2062,6 +2101,7 @@ function renderFarmDocsDocument(input) {
|
|
|
2062
2101
|
<meta name="generator" content="@farming-labs/farmjs">
|
|
2063
2102
|
<title>${escapeDocumentText(data.title)}</title>
|
|
2064
2103
|
${description ? `<meta name="description" content="${escapeDocumentText(description)}">` : ""}
|
|
2104
|
+
<link rel="alternate" type="text/markdown" href="${escapeDocumentText(markdownHref)}">
|
|
2065
2105
|
${favicon ? `<link rel="icon" href="${escapeDocumentText(favicon)}">` : ""}
|
|
2066
2106
|
${renderThemeBootstrap(config)}
|
|
2067
2107
|
${fontPreloads}
|
|
@@ -2072,7 +2112,7 @@ function renderFarmDocsDocument(input) {
|
|
|
2072
2112
|
</head>
|
|
2073
2113
|
<body>
|
|
2074
2114
|
<div id="root"><div id="farm-docs-root"${rootClasses ? ` class="${escapeDocumentText(rootClasses)}"` : ""}${rootStyle ? ` style="${escapeDocumentText(rootStyle)}"` : ""}>${input.markup}</div></div>
|
|
2075
|
-
<script>window.__FARM_DOCS_ADAPTER__={config:${serializeInlineJson(
|
|
2115
|
+
<script>window.__FARM_DOCS_ADAPTER__={config:${serializeInlineJson(clientConfig)},data:${serializeInlineJson(data)}${hasUnserializableValues(clientConfig) ? ",configModule:true" : ""}};</script>
|
|
2076
2116
|
<script type="module" src="${escapeDocumentText(input.clientEntry)}"></script>
|
|
2077
2117
|
</body>
|
|
2078
2118
|
</html>`;
|
|
@@ -2159,6 +2199,7 @@ export function createFarmDocsRuntimeHandler(config, options = {}) {
|
|
|
2159
2199
|
clientEntry: options.clientEntry ?? "/farm-client.js",
|
|
2160
2200
|
stylesheets: options.stylesheets ?? [],
|
|
2161
2201
|
fonts,
|
|
2202
|
+
origin: new URL(request.url).origin,
|
|
2162
2203
|
});
|
|
2163
2204
|
return new Response(request.method.toUpperCase() === "HEAD" ? null : html, {
|
|
2164
2205
|
status: 200,
|