@farming-labs/docs 0.2.72 → 0.2.73

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 (55) hide show
  1. package/dist/{agent-DbDfIqhe.mjs → agent-ClRpctMG.mjs} +4 -3
  2. package/dist/{agent-evals-CjYzCQMZ.mjs → agent-evals-BFHGypqh.mjs} +30 -13
  3. package/dist/{agent-export-CpQhD8eA.mjs → agent-export-B9bah0AV.mjs} +12 -11
  4. package/dist/{agent-pS2nNQS3.mjs → agent-o9OTadrf.mjs} +576 -765
  5. package/dist/agent-skills-bundle.d.mts +1 -1
  6. package/dist/{agent-skills-server-DZnNB4_S.d.mts → agent-skills-server-DCbAx5WU.d.mts} +2 -2
  7. package/dist/{agent-skills-server-BPVv4gMg.mjs → agent-skills-server-noFn1l_p.mjs} +1 -1
  8. package/dist/agent-skills-vite.d.mts +3 -3
  9. package/dist/agent-skills-vite.mjs +2 -2
  10. package/dist/{agents-B-1h9Jlm.mjs → agents-CR-Uasbc.mjs} +10 -9
  11. package/dist/cli/index.mjs +29 -29
  12. package/dist/client/react.d.mts +1 -1
  13. package/dist/{cloud-ask-ai-D9gIN4Vr.d.mts → cloud-ask-ai-yR9vZmSG.d.mts} +1 -1
  14. package/dist/{cloud-CyysfDny.mjs → cloud-pdNC-tyj.mjs} +3 -3
  15. package/dist/{codeblocks-DAj7EAwt.mjs → codeblocks-CFuurVIH.mjs} +2 -2
  16. package/dist/{dev-qE7MYEh9.mjs → dev-Cc1cFFj-.mjs} +2 -2
  17. package/dist/docs-cloud-server.d.mts +2 -2
  18. package/dist/docs-cloud-server.mjs +1 -1
  19. package/dist/{doctor-CBy8-tPu.mjs → doctor-BeyN3Ljh.mjs} +15 -14
  20. package/dist/{downgrade-DCxezPZI.mjs → downgrade-w7e6Se0L.mjs} +2 -2
  21. package/dist/{golden-evaluations-DGg_eHIY.mjs → golden-evaluations-CloP0pAe.mjs} +4 -3
  22. package/dist/index.d.mts +72 -6
  23. package/dist/index.mjs +9 -8
  24. package/dist/{init-p1MHf06G.mjs → init-DAkI0Lkf.mjs} +3 -3
  25. package/dist/markdown-rendering.d.mts +75 -0
  26. package/dist/markdown-rendering.mjs +618 -0
  27. package/dist/markdown-sections-7OoA7ylx.mjs +1492 -0
  28. package/dist/{mcp-BNK45dzD.mjs → mcp-BLLXvEXB.mjs} +9 -8
  29. package/dist/mcp.d.mts +2 -2
  30. package/dist/mcp.mjs +10 -9
  31. package/dist/{metadata-D6qlWDu-.mjs → metadata-N252j5_a.mjs} +1 -1
  32. package/dist/{package-version-BXHcIm1T.mjs → package-version-n5AFur8a.mjs} +1 -1
  33. package/dist/{reading-time-DvTuW2Iy.mjs → prompt-references-Cz35rlOa.mjs} +158 -4
  34. package/dist/{review-Cace7A2c.mjs → review-DaJLdPLh.mjs} +10 -9
  35. package/dist/{robots-C2SindI5.mjs → robots-BcuxnZqZ.mjs} +2 -2
  36. package/dist/{robots-DmE_wXvG.mjs → robots-DI-9MZz1.mjs} +6 -5
  37. package/dist/{search-1aftosa5.d.mts → search-D1n8Sf25.d.mts} +24 -3
  38. package/dist/{search-DB3svkNQ.mjs → search-DeOJiMAy.mjs} +9 -8
  39. package/dist/{search-BbArHODP.mjs → search-RfPcG1if.mjs} +56 -21
  40. package/dist/server.d.mts +5 -5
  41. package/dist/server.mjs +10 -9
  42. package/dist/{sitemap-DPTLh_26.mjs → sitemap-BGGbX_KE.mjs} +10 -9
  43. package/dist/{sitemap-server-PUoOhplO.mjs → sitemap-server-VefDnzEB.mjs} +1 -1
  44. package/dist/{standards-discovery-DRJ10g7B.d.mts → standards-discovery-83lp1lew.d.mts} +5 -4
  45. package/dist/{standards-discovery-CYfiQE13.mjs → standards-discovery-BwL5ffGx.mjs} +4 -3
  46. package/dist/{upgrade-DDJQ5l6n.mjs → upgrade-oz-GChgt.mjs} +2 -2
  47. package/package.json +9 -1
  48. /package/dist/{cloud-ask-ai-hnJfj8-X.mjs → cloud-ask-ai-sbpjOR2K.mjs} +0 -0
  49. /package/dist/{code-blocks-qe0T8-xe.mjs → code-blocks-DnNVNK2M.mjs} +0 -0
  50. /package/dist/{config-z7_R0f86.mjs → config-Wcdj-D0a.mjs} +0 -0
  51. /package/dist/{errors-Cc_qplZU.mjs → errors-DbOhkE1h.mjs} +0 -0
  52. /package/dist/{i18n-CCaFUnAN.mjs → i18n-hHVWcflJ.mjs} +0 -0
  53. /package/dist/{templates-BJnf6B8l.mjs → templates-C6avM0U3.mjs} +0 -0
  54. /package/dist/{types-B9DNNAdT.d.mts → types-_HCPD4wc.d.mts} +0 -0
  55. /package/dist/{utils-C4RC8Zq_.mjs → utils-DpiIioYb.mjs} +0 -0
