@farming-labs/theme 0.1.30 → 0.1.33

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/docs-api.mjs CHANGED
@@ -34,6 +34,14 @@ const FILE_EXTS = [
34
34
  ];
35
35
  const DEFAULT_DOCS_API_ROUTE = "/api/docs";
36
36
  const DEFAULT_AGENT_SPEC_ROUTE = "/api/docs/agent/spec";
37
+ const DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE = "/.well-known/agent";
38
+ const DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE = "/.well-known/agent.json";
39
+ const DEFAULT_MCP_ROUTE = "/api/docs/mcp";
40
+ const DEFAULT_MCP_PUBLIC_ROUTE = "/mcp";
41
+ const DEFAULT_LLMS_TXT_ROUTE = "/llms.txt";
42
+ const DEFAULT_LLMS_FULL_TXT_ROUTE = "/llms-full.txt";
43
+ const DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE = "/.well-known/llms.txt";
44
+ const DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE = "/.well-known/llms-full.txt";
37
45
  const DEFAULT_AGENT_FEEDBACK_ROUTE = "/api/docs/agent/feedback";
38
46
  const DEFAULT_AGENT_FEEDBACK_PAYLOAD_SCHEMA = {
39
47
  type: "object",
@@ -147,7 +155,8 @@ function resolveAgentFeedbackRequest(url, feedback) {
147
155
  }
148
156
  function resolveAgentSpecRequest(url) {
149
157
  if (url.searchParams.get("agent")?.trim() === "spec") return true;
150
- return normalizeUrlPath(url.pathname) === DEFAULT_AGENT_SPEC_ROUTE;
158
+ const pathname = normalizeUrlPath(url.pathname);
159
+ return pathname === DEFAULT_AGENT_SPEC_ROUTE || pathname === DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE || pathname === DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE;
151
160
  }
152
161
  function isSearchEnabled(search) {
153
162
  if (search === false) return false;
@@ -189,6 +198,10 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms }) {
189
198
  api: {
190
199
  docs: DEFAULT_DOCS_API_ROUTE,
191
200
  agentSpec: DEFAULT_AGENT_SPEC_ROUTE,
201
+ agentSpecDefault: DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
202
+ agentSpecFallback: DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
203
+ agentSpecWellKnown: DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
204
+ agentSpecWellKnownJson: DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
192
205
  agentSpecQuery: `${DEFAULT_DOCS_API_ROUTE}?agent=spec`
193
206
  },
194
207
  markdown: {
@@ -205,8 +218,14 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms }) {
205
218
  },
206
219
  llms: {
207
220
  enabled: llms.enabled,
221
+ defaultTxt: DEFAULT_LLMS_TXT_ROUTE,
222
+ defaultFull: DEFAULT_LLMS_FULL_TXT_ROUTE,
208
223
  txt: `${DEFAULT_DOCS_API_ROUTE}?format=llms`,
209
- full: `${DEFAULT_DOCS_API_ROUTE}?format=llms-full`
224
+ full: `${DEFAULT_DOCS_API_ROUTE}?format=llms-full`,
225
+ publicTxt: DEFAULT_LLMS_TXT_ROUTE,
226
+ publicFull: DEFAULT_LLMS_FULL_TXT_ROUTE,
227
+ wellKnownTxt: DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE,
228
+ wellKnownFull: DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE
210
229
  },
211
230
  search: {
212
231
  enabled: searchEnabled,
@@ -227,6 +246,9 @@ function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms }) {
227
246
  mcp: {
228
247
  enabled: mcp.enabled,
229
248
  endpoint: mcp.route,
249
+ defaultEndpoint: DEFAULT_MCP_PUBLIC_ROUTE,
250
+ publicEndpoint: DEFAULT_MCP_PUBLIC_ROUTE,
251
+ canonicalEndpoint: DEFAULT_MCP_ROUTE,
230
252
  name: mcp.name,
231
253
  version: mcp.version,
232
254
  tools: mcp.tools
@@ -768,6 +790,13 @@ function resolveMarkdownRequest(entry, url, request) {
768
790
  }
769
791
  return null;
770
792
  }
793
+ function resolveLlmsTxtFormat(url) {
794
+ const pathname = normalizeUrlPath(url.pathname);
795
+ if (pathname === DEFAULT_LLMS_TXT_ROUTE || pathname === DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE) return "llms";
796
+ if (pathname === DEFAULT_LLMS_FULL_TXT_ROUTE || pathname === DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE) return "llms-full";
797
+ const format = url.searchParams.get("format");
798
+ return format === "llms" || format === "llms-full" ? format : null;
799
+ }
771
800
  function renderMarkdownDocument(page) {
772
801
  if ("agentRawContent" in page && page.agentRawContent !== void 0) return page.agentRawContent;
773
802
  const lines = [`# ${page.title}`, `URL: ${page.url}`];
@@ -1088,12 +1117,12 @@ function createDocsAPI(options) {
1088
1117
  "X-Robots-Tag": "noindex"
1089
1118
  } });
