@farming-labs/docs 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.
Files changed (188) hide show
  1. package/README.md +8 -0
  2. package/dist/access.d.mts +13 -0
  3. package/dist/access.mjs +56 -0
  4. package/dist/agent-conformance.d.mts +60 -0
  5. package/dist/agent-conformance.mjs +538 -0
  6. package/dist/agent-contract.d.mts +47 -0
  7. package/dist/agent-contract.mjs +645 -0
  8. package/dist/agent-detection.d.mts +6 -0
  9. package/dist/agent-detection.mjs +83 -0
  10. package/dist/agent-evals.d.mts +224 -0
  11. package/dist/{agent-evals-BLNLvXbG.mjs → agent-evals.mjs} +7 -565
  12. package/dist/agent-feedback-evaluations-node.mjs +38 -0
  13. package/dist/agent-feedback-evaluations.d.mts +91 -0
  14. package/dist/{agent-feedback-evaluations-CcMGlgsO.mjs → agent-feedback-evaluations.mjs} +2 -2
  15. package/dist/agent-feedback-loop.d.mts +45 -0
  16. package/dist/{agent-feedback-loop-CcZL_sb1.mjs → agent-feedback-loop.mjs} +1 -1
  17. package/dist/agent-maintenance.d.mts +71 -0
  18. package/dist/{agent-maintenance-CuZ7iAKq.mjs → agent-maintenance.mjs} +1 -1
  19. package/dist/agent-provenance.d.mts +23 -0
  20. package/dist/agent-provenance.mjs +77 -0
  21. package/dist/agent-scope.mjs +321 -0
  22. package/dist/agent-skills-archive.mjs +86 -0
  23. package/dist/agent-skills-bundle.d.mts +1 -1
  24. package/dist/{agent-skills-progressive-disclosure-PjPtTYL-.mjs → agent-skills-progressive-disclosure.mjs} +2 -2
  25. package/dist/{agent-skills-server-CTNWr23x.d.mts → agent-skills-server.d.mts} +3 -3
  26. package/dist/{agent-skills-server-BC7md56k.mjs → agent-skills-server.mjs} +2 -2
  27. package/dist/agent-skills-vite.d.mts +3 -3
  28. package/dist/agent-skills-vite.mjs +1 -2
  29. package/dist/agent-surface-drift.mjs +236 -0
  30. package/dist/{golden-evaluations-CLUViycJ.mjs → agent-usefulness.mjs} +5 -290
  31. package/dist/{content-change-hydration-CvHJadhE.d.mts → agent.d.mts} +10 -411
  32. package/dist/agent.mjs +2729 -0
  33. package/dist/{analytics-B8RZiKUt.d.mts → analytics.d.mts} +2 -2
  34. package/dist/{analytics-p8Vhhu2P.mjs → analytics.mjs} +2 -2
  35. package/dist/{sitemap-server-C9r22_06.d.mts → api-reference.d.mts} +3 -6
  36. package/dist/api-reference.mjs +1481 -0
  37. package/dist/{audience-exposure-DBrFWULA.d.mts → audience-exposure.d.mts} +1 -1
  38. package/dist/audience-exposure.mjs +8 -0
  39. package/dist/audience.d.mts +44 -0
  40. package/dist/audience.mjs +1654 -0
  41. package/dist/authoring-mcp.d.mts +44 -0
  42. package/dist/{authoring-mcp-CiCUQe3o.mjs → authoring-mcp.mjs} +3 -3
  43. package/dist/browser.d.mts +6 -4
  44. package/dist/browser.mjs +6 -7
  45. package/dist/build.d.mts +8 -0
  46. package/dist/build.mjs +8 -0
  47. package/dist/changelog.d.mts +20 -0
  48. package/dist/changelog.mjs +39 -0
  49. package/dist/{agent-export-Cxljt6RP.mjs → cli/agent-export.mjs} +19 -45
  50. package/dist/{agent-CYk2DxY7.mjs → cli/agent.mjs} +6 -35
  51. package/dist/{agents-jtn256sz.mjs → cli/agents.mjs} +5 -18
  52. package/dist/cli/api-doctor.mjs +206 -0
  53. package/dist/{authoring-C2ymvYWl.mjs → cli/authoring.mjs} +2 -8
  54. package/dist/{cloud-6eKrlmKd.mjs → cli/cloud.mjs} +3 -3
  55. package/dist/{codeblocks-CHpgAwY-.mjs → cli/codeblocks.mjs} +2 -2
  56. package/dist/cli/config.d.mts +11 -0
  57. package/dist/{config-BZnKAj_Y.mjs → cli/config.mjs} +1 -1
  58. package/dist/cli/dev-banner.mjs +58 -0
  59. package/dist/{dev-Bnn-NUNa.mjs → cli/dev.mjs} +3 -57
  60. package/dist/{doctor-CUMgbglt.mjs → cli/doctor.mjs} +41 -226
  61. package/dist/{downgrade-CHMta85e.mjs → cli/downgrade.mjs} +2 -2
  62. package/dist/cli/errors.d.mts +4 -0
  63. package/dist/{errors-BtnVLhNF.mjs → cli/errors.mjs} +1 -1
  64. package/dist/{feedback-evals-DMilg9pY.mjs → cli/feedback-evals.mjs} +3 -36
  65. package/dist/{feedback-DL4T5oIO.mjs → cli/feedback.mjs} +1 -1
  66. package/dist/cli/git-dates.mjs +35 -0
  67. package/dist/cli/golden-evaluations.mjs +52 -0
  68. package/dist/cli/index.d.mts +2 -3
  69. package/dist/cli/index.mjs +38 -38
  70. package/dist/{init-K0LmXDZ5.mjs → cli/init.mjs} +3 -3
  71. package/dist/{mcp-Bvha6_mG.mjs → cli/mcp.mjs} +7 -19
  72. package/dist/{openapi-diff-BOESBfnP.mjs → cli/openapi-diff.mjs} +2 -7
  73. package/dist/{openapi-sdk-DJutz2AC.mjs → cli/openapi-sdk.mjs} +2 -7
  74. package/dist/{openapi-source-CiX3hwFp.mjs → cli/openapi-source.mjs} +2 -2
  75. package/dist/{package-version-HJhYeq4M.mjs → cli/package-version.mjs} +2 -2
  76. package/dist/{propose-JmUv_BTt.mjs → cli/propose.mjs} +1 -1
  77. package/dist/{review-C6EmbV0l.mjs → cli/review.mjs} +16 -15
  78. package/dist/{robots-DteZB8vl.mjs → cli/robots.mjs} +3 -7
  79. package/dist/{search-DKcdZgGx.mjs → cli/search.mjs} +7 -20
  80. package/dist/{sitemap-CBQoERNz.mjs → cli/sitemap.mjs} +7 -42
  81. package/dist/{skills-a90P31sJ.mjs → cli/skills.mjs} +5 -19
  82. package/dist/{templates-BuQ8YsGv.mjs → cli/templates.mjs} +1 -1
  83. package/dist/{upgrade-DlQMOFV1.mjs → cli/upgrade.mjs} +2 -2
  84. package/dist/{utils-C7KDrPpA.mjs → cli/utils.mjs} +1 -1
  85. package/dist/client/react.d.mts +2 -18
  86. package/dist/client/react.mjs +1 -157
  87. package/dist/{cloud-analytics-D14HplI7.mjs → cloud-analytics.mjs} +1 -1
  88. package/dist/{cloud-ask-ai-BOahlsIZ.d.mts → cloud-ask-ai.d.mts} +2 -2
  89. package/dist/{cloud-ask-ai-BqKhjpS5.mjs → cloud-ask-ai.mjs} +3 -3
  90. package/dist/code-blocks.d.mts +51 -0
  91. package/dist/{code-blocks-GYdvS3BH.mjs → code-blocks.mjs} +2 -2
  92. package/dist/code-group-mdx.d.mts +11 -0
  93. package/dist/code-group-mdx.mjs +57 -0
  94. package/dist/content-change-hydration.d.mts +87 -0
  95. package/dist/{openapi-mcp-BIOTLiA7.mjs → content-change-hydration.mjs} +5 -210
  96. package/dist/content-changes.d.mts +47 -0
  97. package/dist/content-changes.mjs +216 -0
  98. package/dist/create-theme.d.mts +48 -0
  99. package/dist/create-theme.mjs +57 -0
  100. package/dist/date.d.mts +5 -0
  101. package/dist/date.mjs +17 -0
  102. package/dist/define-docs.d.mts +9 -0
  103. package/dist/define-docs.mjs +46 -0
  104. package/dist/docs-cloud-client.d.mts +18 -0
  105. package/dist/docs-cloud-client.mjs +161 -0
  106. package/dist/docs-cloud-server.d.mts +2 -2
  107. package/dist/docs-cloud-server.mjs +2 -3
  108. package/dist/heading-toc.d.mts +10 -0
  109. package/dist/heading-toc.mjs +23 -0
  110. package/dist/http-body.d.mts +14 -0
  111. package/dist/{http-body-DkAPk6D5.mjs → http-body.mjs} +1 -1
  112. package/dist/http-cache.d.mts +25 -0
  113. package/dist/http-cache.mjs +140 -0
  114. package/dist/http-link.mjs +81 -0
  115. package/dist/i18n.d.mts +18 -0
  116. package/dist/{i18n-B1gJ9EW0.mjs → i18n.mjs} +1 -1
  117. package/dist/index.d.mts +43 -675
  118. package/dist/index.mjs +40 -14
  119. package/dist/markdown-rendering.mjs +1 -1
  120. package/dist/markdown-section-cache.mjs +49 -0
  121. package/dist/markdown-sections.d.mts +47 -0
  122. package/dist/{markdown-sections-9Oxr33b-.mjs → markdown-sections.mjs} +29 -703
  123. package/dist/mcp-auth.d.mts +14 -0
  124. package/dist/mcp-auth.mjs +99 -0
  125. package/dist/mcp.d.mts +5 -3
  126. package/dist/mcp.mjs +39 -9
  127. package/dist/mdx.d.mts +6 -0
  128. package/dist/mdx.mjs +7 -0
  129. package/dist/metadata.d.mts +60 -0
  130. package/dist/{metadata-BOHn0Y5K.mjs → metadata.mjs} +2 -2
  131. package/dist/native-api-reference.mjs +968 -0
  132. package/dist/okf.d.mts +42 -0
  133. package/dist/okf.mjs +145 -0
  134. package/dist/openapi-contract.mjs +154 -0
  135. package/dist/{openapi-mcp-node-C4jUpZG6.mjs → openapi-mcp-node.mjs} +1 -1
  136. package/dist/openapi-mcp.d.mts +26 -0
  137. package/dist/openapi-mcp.mjs +132 -0
  138. package/dist/openapi-operations.d.mts +71 -0
  139. package/dist/{openapi-operations-DFpaqOqA.mjs → openapi-operations.mjs} +1 -1
  140. package/dist/openapi-overlays.mjs +221 -0
  141. package/dist/openapi-references.mjs +233 -0
  142. package/dist/pagination.d.mts +7 -0
  143. package/dist/pagination.mjs +100 -0
  144. package/dist/prompt-references.d.mts +12 -0
  145. package/dist/prompt-references.mjs +132 -0
  146. package/dist/prompt-utils.d.mts +36 -0
  147. package/dist/{prompt-utils-B5g-bv7o.mjs → prompt-utils.mjs} +1 -57
  148. package/dist/reading-time.d.mts +23 -0
  149. package/dist/reading-time.mjs +58 -0
  150. package/dist/related.d.mts +7 -0
  151. package/dist/related.mjs +50 -0
  152. package/dist/retrieval-digest.d.mts +16 -0
  153. package/dist/{retrieval-digest-CT-eIEcp.mjs → retrieval-digest.mjs} +1 -1
  154. package/dist/review.d.mts +69 -0
  155. package/dist/review.mjs +562 -0
  156. package/dist/robots.d.mts +54 -0
  157. package/dist/{robots-BYJAVeI6.mjs → robots.mjs} +5 -3
  158. package/dist/runtime.d.mts +3 -3
  159. package/dist/runtime.mjs +3 -9
  160. package/dist/search.d.mts +210 -0
  161. package/dist/search.mjs +3401 -0
  162. package/dist/server.d.mts +22 -198
  163. package/dist/server.mjs +21 -19
  164. package/dist/sidebar.d.mts +15 -0
  165. package/dist/sidebar.mjs +73 -0
  166. package/dist/sitemap-server.d.mts +7 -0
  167. package/dist/{sitemap-server-Lg3YhUx4.mjs → sitemap-server.mjs} +2 -2
  168. package/dist/{sitemap-DafdOrxK.d.mts → sitemap.d.mts} +3 -3
  169. package/dist/sitemap.mjs +254 -0
  170. package/dist/{standards-discovery-1fiUVDAo.d.mts → standards-discovery.d.mts} +2 -2
  171. package/dist/{standards-discovery-sSEojU80.mjs → standards-discovery.mjs} +3 -139
  172. package/dist/telemetry-runtime.d.mts +42 -0
  173. package/dist/telemetry-runtime.mjs +238 -0
  174. package/dist/telemetry.d.mts +15 -0
  175. package/dist/telemetry.mjs +117 -0
  176. package/dist/{types-BncG8J3g.d.mts → types.d.mts} +21 -3
  177. package/dist/urls.d.mts +7 -0
  178. package/dist/urls.mjs +21 -0
  179. package/dist/utils.d.mts +8 -0
  180. package/dist/utils.mjs +22 -0
  181. package/package.json +21 -3
  182. package/dist/agent-DkAidqtV.mjs +0 -9026
  183. package/dist/api-reference-By_LokQ-.mjs +0 -3033
  184. package/dist/prompt-references-DMgbu_dz.mjs +0 -1082
  185. package/dist/retrieval-digest-DLAQsQmx.d.mts +0 -367
  186. package/dist/sidebar-C2LKcU7n.d.mts +0 -63
  187. package/dist/sidebar-CFHBj29f.mjs +0 -421
  188. /package/dist/{openapi-CfCzX_a1.mjs → cli/openapi.mjs} +0 -0