@@ -1,13 +1,14 @@
1
- import "./agent-pS2nNQS3.mjs";
2
- import { I as resolveDocsPublishedAgentSkill } from "./standards-discovery-CYfiQE13.mjs";
3
- import "./search-BbArHODP.mjs";
4
- import "./sitemap-server-PUoOhplO.mjs";
5
- import "./agent-evals-CjYzCQMZ.mjs";
1
+ import "./agent-o9OTadrf.mjs";
2
+ import "./markdown-sections-7OoA7ylx.mjs";
3
+ import { L as resolveDocsPublishedAgentSkill } from "./standards-discovery-BwL5ffGx.mjs";
4
+ import "./search-RfPcG1if.mjs";
5
+ import "./sitemap-server-VefDnzEB.mjs";
6
+ import "./agent-evals-BFHGypqh.mjs";
6
7
  import { createFilesystemDocsMcpSource, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
7
- import "./code-blocks-qe0T8-xe.mjs";
8
- import { t as resolveConfiguredAgentSkills } from "./agent-skills-server-BPVv4gMg.mjs";
8
+ import "./code-blocks-DnNVNK2M.mjs";
9
+ import { t as resolveConfiguredAgentSkills } from "./agent-skills-server-noFn1l_p.mjs";
9
10
  import "./server.mjs";
10
- import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, i as hasTopLevelProperty, l as readBooleanProperty, n as extractObjectLiteral, o as loadDocsConfigModuleResult, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-z7_R0f86.mjs";
11
+ import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, i as hasTopLevelProperty, l as readBooleanProperty, n as extractObjectLiteral, o as loadDocsConfigModuleResult, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-Wcdj-D0a.mjs";
11
12
  import { existsSync, readFileSync } from "node:fs";
12
13
  import path from "node:path";
13
14
  import pc from "picocolors";
package/dist/mcp.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { Ft as DocsMcpAuthenticate, Kt as DocsObservabilityConfig, Nt as DocsMcpAllowedOrigins, Pt as DocsMcpAuthPrincipal, Qn as PageAgentFrontmatter, Rt as DocsMcpConfig, cn as DocsSearchConfig, kn as DocsTelemetryFramework, qn as OrderingItem, rt as DocsAnalyticsConfig, wn as DocsTelemetryConfig, yn as DocsSearchSourcePage } from "./types-B9DNNAdT.mjs";
2
- import { I as DocsPublishedAgentSkill } from "./standards-discovery-DRJ10g7B.mjs";
1
+ import { Ft as DocsMcpAuthenticate, Kt as DocsObservabilityConfig, Nt as DocsMcpAllowedOrigins, Pt as DocsMcpAuthPrincipal, Qn as PageAgentFrontmatter, Rt as DocsMcpConfig, cn as DocsSearchConfig, kn as DocsTelemetryFramework, qn as OrderingItem, rt as DocsAnalyticsConfig, wn as DocsTelemetryConfig, yn as DocsSearchSourcePage } from "./types-_HCPD4wc.mjs";
2
+ import { L as DocsPublishedAgentSkill } from "./standards-discovery-83lp1lew.mjs";
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
 
5
5
  //#region src/mcp.d.ts
package/dist/mcp.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { a as emitDocsAnalyticsEvent, i as emitDocsAgentTraceEvent, n as createDocsAgentTraceContext, r as createDocsAgentTraceId } from "./analytics-Bx44lg6d.mjs";
2
- import { At as resolveDocsAudienceMdxContent, Gt as findDocsMarkdownSection, Jt as renderDocsRelatedMarkdownLines, Kt as parseDocsMarkdownSections, Sn as resolveDocsMcpResourceLocation, bn as normalizeDocsMcpEndpointPath, gn as isDocsMcpProtectedResourceMetadataPath, hn as isDocsMcpOAuthScopeToken, nn as normalizePageAgentFrontmatter, on as upsertPageAgentContractMarkdown, qt as normalizeDocsRelated, tn as hasStructuredPageAgentContract, vn as isDocsMcpResourcePath, xn as resolveDocsMcpProtectedResourceMetadataLocation, yn as normalizeDocsMcpAuthorizationServerUrls } from "./agent-pS2nNQS3.mjs";
3
- import "./standards-discovery-CYfiQE13.mjs";
4
- import { A as stripGeneratedAgentProvenance, F as emitDocsTelemetryAgentSurfaceEvent, L as emitDocsTelemetryMcpToolEvent, M as resolvePageSidebarFolderIndexBehavior, R as emitDocsTelemetryProjectEvent, S as normalizeAgentScopeValues, b as normalizeAgentFramework, d as performDocsSearch, f as performDocsSearchWithMetadata, u as normalizeDocsSearchFilters, v as agentVersionConstraintMatches, x as normalizeAgentLocale, y as agentVersionConstraintsOverlap } from "./search-BbArHODP.mjs";
2
+ import { Kt as normalizeDocsRelated, an as isDocsMcpResourcePath, cn as resolveDocsMcpProtectedResourceMetadataLocation, jt as resolveDocsAudienceMdxContent, ln as resolveDocsMcpResourceLocation, nn as isDocsMcpOAuthScopeToken, on as normalizeDocsMcpAuthorizationServerUrls, qt as renderDocsRelatedMarkdownLines, rn as isDocsMcpProtectedResourceMetadataPath, sn as normalizeDocsMcpEndpointPath } from "./agent-o9OTadrf.mjs";
3
+ import { S as upsertPageAgentContractMarkdown, _ as hasStructuredPageAgentContract, o as findDocsMarkdownSection, s as parseDocsMarkdownSections, v as normalizePageAgentFrontmatter } from "./markdown-sections-7OoA7ylx.mjs";
4
+ import "./standards-discovery-BwL5ffGx.mjs";
5
+ import { A as stripGeneratedAgentProvenance, F as emitDocsTelemetryAgentSurfaceEvent, L as emitDocsTelemetryMcpToolEvent, M as resolvePageSidebarFolderIndexBehavior, R as emitDocsTelemetryProjectEvent, S as normalizeAgentScopeValues, b as normalizeAgentFramework, d as performDocsSearch, f as performDocsSearchWithMetadata, u as normalizeDocsSearchFilters, v as agentVersionConstraintMatches, x as normalizeAgentLocale, y as agentVersionConstraintsOverlap } from "./search-RfPcG1if.mjs";
5
6
  import matter from "gray-matter";
6
7
  import fs from "node:fs";
7
8
  import path from "node:path";
@@ -3198,11 +3199,10 @@ async function createDocsMcpServer(options) {
3198
3199
  };
3199
3200
  }
3200
3201
  const fullDocument = renderPageDocument(page);