1090
1119
  }
1091
- const format = url.searchParams.get("format");
1092
- if (format === "llms") return new Response(getLlmsContent(ctx).llmsTxt, { headers: {
1120
+ const llmsFormat = resolveLlmsTxtFormat(url);
1121
+ if (llmsFormat === "llms") return new Response(getLlmsContent(ctx).llmsTxt, { headers: {
1093
1122
  "Content-Type": "text/plain; charset=utf-8",
1094
1123
  "Cache-Control": "public, max-age=3600"
1095
1124
  } });
1096
- if (format === "llms-full") return new Response(getLlmsContent(ctx).llmsFullTxt, { headers: {
1125
+ if (llmsFormat === "llms-full") return new Response(getLlmsContent(ctx).llmsFullTxt, { headers: {
1097
1126
  "Content-Type": "text/plain; charset=utf-8",
1098
1127
  "Cache-Control": "public, max-age=3600"
1099
1128
  } });
@@ -165,7 +165,7 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
165
165
  const [browserPath, setBrowserPath] = useState(null);
166
166
  const pathname = usePathname();
167
167
  const activeLocale = resolveClientLocale(useWindowSearchParams(), locale);
168
- const llmsLangParam = activeLocale ? `&lang=${encodeURIComponent(activeLocale)}` : "";
168
+ const llmsLangQuery = activeLocale ? `?lang=${encodeURIComponent(activeLocale)}` : "";
169
169
  const pageDescription = description ?? descriptionMap?.[pathname.replace(/\/$/, "") || "/"];
170
170
  const normalizedPath = (browserPath ?? pathname).replace(/\/$/, "") || "/";
171
171
  const isChangelogRoute = !!(changelogBasePath && (normalizedPath === changelogBasePath || normalizedPath.startsWith(`${changelogBasePath}/`)));
@@ -361,13 +361,13 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
361
361
  llmsTxtEnabled && /* @__PURE__ */ jsxs("span", {
362
362
  className: "fd-llms-txt-links",
363
363
  children: [/* @__PURE__ */ jsx("a", {
364
- href: `/api/docs?format=llms${llmsLangParam}`,
364
+ href: `/llms.txt${llmsLangQuery}`,
365
365
  target: "_blank",
366
366
  rel: "noopener noreferrer",
367
367
  className: "fd-llms-txt-link",
368
368
  children: "llms.txt"
369
369
  }), /* @__PURE__ */ jsx("a", {
370
- href: `/api/docs?format=llms-full${llmsLangParam}`,
370
+ href: `/llms-full.txt${llmsLangQuery}`,
371
371
  target: "_blank",
372
372
  rel: "noopener noreferrer",
373
373
  className: "fd-llms-txt-link",
package/dist/index.d.mts CHANGED
@@ -11,9 +11,10 @@ import { DocsFeedback, DocsFeedbackProps } from "./docs-feedback.mjs";
11
11
  import { PageActions } from "./page-actions.mjs";
12
12
  import { withLangInUrl } from "./i18n.mjs";
13
13
  import { HoverLink, HoverLinkProps } from "./hover-link.mjs";
14
+ import { Agent } from "./mdx.mjs";
14
15
  import { DocsLayout } from "fumadocs-ui/layouts/docs";
15
16
  import { AIConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CopyMarkdownConfig, DocsConfig, DocsFeedbackData, DocsFeedbackValue, DocsMetadata, DocsNav, DocsTheme, FeedbackConfig, FontStyle, OGConfig, OpenDocsConfig, OpenDocsProvider, PageActionsConfig, PageFrontmatter, SidebarConfig, ThemeToggleConfig, TypographyConfig, UIConfig, createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
16
17
  import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
17
18
  import { Tab, Tabs } from "fumadocs-ui/components/tabs";
18
19
  import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
19
- export { type AIConfig, type BreadcrumbConfig, type ChangelogConfig, type ChangelogFrontmatter, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CommandGridUIDefaults, ConcreteUIDefaults, type CopyMarkdownConfig, DocsBody, DocsClientHooks, DocsCommandSearch, type DocsConfig, DocsFeedback, type DocsFeedbackData, type DocsFeedbackProps, type DocsFeedbackValue, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FeedbackConfig, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, type HoverLinkProps, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, type TypographyConfig, type UIConfig, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, withLangInUrl };
20
+ export { type AIConfig, Agent, type BreadcrumbConfig, type ChangelogConfig, type ChangelogFrontmatter, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CommandGridUIDefaults, ConcreteUIDefaults, type CopyMarkdownConfig, DocsBody, DocsClientHooks, DocsCommandSearch, type DocsConfig, DocsFeedback, type DocsFeedbackData, type DocsFeedbackProps, type DocsFeedbackValue, DocsLayout, type DocsMetadata, type DocsNav, DocsPage, DocsPageClient, type DocsTheme, type FeedbackConfig, type FontStyle, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, type HoverLinkProps, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, PageActions, type PageActionsConfig, type PageFrontmatter, Pre, RootProvider, type SidebarConfig, Tab, Tabs, type ThemeToggleConfig, type TypographyConfig, type UIConfig, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, withLangInUrl };
package/dist/index.mjs CHANGED
@@ -11,10 +11,11 @@ import { ConcreteUIDefaults, concrete } from "./concrete/index.mjs";
11
11
  import { HardlineUIDefaults, hardline } from "./hardline/index.mjs";
12
12
  import { DocsClientHooks } from "./docs-client-hooks.mjs";
13
13
  import { HoverLink } from "./hover-link.mjs";
14
+ import { Agent } from "./mdx.mjs";
14
15
  import { DocsLayout } from "fumadocs-ui/layouts/docs";
15
16
  import { createTheme, deepMerge, defineDocs, extendTheme } from "@farming-labs/docs";
16
17
  import { DocsBody, DocsPage } from "fumadocs-ui/layouts/docs/page";
17
18
  import { Tab, Tabs } from "fumadocs-ui/components/tabs";
18
19
  import { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre } from "fumadocs-ui/components/codeblock";
19
20
 
20
- export { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CommandGridUIDefaults, ConcreteUIDefaults, DocsBody, DocsClientHooks, DocsCommandSearch, DocsFeedback, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, PageActions, Pre, RootProvider, Tab, Tabs, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, withLangInUrl };
21
+ export { Agent, CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CommandGridUIDefaults, ConcreteUIDefaults, DocsBody, DocsClientHooks, DocsCommandSearch, DocsFeedback, DocsLayout, DocsPage, DocsPageClient, DefaultUIDefaults as FumadocsUIDefaults, HardlineUIDefaults, HoverLink, PageActions, Pre, RootProvider, Tab, Tabs, commandGrid, concrete, createDocsLayout, createDocsMetadata, createPageMetadata, createTheme, deepMerge, defineDocs, extendTheme, fumadocs, hardline, withLangInUrl };
package/dist/mdx.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { HoverLink } from "./hover-link.mjs";
2
1
  import { MDXImg } from "./mdx-img.mjs";
2
+ import { HoverLink } from "./hover-link.mjs";
3
3
  import React from "react";
4
4
  import { CodeBlockCopyData, DocsTheme } from "@farming-labs/docs";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
package/dist/mdx.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { HoverLink } from "./hover-link.mjs";
2
1
  import { MDXImg } from "./mdx-img.mjs";
3
2
  import { createPreWithCopyCallback } from "./code-block-copy-wrapper.mjs";
3
+ import { HoverLink } from "./hover-link.mjs";
4
4
  import React from "react";
5
5
  import { Tab, Tabs } from "fumadocs-ui/components/tabs";
6
6
  import defaultMdxComponents from "fumadocs-ui/mdx";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.1.30",
3
+ "version": "0.1.33",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -133,7 +133,7 @@
133
133
  "tsdown": "^0.20.3",
134
134
  "typescript": "^5.9.3",
135
135
  "vitest": "^3.2.4",
136
- "@farming-labs/docs": "0.1.30"
136
+ "@farming-labs/docs": "0.1.33"
137
137
  },
138
138
  "peerDependencies": {
139
139
  "@farming-labs/docs": ">=0.0.1",