@@ -0,0 +1,238 @@
1
+ //#region src/telemetry-runtime.ts
2
+ const DOCS_PACKAGE_NAME = "@farming-labs/docs";
3
+ const DOCS_PACKAGE_VERSION = "0.2.25";
4
+ const DEFAULT_DOCS_TELEMETRY_ENDPOINT = "https://docs.farming-labs.dev/api/telemetry/events";
5
+ function getRuntimeEnv() {
6
+ if (typeof process === "undefined" || !process.env) return;
7
+ return process.env;
8
+ }
9
+ function readRuntimeEnv(name) {
10
+ const value = getRuntimeEnv()?.[name]?.trim();
11
+ return value ? value : void 0;
12
+ }
13
+ function isTruthyEnv(value) {
14
+ return /^(1|true|yes|on)$/i.test(value ?? "");
15
+ }
16
+ function isFalsyEnv(value) {
17
+ return /^(0|false|no|off)$/i.test(value ?? "");
18
+ }
19
+ function isBrowserRuntime() {
20
+ return typeof window !== "undefined" && typeof document !== "undefined";
21
+ }
22
+ function isProductionTelemetryRuntime() {
23
+ if (isBrowserRuntime()) return false;
24
+ const env = getRuntimeEnv();
25
+ if (!env) return true;
26
+ if (env.NODE_ENV === "test") return false;
27
+ if (env.VERCEL_ENV === "production") return true;
28
+ if (env.CONTEXT === "production" && isTruthyEnv(env.NETLIFY)) return true;
29
+ if (isTruthyEnv(env.CF_PAGES)) return true;
30
+ if (env.RENDER_SERVICE_ID || env.FLY_APP_NAME || env.RAILWAY_ENVIRONMENT) return true;
31
+ return env.NODE_ENV === "production";
32
+ }
33
+ function resolveDocsTelemetryConfig(telemetry) {
34
+ const envToggle = readRuntimeEnv("DOCS_TELEMETRY");
35
+ const envDisabled = readRuntimeEnv("DOCS_TELEMETRY_DISABLED");
36
+ if (isFalsyEnv(envToggle) || isTruthyEnv(envDisabled) || telemetry === false) return { enabled: false };
37
+ const objectConfig = telemetry && typeof telemetry === "object" ? telemetry : void 0;
38
+ if (objectConfig?.enabled === false) return { enabled: false };
39
+ return {
40
+ enabled: telemetry === true || objectConfig?.enabled === true || isTruthyEnv(envToggle) || isProductionTelemetryRuntime(),
41
+ endpoint: objectConfig?.endpoint?.trim() || readRuntimeEnv("DOCS_TELEMETRY_ENDPOINT") || DEFAULT_DOCS_TELEMETRY_ENDPOINT
42
+ };
43
+ }
44
+ function readRequestOrigin(request) {
45
+ if (!request?.url) return void 0;
46
+ try {
47
+ return new URL(request.url).origin;
48
+ } catch {
49
+ return;
50
+ }
51
+ }
52
+ /** Normalize an HTTP(S) telemetry site value to its origin. */
53
+ function normalizeDocsTelemetryOrigin(candidate) {
54
+ if (typeof candidate !== "string") return void 0;
55
+ const trimmed = candidate.trim();
56
+ if (!trimmed) return void 0;
57
+ try {
58
+ const hasScheme = /^[a-z][a-z\d+.-]*:(?!\d)/i.test(trimmed);
59
+ const url = new URL(hasScheme ? trimmed : `https://${trimmed}`);
60
+ if (url.protocol !== "http:" && url.protocol !== "https:") return void 0;
61
+ return url.origin;
62
+ } catch {
63
+ return;
64
+ }
65
+ }
66
+ /** Return whether a telemetry origin points at a local development server. */
67
+ function isLocalDocsTelemetryOrigin(candidate) {
68
+ const origin = normalizeDocsTelemetryOrigin(candidate);
69
+ if (!origin) return false;
70
+ const hostname = new URL(origin).hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.+$/, "");
71
+ if ([
72
+ "localhost",
73
+ "localhost.localdomain",
74
+ "localhost6",
75
+ "localhost6.localdomain6",
76
+ "ip6-localhost",
77
+ "ip6-loopback"
78
+ ].includes(hostname) || hostname.endsWith(".localhost")) return true;
79
+ if (hostname === "::" || hostname === "::1") return true;
80
+ const ipv4 = hostname.split(".").map((part) => Number(part));
81
+ if (ipv4.length === 4 && ipv4.every((part) => Number.isInteger(part) && part >= 0 && part <= 255)) return ipv4[0] === 127 || ipv4.every((part) => part === 0);
82
+ return /^::ffff:7f[0-9a-f]{2}:/.test(hostname) || hostname === "::ffff:0:0";
83
+ }
84
+ function isBlockedDocsTelemetryOrigin(candidate) {
85
+ if (candidate === void 0) return false;
86
+ return !normalizeDocsTelemetryOrigin(candidate) || isLocalDocsTelemetryOrigin(candidate);
87
+ }
88
+ function readDeploymentOrigin() {
89
+ const candidates = [
90
+ readRuntimeEnv("DOCS_SITE_URL"),
91
+ readRuntimeEnv("NEXT_PUBLIC_BASE_URL"),
92
+ readRuntimeEnv("NEXT_PUBLIC_SITE_URL"),
93
+ readRuntimeEnv("SITE_URL"),
94
+ readRuntimeEnv("URL"),
95
+ readRuntimeEnv("CF_PAGES_URL"),
96
+ readRuntimeEnv("VERCEL_PROJECT_PRODUCTION_URL"),
97
+ readRuntimeEnv("VERCEL_URL"),
98
+ readRuntimeEnv("DEPLOY_PRIME_URL")
99
+ ];
100
+ for (const candidate of candidates) {
101
+ const origin = normalizeDocsTelemetryOrigin(candidate);
102
+ if (origin) return origin;
103
+ }
104
+ }
105
+ function detectDeployment() {
106
+ const env = getRuntimeEnv();
107
+ if (!env) return void 0;
108
+ if (env.VERCEL || env.VERCEL_ENV) return {
109
+ provider: "vercel",
110
+ environment: env.VERCEL_ENV,
111
+ id: env.VERCEL_DEPLOYMENT_ID ?? env.VERCEL_GIT_COMMIT_SHA,
112
+ region: env.VERCEL_REGION
113
+ };
114
+ if (env.NETLIFY) return {
115
+ provider: "netlify",
116
+ environment: env.CONTEXT,
117
+ id: env.DEPLOY_ID ?? env.COMMIT_REF
118
+ };
119
+ if (env.CF_PAGES) return {
120
+ provider: "cloudflare-pages",
121
+ environment: env.CF_PAGES_BRANCH,
122
+ id: env.CF_PAGES_COMMIT_SHA
123
+ };
124
+ if (env.RENDER_SERVICE_ID) return {
125
+ provider: "render",
126
+ environment: env.RENDER_ENV,
127
+ id: env.RENDER_SERVICE_ID
128
+ };
129
+ if (env.FLY_APP_NAME) return {
130
+ provider: "fly",
131
+ environment: env.FLY_APP_NAME,
132
+ id: env.FLY_ALLOC_ID,
133
+ region: env.FLY_REGION
134
+ };
135
+ if (env.RAILWAY_ENVIRONMENT) return {
136
+ provider: "railway",
137
+ environment: env.RAILWAY_ENVIRONMENT,
138
+ id: env.RAILWAY_DEPLOYMENT_ID
139
+ };
140
+ return env.NODE_ENV === "production" ? { environment: "production" } : void 0;
141
+ }
142
+ function detectRuntime() {
143
+ if (typeof process !== "undefined" && process.versions?.node) return {
144
+ name: "node",
145
+ version: process.versions.node
146
+ };
147
+ if (typeof navigator !== "undefined" && navigator.userAgent) return { name: "web-standard" };
148
+ }
149
+ function createDocsTelemetryEvent(config, input, context = {}, resolveFeatures) {
150
+ const telemetryConfig = config.telemetry && typeof config.telemetry === "object" ? config.telemetry : void 0;
151
+ const siteOriginCandidates = [
152
+ context.siteOrigin,
153
+ input.site?.origin,
154
+ telemetryConfig?.siteOrigin,
155
+ readRequestOrigin(context.request),
156
+ readDeploymentOrigin()
157
+ ];
158
+ if (siteOriginCandidates.some(isBlockedDocsTelemetryOrigin)) return void 0;
159
+ const siteOrigin = siteOriginCandidates.map(normalizeDocsTelemetryOrigin).find((origin) => Boolean(origin));
160
+ const deployment = input.deployment ?? detectDeployment();
161
+ const properties = context.properties || input.properties ? {
162
+ ...input.properties,
163
+ ...context.properties
164
+ } : void 0;
165
+ return {
166
+ ...input,
167
+ timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
168
+ package: {
169
+ name: DOCS_PACKAGE_NAME,
170
+ version: DOCS_PACKAGE_VERSION,
171
+ ...input.package
172
+ },
173
+ framework: input.framework ?? context.framework,
174
+ runtime: input.runtime ?? detectRuntime(),
175
+ site: siteOrigin ? { origin: siteOrigin } : input.site,
176
+ deployment,
177
+ features: input.features ?? resolveFeatures?.() ?? {},
178
+ properties
179
+ };
180
+ }
181
+ async function emitDocsTelemetryEvent(telemetry, event) {
182
+ const resolved = resolveDocsTelemetryConfig(telemetry);
183
+ const eventSiteOrigin = event.site?.origin;
184
+ const normalizedSiteOrigin = normalizeDocsTelemetryOrigin(eventSiteOrigin);
185
+ if (!resolved.enabled || !resolved.endpoint || typeof fetch !== "function" || eventSiteOrigin !== void 0 && (!normalizedSiteOrigin || isLocalDocsTelemetryOrigin(eventSiteOrigin))) return;
186
+ const eventToSend = normalizedSiteOrigin ? {
187
+ ...event,
188
+ site: { origin: normalizedSiteOrigin }
189
+ } : event;
190
+ try {
191
+ const ingestKey = readRuntimeEnv("DOCS_TELEMETRY_INGEST_KEY");
192
+ const browserRequest = isBrowserRuntime() && !ingestKey;
193
+ const headers = { "content-type": browserRequest ? "text/plain;charset=UTF-8" : "application/json" };
194
+ if (ingestKey) headers["x-docs-telemetry-key"] = ingestKey;
195
+ await fetch(resolved.endpoint, {
196
+ method: "POST",
197
+ headers,
198
+ body: JSON.stringify({ event: eventToSend }),
199
+ keepalive: true,
200
+ ...browserRequest ? {
201
+ credentials: "omit",
202
+ mode: "no-cors"
203
+ } : {}
204
+ });
205
+ } catch {}
206
+ }
207
+ /**
208
+ * Emit a privacy-preserving browser page view for the maintainer telemetry dashboard.
209
+ *
210
+ * Page views include only the public site origin, pathname, locale, framework, and package
211
+ * metadata. They never include a query string, referrer, visitor id, IP address, or user agent.
212
+ */
213
+ function emitDocsTelemetryPageViewEvent(telemetry, context = {}) {
214
+ if (telemetry === false || telemetry && typeof telemetry === "object" && telemetry.enabled === false) return;
215
+ const runtimeSiteOrigin = context.siteOrigin ?? (typeof window !== "undefined" ? window.location?.origin : void 0);
216
+ if (isBlockedDocsTelemetryOrigin(runtimeSiteOrigin)) return;
217
+ const siteOrigin = (telemetry && typeof telemetry === "object" ? telemetry.siteOrigin : void 0) ?? runtimeSiteOrigin;
218
+ const event = createDocsTelemetryEvent({ telemetry }, {
219
+ type: "page_view",
220
+ features: {},
221
+ properties: {
222
+ trafficType: "human",
223
+ ...context.path ? { path: context.path.slice(0, 2048) } : {},
224
+ ...context.locale ? { locale: context.locale.slice(0, 80) } : {}
225
+ }
226
+ }, {
227
+ framework: context.framework,
228
+ siteOrigin
229
+ });
230
+ if (!event) return;
231
+ emitDocsTelemetryEvent(telemetry && typeof telemetry === "object" ? {
232
+ ...telemetry,
233
+ enabled: true
234
+ } : true, event);
235
+ }
236
+
237
+ //#endregion
238
+ export { createDocsTelemetryEvent, emitDocsTelemetryEvent, emitDocsTelemetryPageViewEvent, isLocalDocsTelemetryOrigin, normalizeDocsTelemetryOrigin, resolveDocsTelemetryConfig };
@@ -0,0 +1,15 @@
1
+ import { DocsConfig, DocsTelemetryAgentSurface, DocsTelemetryFeatures } from "./types.mjs";
2
+ import { DocsTelemetryAgentSurfaceContext, DocsTelemetryAgentSurfaceRequestOptions, DocsTelemetryContext, DocsTelemetryPageViewContext, ResolvedDocsTelemetryConfig, emitDocsTelemetryEvent, emitDocsTelemetryPageViewEvent, isLocalDocsTelemetryOrigin, normalizeDocsTelemetryOrigin, resolveDocsTelemetryConfig } from "./telemetry-runtime.mjs";
3
+
4
+ //#region src/telemetry.d.ts
5
+ declare function getDocsTelemetryFeatures(config: Partial<DocsConfig>): DocsTelemetryFeatures;
6
+ declare function emitDocsTelemetryProjectEvent(config: Partial<DocsConfig>, context?: DocsTelemetryContext): void;
7
+ declare function emitDocsTelemetryAgentSurfaceEvent(config: Partial<DocsConfig>, context: DocsTelemetryAgentSurfaceContext): void;
8
+ declare function emitDocsTelemetryMcpToolEvent(config: Partial<DocsConfig>, context: DocsTelemetryContext & {
9
+ tool: string;
10
+ locale?: string;
11
+ resultCount?: number;
12
+ }): void;
13
+ declare function inferDocsTelemetryAgentSurface(request: Request, options: DocsTelemetryAgentSurfaceRequestOptions): DocsTelemetryAgentSurface | undefined;
14
+ //#endregion
15
+ export { emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryMcpToolEvent, emitDocsTelemetryProjectEvent, getDocsTelemetryFeatures, inferDocsTelemetryAgentSurface };
@@ -0,0 +1,117 @@
1
+ import { isDocsContentChangesRequest, resolveDocsContentChangesConfig } from "./content-changes.mjs";
2
+ import { isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsSkillRequest, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolveDocsAgentsFormat, resolveDocsLlmsTxtRequest, resolveDocsMarkdownRequest, resolveDocsSkillFormat } from "./agent.mjs";
3
+ import { createDocsTelemetryEvent, emitDocsTelemetryEvent, emitDocsTelemetryPageViewEvent, isLocalDocsTelemetryOrigin, normalizeDocsTelemetryOrigin, resolveDocsTelemetryConfig } from "./telemetry-runtime.mjs";
4
+
5
+ //#region src/telemetry.ts
6
+ const PROJECT_TELEMETRY_CACHE_TTL_MS = 1440 * 60 * 1e3;
7
+ const PROJECT_TELEMETRY_CACHE_MAX_KEYS = 256;
8
+ function isObjectConfigEnabled(value, defaultEnabled) {
9
+ if (value === false) return false;
10
+ if (value === true) return true;
11
+ if (value && typeof value === "object" && !Array.isArray(value)) {
12
+ const enabled = value.enabled;
13
+ return enabled === false ? false : defaultEnabled || enabled === true;
14
+ }
15
+ return defaultEnabled;
16
+ }
17
+ function hasObjectConfig(value) {
18
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
19
+ }
20
+ function getDocsTelemetryFeatures(config) {
21
+ const pageActions = config.pageActions;
22
+ const feedback = config.feedback;
23
+ return {
24
+ search: isObjectConfigEnabled(config.search, true),
25
+ contentChanges: resolveDocsContentChangesConfig(config.agent?.contentChanges, { staticExport: config.staticExport === true }).enabled,
26
+ ai: isObjectConfigEnabled(config.ai, false),
27
+ mcp: isObjectConfigEnabled(config.mcp, true),
28
+ llmsTxt: isObjectConfigEnabled(config.llmsTxt, true),
29
+ pageActions: hasObjectConfig(pageActions),
30
+ feedback: feedback === true || hasObjectConfig(feedback) && feedback.enabled !== false,
31
+ agentFeedback: feedback !== false && !(hasObjectConfig(feedback) && feedback.agent === false) && !(hasObjectConfig(feedback) && hasObjectConfig(feedback.agent) && feedback.agent.enabled === false),
32
+ sitemap: isObjectConfigEnabled(config.sitemap, true),
33
+ robots: isObjectConfigEnabled(config.robots, true),
34
+ apiReference: isObjectConfigEnabled(config.apiReference, false),
35
+ staticExport: config.staticExport === true,
36
+ changelog: isObjectConfigEnabled(config.changelog, false),
37
+ cloud: typeof config.cloud !== "undefined" && isObjectConfigEnabled(config.cloud, true),
38
+ review: isObjectConfigEnabled(config.review, true),
39
+ codeBlocksValidate: hasObjectConfig(config.codeBlocks) && Boolean(config.codeBlocks.validate)
40
+ };
41
+ }
42
+ function projectEventKey(event) {
43
+ return [
44
+ event.package.name,
45
+ event.package.version,
46
+ event.framework ?? "",
47
+ event.site?.origin ?? "",
48
+ event.deployment?.provider ?? "",
49
+ event.deployment?.environment ?? "",
50
+ event.deployment?.id ?? ""
51
+ ].join("|");
52
+ }
53
+ function getSentProjectKeys() {
54
+ const globalValue = globalThis;
55
+ globalValue.__farmingLabsDocsTelemetryProjectKeys__ ??= /* @__PURE__ */ new Map();
56
+ return globalValue.__farmingLabsDocsTelemetryProjectKeys__;
57
+ }
58
+ function pruneSentProjectKeys(sent, now) {
59
+ for (const [key, expiresAt] of sent) if (expiresAt <= now) sent.delete(key);
60
+ while (sent.size >= PROJECT_TELEMETRY_CACHE_MAX_KEYS) {
61
+ const oldestKey = sent.keys().next().value;
62
+ if (!oldestKey) return;
63
+ sent.delete(oldestKey);
64
+ }
65
+ }
66
+ function emitDocsTelemetryProjectEvent(config, context = {}) {
67
+ const event = createDocsTelemetryEvent(config, { type: "project_detected" }, context, () => getDocsTelemetryFeatures(config));
68
+ if (!event) return;
69
+ const key = projectEventKey(event);
70
+ const sent = getSentProjectKeys();
71
+ const now = Date.now();
72
+ const expiresAt = sent.get(key);
73
+ if (expiresAt && expiresAt > now) return;
74
+ if (typeof expiresAt === "number") sent.delete(key);
75
+ pruneSentProjectKeys(sent, now);
76
+ sent.set(key, now + PROJECT_TELEMETRY_CACHE_TTL_MS);
77
+ emitDocsTelemetryEvent(config.telemetry, event);
78
+ }
79
+ function emitDocsTelemetryAgentSurfaceEvent(config, context) {
80
+ const event = createDocsTelemetryEvent(config, {
81
+ type: context.surface === "mcp" ? "mcp_request" : "agent_surface_used",
82
+ properties: { surface: context.surface }
83
+ }, context, () => getDocsTelemetryFeatures(config));
84
+ if (!event) return;
85
+ emitDocsTelemetryEvent(config.telemetry, event);
86
+ }
87
+ function emitDocsTelemetryMcpToolEvent(config, context) {
88
+ const event = createDocsTelemetryEvent(config, {
89
+ type: "mcp_tool_used",
90
+ properties: {
91
+ tool: context.tool,
92
+ locale: context.locale,
93
+ resultCount: context.resultCount
94
+ }
95
+ }, context, () => getDocsTelemetryFeatures(config));
96
+ if (!event) return;
97
+ emitDocsTelemetryEvent(config.telemetry, event);
98
+ }
99
+ function inferDocsTelemetryAgentSurface(request, options) {
100
+ const url = new URL(request.url);
101
+ const method = request.method.toUpperCase();
102
+ const feedbackRequest = resolveDocsAgentFeedbackRequest(url, resolveDocsAgentFeedbackConfig(options.feedback));
103
+ if ((method === "GET" || method === "HEAD") && isDocsAgentDiscoveryRequest(url)) return "agent_spec";
104
+ if ((method === "GET" || method === "HEAD") && feedbackRequest?.kind === "schema") return "agent_feedback_schema";
105
+ if (method === "POST" && feedbackRequest?.kind === "submit") return "agent_feedback_submit";
106
+ if (method === "GET" || method === "HEAD") {
107
+ if (isDocsContentChangesRequest(url)) return "content_changes";
108
+ if (isDocsAgentsRequest(url) || resolveDocsAgentsFormat(url) === "agents") return "agents";
109
+ if (isDocsSkillRequest(url) || resolveDocsSkillFormat(url) === "skill") return "skill";
110
+ if (resolveDocsMarkdownRequest(options.entry, url, request)) return "markdown";
111
+ if (resolveDocsLlmsTxtRequest(url, options.llmsTxt, options.entry)) return "llms";
112
+ }
113
+ if (method === "POST") return "ask_ai";
114
+ }
115
+
116
+ //#endregion
117
+ export { emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryMcpToolEvent, emitDocsTelemetryProjectEvent, getDocsTelemetryFeatures, inferDocsTelemetryAgentSurface };
@@ -1960,7 +1960,8 @@ type ReadingTimeFormat = "long" | "short";
1960
1960
  interface ReadingTimeConfig {
1961
1961
  /**
1962
1962
  * Whether to show the estimated reading time.
1963
- * @default true
1963
+ * This must be set to `true` to opt in when using an options object.
1964
+ * @default false
1964
1965
  */
1965
1966
  enabled?: boolean;
1966
1967
  /**
@@ -2739,6 +2740,19 @@ interface ChangelogConfig {
2739
2740
  actionsComponent?: unknown;
2740
2741
  }
2741
2742
  type ApiReferenceRenderer = "farming-labs" | "fumadocs" | "scalar";
2743
+ /** Renderer selection with renderer-specific options supplied by a framework adapter. */
2744
+ interface ApiReferenceRendererConfig {
2745
+ /** Renderer implementation to use. */
2746
+ name: ApiReferenceRenderer;
2747
+ /**
2748
+ * Options forwarded to the selected renderer.
2749
+ *
2750
+ * Use the framework adapter's typed renderer helper when available. For example,
2751
+ * Next.js exports `fumadocsRenderer()` from `@farming-labs/next/fumadocs-renderer`.
2752
+ */
2753
+ options?: Readonly<Record<string, unknown>>;
2754
+ }
2755
+ type ApiReferenceRendererInput = ApiReferenceRenderer | ApiReferenceRendererConfig;
2742
2756
  interface ApiReferenceVersionConfig {
2743
2757
  /** OpenAPI JSON or YAML source for this stable version identifier. */
2744
2758
  specUrl: string;
@@ -2860,10 +2874,14 @@ interface ApiReferenceConfig {
2860
2874
  * - `"farming-labs"` uses the framework-neutral renderer backed by the normalized operation model
2861
2875
  * - `"fumadocs"` uses the Fumadocs OpenAPI renderer bundled by `@farming-labs/next`
2862
2876
  * - `"scalar"` uses the Scalar renderer bundled by `@farming-labs/docs` and the adapters
2877
+ * - `{ name, options }` selects a renderer and forwards adapter-specific options
2878
+ *
2879
+ * Next.js provides `fumadocsRenderer()` from `@farming-labs/next/fumadocs-renderer` for typed
2880
+ * Fumadocs playground and runtime options.
2863
2881
  *
2864
2882
  * @default "farming-labs"
2865
2883
  */
2866
- renderer?: ApiReferenceRenderer;
2884
+ renderer?: ApiReferenceRendererInput;
2867
2885
  /**
2868
2886
  * Explicitly expose selected OpenAPI operations as MCP tools. This is deny-by-default:
2869
2887
  * set `operations`, or mark an operation with `x-farming-labs-mcp.enabled: true`.
@@ -4175,4 +4193,4 @@ interface DocsConfig {
4175
4193
  og?: OGConfig;
4176
4194
  }
4177
4195
  //#endregion
4178
- export { DocsAgentGoldenExampleVerification as $, DocsSearchFacetValue as $n, PageAgentVerification as $r, DocsI18nConfig as $t, DocsAgentA2AOpenIdConnectSecurityScheme as A, DocsRetrievalSourceProvenance as An, GithubConfig as Ar, DocsCloudConfig as At, DocsAgentEvaluationAnswerProvider as B, DocsSearchAdapter as Bn, OpenDocsProviderConfig as Br, DocsCodeBlocksValidationMode as Bt, DocsAgentA2AOAuth2SecurityScheme as C, DocsOkfTrustTier as Cn, DocsTelemetryEventInput as Cr, DocsAskAIActionType as Ct, DocsAgentA2AOAuthFlows as D, DocsPageAccessPolicy as Dn, DocsTheme as Dr, DocsAskAIFeedbackValue as Dt, DocsAgentA2AOAuthDeviceCodeFlow as E, DocsOpenApiMcpHeaders as En, DocsTelemetryFramework as Er, DocsAskAIFeedbackMessage as Et, DocsAgentA2ASkill as F, DocsReviewRulesConfig as Fn, LlmsTxtSectionConfig as Fr, DocsCodeBlocksPlannerConfig as Ft, DocsAgentEvaluationSurface as G, DocsSearchAmbiguityDecisionStatus as Gn, PageActionConnectMcpConfig as Gr, DocsContentChangeSnapshotLoader as Gt, DocsAgentEvaluationAnswerResult as H, DocsSearchAdapterFactory as Hn, OpenDocsTarget as Hr, DocsConfig as Ht, DocsAgentCompactConfig as I, DocsReviewScoreConfig as In, McpDocsSearchConfig as Ir, DocsCodeBlocksPlannerProvider as It, DocsAgentFeedbackContext as J, DocsSearchConfig as Jn, PageActionsConfig as Jr, DocsContentChangesResponse as Jt, DocsAgentEvaluationTaskInput as K, DocsSearchAmbiguityResolution as Kn, PageActionInstallSkillsConfig as Kr, DocsContentChangeSnapshotSaver as Kt, DocsAgentConfig as L, DocsReviewSeverity as Ln, OGConfig as Lr, DocsCodeBlocksRunnerConfig as Lt, DocsAgentA2ASecurityRequirement as M, DocsReviewCiConfig as Mn, LlmsTxtConfig as Mr, DocsCloudPreviewConfig as Mt, DocsAgentA2ASecurityScheme as N, DocsReviewCiMode as Nn, LlmsTxtMaxCharsConfig as Nr, DocsCloudPublishConfig as Nt, DocsAgentA2AOAuthImplicitFlow as O, DocsPaginatedSearchResponse as On, FeedbackConfig as Or, DocsAskAIMcpConfig as Ot, DocsAgentA2ASecurityScopeList as P, DocsReviewConfig as Pn, LlmsTxtMaxCharsMode as Pr, DocsCodeBlocksConfig as Pt, DocsAgentGoldenCoverageApplicability as Q, DocsSearchFacet as Qn, PageAgentFrontmatter as Qr, DocsFeedbackValue as Qt, DocsAgentContentChangesConfig as R, DocsRobotsConfig as Rn, OpenDocsConfig as Rr, DocsCodeBlocksRunnerProvider as Rt, DocsAgentA2AMutualTlsSecurityScheme as S, DocsOkfTrustMetadataInput as Sn, DocsTelemetryEvent as Sr, DocsAskAIActionData as St, DocsAgentA2AOAuthClientCredentialsFlow as T, DocsOpenApiMcpCredentialContext as Tn, DocsTelemetryFeatures as Tr, DocsAskAIFeedbackData as Tt, DocsAgentEvaluationAnswerRunner as U, DocsSearchAdapterPage as Un, OpenGraphImage as Ur, DocsContentChangeDocument as Ut, DocsAgentEvaluationAnswerRequest as V, DocsSearchAdapterContext as Vn, OpenDocsProviderId as Vr, DocsCodeBlocksValidationPolicy as Vt, DocsAgentEvaluationSourceReference as W, DocsSearchAmbiguityDecision as Wn, OrderingItem as Wr, DocsContentChangeSnapshotContext as Wt, DocsAgentGoldenAnswerExpectation as X, DocsSearchEmbeddingsConfig as Xn, PageAgentCommand as Xr, DocsContentSnapshotDocument as Xt, DocsAgentFeedbackData as Y, DocsSearchDocument as Yn, PageAgentAppliesTo as Yr, DocsContentSnapshot as Yt, DocsAgentGoldenAuthenticatedContentExpectation as Z, DocsSearchExplanation as Zn, PageAgentFailureMode as Zr, DocsFeedbackData as Zt, DocsAgentA2ACapabilities as _, TypographyConfig as _i, DocsOkfActorTimestamp as _n, DocsSearchWarning as _r, DocsAnalyticsEvent as _t, ApiReferenceRenderer as a, ReadingTimeFormat as ai, DocsMcpConfig as an, DocsSearchFilters as ar, DocsAgentGoldenSafetyExpectation as at, DocsAgentA2AHttpAuthSecurityScheme as b, DocsOkfStatus as bn, DocsTelemetryAgentSurface as br, DocsAnalyticsInput as bt, ChangelogConfig as c, SidebarConfig as ci, DocsMcpPromptsConfig as cn, DocsSearchQuery as cr, DocsAgentGoldenTaskFilters as ct, CopyMarkdownConfig as d, SidebarNode as di, DocsMcpToolsConfig as dn, DocsSearchRankingStrategy as dr, DocsAgentSkillsInput as dt, PageFrontmatter as ei, DocsMcpAllowedOrigins as en, DocsSearchFacetsResponse as er, DocsAgentGoldenExpectedExample as et, CopyMarkdownFormat as f, SidebarPageNode as fi, DocsMetadata as fn, DocsSearchRequest as fr, DocsAgentSkillsProgressiveDisclosureConfig as ft, DocsAgentA2AApiKeySecurityScheme as g, TypesenseDocsSearchConfig as gi, DocsObservabilityEventInput as gn, DocsSearchSourcePage as gr, DocsAnalyticsConfig as gt, DocsAccessPrincipal as h, ThemeToggleConfig as hi, DocsObservabilityEvent as hn, DocsSearchResultType as hr, DocsAgentTraceStatus as ht, ApiReferenceConfig as i, ReadingTimeConfig as ii, DocsMcpAuthenticateResult as in, DocsSearchFilterInput as ir, DocsAgentGoldenQueryVariantKind as it, DocsAgentA2AProtocolBinding as j, DocsRetrievalSourceScope as jn, LastUpdatedConfig as jr, DocsCloudFeatureConfig as jt, DocsAgentA2AOAuthPasswordFlow as k, DocsRelatedItem as kn, FontStyle as kr, DocsCloudApiKeyConfig as kt, ChangelogFrontmatter as l, SidebarFolderIndexBehavior as li, DocsMcpProtectedResourceConfig as ln, DocsSearchRankingReason as lr, DocsAgentSkillsCompatibilityPolicy as lt, DocsAccessClaimValue as m, SimpleDocsSearchConfig as mi, DocsObservabilityConfig as mn, DocsSearchResult as mr, DocsAgentTraceEventType as mt, AgentFeedbackConfig as n, PageSidebarFrontmatter as ni, DocsMcpAuthenticate as nn, DocsSearchFilterDecisionOutcome as nr, DocsAgentGoldenPromptInjectionExpectation as nt, ApiReferenceVersionConfig as o, ResolvedDocsRelatedLink as oi, DocsMcpCorsConfig as on, DocsSearchMatchField as or, DocsAgentGoldenTask as ot, CustomDocsSearchConfig as p, SidebarTree as pi, DocsNav as pn, DocsSearchResponse as pr, DocsAgentTraceEventInput as pt, DocsAgentEvaluationsConfig as q, DocsSearchChunkingConfig as qn, PageActionMcpProvider as qr, DocsContentChangedDocument as qt, AlgoliaDocsSearchConfig as r, PageTwitter as ri, DocsMcpAuthenticateContext as rn, DocsSearchFilterField as rr, DocsAgentGoldenQueryVariant as rt, BreadcrumbConfig as s, SidebarComponentProps as si, DocsMcpOriginContext as sn, DocsSearchMatchedTerm as sr, DocsAgentGoldenTaskExpectation as st, AIConfig as t, PageOpenGraph as ti, DocsMcpAuthPrincipal as tn, DocsSearchFilterDecision as tr, DocsAgentGoldenFreshnessExpectation as tt, CodeBlockCopyData as u, SidebarFolderNode as ui, DocsMcpSecurityConfig as un, DocsSearchRankingReasonCode as ur, DocsAgentSkillsConfig as ut, DocsAgentA2AConfig as v, UIConfig as vi, DocsOkfConfig as vn, DocsSearchWarningCode as vr, DocsAnalyticsEventInput as vt, DocsAgentA2AOAuthAuthorizationCodeFlow as w, DocsOpenApiMcpConfig as wn, DocsTelemetryEventType as wr, DocsAskAIFeedbackConfig as wt, DocsAgentA2AInterfaceConfig as x, DocsOkfTrustMetadata as xn, DocsTelemetryConfig as xr, DocsAnalyticsSource as xt, DocsAgentA2AExtension as y, DocsOkfSource as yn, DocsSitemapConfig as yr, DocsAnalyticsEventType as yt, DocsAgentEvaluationAnswerInput as z, DocsRobotsRule as zn, OpenDocsProvider as zr, DocsCodeBlocksValidateConfig as zt };
4196
+ export { AIConfig, AgentFeedbackConfig, AlgoliaDocsSearchConfig, ApiReferenceConfig, ApiReferenceRenderer, ApiReferenceRendererConfig, ApiReferenceRendererInput, ApiReferenceVersionConfig, BreadcrumbConfig, ChangelogConfig, ChangelogFrontmatter, CodeBlockCopyData, CopyMarkdownConfig, CopyMarkdownFormat, CustomDocsSearchConfig, DocsAccessClaimValue, DocsAccessPrincipal, DocsAgentA2AApiKeySecurityScheme, DocsAgentA2ACapabilities, DocsAgentA2AConfig, DocsAgentA2AExtension, DocsAgentA2AHttpAuthSecurityScheme, DocsAgentA2AInterfaceConfig, DocsAgentA2AMutualTlsSecurityScheme, DocsAgentA2AOAuth2SecurityScheme, DocsAgentA2AOAuthAuthorizationCodeFlow, DocsAgentA2AOAuthClientCredentialsFlow, DocsAgentA2AOAuthDeviceCodeFlow, DocsAgentA2AOAuthFlows, DocsAgentA2AOAuthImplicitFlow, DocsAgentA2AOAuthPasswordFlow, DocsAgentA2AOpenIdConnectSecurityScheme, DocsAgentA2AProtocolBinding, DocsAgentA2ASecurityRequirement, DocsAgentA2ASecurityScheme, DocsAgentA2ASecurityScopeList, DocsAgentA2ASkill, DocsAgentCompactConfig, DocsAgentConfig, DocsAgentContentChangesConfig, DocsAgentEvaluationAnswerInput, DocsAgentEvaluationAnswerProvider, DocsAgentEvaluationAnswerRequest, DocsAgentEvaluationAnswerResult, DocsAgentEvaluationAnswerRunner, DocsAgentEvaluationSourceReference, DocsAgentEvaluationSurface, DocsAgentEvaluationTaskInput, DocsAgentEvaluationsConfig, DocsAgentFeedbackContext, DocsAgentFeedbackData, DocsAgentGoldenAnswerExpectation, DocsAgentGoldenAuthenticatedContentExpectation, DocsAgentGoldenCoverageApplicability, DocsAgentGoldenExampleVerification, DocsAgentGoldenExpectedExample, DocsAgentGoldenFreshnessExpectation, DocsAgentGoldenPromptInjectionExpectation, DocsAgentGoldenQueryVariant, DocsAgentGoldenQueryVariantKind, DocsAgentGoldenSafetyExpectation, DocsAgentGoldenTask, DocsAgentGoldenTaskExpectation, DocsAgentGoldenTaskFilters, DocsAgentSkillsCompatibilityPolicy, DocsAgentSkillsConfig, DocsAgentSkillsInput, DocsAgentSkillsProgressiveDisclosureConfig, DocsAgentTraceEventInput, DocsAgentTraceEventType, DocsAgentTraceStatus, DocsAnalyticsConfig, DocsAnalyticsEvent, DocsAnalyticsEventInput, DocsAnalyticsEventType, DocsAnalyticsInput, DocsAnalyticsSource, DocsAskAIActionData, DocsAskAIActionType, DocsAskAIFeedbackConfig, DocsAskAIFeedbackData, DocsAskAIFeedbackMessage, DocsAskAIFeedbackValue, DocsAskAIMcpConfig, DocsCloudApiKeyConfig, DocsCloudConfig, DocsCloudFeatureConfig, DocsCloudPreviewConfig, DocsCloudPublishConfig, DocsCodeBlocksConfig, DocsCodeBlocksPlannerConfig, DocsCodeBlocksPlannerProvider, DocsCodeBlocksRunnerConfig, DocsCodeBlocksRunnerProvider, DocsCodeBlocksValidateConfig, DocsCodeBlocksValidationMode, DocsCodeBlocksValidationPolicy, DocsConfig, DocsContentChangeDocument, DocsContentChangeSnapshotContext, DocsContentChangeSnapshotLoader, DocsContentChangeSnapshotSaver, DocsContentChangedDocument, DocsContentChangesResponse, DocsContentSnapshot, DocsContentSnapshotDocument, DocsFeedbackData, DocsFeedbackValue, DocsI18nConfig, DocsMcpAllowedOrigins, DocsMcpAuthPrincipal, DocsMcpAuthenticate, DocsMcpAuthenticateContext, DocsMcpAuthenticateResult, DocsMcpConfig, DocsMcpCorsConfig, DocsMcpOriginContext, DocsMcpPromptsConfig, DocsMcpProtectedResourceConfig, DocsMcpSecurityConfig, DocsMcpToolsConfig, DocsMetadata, DocsNav, DocsObservabilityConfig, DocsObservabilityEvent, DocsObservabilityEventInput, DocsOkfActorTimestamp, DocsOkfConfig, DocsOkfSource, DocsOkfStatus, DocsOkfTrustMetadata, DocsOkfTrustMetadataInput, DocsOkfTrustTier, DocsOpenApiMcpConfig, DocsOpenApiMcpCredentialContext, DocsOpenApiMcpHeaders, DocsPageAccessPolicy, DocsPaginatedSearchResponse, DocsRelatedItem, DocsRetrievalSourceProvenance, DocsRetrievalSourceScope, DocsReviewCiConfig, DocsReviewCiMode, DocsReviewConfig, DocsReviewRulesConfig, DocsReviewScoreConfig, DocsReviewSeverity, DocsRobotsConfig, DocsRobotsRule, DocsSearchAdapter, DocsSearchAdapterContext, DocsSearchAdapterFactory, DocsSearchAdapterPage, DocsSearchAmbiguityDecision, DocsSearchAmbiguityDecisionStatus, DocsSearchAmbiguityResolution, DocsSearchChunkingConfig, DocsSearchConfig, DocsSearchDocument, DocsSearchEmbeddingsConfig, DocsSearchExplanation, DocsSearchFacet, DocsSearchFacetValue, DocsSearchFacetsResponse, DocsSearchFilterDecision, DocsSearchFilterDecisionOutcome, DocsSearchFilterField, DocsSearchFilterInput, DocsSearchFilters, DocsSearchMatchField, DocsSearchMatchedTerm, DocsSearchQuery, DocsSearchRankingReason, DocsSearchRankingReasonCode, DocsSearchRankingStrategy, DocsSearchRequest, DocsSearchResponse, DocsSearchResult, DocsSearchResultType, DocsSearchSourcePage, DocsSearchWarning, DocsSearchWarningCode, DocsSitemapConfig, DocsTelemetryAgentSurface, DocsTelemetryConfig, DocsTelemetryEvent, DocsTelemetryEventInput, DocsTelemetryEventType, DocsTelemetryFeatures, DocsTelemetryFramework, DocsTheme, FeedbackConfig, FontStyle, GithubConfig, LastUpdatedConfig, LlmsTxtConfig, LlmsTxtMaxCharsConfig, LlmsTxtMaxCharsMode, LlmsTxtSectionConfig, McpDocsSearchConfig, OGConfig, OpenDocsConfig, OpenDocsProvider, OpenDocsProviderConfig, OpenDocsProviderId, OpenDocsTarget, OpenGraphImage, OrderingItem, PageActionConnectMcpConfig, PageActionInstallSkillsConfig, PageActionMcpProvider, PageActionsConfig, PageAgentAppliesTo, PageAgentCommand, PageAgentFailureMode, PageAgentFrontmatter, PageAgentVerification, PageFrontmatter, PageOpenGraph, PageSidebarFrontmatter, PageTwitter, ReadingTimeConfig, ReadingTimeFormat, ResolvedDocsRelatedLink, SidebarComponentProps, SidebarConfig, SidebarFolderIndexBehavior, SidebarFolderNode, SidebarNode, SidebarPageNode, SidebarTree, SimpleDocsSearchConfig, ThemeToggleConfig, TypesenseDocsSearchConfig, TypographyConfig, UIConfig };
@@ -0,0 +1,7 @@
1
+ //#region src/urls.d.ts
2
+ declare function normalizeDocsUrlPath(value: string): string;
3
+ declare function toDocsMarkdownUrl(url: string, options?: {
4
+ locale?: string;
5
+ }): string;
6
+ //#endregion
7
+ export { normalizeDocsUrlPath, toDocsMarkdownUrl };
package/dist/urls.mjs ADDED
@@ -0,0 +1,21 @@
1
+ //#region src/urls.ts
2
+ function normalizeDocsUrlPath(value) {
3
+ const normalized = value.replace(/\/+/g, "/");
4
+ if (normalized === "/") return normalized;
5
+ return normalized.replace(/\/+$/, "");
6
+ }
7
+ function toDocsMarkdownUrl(url, options = {}) {
8
+ const hashIndex = url.indexOf("#");
9
+ const withoutHash = hashIndex >= 0 ? url.slice(0, hashIndex) : url;
10
+ const hash = hashIndex >= 0 ? url.slice(hashIndex + 1) : "";
11
+ const [pathname, query = ""] = withoutHash.split("?", 2);
12
+ const normalizedPath = normalizeDocsUrlPath(pathname || "/");
13
+ const markdownPath = normalizedPath.endsWith(".md") ? normalizedPath : `${normalizedPath}.md`;
14
+ const params = new URLSearchParams(query);
15
+ if (options.locale && !params.has("lang")) params.set("lang", options.locale);
16
+ const search = params.toString();
17
+ return `${markdownPath}${search ? `?${search}` : ""}${hash ? `#${hash}` : ""}`;
18
+ }
19
+
20
+ //#endregion
21
+ export { normalizeDocsUrlPath, toDocsMarkdownUrl };
@@ -0,0 +1,8 @@
1
+ //#region src/utils.d.ts
2
+ /**
3
+ * Deep merge utility for theme overrides.
4
+ * Merges objects recursively; later values override earlier ones.
5
+ */
6
+ declare function deepMerge<T extends Record<string, unknown>>(target: T, ...sources: Partial<T>[]): T;
7
+ //#endregion
8
+ export { deepMerge };
package/dist/utils.mjs ADDED
@@ -0,0 +1,22 @@
1
+ //#region src/utils.ts
2
+ /**
3
+ * Deep merge utility for theme overrides.
4
+ * Merges objects recursively; later values override earlier ones.
5
+ */
6
+ function deepMerge(target, ...sources) {
7
+ if (!sources.length) return target;
8
+ const source = sources.shift();
9
+ if (!source) return target;
10
+ const result = { ...target };
11
+ for (const key of Object.keys(source)) {
12
+ const sourceVal = source[key];
13
+ const targetVal = result[key];
14
+ if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal && typeof targetVal === "object" && !Array.isArray(targetVal)) result[key] = deepMerge(targetVal, sourceVal);
15
+ else if (sourceVal !== void 0) result[key] = sourceVal;
16
+ }
17
+ if (sources.length) return deepMerge(result, ...sources);
18
+ return result;
19
+ }
20
+
21
+ //#endregion
22
+ export { deepMerge };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.2.119",
3
+ "version": "0.2.121",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",
@@ -19,6 +19,10 @@
19
19
  "dist",
20
20
  "styles"
21
21
  ],
22
+ "sideEffects": [
23
+ "**/*.css",
24
+ "./dist/cli/**"
25
+ ],
22
26
  "type": "module",
23
27
  "main": "./dist/index.mjs",
24
28
  "module": "./dist/index.mjs",
@@ -39,6 +43,11 @@
39
43
  "import": "./dist/runtime.mjs",
40
44
  "default": "./dist/runtime.mjs"
41
45
  },