3201
- const sectionDocument = getDocsMcpSourceMarkdown(page);
3202
- const selectedSection = section ? findDocsMarkdownSection(sectionDocument, section) ?? (sectionDocument !== fullDocument ? findDocsMarkdownSection(fullDocument, section) : void 0) : void 0;
3202
+ const sectionDocument = upsertPageAgentContractMarkdown(getDocsMcpSourceMarkdown(page), page.agent);
3203
+ const selectedSection = section ? findDocsMarkdownSection(sectionDocument, section) : void 0;
3203
3204
  if (section && !selectedSection) {
3204
- const sourceSections = parseDocsMarkdownSections(sectionDocument);
3205
- const availableSections = (sourceSections.length > 0 ? sourceSections : parseDocsMarkdownSections(fullDocument)).map((item) => ({
3205
+ const availableSections = parseDocsMarkdownSections(sectionDocument).map((item) => ({
3206
3206
  title: item.title,
3207
3207
  anchor: item.anchor
3208
3208
  }));
@@ -4613,7 +4613,8 @@ function getDocsMcpResultPageUrl(value) {
4613
4613
  return value.split("#", 1)[0] ?? value;
4614
4614
  }
4615
4615
  function getDocsMcpResultAnchor(value) {
4616
- const anchor = value.split("#", 2)[1];
4616
+ const hashIndex = value.indexOf("#");
4617
+ const anchor = hashIndex >= 0 ? value.slice(hashIndex + 1) : "";
4617
4618
  if (!anchor) return void 0;
4618
4619
  try {
4619
4620
  return decodeURIComponent(anchor);
@@ -4695,7 +4696,7 @@ async function buildDocsMcpContext(options) {
4695
4696
  let usedUtf8Bytes = 0;
4696
4697
  for (const { result, page, scope, selectedSection, rawContent } of resolvedCandidates) {
4697
4698
  const anchor = selectedSection?.anchor;
4698
- const sourceUrl = anchor ? `${page.url}#${anchor}` : page.url;
4699
+ const sourceUrl = anchor ? `${page.url.split("#", 1)[0]}#${encodeURIComponent(anchor)}` : page.url;
4699
4700
  const headerLines = [`## ${page.title}`, `Source: ${sourceUrl}`];
4700
4701
  if (selectedSection?.title) headerLines.push(`Section: ${selectedSection.title}`);
4701
4702
  if (scope.framework) headerLines.push(`Framework: ${scope.framework}`);
@@ -1,4 +1,4 @@
1
- import { nn as normalizePageAgentFrontmatter, tn as hasStructuredPageAgentContract } from "./agent-pS2nNQS3.mjs";
1
+ import { _ as hasStructuredPageAgentContract, v as normalizePageAgentFrontmatter } from "./markdown-sections-7OoA7ylx.mjs";
2
2
 
3
3
  //#region src/metadata.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-C4RC8Zq_.mjs";
1
+ import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-DpiIioYb.mjs";
2
2
  import pc from "picocolors";
3
3
  import * as p from "@clack/prompts";
4
4
 
@@ -1,7 +1,7 @@
1
- import { Ft as DEFAULT_SITEMAP_XML_ROUTE, Nt as DEFAULT_SITEMAP_MD_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, f as DEFAULT_DOCS_CONFIG_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, m as DEFAULT_DOCS_DIAGNOSTICS_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, un as DEFAULT_MCP_WELL_KNOWN_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-pS2nNQS3.mjs";
1
+ import { It as DEFAULT_SITEMAP_XML_ROUTE, Pt as DEFAULT_SITEMAP_MD_ROUTE, Zt as DEFAULT_MCP_WELL_KNOWN_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, f as DEFAULT_DOCS_CONFIG_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, m as DEFAULT_DOCS_DIAGNOSTICS_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-o9OTadrf.mjs";
2
2
  import { isDocsAgentSkillName, validateDocsAgentSkillFrontmatter } from "./agent-skills-spec.mjs";
3
- import { C as DOCS_AGENT_MANIFEST_SCHEMA_MEDIA_TYPE, S as DOCS_AGENT_MANIFEST_FORMAT, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, n as API_CATALOG_MEDIA_TYPE, r as API_CATALOG_PROFILE_URI, t as AGENT_SKILLS_DISCOVERY_SCHEMA_URI, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, w as DOCS_AGENT_MANIFEST_SCHEMA_URI } from "./standards-discovery-CYfiQE13.mjs";
4
- import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-C2SindI5.mjs";
3
+ import { C as DOCS_AGENT_MANIFEST_SCHEMA_MEDIA_TYPE, S as DOCS_AGENT_MANIFEST_FORMAT, T as DOCS_AGENT_MANIFEST_VERSION, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, n as API_CATALOG_MEDIA_TYPE, r as API_CATALOG_PROFILE_URI, t as AGENT_SKILLS_DISCOVERY_SCHEMA_URI, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, w as DOCS_AGENT_MANIFEST_SCHEMA_URI } from "./standards-discovery-BwL5ffGx.mjs";
4
+ import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-BcuxnZqZ.mjs";
5
5
  import matter from "gray-matter";
6
6
 
7
7
  //#region src/define-docs.ts
@@ -683,6 +683,7 @@ function validateAgentManifest(content) {
683
683
  const issues = [];
684
684
  if (root?.$schema !== DOCS_AGENT_MANIFEST_SCHEMA_URI) issues.push(`Agent manifest did not declare top-level $schema ${DOCS_AGENT_MANIFEST_SCHEMA_URI}`);
685
685
  if (root?.format !== DOCS_AGENT_MANIFEST_FORMAT) issues.push(`Agent manifest did not declare top-level format ${DOCS_AGENT_MANIFEST_FORMAT}`);
686
+ if (root?.version !== DOCS_AGENT_MANIFEST_VERSION) issues.push(`Agent manifest did not declare top-level version ${DOCS_AGENT_MANIFEST_VERSION}`);
686
687
  return issues;
687
688
  }
688
689
  function httpLinkMatchesContractExpectation(header, expectation, responseUrl) {
@@ -909,4 +910,157 @@ function resolveReadingTimeFromSource(source, wordsPerMinute, options) {
909
910
  }
910
911
 
911
912
  //#endregion
912
- export { resolveReadingTimeOptions as a, runDocsAgentConformance as c, readAgentSkillDocumentFromTar as d, createTheme as f, defineDocs as g, resolveChangelogConfig as h, resolveReadingTimeFromSource as i, httpLinkHeaderHasTargetRelation as l, deepMerge as m, resolvePageReadingTime as n, DOCS_AGENT_CONTRACT_VERSION as o, extendTheme as p, resolveReadingTimeFromContent as r, createDocsAgentContractCases as s, estimateReadingTimeMinutes as t, AGENT_SKILL_ARCHIVE_MAX_UNCOMPRESSED_BYTES as u };
913
+ //#region src/heading-toc.ts
914
+ /**
915
+ * Encode heading fragments emitted by a renderer's nested table of contents.
916
+ *
917
+ * Fumadocs stores fragment URLs as raw DOM ids. Encoding the fragment after its
918
+ * heading visitor runs keeps links valid without changing path prefixes.
919
+ */
920
+ function encodeDocsHeadingTocUrls(value) {
921
+ if (Array.isArray(value)) {
922
+ for (const item of value) encodeDocsHeadingTocUrls(item);
923
+ return;
924
+ }
925
+ if (!value || typeof value !== "object") return;
926
+ const item = value;
927
+ if (typeof item.url === "string") {
928
+ const hashIndex = item.url.indexOf("#");
929
+ if (hashIndex >= 0) item.url = `${item.url.slice(0, hashIndex)}#${encodeURIComponent(item.url.slice(hashIndex + 1))}`;
930
+ }
931
+ encodeDocsHeadingTocUrls(item.children);
932
+ }
933
+
934
+ //#endregion
935
+ //#region src/prompt-references.ts
936
+ function isDocsMarkdownPromptNode(node) {
937
+ return (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === "Prompt";
938
+ }
939
+ function normalizeDocsMarkdownReferenceIdentifier(value) {
940
+ return typeof value === "string" ? value.trim().replace(/\s+/gu, " ").toLowerCase() : "";
941
+ }
942
+ function readDocsMarkdownPromptReferenceSource(value) {
943
+ const source = typeof value === "string" ? value : value instanceof Uint8Array ? new TextDecoder().decode(value) : void 0;
944
+ if (source === void 0) return void 0;
945
+ return source.startsWith("") ? source.slice(1) : source;
946
+ }
947
+ function sliceDocsMarkdownPromptReferenceSource(node, source) {
948
+ if (source === void 0) return void 0;
949
+ const start = node.position?.start?.offset;
950
+ const end = node.position?.end?.offset;
951
+ if (typeof start !== "number" || typeof end !== "number" || !Number.isInteger(start) || !Number.isInteger(end) || start < 0 || end < start || end > source.length) return;
952
+ return source.slice(start, end);
953
+ }
954
+ function sliceDocsMarkdownPromptChildrenSource(node, source) {
955
+ const nodeSource = sliceDocsMarkdownPromptReferenceSource(node, source);
956
+ if (nodeSource === void 0) return void 0;
957
+ const closingStart = nodeSource.lastIndexOf("</Prompt");
958
+ if (closingStart < 0) return void 0;
959
+ const children = node.children ?? [];
960
+ const isolatedChild = children.length === 1 ? children[0] : void 0;
961
+ if (isolatedChild?.type === "text" && typeof isolatedChild.value === "string" && isolatedChild.position === void 0) return isolatedChild.value;
962
+ const nodeStart = node.position?.start?.offset;
963
+ if (typeof nodeStart !== "number") return void 0;
964
+ let firstChildStart;
965
+ for (const child of children) {
966
+ const childStart = child.position?.start?.offset;
967
+ if (typeof childStart === "number" && Number.isInteger(childStart) && childStart >= nodeStart && (firstChildStart === void 0 || childStart - nodeStart < firstChildStart)) firstChildStart = childStart - nodeStart;
968
+ }
969
+ if (children.length > 0 && firstChildStart === void 0) return void 0;
970
+ const openingEnd = nodeSource.lastIndexOf(">", (firstChildStart ?? closingStart) - 1);
971
+ if (openingEnd < 0 || openingEnd >= closingStart) return void 0;
972
+ return nodeSource.slice(openingEnd + 1, closingStart);
973
+ }
974
+ function flattenDocsMarkdownPromptReferenceNode(node) {
975
+ if (typeof node.value === "string") return node.value;
976
+ return (node.children ?? []).map((child) => flattenDocsMarkdownPromptReferenceNode(child)).join("");
977
+ }
978
+ function formatDocsMarkdownPromptReference(node) {
979
+ const image = node.type === "imageReference";
980
+ const visibleLabel = image ? typeof node.alt === "string" ? node.alt : "" : flattenDocsMarkdownPromptReferenceNode(node);
981
+ const referenceLabel = typeof node.label === "string" ? node.label : typeof node.identifier === "string" ? node.identifier : visibleLabel;
982
+ const prefix = image ? "!" : "";
983
+ if (node.referenceType === "collapsed") return `${prefix}[${visibleLabel}][]`;
984
+ if (node.referenceType === "shortcut") return `${prefix}[${visibleLabel}]`;
985
+ return `${prefix}[${visibleLabel}][${referenceLabel}]`;
986
+ }
987
+ function formatDocsMarkdownPromptDefinition(node) {
988
+ const label = typeof node.label === "string" ? node.label : typeof node.identifier === "string" ? node.identifier : "";
989
+ const rawUrl = typeof node.url === "string" ? node.url : "";
990
+ return `[${label}]: ${/[<>\s]/u.test(rawUrl) ? `<${rawUrl.replace(/>/gu, "\\>")}>` : rawUrl}${typeof node.title === "string" ? ` "${node.title.replace(/"/gu, "\\\"")}"` : ""}`;
991
+ }
992
+ function createDocsMarkdownPromptReferenceText(node, source) {
993
+ return {
994
+ type: "text",
995
+ value: sliceDocsMarkdownPromptReferenceSource(node, source) ?? formatDocsMarkdownPromptReference(node),
996
+ position: node.position
997
+ };
998
+ }
999
+ function createDocsMarkdownPromptDefinitionParagraph(node, source) {
1000
+ return {
1001
+ type: "paragraph",
1002
+ children: [{
1003
+ type: "text",
1004
+ value: sliceDocsMarkdownPromptReferenceSource(node, source) ?? formatDocsMarkdownPromptDefinition(node),
1005
+ position: node.position
1006
+ }],
1007
+ position: node.position
1008
+ };
1009
+ }
1010
+ /**
1011
+ * Keep `<Prompt>` children literal before Markdown reference definitions are
1012
+ * resolved by the MDX compiler.
1013
+ *
1014
+ * Definitions inside Prompt are copyable source, not page-level definitions.
1015
+ * References inside Prompt always remain source text, while references outside
1016
+ * Prompt only remain live when they have a definition outside Prompt.
1017
+ */
1018
+ function isolateDocsMarkdownPromptReferences(root, value) {
1019
+ if (!root || typeof root !== "object") return;
1020
+ const source = readDocsMarkdownPromptReferenceSource(value);
1021
+ const promptDefinitions = /* @__PURE__ */ new Set();
1022
+ const pageDefinitions = /* @__PURE__ */ new Set();
1023
+ let hasPrompt = false;
1024
+ const collectDefinitions = (node, insidePrompt) => {
1025
+ const prompt = isDocsMarkdownPromptNode(node);
1026
+ const literal = insidePrompt || prompt;
1027
+ if (prompt) hasPrompt = true;
1028
+ if (node.type === "definition") {
1029
+ const identifier = normalizeDocsMarkdownReferenceIdentifier(node.identifier);
1030
+ if (identifier) (literal ? promptDefinitions : pageDefinitions).add(identifier);
1031
+ }
1032
+ for (const child of node.children ?? []) collectDefinitions(child, literal);
1033
+ };
1034
+ collectDefinitions(root, false);
1035
+ if (!hasPrompt) return;
1036
+ const isolateReferences = (node, insidePrompt) => {
1037
+ const prompt = isDocsMarkdownPromptNode(node);
1038
+ if (prompt) {
1039
+ const promptSource = sliceDocsMarkdownPromptChildrenSource(node, source);
1040
+ if (promptSource !== void 0) {
1041
+ node.children = [{
1042
+ type: "text",
1043
+ value: promptSource
1044
+ }];
1045
+ return;
1046
+ }
1047
+ }
1048
+ const literal = insidePrompt || prompt;
1049
+ const children = node.children;
1050
+ if (!children) return;
1051
+ node.children = children.map((child) => {
1052
+ const childInsidePrompt = literal || isDocsMarkdownPromptNode(child);
1053
+ if (childInsidePrompt && child.type === "definition") return createDocsMarkdownPromptDefinitionParagraph(child, source);
1054
+ if (child.type === "linkReference" || child.type === "imageReference") {
1055
+ const identifier = normalizeDocsMarkdownReferenceIdentifier(child.identifier);
1056
+ if (childInsidePrompt || promptDefinitions.has(identifier) && !pageDefinitions.has(identifier)) return createDocsMarkdownPromptReferenceText(child, source);
1057
+ }
1058
+ isolateReferences(child, childInsidePrompt);
1059
+ return child;
1060
+ });
1061
+ };
1062
+ isolateReferences(root, false);
1063
+ }
1064
+
1065
+ //#endregion
1066
+ export { resolveChangelogConfig as _, resolveReadingTimeFromContent as a, DOCS_AGENT_CONTRACT_VERSION as c, httpLinkHeaderHasTargetRelation as d, AGENT_SKILL_ARCHIVE_MAX_UNCOMPRESSED_BYTES as f, deepMerge as g, extendTheme as h, resolvePageReadingTime as i, createDocsAgentContractCases as l, createTheme as m, encodeDocsHeadingTocUrls as n, resolveReadingTimeFromSource as o, readAgentSkillDocumentFromTar as p, estimateReadingTimeMinutes as r, resolveReadingTimeOptions as s, isolateDocsMarkdownPromptReferences as t, runDocsAgentConformance as u, defineDocs as v };
@@ -1,13 +1,14 @@
1
- import { A as buildDocsAgentDiscoverySpec, Et as findDocsAudienceMdxIssues, M as buildDocsConfigMap, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, Xt as PAGE_AGENT_CONTRACT_FIELDS, en as getPageAgentFrontmatterIssues, fn as getDocsMcpProtectedResourceMetadataRoutes, nn as normalizePageAgentFrontmatter, tn as hasStructuredPageAgentContract } from "./agent-pS2nNQS3.mjs";
2
- import { F as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE } from "./standards-discovery-CYfiQE13.mjs";
3
- import { p as resolveAskAISearchRequestConfig } from "./search-BbArHODP.mjs";
4
- import { a as resolveDocsMetadataBaseUrl } from "./metadata-D6qlWDu-.mjs";
5
- import { c as resolveDocsReviewConfig, o as ensureDocsReviewWorkflow, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-CjYzCQMZ.mjs";
1
+ import { $t as getDocsMcpProtectedResourceMetadataRoutes, A as buildDocsAgentDiscoverySpec, Dt as findDocsAudienceMdxIssues, M as buildDocsConfigMap, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS } from "./agent-o9OTadrf.mjs";
2
+ import { _ as hasStructuredPageAgentContract, f as PAGE_AGENT_CONTRACT_FIELDS, g as getPageAgentFrontmatterIssues, v as normalizePageAgentFrontmatter } from "./markdown-sections-7OoA7ylx.mjs";
3
+ import { I as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE } from "./standards-discovery-BwL5ffGx.mjs";
4
+ import { p as resolveAskAISearchRequestConfig } from "./search-RfPcG1if.mjs";
5
+ import { a as resolveDocsMetadataBaseUrl } from "./metadata-N252j5_a.mjs";
6
+ import { c as resolveDocsReviewConfig, o as ensureDocsReviewWorkflow, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-BFHGypqh.mjs";
6
7
  import { createFilesystemDocsMcpSource, getDocsConfigSchema, resolveDocsMcpConfig } from "./mcp.mjs";
7
- import "./code-blocks-qe0T8-xe.mjs";
8
- import { _ as resolveDocsContentDir, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-z7_R0f86.mjs";
9
- import { t as detectFramework } from "./utils-C4RC8Zq_.mjs";
10
- import { a as extractAgentBlocks, i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-DGg_eHIY.mjs";
8
+ import "./code-blocks-DnNVNK2M.mjs";
9
+ import { _ as resolveDocsContentDir, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-Wcdj-D0a.mjs";
10
+ import { t as detectFramework } from "./utils-DpiIioYb.mjs";
11
+ import { a as extractAgentBlocks, i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-CloP0pAe.mjs";
11
12
  import matter from "gray-matter";
12
13
  import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
13
14
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Vt as resolveDocsSitemapConfig, a as DEFAULT_AGENT_MD_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, cn as DEFAULT_MCP_PUBLIC_ROUTE, et as normalizeDocsPathSegment, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, un as DEFAULT_MCP_WELL_KNOWN_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-pS2nNQS3.mjs";
2
- import { a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, x as DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery-CYfiQE13.mjs";
1
+ import { Ht as resolveDocsSitemapConfig, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Yt as DEFAULT_MCP_PUBLIC_ROUTE, Zt as DEFAULT_MCP_WELL_KNOWN_ROUTE, a as DEFAULT_AGENT_MD_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, et as normalizeDocsPathSegment, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-o9OTadrf.mjs";
2
+ import { a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, x as DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery-BwL5ffGx.mjs";
3
3
 
4
4
  //#region src/robots.ts
5
5
  const DEFAULT_ROBOTS_TXT_ROUTE = "/robots.txt";
@@ -1,8 +1,9 @@
1
- import "./agent-pS2nNQS3.mjs";
2
- import "./standards-discovery-CYfiQE13.mjs";
3
- import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-C2SindI5.mjs";
4
- import { a as loadDocsConfigModule, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-z7_R0f86.mjs";
5
- import { t as detectFramework } from "./utils-C4RC8Zq_.mjs";
1
+ import "./agent-o9OTadrf.mjs";
2
+ import "./markdown-sections-7OoA7ylx.mjs";
3
+ import "./standards-discovery-BwL5ffGx.mjs";
4
+ import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-BcuxnZqZ.mjs";
5
+ import { a as loadDocsConfigModule, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-Wcdj-D0a.mjs";
6
+ import { t as detectFramework } from "./utils-DpiIioYb.mjs";
6
7
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
8
  import path from "node:path";
8
9
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
- import { Gn as OpenDocsTarget, Hn as OpenDocsProvider, Jt as DocsObservabilityEventInput, Kt as DocsObservabilityConfig, Sn as DocsSitemapConfig, _n as DocsSearchResult, at as DocsAnalyticsEventInput, cn as DocsSearchConfig, et as DocsAgentTraceEventInput, f as CustomDocsSearchConfig, fn as DocsSearchFilterInput, gn as DocsSearchResponse, gr as TypesenseDocsSearchConfig, hn as DocsSearchRequest, ht as DocsAskAIMcpConfig, in as DocsSearchAdapter, it as DocsAnalyticsEvent, ln as DocsSearchDocument, on as DocsSearchAdapterFactory, or as ResolvedDocsRelatedLink, pn as DocsSearchFilters, qt as DocsObservabilityEvent, r as AlgoliaDocsSearchConfig, rt as DocsAnalyticsConfig, sn as DocsSearchChunkingConfig, yn as DocsSearchSourcePage, zn as McpDocsSearchConfig } from "./types-B9DNNAdT.mjs";
2
- import { F as DocsDiscoveryApiRouteOptions } from "./standards-discovery-DRJ10g7B.mjs";
1
+ import { Gn as OpenDocsTarget, Hn as OpenDocsProvider, Jt as DocsObservabilityEventInput, Kt as DocsObservabilityConfig, Sn as DocsSitemapConfig, _n as DocsSearchResult, at as DocsAnalyticsEventInput, cn as DocsSearchConfig, et as DocsAgentTraceEventInput, f as CustomDocsSearchConfig, fn as DocsSearchFilterInput, gn as DocsSearchResponse, gr as TypesenseDocsSearchConfig, hn as DocsSearchRequest, ht as DocsAskAIMcpConfig, in as DocsSearchAdapter, it as DocsAnalyticsEvent, ln as DocsSearchDocument, on as DocsSearchAdapterFactory, or as ResolvedDocsRelatedLink, pn as DocsSearchFilters, qt as DocsObservabilityEvent, r as AlgoliaDocsSearchConfig, rt as DocsAnalyticsConfig, sn as DocsSearchChunkingConfig, yn as DocsSearchSourcePage, zn as McpDocsSearchConfig } from "./types-_HCPD4wc.mjs";
2
+ import { I as DocsDiscoveryApiRouteOptions } from "./standards-discovery-83lp1lew.mjs";
3
3
 
4
4
  //#region src/analytics.d.ts
5
5
  declare const DOCS_AGENT_TRACE_EVENT_TYPES: readonly ["run.start", "run.end", "run.error", "user.input", "prompt.build", "retrieval.query", "retrieval.result", "retrieval.error", "model.call", "model.response", "model.stream", "model.error", "tool.call", "tool.result", "tool.error", "retry", "timeout", "error", "agent.final"];
@@ -35,11 +35,32 @@ declare function emitDocsAgentTraceEvent(observability: boolean | DocsObservabil
35
35
  type DocsContentAudience = "human" | "agent";
36
36
  /** Resolve whether content with an optional audience restriction is visible. */
37
37
  declare function resolveDocsAudienceExposure(only: unknown, audience: DocsContentAudience): boolean;
38
+ interface DocsMarkdownPromptBlock {
39
+ /** Raw JSX attributes between the Prompt name and opening bracket. */
40
+ attributes: string;
41
+ /** Literal source between the Prompt tags, with enclosing Markdown container prefixes removed. */
42
+ children: string;
43
+ /** Collision-safe placeholder carried through document-level rendering. */
44
+ token: string;
45
+ }
46
+ interface ExtractedDocsMarkdownPromptBlocks {
47
+ blocks: DocsMarkdownPromptBlock[];
48
+ markdown: string;
49
+ }
38
50
  interface DocsAudienceMdxIssue {
39
51
  code: "missing-only" | "invalid-only" | "dynamic-only" | "ignored-agent-only" | "ignored-human-only";
40
52
  index: number;
41
53
  message: string;
42
54
  }
55
+ /**
56
+ * Extract live MDX Prompt blocks while leaving Markdown literals untouched.
57
+ *
58
+ * Prompt bodies are copyable source, so callers can safely run audience,
59
+ * reference-definition, and heading passes over `markdown`, then restore each
60
+ * block from its token. Fences (including container fences), inline code, links,
61
+ * comments, raw elements, and other literal contexts are never extracted.
62
+ */
63
+ declare function extractDocsMarkdownPromptBlocks(content: string): ExtractedDocsMarkdownPromptBlocks;
43
64
  /** Find audience declarations that cannot be projected consistently at build time. */
44
65
  declare function findDocsAudienceMdxIssues(content: string): DocsAudienceMdxIssue[];
45
66
  /**
@@ -291,4 +312,4 @@ declare function buildDocsAskAIContext(options: {
291
312
  }): Promise<DocsAskAIContext>;
292
313
  declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
293
314
  //#endregion
294
- export { serializeOpenDocsProviders as $, createDocsSitemapResponse as A, DEFAULT_OPEN_DOCS_TARGET as B, DEFAULT_SITEMAP_XML_ROUTE as C, DocsSitemapPageInput as D, DocsSitemapManifestPage as E, resolveDocsSitemapPageLastmod as F, SerializedOpenDocsProvider as G, PromptAction as H, resolveDocsSitemapRequest as I, resolvePromptProviderChoices as J, normalizePromptProviderName as K, toDocsSitemapMarkdownUrl as L, renderDocsSitemapMarkdown as M, renderDocsSitemapXml as N, DocsSitemapResolvedConfig as O, resolveDocsSitemapConfig as P, serializeOpenDocsProvider as Q, DEFAULT_OPEN_DOCS_PROMPT as R, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as S, DocsSitemapManifest as T, PromptProviderChoice as U, DEFAULT_PROMPT_PROVIDER_TEMPLATES as V, SerializeOpenDocsProviderOptions as W, serializeDocsIcon as X, sanitizePromptText as Y, serializeDocsIconRegistry as Z, resolveDocsSearchRequest as _, resolveDocsObservabilityConfig as _t, createCustomSearchAdapter as a, resolveDocsAudienceMdxContent as at, DEFAULT_SITEMAP_MD_DOCS_ROUTE as b, createTypesenseSearchAdapter as c, ResolvedDocsAnalyticsConfig as ct, normalizeDocsSearchFilters as d, createDocsAgentTraceId as dt, DocsAudienceMdxIssue as et, performDocsSearch as f, emitDocsAgentTraceEvent as ft, resolveDocsSearchFilters as g, resolveDocsAnalyticsConfig as gt, resolveDocsSearchAudience as h, getDocsRequestAnalyticsProperties as ht, createAlgoliaSearchAdapter as i, resolveDocsAudienceExposure as it, readDocsSitemapManifestFromContentMap as j, buildDocsSitemapManifest as k, formatDocsAskAIPackageHints as l, ResolvedDocsObservabilityConfig as lt, resolveAskAISearchRequestConfig as m, emitDocsObservabilityEvent as mt, buildDocsAskAIContext as n, findDocsAudienceMdxIssues as nt, createMcpSearchAdapter as o, DOCS_AGENT_TRACE_EVENT_TYPES as ot, performDocsSearchWithMetadata as p, emitDocsAnalyticsEvent as pt, parsePromptStringArray as q, buildDocsSearchDocuments as r, resolveDocsAgentMdxContent as rt, createSimpleSearchAdapter as s, DocsAgentTraceContext as st, PerformDocsSearchOptions as t, DocsContentAudience as tt, inferDocsAskAIPackageHints as u, createDocsAgentTraceContext as ut, resolveSearchRequestConfig as v, DocsSitemapFormat as w, DEFAULT_SITEMAP_MD_ROUTE as x, DEFAULT_SITEMAP_MANIFEST_PATH as y, DEFAULT_OPEN_DOCS_PROVIDER_IDS as z };
315
+ export { serializeOpenDocsProviders as $, createDocsSitemapResponse as A, DEFAULT_OPEN_DOCS_TARGET as B, DEFAULT_SITEMAP_XML_ROUTE as C, DocsSitemapPageInput as D, DocsSitemapManifestPage as E, resolveDocsSitemapPageLastmod as F, SerializedOpenDocsProvider as G, PromptAction as H, resolveDocsSitemapRequest as I, resolvePromptProviderChoices as J, normalizePromptProviderName as K, toDocsSitemapMarkdownUrl as L, renderDocsSitemapMarkdown as M, renderDocsSitemapXml as N, DocsSitemapResolvedConfig as O, resolveDocsSitemapConfig as P, serializeOpenDocsProvider as Q, DEFAULT_OPEN_DOCS_PROMPT as R, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as S, DocsSitemapManifest as T, PromptProviderChoice as U, DEFAULT_PROMPT_PROVIDER_TEMPLATES as V, SerializeOpenDocsProviderOptions as W, serializeDocsIcon as X, sanitizePromptText as Y, serializeDocsIconRegistry as Z, resolveDocsSearchRequest as _, emitDocsObservabilityEvent as _t, createCustomSearchAdapter as a, findDocsAudienceMdxIssues as at, DEFAULT_SITEMAP_MD_DOCS_ROUTE as b, resolveDocsObservabilityConfig as bt, createTypesenseSearchAdapter as c, resolveDocsAudienceMdxContent as ct, normalizeDocsSearchFilters as d, ResolvedDocsAnalyticsConfig as dt, DocsAudienceMdxIssue as et, performDocsSearch as f, ResolvedDocsObservabilityConfig as ft, resolveDocsSearchFilters as g, emitDocsAnalyticsEvent as gt, resolveDocsSearchAudience as h, emitDocsAgentTraceEvent as ht, createAlgoliaSearchAdapter as i, extractDocsMarkdownPromptBlocks as it, readDocsSitemapManifestFromContentMap as j, buildDocsSitemapManifest as k, formatDocsAskAIPackageHints as l, DOCS_AGENT_TRACE_EVENT_TYPES as lt, resolveAskAISearchRequestConfig as m, createDocsAgentTraceId as mt, buildDocsAskAIContext as n, DocsMarkdownPromptBlock as nt, createMcpSearchAdapter as o, resolveDocsAgentMdxContent as ot, performDocsSearchWithMetadata as p, createDocsAgentTraceContext as pt, parsePromptStringArray as q, buildDocsSearchDocuments as r, ExtractedDocsMarkdownPromptBlocks as rt, createSimpleSearchAdapter as s, resolveDocsAudienceExposure as st, PerformDocsSearchOptions as t, DocsContentAudience as tt, inferDocsAskAIPackageHints as u, DocsAgentTraceContext as ut, resolveSearchRequestConfig as v, getDocsRequestAnalyticsProperties as vt, DocsSitemapFormat as w, DEFAULT_SITEMAP_MD_ROUTE as x, DEFAULT_SITEMAP_MANIFEST_PATH as y, resolveDocsAnalyticsConfig as yt, DEFAULT_OPEN_DOCS_PROVIDER_IDS as z };
@@ -1,13 +1,14 @@
1
- import "./agent-pS2nNQS3.mjs";
2
- import "./standards-discovery-CYfiQE13.mjs";
3
- import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-BbArHODP.mjs";
4
- import "./sitemap-server-PUoOhplO.mjs";
5
- import "./agent-evals-CjYzCQMZ.mjs";
1
+ import "./agent-o9OTadrf.mjs";
2
+ import "./markdown-sections-7OoA7ylx.mjs";
3
+ import "./standards-discovery-BwL5ffGx.mjs";
4
+ import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-RfPcG1if.mjs";
5
+ import "./sitemap-server-VefDnzEB.mjs";
6
+ import "./agent-evals-BFHGypqh.mjs";
6
7
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
7
- import "./code-blocks-qe0T8-xe.mjs";
8
- import "./agent-skills-server-BPVv4gMg.mjs";
8
+ import "./code-blocks-DnNVNK2M.mjs";
9
+ import "./agent-skills-server-noFn1l_p.mjs";
9
10
  import "./server.mjs";
10
- import { _ as resolveDocsContentDir, c as loadProjectEnv, g as resolveDocsConfigPath, h as readTopLevelStringProperty } from "./config-z7_R0f86.mjs";
11
+ import { _ as resolveDocsContentDir, c as loadProjectEnv, g as resolveDocsConfigPath, h as readTopLevelStringProperty } from "./config-Wcdj-D0a.mjs";
11
12
  import { readFileSync } from "node:fs";
12
13
  import pc from "picocolors";
13
14
 
@@ -1,4 +1,5 @@
1
- import { At as resolveDocsAudienceMdxContent, G as isDocsAgentDiscoveryRequest, Gt as findDocsMarkdownSection, K as isDocsAgentsRequest, Kt as parseDocsMarkdownSections, Q as isDocsSkillRequest, Qt as PAGE_AGENT_CONTRACT_START_MARKER, Yt as PAGE_AGENT_CONTRACT_END_MARKER, _t as resolveDocsMarkdownRequest, dt as resolveDocsAgentsFormat, lt as resolveDocsAgentFeedbackConfig, on as upsertPageAgentContractMarkdown, pt as resolveDocsLlmsTxtRequest, rn as renderPageAgentContractMarkdown, ut as resolveDocsAgentFeedbackRequest, xt as resolveDocsSkillFormat } from "./agent-pS2nNQS3.mjs";
1
+ import { G as isDocsAgentDiscoveryRequest, K as isDocsAgentsRequest, Q as isDocsSkillRequest, _t as resolveDocsMarkdownRequest, dt as resolveDocsAgentsFormat, jt as resolveDocsAudienceMdxContent, lt as resolveDocsAgentFeedbackConfig, pt as resolveDocsLlmsTxtRequest, ut as resolveDocsAgentFeedbackRequest, xt as resolveDocsSkillFormat } from "./agent-o9OTadrf.mjs";
2
+ import { S as upsertPageAgentContractMarkdown, a as findDocsGeneratedAgentContractRanges, d as PAGE_AGENT_CONTRACT_END_MARKER, l as stripDocsGeneratedAgentContractMarkers, m as PAGE_AGENT_CONTRACT_START_MARKER, o as findDocsMarkdownSection, s as parseDocsMarkdownSections, y as renderPageAgentContractMarkdown } from "./markdown-sections-7OoA7ylx.mjs";
2
3
 
3
4
  //#region src/telemetry.ts
4
5
  const DOCS_PACKAGE_NAME = "@farming-labs/docs";
@@ -1044,8 +1045,14 @@ function resolveAskAIContextUrl(value, baseUrl) {
1044
1045
  return value;
1045
1046
  }
1046
1047
  }
1048
+ function cleanGeneratedAgentContractMarkers(content) {
1049
+ return stripDocsGeneratedAgentContractMarkers(content);
1050
+ }
1051
+ function getAskAIPageSectionContent(page) {
1052
+ return getPageAudienceSectionContent(page, "agent");
1053
+ }
1047
1054
  function getAskAIPageContent(page) {
1048
- return upsertPageAgentContractMarkdown(getPageAudienceRawContent(page, "agent"), page.agent).replace(PAGE_AGENT_CONTRACT_START_MARKER, "").replace(PAGE_AGENT_CONTRACT_END_MARKER, "").replace(/^\r?\n+/, "");
1055
+ return cleanGeneratedAgentContractMarkers(getAskAIPageSectionContent(page));
1049
1056
  }
1050
1057
  function getPageAgentContractSearchText(page) {
1051
1058
  return stripMarkdownText(renderPageAgentContractMarkdown(page.agent).replace(PAGE_AGENT_CONTRACT_START_MARKER, "").replace(PAGE_AGENT_CONTRACT_END_MARKER, ""));
@@ -1145,7 +1152,7 @@ function formatAskAIContextResult(options) {
1145
1152
  const title = inferResultTitle(result, page);
1146
1153
  const section = result.section;
1147
1154
  const sectionSelector = getSearchResultAnchor(result.url) ?? section;
1148
- const contextContent = clampText(cleanAskAIContextMarkdown(page ? sectionSelector ? findDocsMarkdownSection(getAskAIPageContent(page), sectionSelector)?.content ?? "" : getAskAIPageContent(page) : [result.content, result.description].filter(Boolean).join("\n\n")), maxChars);
1155
+ const contextContent = clampText(cleanAskAIContextMarkdown(page ? sectionSelector ? cleanGeneratedAgentContractMarkers(findDocsMarkdownSection(getAskAIPageSectionContent(page), sectionSelector)?.content ?? "") : getAskAIPageContent(page) : [result.content, result.description].filter(Boolean).join("\n\n")), maxChars);
1149
1156
  return {
1150
1157
  ...result,
1151
1158
  url: resolveAskAIContextUrl(result.url, baseUrl),
@@ -1154,20 +1161,17 @@ function formatAskAIContextResult(options) {
1154
1161
  };
1155
1162
  }
1156
1163
  function getSearchResultKey(result) {
1157
- let hash = "";
1158
- try {
1159
- hash = new URL(result.url, "https://docs.local").hash.replace(/^#/, "");
1160
- } catch {
1161
- hash = result.url.split("#")[1]?.split(/[?&]/)[0] ?? "";
1162
- }
1163
- return `${normalizeUrlPathname(result.url)}#${normalizeWhitespace(hash || result.section || "").toLowerCase()}`;
1164
+ const anchor = getSearchResultAnchor(result.url);
1165
+ const sectionFallback = normalizeWhitespace(result.section ?? "").toLowerCase();
1166
+ return `${normalizeUrlPathname(result.url)}#${anchor ?? sectionFallback}`;
1164
1167
  }
1165
1168
  function getSearchResultAnchor(value) {
1166
1169
  let hash = "";
1167
1170
  try {
1168
1171
  hash = new URL(value, "https://docs.local").hash.replace(/^#/, "");
1169
1172
  } catch {
1170
- hash = value.split("#")[1]?.split(/[?&]/)[0] ?? "";
1173
+ const hashIndex = value.indexOf("#");
1174
+ hash = hashIndex >= 0 ? value.slice(hashIndex + 1) : "";
1171
1175
  }
1172
1176
  if (!hash) return void 0;
1173
1177
  try {
@@ -1191,7 +1195,9 @@ function getAskAIResultPageKey(value, baseUrl, strictExternalOrigins = false) {
1191
1195
  }
1192
1196
  }
1193
1197
  function getAskAIResultKey(result, baseUrl, strictExternalOrigins = false) {
1194
- return `${getAskAIResultPageKey(result.url, baseUrl, strictExternalOrigins)}#${normalizeWhitespace(getSearchResultAnchor(result.url) || result.section || "").toLowerCase()}`;
1198
+ const anchor = getSearchResultAnchor(result.url);
1199
+ const sectionFallback = normalizeWhitespace(result.section ?? "").toLowerCase();
1200
+ return `${getAskAIResultPageKey(result.url, baseUrl, strictExternalOrigins)}#${anchor ?? sectionFallback}`;
1195
1201
  }
1196
1202
  function mergeSearchResults(groups, getResultKey = getSearchResultKey) {
1197
1203
  const seen = /* @__PURE__ */ new Set();
@@ -1267,6 +1273,10 @@ function shouldPreserveUnmatchedExternalResult(options) {
1267
1273
  function getPageAudienceRawContent(page, audience) {
1268
1274
  return resolveDocsAudienceMdxContent(audience === "agent" ? page.agentRawContent ?? page.agentFallbackRawContent ?? page.agentContent ?? page.agentFallbackContent ?? page.rawContent ?? page.content : page.rawContent ?? page.content, audience);
1269
1275
  }
1276
+ function getPageAudienceSectionContent(page, audience) {
1277
+ const content = getPageAudienceRawContent(page, audience);
1278
+ return audience === "agent" ? upsertPageAgentContractMarkdown(content, page.agent) : content;
1279
+ }
1270
1280
  function getPageAudienceSearchText(page, audience) {
1271
1281
  return stripMarkdownText(getPageAudienceRawContent(page, audience));
1272
1282
  }
@@ -1382,14 +1392,19 @@ function makeDocumentId(url, suffix) {
1382
1392
  return `${url}#${suffix}`;
1383
1393
  }
1384
1394
  function splitPageIntoSections(page, audience = "human") {
1385
- const raw = getPageAudienceRawContent(page, audience);
1395
+ const raw = getPageAudienceSectionContent(page, audience);
1396
+ const generatedContract = audience === "agent" ? findDocsGeneratedAgentContractRanges(raw)[0] : void 0;
1386
1397
  const scope = resolveDocsSearchPageScope(page);
1387
- return parseDocsMarkdownSections(raw).flatMap((section, index) => {
1398
+ let documentIndex = 0;
1399
+ return parseDocsMarkdownSections(raw).flatMap((section) => {
1400
+ if (generatedContract && section.startLine > generatedContract.startLine && section.startLine < generatedContract.endLine) return [];
1388
1401
  const content = normalizeWhitespace(stripMarkdownText(section.content));
1389
1402
  if (!content) return [];
1403
+ const index = documentIndex;
1404
+ documentIndex += 1;
1390
1405
  return [{
1391
1406
  id: makeDocumentId(page.url, `section-${index}`),
1392
- url: `${page.url}#${section.anchor}`,
1407
+ url: `${page.url.split("#", 1)[0]}#${encodeURIComponent(section.anchor)}`,
1393
1408
  title: page.title,
1394
1409
  section: section.title,
1395
1410
  content,
@@ -2092,10 +2107,19 @@ async function performDocsSearch(options) {
2092
2107
  const filters = normalizeDocsSearchFilters(options.filters);
2093
2108
  const hasFilters = hasDocsSearchFilters(filters);
2094
2109
  const scopedPages = hasFilters ? options.pages.filter((page) => docsSearchPageMatchesFilters(resolveDocsSearchPageScope(page), filters)) : options.pages;
2095
- const documents = buildDocsSearchDocuments(scopedPages, search.chunking, audience);
2110
+ let resolvedDocuments;
2111
+ const getDocuments = () => {
2112
+ if (!resolvedDocuments) resolvedDocuments = buildDocsSearchDocuments(scopedPages, search.chunking, audience);
2113
+ return resolvedDocuments;
2114
+ };
2096
2115
  const context = {
2097
2116
  pages: scopedPages,
2098
- documents,
2117
+ get documents() {
2118
+ return getDocuments();
2119
+ },
2120
+ set documents(documents) {
2121
+ resolvedDocuments = documents;
2122
+ },
2099
2123
  audience,
2100
2124
  locale: options.locale,
2101
2125
  pathname: options.pathname,
@@ -2112,13 +2136,24 @@ async function performDocsSearch(options) {
2112
2136
  };
2113
2137
  try {
2114
2138
  const adapter = await resolveSearchAdapter(search, context);
2115
- await maybeSyncSearchIndex(adapter, search, audience === "agent" || hasFilters ? {
2116
- ...context,
2139
+ if (shouldSyncOnSearch(search) && typeof adapter.index === "function") await maybeSyncSearchIndex(adapter, search, audience === "agent" || hasFilters ? {
2117
2140
  pages: options.pages,
2118
2141
  documents: buildDocsSearchDocuments(options.pages, search.chunking, "human"),
2119
- audience: "human"
2142
+ audience: "human",
2143
+ locale: options.locale,
2144
+ pathname: options.pathname,
2145
+ siteTitle: options.siteTitle,
2146
+ signal: options.signal
2120
2147
  } : context);
2121
- const results = await adapter.search(query, context);
2148
+ const adapterSearch = adapter.search(query, context);
2149
+ let documents;
2150
+ try {
2151
+ documents = getDocuments();
2152
+ } catch (error) {
2153
+ adapterSearch.catch(() => void 0);
2154
+ throw error;
2155
+ }
2156
+ const results = await adapterSearch;
2122
2157
  if (search.provider === "simple") return results;
2123
2158
  const localAudienceProjectionResults = buildAudienceProjectionSearchResults(documents, options.query);
2124
2159
  const localPagePaths = new Set(scopedPages.map((page) => normalizeUrlPathname(page.url)));