46
+ "./mdx": {
47
+ "types": "./dist/mdx.d.mts",
48
+ "import": "./dist/mdx.mjs",
49
+ "default": "./dist/mdx.mjs"
50
+ },
42
51
  "./markdown-rendering": {
43
52
  "types": "./dist/markdown-rendering.d.mts",
44
53
  "import": "./dist/markdown-rendering.mjs",
@@ -79,14 +88,18 @@
79
88
  "import": "./dist/mcp.mjs",
80
89
  "default": "./dist/mcp.mjs"
81
90
  },
82
- "./styles/themes/shadcn.css": "./styles/themes/shadcn.css"
91
+ "./styles/themes/shadcn.css": "./styles/themes/shadcn.css",
92
+ "./build": {
93
+ "types": "./dist/build.d.mts",
94
+ "import": "./dist/build.mjs",
95
+ "default": "./dist/build.mjs"
96
+ }
83
97
  },
84
98
  "dependencies": {
85
99
  "@clack/prompts": "^1.7.0",
86
100
  "@mdx-js/mdx": "^3.1.1",
87
101
  "@modelcontextprotocol/server": "2.0.0",
88
102
  "@scalar/core": "^0.4.3",
89
- "@vercel/sandbox": "^2.0.0",
90
103
  "github-slugger": "^2.0.0",
91
104
  "gray-matter": "^4.0.3",
92
105
  "jiti": "^2.7.0",
@@ -98,9 +111,13 @@
98
111
  "zod": "^4.3.6"
99
112
  },
100
113
  "peerDependencies": {
114
+ "@vercel/sandbox": "^2.0.0",
101
115
  "react": ">=19.2.0"
102
116
  },
103
117
  "peerDependenciesMeta": {
118
+ "@vercel/sandbox": {
119
+ "optional": true
120
+ },
104
121
  "react": {
105
122
  "optional": true
106
123
  }
@@ -109,6 +126,7 @@
109
126
  "@modelcontextprotocol/client": "2.2.0",
110
127
  "@types/node": "^22.10.0",
111
128
  "@types/react": "^19.2.2",
129
+ "@vercel/sandbox": "^2.0.0",
112
130
  "ajv": "^8.18.0",
113
131
  "ajv-formats": "^3.0.1",
114
132
  "react": "^19.2.0",