@farming-labs/docs 0.1.72 → 0.1.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.
@@ -1,4 +1,4 @@
1
- import { x as renderDocsRelatedMarkdownLines } from "./search-Bk7rg-AY.mjs";
1
+ import { w as renderDocsRelatedMarkdownLines } from "./search-DBZ6Tkij.mjs";
2
2
  import matter from "gray-matter";
3
3
 
4
4
  //#region src/define-docs.ts
@@ -1,5 +1,5 @@
1
- import { C as renderDocsMarkdownDocument, g as findDocsMarkdownPage } from "./agent-D87B57Wv.mjs";
2
- import { d as hashGeneratedAgentContent, m as serializeGeneratedAgentDocument, p as parseGeneratedAgentDocument, u as GENERATED_AGENT_PROVENANCE_VERSION } from "./search-Bk7rg-AY.mjs";
1
+ import { C as renderDocsMarkdownDocument, g as findDocsMarkdownPage } from "./agent-C3PhBE3t.mjs";
2
+ import { _ as serializeGeneratedAgentDocument, g as parseGeneratedAgentDocument, m as hashGeneratedAgentContent, p as GENERATED_AGENT_PROVENANCE_VERSION } from "./search-DBZ6Tkij.mjs";
3
3
  import "./index.mjs";
4
4
  import "./prompt-utils-8nmFLQVH.mjs";
5
5
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
@@ -83,10 +83,10 @@ async function main() {
83
83
  const { dev } = await import("../dev-BQIDeAoL.mjs");
84
84
  await dev(devOptions);
85
85
  } else if (parsedCommand.command === "mcp") {
86
- const { runMcp } = await import("../mcp-obMYAPqu.mjs");
86
+ const { runMcp } = await import("../mcp-DaNntgC6.mjs");
87
87
  await runMcp(mcpOptions);
88
88
  } else if (parsedCommand.command === "agent" && subcommand === "compact") {
89
- const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-beh4aVYP.mjs");
89
+ const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-D94TCE7Q.mjs");
90
90
  const agentCompactOptions = parseAgentCompactArgs(args.slice(2));
91
91
  if (agentCompactOptions.help) {
92
92
  printAgentCompactHelp();
@@ -96,11 +96,11 @@ async function main() {
96
96
  } else if (parsedCommand.command === "agent") {
97
97
  console.error(pc.red(`Unknown agent subcommand: ${subcommand ?? "(missing)"}`));
98
98
  console.error();
99
- const { printAgentCompactHelp } = await import("../agent-beh4aVYP.mjs");
99
+ const { printAgentCompactHelp } = await import("../agent-D94TCE7Q.mjs");
100
100
  printAgentCompactHelp();
101
101
  process.exit(1);
102
102
  } else if (parsedCommand.command === "doctor") {
103
- const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-BUI3LchV.mjs");
103
+ const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-BFq5YKLg.mjs");
104
104
  const doctorOptions = parseDoctorArgs(args.slice(1));
105
105
  if (doctorOptions.help) {
106
106
  printDoctorHelp();
@@ -108,7 +108,7 @@ async function main() {
108
108
  }
109
109
  await runDoctor(doctorOptions);
110
110
  } else if (parsedCommand.command === "search" && subcommand === "sync") {
111
- const { syncSearch } = await import("../search-BzMf2w0H.mjs");
111
+ const { syncSearch } = await import("../search-BzavsA3i.mjs");
112
112
  await syncSearch(searchSyncOptions);
113
113
  } else if (parsedCommand.command === "search") {
114
114
  console.error(pc.red(`Unknown search subcommand: ${subcommand ?? "(missing)"}`));
@@ -1,10 +1,10 @@
1
- import { c as DEFAULT_LLMS_TXT_ROUTE, f as DEFAULT_MCP_WELL_KNOWN_ROUTE, i as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, m as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, o as DEFAULT_LLMS_FULL_TXT_ROUTE, p as DEFAULT_SKILL_MD_ROUTE, r as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, t as DEFAULT_AGENT_FEEDBACK_ROUTE, u as DEFAULT_MCP_PUBLIC_ROUTE } from "./agent-D87B57Wv.mjs";
2
- import "./search-Bk7rg-AY.mjs";
1
+ import { c as DEFAULT_LLMS_TXT_ROUTE, f as DEFAULT_MCP_WELL_KNOWN_ROUTE, i as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, m as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, o as DEFAULT_LLMS_FULL_TXT_ROUTE, p as DEFAULT_SKILL_MD_ROUTE, r as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, t as DEFAULT_AGENT_FEEDBACK_ROUTE, u as DEFAULT_MCP_PUBLIC_ROUTE } from "./agent-C3PhBE3t.mjs";
2
+ import "./search-DBZ6Tkij.mjs";
3
3
  import "./prompt-utils-8nmFLQVH.mjs";
4
4
  import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
5
5
  import "./server.mjs";
6
6
  import { a as loadProjectEnv, c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsContentDir, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-Si-yUfM_.mjs";
7
- import { inspectAgentCompactionState, scanDocsPageTargets } from "./agent-beh4aVYP.mjs";
7
+ import { inspectAgentCompactionState, scanDocsPageTargets } from "./agent-D94TCE7Q.mjs";
8
8
  import { t as detectFramework } from "./utils-DSMXVnEu.mjs";
9
9
  import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
10
10
  import path from "node:path";
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as OGConfig, A as DocsNav, B as DocsSearchDocument, C as DocsConfig, D as DocsMcpConfig, E as DocsI18nConfig, F as DocsSearchAdapter, G as DocsSearchSourcePage, H as DocsSearchQuery, I as DocsSearchAdapterContext, J as FontStyle, K as DocsTheme, L as DocsSearchAdapterFactory, M as DocsObservabilityEvent, N as DocsObservabilityEventInput, O as DocsMcpToolsConfig, P as DocsRelatedItem, Q as McpDocsSearchConfig, R as DocsSearchChunkingConfig, S as DocsAnalyticsSource, St as UIConfig, T as DocsFeedbackValue, U as DocsSearchResult, V as DocsSearchEmbeddingsConfig, W as DocsSearchResultType, X as LastUpdatedConfig, Y as GithubConfig, Z as LlmsTxtConfig, _ as DocsAnalyticsConfig, _t as SidebarTree, a as ApiReferenceRenderer, at as PageFrontmatter, b as DocsAnalyticsEventType, bt as TypesenseDocsSearchConfig, c as ChangelogFrontmatter, ct as PageTwitter, d as CustomDocsSearchConfig, dt as SidebarComponentProps, et as OpenDocsConfig, f as DocsAgentFeedbackContext, ft as SidebarConfig, g as DocsAgentTraceStatus, gt as SidebarPageNode, h as DocsAgentTraceEventType, ht as SidebarNode, i as ApiReferenceConfig, it as PageActionsConfig, j as DocsObservabilityConfig, k as DocsMetadata, l as CodeBlockCopyData, lt as ReadingTimeConfig, m as DocsAgentTraceEventInput, mt as SidebarFolderNode, n as AgentFeedbackConfig, nt as OpenGraphImage, o as BreadcrumbConfig, ot as PageOpenGraph, p as DocsAgentFeedbackData, pt as SidebarFolderIndexBehavior, q as FeedbackConfig, r as AlgoliaDocsSearchConfig, rt as OrderingItem, s as ChangelogConfig, st as PageSidebarFrontmatter, t as AIConfig, tt as OpenDocsProvider, u as CopyMarkdownConfig, ut as ResolvedDocsRelatedLink, v as DocsAnalyticsEvent, vt as SimpleDocsSearchConfig, w as DocsFeedbackData, x as DocsAnalyticsInput, xt as TypographyConfig, y as DocsAnalyticsEventInput, yt as ThemeToggleConfig, z as DocsSearchConfig } from "./types-CgBlM_yI.mjs";
2
- import { _ as emitDocsObservabilityEvent, a as createSimpleSearchAdapter, b as DocsCloudAnalyticsOptions, c as resolveSearchRequestConfig, d as ResolvedDocsAnalyticsConfig, f as ResolvedDocsObservabilityConfig, g as emitDocsAnalyticsEvent, h as emitDocsAgentTraceEvent, i as createMcpSearchAdapter, l as DOCS_AGENT_TRACE_EVENT_TYPES, m as createDocsAgentTraceId, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, p as createDocsAgentTraceContext, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments, u as DocsAgentTraceContext, v as resolveDocsAnalyticsConfig, x as createDocsCloudAnalytics, y as resolveDocsObservabilityConfig } from "./search-COyfvf6H.mjs";
1
+ import { $ as FeedbackConfig, A as DocsFeedbackData, B as DocsRelatedItem, C as DocsAskAIActionData, Ct as SidebarTree, D as DocsAskAIFeedbackMessage, Dt as TypographyConfig, E as DocsAskAIFeedbackData, Et as TypesenseDocsSearchConfig, F as DocsMetadata, G as DocsSearchConfig, H as DocsSearchAdapterContext, I as DocsNav, J as DocsSearchQuery, K as DocsSearchDocument, L as DocsObservabilityConfig, M as DocsI18nConfig, N as DocsMcpConfig, O as DocsAskAIFeedbackValue, Ot as UIConfig, P as DocsMcpToolsConfig, Q as DocsTheme, R as DocsObservabilityEvent, S as DocsAnalyticsSource, St as SidebarPageNode, T as DocsAskAIFeedbackConfig, Tt as ThemeToggleConfig, U as DocsSearchAdapterFactory, V as DocsSearchAdapter, W as DocsSearchChunkingConfig, X as DocsSearchResultType, Y as DocsSearchResult, Z as DocsSearchSourcePage, _ as DocsAnalyticsConfig, _t as SidebarComponentProps, a as ApiReferenceRenderer, at as OGConfig, b as DocsAnalyticsEventType, bt as SidebarFolderNode, c as ChangelogFrontmatter, ct as OpenGraphImage, d as CustomDocsSearchConfig, dt as PageFrontmatter, et as FontStyle, f as DocsAgentFeedbackContext, ft as PageOpenGraph, g as DocsAgentTraceStatus, gt as ResolvedDocsRelatedLink, h as DocsAgentTraceEventType, ht as ReadingTimeConfig, i as ApiReferenceConfig, it as McpDocsSearchConfig, j as DocsFeedbackValue, k as DocsConfig, l as CodeBlockCopyData, lt as OrderingItem, m as DocsAgentTraceEventInput, mt as PageTwitter, n as AgentFeedbackConfig, nt as LastUpdatedConfig, o as BreadcrumbConfig, ot as OpenDocsConfig, p as DocsAgentFeedbackData, pt as PageSidebarFrontmatter, q as DocsSearchEmbeddingsConfig, r as AlgoliaDocsSearchConfig, rt as LlmsTxtConfig, s as ChangelogConfig, st as OpenDocsProvider, t as AIConfig, tt as GithubConfig, u as CopyMarkdownConfig, ut as PageActionsConfig, v as DocsAnalyticsEvent, vt as SidebarConfig, w as DocsAskAIActionType, wt as SimpleDocsSearchConfig, x as DocsAnalyticsInput, xt as SidebarNode, y as DocsAnalyticsEventInput, yt as SidebarFolderIndexBehavior, z as DocsObservabilityEventInput } from "./types-D-OvczD4.mjs";
2
+ import { C as DocsCloudAnalyticsOptions, S as resolveDocsObservabilityConfig, _ as createDocsAgentTraceId, a as createMcpSearchAdapter, b as emitDocsObservabilityEvent, c as formatDocsAskAIPackageHints, d as resolveSearchRequestConfig, f as DOCS_AGENT_TRACE_EVENT_TYPES, g as createDocsAgentTraceContext, h as ResolvedDocsObservabilityConfig, i as createCustomSearchAdapter, l as inferDocsAskAIPackageHints, m as ResolvedDocsAnalyticsConfig, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DocsAgentTraceContext, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as emitDocsAgentTraceEvent, w as createDocsCloudAnalytics, x as resolveDocsAnalyticsConfig, y as emitDocsAnalyticsEvent } from "./search-DSKaQ2JH.mjs";
3
3
  import { DocsMcpPage, DocsMcpResolvedConfig } from "./mcp.mjs";
4
4
 
5
5
  //#region src/define-docs.d.ts
@@ -372,4 +372,4 @@ declare function buildDocsAgentDiscoverySpec({
372
372
  };
373
373
  };
374
374
  //#endregion
375
- export { type AIConfig, type AgentFeedbackConfig, type AlgoliaDocsSearchConfig, type ApiReferenceConfig, type ApiReferenceRenderer, type BreadcrumbConfig, type ChangelogConfig, type ChangelogEntrySummary, type ChangelogFrontmatter, type CodeBlockCopyData, type CopyMarkdownConfig, type CustomDocsSearchConfig, DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentDiscoverySpecOptions, type DocsAgentFeedbackContext, type DocsAgentFeedbackData, type DocsAgentFeedbackDiscoveryConfig, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAnalyticsEventType, type DocsAnalyticsInput, type DocsAnalyticsSource, type DocsCloudAnalyticsOptions, type DocsConfig, type DocsFeedbackData, type DocsFeedbackValue, type DocsI18nConfig, type DocsLlmsDiscoveryConfig, type DocsMarkdownPage, type DocsMcpConfig, type DocsMcpToolsConfig, type DocsMetadata, type DocsNav, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsPathMatch, type DocsRelatedItem, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchChunkingConfig, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchEmbeddingsConfig, type DocsSearchQuery, type DocsSearchResult, type DocsSearchResultType, type DocsSearchSourcePage, type DocsSkillDocumentOptions, type DocsTheme, type FeedbackConfig, type FontStyle, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, type GeneratedAgentProvenance, type GeneratedAgentSourceKind, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type McpDocsSearchConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OpenGraphImage, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type PageOpenGraph, type PageSidebarFrontmatter, type PageTwitter, type ReadingTimeConfig, type ResolvedChangelogConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsI18n, type ResolvedDocsObservabilityConfig, type ResolvedDocsRelatedLink, type SidebarComponentProps, type SidebarConfig, type SidebarFolderIndexBehavior, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type SimpleDocsSearchConfig, type ThemeToggleConfig, type TypesenseDocsSearchConfig, type TypographyConfig, type UIConfig, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, hashGeneratedAgentContent, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance };
375
+ export { type AIConfig, type AgentFeedbackConfig, type AlgoliaDocsSearchConfig, type ApiReferenceConfig, type ApiReferenceRenderer, type BreadcrumbConfig, type ChangelogConfig, type ChangelogEntrySummary, type ChangelogFrontmatter, type CodeBlockCopyData, type CopyMarkdownConfig, type CustomDocsSearchConfig, DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentDiscoverySpecOptions, type DocsAgentFeedbackContext, type DocsAgentFeedbackData, type DocsAgentFeedbackDiscoveryConfig, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAnalyticsEventType, type DocsAnalyticsInput, type DocsAnalyticsSource, type DocsAskAIActionData, type DocsAskAIActionType, type DocsAskAIFeedbackConfig, type DocsAskAIFeedbackData, type DocsAskAIFeedbackMessage, type DocsAskAIFeedbackValue, type DocsCloudAnalyticsOptions, type DocsConfig, type DocsFeedbackData, type DocsFeedbackValue, type DocsI18nConfig, type DocsLlmsDiscoveryConfig, type DocsMarkdownPage, type DocsMcpConfig, type DocsMcpToolsConfig, type DocsMetadata, type DocsNav, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsPathMatch, type DocsRelatedItem, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchChunkingConfig, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchEmbeddingsConfig, type DocsSearchQuery, type DocsSearchResult, type DocsSearchResultType, type DocsSearchSourcePage, type DocsSkillDocumentOptions, type DocsTheme, type FeedbackConfig, type FontStyle, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, type GeneratedAgentProvenance, type GeneratedAgentSourceKind, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type McpDocsSearchConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OpenGraphImage, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type PageOpenGraph, type PageSidebarFrontmatter, type PageTwitter, type ReadingTimeConfig, type ResolvedChangelogConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsI18n, type ResolvedDocsObservabilityConfig, type ResolvedDocsRelatedLink, type SidebarComponentProps, type SidebarConfig, type SidebarFolderIndexBehavior, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type SimpleDocsSearchConfig, type ThemeToggleConfig, type TypesenseDocsSearchConfig, type TypographyConfig, type UIConfig, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsAskAIContext, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, formatDocsAskAIPackageHints, hashGeneratedAgentContent, inferDocsAskAIPackageHints, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as resolvePageReadingTime, B as resolveDocsPath, C as renderDocsMarkdownDocument, D as resolveDocsMarkdownRequest, E as resolveDocsLlmsTxtFormat, F as buildPageTwitter, G as defineDocs, H as extendTheme, I as resolveOGImage, L as resolveTitle, M as resolveReadingTimeFromSource, N as resolveReadingTimeOptions, O as resolveDocsSkillFormat, P as buildPageOpenGraph, R as resolveDocsI18n, S as normalizeDocsUrlPath, T as resolveDocsAgentMdxContent, U as deepMerge, V as createTheme, W as resolveChangelogConfig, _ as isDocsAgentDiscoveryRequest, a as DEFAULT_DOCS_API_ROUTE, b as isDocsSkillRequest, c as DEFAULT_LLMS_TXT_ROUTE, d as DEFAULT_MCP_ROUTE, f as DEFAULT_MCP_WELL_KNOWN_ROUTE, g as findDocsMarkdownPage, h as buildDocsAgentDiscoverySpec, i as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, j as resolveReadingTimeFromContent, k as estimateReadingTimeMinutes, l as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, m as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, n as DEFAULT_AGENT_SPEC_ROUTE, o as DEFAULT_LLMS_FULL_TXT_ROUTE, p as DEFAULT_SKILL_MD_ROUTE, r as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, s as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, t as DEFAULT_AGENT_FEEDBACK_ROUTE, u as DEFAULT_MCP_PUBLIC_ROUTE, v as isDocsMcpRequest, w as renderDocsSkillDocument, x as normalizeDocsPathSegment, y as isDocsPublicGetRequest, z as resolveDocsLocale } from "./agent-D87B57Wv.mjs";
2
- import { A as createDocsCloudAnalytics, C as createDocsAgentTraceContext, D as emitDocsObservabilityEvent, E as emitDocsAnalyticsEvent, O as resolveDocsAnalyticsConfig, S as DOCS_AGENT_TRACE_EVENT_TYPES, T as emitDocsAgentTraceEvent, _ as resolvePageSidebarFolderIndexBehavior, a as createSimpleSearchAdapter, b as normalizeDocsRelated, c as resolveSearchRequestConfig, d as hashGeneratedAgentContent, f as normalizeGeneratedAgentContent, g as applySidebarFolderIndexBehavior, h as stripGeneratedAgentProvenance, i as createMcpSearchAdapter, k as resolveDocsObservabilityConfig, l as GENERATED_AGENT_PROVENANCE_MARKER, m as serializeGeneratedAgentDocument, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, p as parseGeneratedAgentDocument, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments, u as GENERATED_AGENT_PROVENANCE_VERSION, v as resolveSidebarFolderIndexBehavior, w as createDocsAgentTraceId, x as renderDocsRelatedMarkdownLines, y as resolveSidebarFolderIndexBehaviorForPath } from "./search-Bk7rg-AY.mjs";
1
+ import { A as resolvePageReadingTime, B as resolveDocsPath, C as renderDocsMarkdownDocument, D as resolveDocsMarkdownRequest, E as resolveDocsLlmsTxtFormat, F as buildPageTwitter, G as defineDocs, H as extendTheme, I as resolveOGImage, L as resolveTitle, M as resolveReadingTimeFromSource, N as resolveReadingTimeOptions, O as resolveDocsSkillFormat, P as buildPageOpenGraph, R as resolveDocsI18n, S as normalizeDocsUrlPath, T as resolveDocsAgentMdxContent, U as deepMerge, V as createTheme, W as resolveChangelogConfig, _ as isDocsAgentDiscoveryRequest, a as DEFAULT_DOCS_API_ROUTE, b as isDocsSkillRequest, c as DEFAULT_LLMS_TXT_ROUTE, d as DEFAULT_MCP_ROUTE, f as DEFAULT_MCP_WELL_KNOWN_ROUTE, g as findDocsMarkdownPage, h as buildDocsAgentDiscoverySpec, i as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, j as resolveReadingTimeFromContent, k as estimateReadingTimeMinutes, l as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, m as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, n as DEFAULT_AGENT_SPEC_ROUTE, o as DEFAULT_LLMS_FULL_TXT_ROUTE, p as DEFAULT_SKILL_MD_ROUTE, r as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, s as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, t as DEFAULT_AGENT_FEEDBACK_ROUTE, u as DEFAULT_MCP_PUBLIC_ROUTE, v as isDocsMcpRequest, w as renderDocsSkillDocument, x as normalizeDocsPathSegment, y as isDocsPublicGetRequest, z as resolveDocsLocale } from "./agent-C3PhBE3t.mjs";
2
+ import { A as emitDocsObservabilityEvent, C as normalizeDocsRelated, D as createDocsAgentTraceId, E as createDocsAgentTraceContext, M as resolveDocsObservabilityConfig, N as createDocsCloudAnalytics, O as emitDocsAgentTraceEvent, S as resolveSidebarFolderIndexBehaviorForPath, T as DOCS_AGENT_TRACE_EVENT_TYPES, _ as serializeGeneratedAgentDocument, a as createMcpSearchAdapter, b as resolvePageSidebarFolderIndexBehavior, c as formatDocsAskAIPackageHints, d as resolveSearchRequestConfig, f as GENERATED_AGENT_PROVENANCE_MARKER, g as parseGeneratedAgentDocument, h as normalizeGeneratedAgentContent, i as createCustomSearchAdapter, j as resolveDocsAnalyticsConfig, k as emitDocsAnalyticsEvent, l as inferDocsAskAIPackageHints, m as hashGeneratedAgentContent, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as GENERATED_AGENT_PROVENANCE_VERSION, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as stripGeneratedAgentProvenance, w as renderDocsRelatedMarkdownLines, x as resolveSidebarFolderIndexBehavior, y as applySidebarFolderIndexBehavior } from "./search-DBZ6Tkij.mjs";
3
3
 
4
- export { DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, hashGeneratedAgentContent, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance };
4
+ export { DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsAskAIContext, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, formatDocsAskAIPackageHints, hashGeneratedAgentContent, inferDocsAskAIPackageHints, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance };
@@ -1,4 +1,4 @@
1
- import "./search-Bk7rg-AY.mjs";
1
+ import "./search-DBZ6Tkij.mjs";
2
2
  import "./prompt-utils-8nmFLQVH.mjs";
3
3
  import { createFilesystemDocsMcpSource, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
4
4
  import "./server.mjs";
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { D as DocsMcpConfig, G as DocsSearchSourcePage, _ as DocsAnalyticsConfig, j as DocsObservabilityConfig, rt as OrderingItem, z as DocsSearchConfig } from "./types-CgBlM_yI.mjs";
1
+ import { G as DocsSearchConfig, L as DocsObservabilityConfig, N as DocsMcpConfig, Z as DocsSearchSourcePage, _ as DocsAnalyticsConfig, lt as OrderingItem } from "./types-D-OvczD4.mjs";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
 
4
4
  //#region src/mcp.d.ts
package/dist/mcp.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as createDocsAgentTraceContext, E as emitDocsAnalyticsEvent, T as emitDocsAgentTraceEvent, _ as resolvePageSidebarFolderIndexBehavior, b as normalizeDocsRelated, h as stripGeneratedAgentProvenance, s as performDocsSearch, w as createDocsAgentTraceId, x as renderDocsRelatedMarkdownLines } from "./search-Bk7rg-AY.mjs";
1
+ import { C as normalizeDocsRelated, D as createDocsAgentTraceId, E as createDocsAgentTraceContext, O as emitDocsAgentTraceEvent, b as resolvePageSidebarFolderIndexBehavior, k as emitDocsAnalyticsEvent, u as performDocsSearch, v as stripGeneratedAgentProvenance, w as renderDocsRelatedMarkdownLines } from "./search-DBZ6Tkij.mjs";
2
2
  import matter from "gray-matter";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, t as buildDocsSearchDocuments } from "./search-Bk7rg-AY.mjs";
1
+ import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-DBZ6Tkij.mjs";
2
2
  import "./prompt-utils-8nmFLQVH.mjs";
3
3
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
4
4
  import "./server.mjs";
@@ -420,8 +420,41 @@ const DEFAULT_SEARCH_LIMIT = 10;
420
420
  const DEFAULT_MCP_PROTOCOL_VERSION = "2025-11-25";
421
421
  const syncedIndexes = /* @__PURE__ */ new Set();
422
422
  const ALGOLIA_MAX_RECORD_BYTES = 9500;
423
+ const DEFAULT_ASK_AI_CONTEXT_CHARS = 24e3;
424
+ const DEFAULT_ASK_AI_RESULT_CHARS = 6e3;
425
+ const SEARCH_STOP_WORDS = new Set([
426
+ "a",
427
+ "an",
428
+ "and",
429
+ "are",
430
+ "as",
431
+ "at",
432
+ "be",
433
+ "can",
434
+ "do",
435
+ "does",
436
+ "for",
437
+ "from",
438
+ "how",
439
+ "i",
440
+ "in",
441
+ "is",
442
+ "it",
443
+ "of",
444
+ "on",
445
+ "or",
446
+ "the",
447
+ "this",
448
+ "to",
449
+ "use",
450
+ "what",
451
+ "when",
452
+ "where",
453
+ "which",
454
+ "with"
455
+ ]);
423
456
  function stripMarkdownText(content) {
424
- return content.replace(/```[\s\S]*?```/g, "").replace(/~~~[\s\S]*?~~~/g, "").replace(/^(import|export)\s.*$/gm, "").replace(/<[^>]+\/>/g, "").replace(/<\/?[A-Z][^>]*>/g, "").replace(/<\/?[a-z][^>]*>/g, "").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/^\|?[\s:-]+(\|[\s:-]+)+\|?\s*$/gm, "").replace(/\|/g, " ").replace(/^[-*+]\s+/gm, "").replace(/(\*{1,3}|_{1,3})(.*?)\1/g, "$2").replace(/`{3,}[^\n]*$/gm, "").replace(/`([^`]+)`/g, "$1").replace(/`+/g, "").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}\s*$/gm, "").replace(/\n{3,}/g, "\n\n").replace(/\s{2,}/g, " ").trim();
457
+ return removeMdxModuleLinesOutsideFences(content).replace(/```[^\n]*\n([\s\S]*?)```/g, "$1").replace(/```([\s\S]*?)```/g, "$1").replace(/~~~[^\n]*\n([\s\S]*?)~~~/g, "$1").replace(/~~~([\s\S]*?)~~~/g, "$1").replace(/<[^>]+\/>/g, "").replace(/<\/?[A-Z][^>]*>/g, "").replace(/<\/?[a-z][^>]*>/g, "").replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/^\|?[\s:-]+(\|[\s:-]+)+\|?\s*$/gm, "").replace(/\|/g, " ").replace(/^[-*+]\s+/gm, "").replace(/(\*{1,3}|_{1,3})(.*?)\1/g, "$2").replace(/`{3,}[^\n]*$/gm, "").replace(/`([^`]+)`/g, "$1").replace(/`+/g, "").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}\s*$/gm, "").replace(/\n{3,}/g, "\n\n").replace(/\s{2,}/g, " ").trim();
425
458
  }
426
459
  function stripHtml(text) {
427
460
  return text.replace(/<[^>]+>/g, "");
@@ -433,6 +466,194 @@ function normalizeMcpSsePayload(body) {
433
466
  function normalizeWhitespace(value) {
434
467
  return value.replace(/\s+/g, " ").trim();
435
468
  }
469
+ function tokenizeSearchQuery(query) {
470
+ return Array.from(new Set(query.toLowerCase().replace(/[^\p{L}\p{N}@/_:.-]+/gu, " ").split(/\s+/).map((word) => word.replace(/^[^\p{L}\p{N}@]+|[^\p{L}\p{N}]+$/gu, "")).filter((word) => word.length > 1 && !SEARCH_STOP_WORDS.has(word))));
471
+ }
472
+ function normalizeUrlPathname(value) {
473
+ try {
474
+ return new URL(value, "https://docs.local").pathname.replace(/\/+$/, "") || "/";
475
+ } catch {
476
+ return value.split(/[?#]/)[0]?.replace(/\/+$/, "") || "/";
477
+ }
478
+ }
479
+ function resolveAskAIContextUrl(value, baseUrl) {
480
+ if (!baseUrl) return value;
481
+ try {
482
+ return new URL(value, baseUrl).toString();
483
+ } catch {
484
+ return value;
485
+ }
486
+ }
487
+ function getAskAIPageContent(page) {
488
+ return page.agentRawContent ?? page.agentFallbackRawContent ?? page.rawContent ?? page.content;
489
+ }
490
+ function removeMdxModuleLinesOutsideFences(content) {
491
+ let inFence = false;
492
+ return content.split("\n").filter((line) => {
493
+ const trimmed = line.trimStart();
494
+ if (trimmed.startsWith("```") || trimmed.startsWith("~~~")) {
495
+ inFence = !inFence;
496
+ return true;
497
+ }
498
+ return inFence || !/^(import|export)\s/.test(trimmed);
499
+ }).join("\n");
500
+ }
501
+ function cleanAskAIContextMarkdown(content) {
502
+ return removeMdxModuleLinesOutsideFences(content).replace(/<[^>]+\/>/g, "").replace(/<\/?[A-Z][^>]*>/g, "").replace(/<\/?[a-z][^>]*>/g, "").replace(/\n{3,}/g, "\n\n").trim();
503
+ }
504
+ function packageRootFromSpecifier(specifier) {
505
+ if (!specifier || specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("@/") || specifier.startsWith("~/") || specifier.startsWith("#")) return null;
506
+ const parts = specifier.split("/").filter(Boolean);
507
+ if (parts.length === 0) return null;
508
+ if (parts[0]?.startsWith("@")) return parts.length > 1 ? `${parts[0]}/${parts[1]}` : null;
509
+ return parts[0];
510
+ }
511
+ function cleanPackageToken(token) {
512
+ const trimmed = token.trim().replace(/^["'`]+|["'`,;]+$/g, "").replace(/\\$/g, "");
513
+ if (!trimmed || trimmed.startsWith("-") || /^[A-Z_][A-Z0-9_]*=/.test(trimmed)) return null;
514
+ if (/^(npm|pnpm|yarn|bun|install|add|i|x|dlx|run|exec)$/.test(trimmed)) return null;
515
+ return packageRootFromSpecifier(trimmed.startsWith("@") ? trimmed.replace(/^(@[^/]+\/[^@]+)@.+$/, "$1") : trimmed.replace(/^([^@]+)@.+$/, "$1"));
516
+ }
517
+ function inferDocsAskAIPackageHints(content) {
518
+ const packages = /* @__PURE__ */ new Set();
519
+ const imports = /* @__PURE__ */ new Set();
520
+ const installCommands = /* @__PURE__ */ new Set();
521
+ for (const line of content.split("\n")) {
522
+ const trimmed = line.trim();
523
+ if (!trimmed) continue;
524
+ const importSpecifier = trimmed.match(/^(?:import|export)\s+(?:type\s+)?[\s\S]*?\s+from\s+["']([^"']+)["']/)?.[1];
525
+ const bareImportSpecifier = trimmed.match(/^import\s+["']([^"']+)["']/)?.[1];
526
+ const requireSpecifier = trimmed.match(/require\(["']([^"']+)["']\)/)?.[1];
527
+ const specifier = importSpecifier ?? bareImportSpecifier ?? requireSpecifier;
528
+ const packageName = specifier ? packageRootFromSpecifier(specifier) : null;
529
+ if (packageName) {
530
+ packages.add(packageName);
531
+ if (/^(?:import|export)\s/.test(trimmed)) imports.add(trimmed);
532
+ }
533
+ const installMatch = trimmed.match(/^(?:npm\s+(?:install|i)|pnpm\s+add|yarn\s+add|bun\s+add)\s+(.+)$/);
534
+ if (!installMatch) continue;
535
+ const commandPackages = installMatch[1].split(/\s+/).map(cleanPackageToken).filter((value) => Boolean(value));
536
+ if (commandPackages.length > 0) {
537
+ installCommands.add(trimmed);
538
+ for (const name of commandPackages) packages.add(name);
539
+ }
540
+ }
541
+ return {
542
+ packages: Array.from(packages).slice(0, 8),
543
+ imports: Array.from(imports).slice(0, 12),
544
+ installCommands: Array.from(installCommands).slice(0, 8)
545
+ };
546
+ }
547
+ function formatDocsAskAIPackageHints(hints, packageName) {
548
+ const packages = packageName ? Array.from(new Set([packageName, ...hints.packages])) : hints.packages;
549
+ if (packages.length === 0 && hints.imports.length === 0 && hints.installCommands.length === 0) return;
550
+ const lines = ["Package and import hints inferred from the retrieved documentation context:"];
551
+ if (packages.length > 0) lines.push(`- Package names found in install/import examples: ${packages.join(", ")}`);
552
+ if (hints.imports.length > 0) lines.push(`- Exact import lines found in context: ${hints.imports.map((line) => `\`${line}\``).join("; ")}`);
553
+ if (hints.installCommands.length > 0) lines.push(`- Exact install commands found in context: ${hints.installCommands.map((line) => `\`${line}\``).join("; ")}`);
554
+ lines.push("Use these exact package names, install commands, and import lines when relevant. Do not replace them with placeholders.");
555
+ return lines.join("\n");
556
+ }
557
+ function clampText(value, maxChars) {
558
+ if (maxChars <= 0) return "";
559
+ if (value.length <= maxChars) return value;
560
+ return `${value.slice(0, maxChars).trimEnd()}...`;
561
+ }
562
+ function extractHeadingText(line) {
563
+ const match = line.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
564
+ if (!match) return null;
565
+ return {
566
+ level: match[1].length,
567
+ text: normalizeWhitespace(match[2].replace(/[`*_~]/g, ""))
568
+ };
569
+ }
570
+ function extractSectionMarkdown(content, section) {
571
+ if (!section) return content;
572
+ const target = normalizeWhitespace(section).toLowerCase();
573
+ const lines = content.split("\n");
574
+ let start = -1;
575
+ let level = 0;
576
+ for (let i = 0; i < lines.length; i += 1) {
577
+ const heading = extractHeadingText(lines[i]);
578
+ if (!heading) continue;
579
+ if (heading.text.toLowerCase() === target) {
580
+ start = i;
581
+ level = heading.level;
582
+ break;
583
+ }
584
+ }
585
+ if (start === -1) return content;
586
+ let end = lines.length;
587
+ for (let i = start + 1; i < lines.length; i += 1) {
588
+ const heading = extractHeadingText(lines[i]);
589
+ if (heading && heading.level <= level) {
590
+ end = i;
591
+ break;
592
+ }
593
+ }
594
+ return lines.slice(start, end).join("\n");
595
+ }
596
+ function findPageForSearchResult(pages, result) {
597
+ const resultPath = normalizeUrlPathname(result.url);
598
+ return pages.find((page) => normalizeUrlPathname(page.url) === resultPath);
599
+ }
600
+ function inferResultTitle(result, page) {
601
+ if (page) return page.title;
602
+ return stripHtml(result.content).trim().split("—")[0]?.trim() || result.url;
603
+ }
604
+ function formatAskAIContextResult(options) {
605
+ const { result, page, maxChars, baseUrl } = options;
606
+ const title = inferResultTitle(result, page);
607
+ const section = result.section;
608
+ const contextContent = clampText(cleanAskAIContextMarkdown(page ? extractSectionMarkdown(getAskAIPageContent(page), section) : [result.content, result.description].filter(Boolean).join("\n\n")), maxChars);
609
+ return {
610
+ ...result,
611
+ url: resolveAskAIContextUrl(result.url, baseUrl),
612
+ title,
613
+ contextContent
614
+ };
615
+ }
616
+ function getSearchResultKey(result) {
617
+ let hash = "";
618
+ try {
619
+ hash = new URL(result.url, "https://docs.local").hash.replace(/^#/, "");
620
+ } catch {
621
+ hash = result.url.split("#")[1]?.split(/[?&]/)[0] ?? "";
622
+ }
623
+ return `${normalizeUrlPathname(result.url)}#${normalizeWhitespace(hash || result.section || "").toLowerCase()}`;
624
+ }
625
+ function mergeSearchResults(...groups) {
626
+ const seen = /* @__PURE__ */ new Set();
627
+ const results = [];
628
+ for (const group of groups) for (const result of group) {
629
+ const key = getSearchResultKey(result);
630
+ if (seen.has(key)) continue;
631
+ seen.add(key);
632
+ results.push(result);
633
+ }
634
+ return results;
635
+ }
636
+ function shouldSupplementAskAIWithSimpleSearch(search) {
637
+ return search.enabled && search.provider !== "simple";
638
+ }
639
+ function rankAskAIContextResult(query, result) {
640
+ return scoreDocument(query, {
641
+ id: result.id,
642
+ url: result.url,
643
+ title: result.title,
644
+ content: result.contextContent,
645
+ description: result.description,
646
+ type: result.type,
647
+ section: result.section
648
+ });
649
+ }
650
+ function buildAskAIContextBlock(result) {
651
+ const lines = [`## ${result.title}`, `URL: ${result.url}`];
652
+ if (result.section) lines.push(`Section: ${result.section}`);
653
+ if (result.description) lines.push(`Search snippet: ${result.description}`);
654
+ lines.push("", result.contextContent);
655
+ return lines.join("\n").trim();
656
+ }
436
657
  function makeDocumentId(url, suffix) {
437
658
  return `${url}#${suffix}`;
438
659
  }
@@ -507,14 +728,16 @@ function buildDocsSearchDocuments(pages, chunking = {}) {
507
728
  });
508
729
  }
509
730
  function scoreDocument(query, document) {
510
- const q = query.toLowerCase().trim();
731
+ const q = normalizeWhitespace(query.toLowerCase().replace(/[?!.,;:]+$/g, ""));
511
732
  if (!q) return 0;
512
- const words = Array.from(new Set(q.split(/\s+/).filter(Boolean)));
733
+ const words = tokenizeSearchQuery(q);
513
734
  const title = document.title.toLowerCase();
514
735
  const section = document.section?.toLowerCase() ?? "";
515
736
  const description = document.description?.toLowerCase() ?? "";
516
737
  const content = document.content.toLowerCase();
517
738
  const url = document.url.toLowerCase();
739
+ const titleTokens = tokenizeSearchQuery(title);
740
+ const sectionTokens = tokenizeSearchQuery(section);
518
741
  let score = 0;
519
742
  if (title === q) score += 120;
520
743
  else if (title.startsWith(q)) score += 70;
@@ -558,6 +781,10 @@ function scoreDocument(query, document) {
558
781
  }
559
782
  if (matched) matchedWords += 1;
560
783
  }
784
+ if (words.length > 1) {
785
+ if (sectionTokens.length > 0 && words.every((word) => sectionTokens.includes(word))) score += 30;
786
+ if (document.type === "page" && titleTokens.length > 0 && words.every((word) => titleTokens.includes(word))) score += 24;
787
+ }
561
788
  if (matchedWords === words.length && words.length > 1) score += 20;
562
789
  if (document.type === "heading") score += 6;
563
790
  return score;
@@ -1077,6 +1304,80 @@ async function performDocsSearch(options) {
1077
1304
  return createSimpleSearchAdapter().search(query, context);
1078
1305
  }
1079
1306
  }
1307
+ async function buildDocsAskAIContext(options) {
1308
+ const limit = options.limit ?? 5;
1309
+ const searchLimit = Math.max(limit * 2, limit);
1310
+ const initialSearch = options.search === false ? true : options.search;
1311
+ const primarySearch = normalizeDocsSearchConfig(initialSearch).enabled ? initialSearch : true;
1312
+ const primarySearchConfig = normalizeDocsSearchConfig(primarySearch);
1313
+ const searchResults = mergeSearchResults(await performDocsSearch({
1314
+ pages: options.pages,
1315
+ query: options.query,
1316
+ search: primarySearch,
1317
+ locale: options.locale,
1318
+ pathname: options.pathname,
1319
+ siteTitle: options.siteTitle,
1320
+ limit: searchLimit
1321
+ }), shouldSupplementAskAIWithSimpleSearch(primarySearchConfig) ? await performDocsSearch({
1322
+ pages: options.pages,
1323
+ query: options.query,
1324
+ search: {
1325
+ provider: "simple",
1326
+ enabled: true,
1327
+ chunking: primarySearchConfig.chunking,
1328
+ maxResults: searchLimit
1329
+ },
1330
+ locale: options.locale,
1331
+ pathname: options.pathname,
1332
+ siteTitle: options.siteTitle,
1333
+ limit: searchLimit
1334
+ }) : []);
1335
+ const seen = /* @__PURE__ */ new Set();
1336
+ const maxResultChars = options.maxResultChars ?? DEFAULT_ASK_AI_RESULT_CHARS;
1337
+ const rankedResults = searchResults.map((result, index) => {
1338
+ const formatted = formatAskAIContextResult({
1339
+ result,
1340
+ page: findPageForSearchResult(options.pages, result),
1341
+ maxChars: maxResultChars,
1342
+ baseUrl: options.baseUrl
1343
+ });
1344
+ return {
1345
+ result,
1346
+ formatted,
1347
+ index,
1348
+ rank: rankAskAIContextResult(options.query, formatted)
1349
+ };
1350
+ }).sort((a, b) => b.rank - a.rank || a.index - b.index);
1351
+ const formattedResults = rankedResults.map((item) => item.formatted);
1352
+ const sectionResultPaths = new Set(formattedResults.filter((result) => result.section).map((result) => normalizeUrlPathname(result.url)));
1353
+ const results = formattedResults.filter((result) => result.section || !sectionResultPaths.has(normalizeUrlPathname(result.url))).filter((result) => {
1354
+ const key = getSearchResultKey(result);
1355
+ if (seen.has(key)) return false;
1356
+ seen.add(key);
1357
+ return result.contextContent.length > 0;
1358
+ }).slice(0, limit);
1359
+ const maxContextChars = options.maxContextChars ?? DEFAULT_ASK_AI_CONTEXT_CHARS;
1360
+ const blocks = [];
1361
+ let usedChars = 0;
1362
+ for (const result of results) {
1363
+ const block = buildAskAIContextBlock(result);
1364
+ const separatorChars = blocks.length === 0 ? 0 : 7;
1365
+ if (usedChars + separatorChars + block.length > maxContextChars) {
1366
+ const remaining = maxContextChars - usedChars - separatorChars;
1367
+ if (remaining > 400) blocks.push(clampText(block, remaining));
1368
+ break;
1369
+ }
1370
+ blocks.push(block);
1371
+ usedChars += separatorChars + block.length;
1372
+ }
1373
+ const context = blocks.join("\n\n---\n\n");
1374
+ return {
1375
+ context,
1376
+ results: results.slice(0, blocks.length),
1377
+ searchResults: rankedResults.map((item) => item.result),
1378
+ packageHints: inferDocsAskAIPackageHints(context)
1379
+ };
1380
+ }
1080
1381
  function createCustomSearchAdapter(adapter) {
1081
1382
  return {
1082
1383
  provider: "custom",
@@ -1085,4 +1386,4 @@ function createCustomSearchAdapter(adapter) {
1085
1386
  }
1086
1387
 
1087
1388
  //#endregion
1088
- export { createDocsCloudAnalytics as A, createDocsAgentTraceContext as C, emitDocsObservabilityEvent as D, emitDocsAnalyticsEvent as E, resolveDocsAnalyticsConfig as O, DOCS_AGENT_TRACE_EVENT_TYPES as S, emitDocsAgentTraceEvent as T, resolvePageSidebarFolderIndexBehavior as _, createSimpleSearchAdapter as a, normalizeDocsRelated as b, resolveSearchRequestConfig as c, hashGeneratedAgentContent as d, normalizeGeneratedAgentContent as f, applySidebarFolderIndexBehavior as g, stripGeneratedAgentProvenance as h, createMcpSearchAdapter as i, resolveDocsObservabilityConfig as k, GENERATED_AGENT_PROVENANCE_MARKER as l, serializeGeneratedAgentDocument as m, createAlgoliaSearchAdapter as n, createTypesenseSearchAdapter as o, parseGeneratedAgentDocument as p, createCustomSearchAdapter as r, performDocsSearch as s, buildDocsSearchDocuments as t, GENERATED_AGENT_PROVENANCE_VERSION as u, resolveSidebarFolderIndexBehavior as v, createDocsAgentTraceId as w, renderDocsRelatedMarkdownLines as x, resolveSidebarFolderIndexBehaviorForPath as y };
1389
+ export { emitDocsObservabilityEvent as A, normalizeDocsRelated as C, createDocsAgentTraceId as D, createDocsAgentTraceContext as E, resolveDocsObservabilityConfig as M, createDocsCloudAnalytics as N, emitDocsAgentTraceEvent as O, resolveSidebarFolderIndexBehaviorForPath as S, DOCS_AGENT_TRACE_EVENT_TYPES as T, serializeGeneratedAgentDocument as _, createMcpSearchAdapter as a, resolvePageSidebarFolderIndexBehavior as b, formatDocsAskAIPackageHints as c, resolveSearchRequestConfig as d, GENERATED_AGENT_PROVENANCE_MARKER as f, parseGeneratedAgentDocument as g, normalizeGeneratedAgentContent as h, createCustomSearchAdapter as i, resolveDocsAnalyticsConfig as j, emitDocsAnalyticsEvent as k, inferDocsAskAIPackageHints as l, hashGeneratedAgentContent as m, buildDocsSearchDocuments as n, createSimpleSearchAdapter as o, GENERATED_AGENT_PROVENANCE_VERSION as p, createAlgoliaSearchAdapter as r, createTypesenseSearchAdapter as s, buildDocsAskAIContext as t, performDocsSearch as u, stripGeneratedAgentProvenance as v, renderDocsRelatedMarkdownLines as w, resolveSidebarFolderIndexBehavior as x, applySidebarFolderIndexBehavior as y };
@@ -1,4 +1,4 @@
1
- import { B as DocsSearchDocument, F as DocsSearchAdapter, G as DocsSearchSourcePage, L as DocsSearchAdapterFactory, M as DocsObservabilityEvent, N as DocsObservabilityEventInput, Q as McpDocsSearchConfig, R as DocsSearchChunkingConfig, U as DocsSearchResult, _ as DocsAnalyticsConfig, bt as TypesenseDocsSearchConfig, d as CustomDocsSearchConfig, j as DocsObservabilityConfig, m as DocsAgentTraceEventInput, r as AlgoliaDocsSearchConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsSearchConfig } from "./types-CgBlM_yI.mjs";
1
+ import { Et as TypesenseDocsSearchConfig, G as DocsSearchConfig, K as DocsSearchDocument, L as DocsObservabilityConfig, R as DocsObservabilityEvent, U as DocsSearchAdapterFactory, V as DocsSearchAdapter, W as DocsSearchChunkingConfig, Y as DocsSearchResult, Z as DocsSearchSourcePage, _ as DocsAnalyticsConfig, d as CustomDocsSearchConfig, it as McpDocsSearchConfig, m as DocsAgentTraceEventInput, r as AlgoliaDocsSearchConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEventInput } from "./types-D-OvczD4.mjs";
2
2
 
3
3
  //#region src/cloud-analytics.d.ts
4
4
  interface DocsCloudAnalyticsOptions {
@@ -39,6 +39,23 @@ declare function emitDocsObservabilityEvent(observability: boolean | DocsObserva
39
39
  declare function emitDocsAgentTraceEvent(observability: boolean | DocsObservabilityConfig | undefined, event: DocsAgentTraceEventInput): Promise<void>;
40
40
  //#endregion
41
41
  //#region src/search.d.ts
42
+ interface DocsAskAIContextResult extends DocsSearchResult {
43
+ title: string;
44
+ contextContent: string;
45
+ }
46
+ interface DocsAskAIContext {
47
+ context: string;
48
+ results: DocsAskAIContextResult[];
49
+ searchResults: DocsSearchResult[];
50
+ packageHints: DocsAskAIPackageHints;
51
+ }
52
+ interface DocsAskAIPackageHints {
53
+ packages: string[];
54
+ imports: string[];
55
+ installCommands: string[];
56
+ }
57
+ declare function inferDocsAskAIPackageHints(content: string): DocsAskAIPackageHints;
58
+ declare function formatDocsAskAIPackageHints(hints: DocsAskAIPackageHints, packageName?: string): string | undefined;
42
59
  declare function buildDocsSearchDocuments(pages: DocsSearchSourcePage[], chunking?: DocsSearchChunkingConfig): DocsSearchDocument[];
43
60
  declare function createSimpleSearchAdapter(): DocsSearchAdapter;
44
61
  declare function createTypesenseSearchAdapter(config: TypesenseDocsSearchConfig): DocsSearchAdapter;
@@ -54,6 +71,18 @@ declare function performDocsSearch(options: {
54
71
  siteTitle?: string;
55
72
  limit?: number;
56
73
  }): Promise<DocsSearchResult[]>;
74
+ declare function buildDocsAskAIContext(options: {
75
+ pages: DocsSearchSourcePage[];
76
+ query: string;
77
+ search?: boolean | DocsSearchConfig;
78
+ locale?: string;
79
+ pathname?: string;
80
+ siteTitle?: string;
81
+ baseUrl?: string;
82
+ limit?: number;
83
+ maxContextChars?: number;
84
+ maxResultChars?: number;
85
+ }): Promise<DocsAskAIContext>;
57
86
  declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
58
87
  //#endregion
59
- export { emitDocsObservabilityEvent as _, createSimpleSearchAdapter as a, DocsCloudAnalyticsOptions as b, resolveSearchRequestConfig as c, ResolvedDocsAnalyticsConfig as d, ResolvedDocsObservabilityConfig as f, emitDocsAnalyticsEvent as g, emitDocsAgentTraceEvent as h, createMcpSearchAdapter as i, DOCS_AGENT_TRACE_EVENT_TYPES as l, createDocsAgentTraceId as m, createAlgoliaSearchAdapter as n, createTypesenseSearchAdapter as o, createDocsAgentTraceContext as p, createCustomSearchAdapter as r, performDocsSearch as s, buildDocsSearchDocuments as t, DocsAgentTraceContext as u, resolveDocsAnalyticsConfig as v, createDocsCloudAnalytics as x, resolveDocsObservabilityConfig as y };
88
+ export { DocsCloudAnalyticsOptions as C, resolveDocsObservabilityConfig as S, createDocsAgentTraceId as _, createMcpSearchAdapter as a, emitDocsObservabilityEvent as b, formatDocsAskAIPackageHints as c, resolveSearchRequestConfig as d, DOCS_AGENT_TRACE_EVENT_TYPES as f, createDocsAgentTraceContext as g, ResolvedDocsObservabilityConfig as h, createCustomSearchAdapter as i, inferDocsAskAIPackageHints as l, ResolvedDocsAnalyticsConfig as m, buildDocsSearchDocuments as n, createSimpleSearchAdapter as o, DocsAgentTraceContext as p, createAlgoliaSearchAdapter as r, createTypesenseSearchAdapter as s, buildDocsAskAIContext as t, performDocsSearch as u, emitDocsAgentTraceEvent as v, createDocsCloudAnalytics as w, resolveDocsAnalyticsConfig as x, emitDocsAnalyticsEvent as y };
package/dist/server.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as DocsSearchDocument, C as DocsConfig, F as DocsSearchAdapter, G as DocsSearchSourcePage, H as DocsSearchQuery, I as DocsSearchAdapterContext, L as DocsSearchAdapterFactory, M as DocsObservabilityEvent, N as DocsObservabilityEventInput, Q as McpDocsSearchConfig, U as DocsSearchResult, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, j as DocsObservabilityConfig, m as DocsAgentTraceEventInput, tt as OpenDocsProvider, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsSearchConfig } from "./types-CgBlM_yI.mjs";
2
- import { _ as emitDocsObservabilityEvent, a as createSimpleSearchAdapter, b as DocsCloudAnalyticsOptions, c as resolveSearchRequestConfig, d as ResolvedDocsAnalyticsConfig, f as ResolvedDocsObservabilityConfig, g as emitDocsAnalyticsEvent, h as emitDocsAgentTraceEvent, i as createMcpSearchAdapter, l as DOCS_AGENT_TRACE_EVENT_TYPES, m as createDocsAgentTraceId, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, p as createDocsAgentTraceContext, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments, u as DocsAgentTraceContext, v as resolveDocsAnalyticsConfig, x as createDocsCloudAnalytics, y as resolveDocsObservabilityConfig } from "./search-COyfvf6H.mjs";
1
+ import { D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, G as DocsSearchConfig, H as DocsSearchAdapterContext, J as DocsSearchQuery, K as DocsSearchDocument, L as DocsObservabilityConfig, O as DocsAskAIFeedbackValue, R as DocsObservabilityEvent, T as DocsAskAIFeedbackConfig, U as DocsSearchAdapterFactory, V as DocsSearchAdapter, Y as DocsSearchResult, Z as DocsSearchSourcePage, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, it as McpDocsSearchConfig, k as DocsConfig, m as DocsAgentTraceEventInput, st as OpenDocsProvider, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEventInput } from "./types-D-OvczD4.mjs";
2
+ import { C as DocsCloudAnalyticsOptions, S as resolveDocsObservabilityConfig, _ as createDocsAgentTraceId, a as createMcpSearchAdapter, b as emitDocsObservabilityEvent, c as formatDocsAskAIPackageHints, d as resolveSearchRequestConfig, f as DOCS_AGENT_TRACE_EVENT_TYPES, g as createDocsAgentTraceContext, h as ResolvedDocsObservabilityConfig, i as createCustomSearchAdapter, l as inferDocsAskAIPackageHints, m as ResolvedDocsAnalyticsConfig, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DocsAgentTraceContext, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as emitDocsAgentTraceEvent, w as createDocsCloudAnalytics, x as resolveDocsAnalyticsConfig, y as emitDocsAnalyticsEvent } from "./search-DSKaQ2JH.mjs";
3
3
  import { DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
4
4
 
5
5
  //#region src/api-reference.d.ts
@@ -63,4 +63,4 @@ declare function parsePromptStringArray(value: unknown): string[] | undefined;
63
63
  declare function resolvePromptProviderChoices(availableProviders?: PromptProviderInput[], preferredNames?: string[]): PromptProviderChoice[];
64
64
  declare function sanitizePromptText(text: string): string;
65
65
  //#endregion
66
- export { type ApiReferenceFramework, type ApiReferenceRenderer, type ApiReferenceRoute, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsCloudAnalyticsOptions, type DocsMcpHttpHandlers, type DocsMcpNavigationNode, type DocsMcpNavigationTree, type DocsMcpPage, type DocsMcpResolvedConfig, type DocsMcpSource, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchQuery, type DocsSearchResult, type DocsSearchSourcePage, type McpDocsSearchConfig, type PromptAction, type PromptProviderChoice, type ResolvedApiReferenceConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsObservabilityConfig, type SerializedOpenDocsProvider, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsSearchDocuments, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProviders };
66
+ export { type ApiReferenceFramework, type ApiReferenceRenderer, type ApiReferenceRoute, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DOCS_AGENT_TRACE_EVENT_TYPES, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAskAIFeedbackConfig, type DocsAskAIFeedbackData, type DocsAskAIFeedbackMessage, type DocsAskAIFeedbackValue, type DocsCloudAnalyticsOptions, type DocsMcpHttpHandlers, type DocsMcpNavigationNode, type DocsMcpNavigationTree, type DocsMcpPage, type DocsMcpResolvedConfig, type DocsMcpSource, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchQuery, type DocsSearchResult, type DocsSearchSourcePage, type McpDocsSearchConfig, type PromptAction, type PromptProviderChoice, type ResolvedApiReferenceConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsObservabilityConfig, type SerializedOpenDocsProvider, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsSearchDocuments, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, formatDocsAskAIPackageHints, inferDocsAskAIPackageHints, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProviders };
package/dist/server.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as createDocsCloudAnalytics, C as createDocsAgentTraceContext, D as emitDocsObservabilityEvent, E as emitDocsAnalyticsEvent, O as resolveDocsAnalyticsConfig, S as DOCS_AGENT_TRACE_EVENT_TYPES, T as emitDocsAgentTraceEvent, a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, k as resolveDocsObservabilityConfig, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments, w as createDocsAgentTraceId } from "./search-Bk7rg-AY.mjs";
1
+ import { A as emitDocsObservabilityEvent, D as createDocsAgentTraceId, E as createDocsAgentTraceContext, M as resolveDocsObservabilityConfig, N as createDocsCloudAnalytics, O as emitDocsAgentTraceEvent, T as DOCS_AGENT_TRACE_EVENT_TYPES, a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveSearchRequestConfig, i as createCustomSearchAdapter, j as resolveDocsAnalyticsConfig, k as emitDocsAnalyticsEvent, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch } from "./search-DBZ6Tkij.mjs";
2
2
  import { a as sanitizePromptText, c as serializeOpenDocsProviders, d as buildApiReferenceOpenApiDocument, f as buildApiReferenceOpenApiDocumentAsync, g as resolveApiReferenceRenderer, h as resolveApiReferenceConfig, i as resolvePromptProviderChoices, l as buildApiReferenceHtmlDocument, m as buildApiReferenceScalarCss, n as normalizePromptProviderName, o as serializeDocsIcon, p as buildApiReferencePageTitle, r as parsePromptStringArray, s as serializeDocsIconRegistry, t as DEFAULT_PROMPT_PROVIDER_TEMPLATES, u as buildApiReferenceHtmlDocumentAsync } from "./prompt-utils-8nmFLQVH.mjs";
3
3
  import { createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
4
4
 
5
- export { DEFAULT_PROMPT_PROVIDER_TEMPLATES, DOCS_AGENT_TRACE_EVENT_TYPES, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsSearchDocuments, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProviders };
5
+ export { DEFAULT_PROMPT_PROVIDER_TEMPLATES, DOCS_AGENT_TRACE_EVENT_TYPES, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsSearchDocuments, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, formatDocsAskAIPackageHints, inferDocsAskAIPackageHints, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProviders };
@@ -635,10 +635,11 @@ interface PageActionsConfig {
635
635
  type DocsAnalyticsSource = "client" | "server" | "mcp";
636
636
  type DocsAgentTraceStatus = "started" | "success" | "error" | "retry" | "timeout";
637
637
  type DocsAgentTraceEventType = "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";
638
- type DocsAnalyticsEventType = "page_view" | "search_open" | "search_close" | "search_query" | "search_result_click" | "search_error" | "ai_open" | "ai_close" | "ai_question" | "ai_response" | "ai_error" | "ai_clear" | "page_action_copy_markdown" | "page_action_open_docs_menu" | "page_action_open_docs" | "code_block_copy" | "feedback_select" | "feedback_submit" | "feedback_error" | "agent_read" | "agent_spec_request" | "agent_feedback_schema" | "agent_feedback_submit" | "agent_feedback_error" | "markdown_request" | "llms_request" | "skill_request" | "api_search" | "api_ai_request" | "api_ai_response" | "api_ai_error" | "mcp_request" | "mcp_tool";
638
+ type DocsAnalyticsEventType = "page_view" | "search_open" | "search_close" | "search_query" | "search_result_click" | "search_error" | "ai_open" | "ai_close" | "ai_question" | "ai_response" | "ai_feedback" | "ai_error" | "ai_clear" | "page_action_copy_markdown" | "page_action_open_docs_menu" | "page_action_open_docs" | "code_block_copy" | "feedback_select" | "feedback_submit" | "feedback_error" | "agent_read" | "agent_spec_request" | "agent_feedback_schema" | "agent_feedback_submit" | "agent_feedback_error" | "markdown_request" | "llms_request" | "skill_request" | "api_search" | "api_ai_request" | "api_ai_response" | "api_ai_error" | "mcp_request" | "mcp_tool";
639
639
  interface DocsAnalyticsInput {
640
640
  query?: string;
641
641
  question?: string;
642
+ feedbackValue?: string;
642
643
  feedbackComment?: string;
643
644
  content?: string;
644
645
  }
@@ -1016,6 +1017,51 @@ interface GithubConfig {
1016
1017
  */
1017
1018
  directory?: string;
1018
1019
  }
1020
+ type DocsAskAIFeedbackValue = "like" | "dislike";
1021
+ type DocsAskAIActionType = "copy" | DocsAskAIFeedbackValue;
1022
+ interface DocsAskAIFeedbackMessage {
1023
+ role: "user" | "assistant";
1024
+ content: string;
1025
+ }
1026
+ interface DocsAskAIActionData {
1027
+ type: DocsAskAIActionType;
1028
+ value?: DocsAskAIFeedbackValue;
1029
+ question: string;
1030
+ answer: string;
1031
+ messageId?: string;
1032
+ messageIndex?: number;
1033
+ model?: string;
1034
+ surface?: string;
1035
+ url?: string;
1036
+ path?: string;
1037
+ messages?: DocsAskAIFeedbackMessage[];
1038
+ copied?: boolean;
1039
+ }
1040
+ interface DocsAskAIFeedbackData {
1041
+ value: DocsAskAIFeedbackValue;
1042
+ question: string;
1043
+ answer: string;
1044
+ messageId?: string;
1045
+ messageIndex?: number;
1046
+ model?: string;
1047
+ surface?: string;
1048
+ url?: string;
1049
+ path?: string;
1050
+ messages?: DocsAskAIFeedbackMessage[];
1051
+ }
1052
+ interface DocsAskAIFeedbackConfig {
1053
+ /**
1054
+ * Whether to show response rating controls after each completed Ask AI answer.
1055
+ * @default true
1056
+ */
1057
+ enabled?: boolean;
1058
+ /** Label for the positive rating button. @default "Helpful" */
1059
+ positiveLabel?: string;
1060
+ /** Label for the negative rating button. @default "Not helpful" */
1061
+ negativeLabel?: string;
1062
+ /** Called when a user rates an Ask AI response. */
1063
+ onFeedback?: (data: DocsAskAIFeedbackData) => void | Promise<void>;
1064
+ }
1019
1065
  /**
1020
1066
  * Configuration for "Ask AI" — a RAG-powered chat that lets users
1021
1067
  * ask questions about the documentation content.
@@ -1277,8 +1323,8 @@ interface AIConfig {
1277
1323
  */
1278
1324
  aiLabel?: string;
1279
1325
  /**
1280
- * The npm package name used in import examples.
1281
- * The AI will use this in code snippets instead of generic placeholders.
1326
+ * Optional npm package-name override used in import examples.
1327
+ * Ask AI normally infers package names and exact imports from retrieved docs context.
1282
1328
  *
1283
1329
  * @example
1284
1330
  * ```ts
@@ -1352,6 +1398,45 @@ interface AIConfig {
1352
1398
  loadingComponent?: (props: {
1353
1399
  name: string;
1354
1400
  }) => unknown;
1401
+ /**
1402
+ * Response rating controls for generated Ask AI answers.
1403
+ *
1404
+ * Set to `false` to hide the buttons. Pass an object to customize labels
1405
+ * and receive callback payloads with the question, answer, model, and UI surface.
1406
+ *
1407
+ * @default true
1408
+ *
1409
+ * @example
1410
+ * ```ts
1411
+ * ai: {
1412
+ * enabled: true,
1413
+ * feedback: {
1414
+ * onFeedback(data) {
1415
+ * console.log(data.value, data.question, data.answer);
1416
+ * },
1417
+ * },
1418
+ * }
1419
+ * ```
1420
+ */
1421
+ feedback?: boolean | DocsAskAIFeedbackConfig;
1422
+ /**
1423
+ * Called when a user clicks an Ask AI response action.
1424
+ *
1425
+ * `data.type` is `"copy"`, `"like"`, or `"dislike"`.
1426
+ *
1427
+ * @example
1428
+ * ```ts
1429
+ * ai: {
1430
+ * enabled: true,
1431
+ * onActions(data) {
1432
+ * if (data.type === "copy") console.log("Copied", data.answer);
1433
+ * if (data.type === "like") console.log("Helpful", data.question);
1434
+ * if (data.type === "dislike") console.log("Not helpful", data.question);
1435
+ * },
1436
+ * }
1437
+ * ```
1438
+ */
1439
+ onActions?: (data: DocsAskAIActionData) => void | Promise<void>;
1355
1440
  }
1356
1441
  /**
1357
1442
  * A single item in the slug-based sidebar ordering.
@@ -2107,4 +2192,4 @@ interface DocsConfig {
2107
2192
  og?: OGConfig;
2108
2193
  }
2109
2194
  //#endregion
2110
- export { OGConfig as $, DocsNav as A, DocsSearchDocument as B, DocsConfig as C, DocsMcpConfig as D, DocsI18nConfig as E, DocsSearchAdapter as F, DocsSearchSourcePage as G, DocsSearchQuery as H, DocsSearchAdapterContext as I, FontStyle as J, DocsTheme as K, DocsSearchAdapterFactory as L, DocsObservabilityEvent as M, DocsObservabilityEventInput as N, DocsMcpToolsConfig as O, DocsRelatedItem as P, McpDocsSearchConfig as Q, DocsSearchChunkingConfig as R, DocsAnalyticsSource as S, UIConfig as St, DocsFeedbackValue as T, DocsSearchResult as U, DocsSearchEmbeddingsConfig as V, DocsSearchResultType as W, LastUpdatedConfig as X, GithubConfig as Y, LlmsTxtConfig as Z, DocsAnalyticsConfig as _, SidebarTree as _t, ApiReferenceRenderer as a, PageFrontmatter as at, DocsAnalyticsEventType as b, TypesenseDocsSearchConfig as bt, ChangelogFrontmatter as c, PageTwitter as ct, CustomDocsSearchConfig as d, SidebarComponentProps as dt, OpenDocsConfig as et, DocsAgentFeedbackContext as f, SidebarConfig as ft, DocsAgentTraceStatus as g, SidebarPageNode as gt, DocsAgentTraceEventType as h, SidebarNode as ht, ApiReferenceConfig as i, PageActionsConfig as it, DocsObservabilityConfig as j, DocsMetadata as k, CodeBlockCopyData as l, ReadingTimeConfig as lt, DocsAgentTraceEventInput as m, SidebarFolderNode as mt, AgentFeedbackConfig as n, OpenGraphImage as nt, BreadcrumbConfig as o, PageOpenGraph as ot, DocsAgentFeedbackData as p, SidebarFolderIndexBehavior as pt, FeedbackConfig as q, AlgoliaDocsSearchConfig as r, OrderingItem as rt, ChangelogConfig as s, PageSidebarFrontmatter as st, AIConfig as t, OpenDocsProvider as tt, CopyMarkdownConfig as u, ResolvedDocsRelatedLink as ut, DocsAnalyticsEvent as v, SimpleDocsSearchConfig as vt, DocsFeedbackData as w, DocsAnalyticsInput as x, TypographyConfig as xt, DocsAnalyticsEventInput as y, ThemeToggleConfig as yt, DocsSearchConfig as z };
2195
+ export { FeedbackConfig as $, DocsFeedbackData as A, DocsRelatedItem as B, DocsAskAIActionData as C, SidebarTree as Ct, DocsAskAIFeedbackMessage as D, TypographyConfig as Dt, DocsAskAIFeedbackData as E, TypesenseDocsSearchConfig as Et, DocsMetadata as F, DocsSearchConfig as G, DocsSearchAdapterContext as H, DocsNav as I, DocsSearchQuery as J, DocsSearchDocument as K, DocsObservabilityConfig as L, DocsI18nConfig as M, DocsMcpConfig as N, DocsAskAIFeedbackValue as O, UIConfig as Ot, DocsMcpToolsConfig as P, DocsTheme as Q, DocsObservabilityEvent as R, DocsAnalyticsSource as S, SidebarPageNode as St, DocsAskAIFeedbackConfig as T, ThemeToggleConfig as Tt, DocsSearchAdapterFactory as U, DocsSearchAdapter as V, DocsSearchChunkingConfig as W, DocsSearchResultType as X, DocsSearchResult as Y, DocsSearchSourcePage as Z, DocsAnalyticsConfig as _, SidebarComponentProps as _t, ApiReferenceRenderer as a, OGConfig as at, DocsAnalyticsEventType as b, SidebarFolderNode as bt, ChangelogFrontmatter as c, OpenGraphImage as ct, CustomDocsSearchConfig as d, PageFrontmatter as dt, FontStyle as et, DocsAgentFeedbackContext as f, PageOpenGraph as ft, DocsAgentTraceStatus as g, ResolvedDocsRelatedLink as gt, DocsAgentTraceEventType as h, ReadingTimeConfig as ht, ApiReferenceConfig as i, McpDocsSearchConfig as it, DocsFeedbackValue as j, DocsConfig as k, CodeBlockCopyData as l, OrderingItem as lt, DocsAgentTraceEventInput as m, PageTwitter as mt, AgentFeedbackConfig as n, LastUpdatedConfig as nt, BreadcrumbConfig as o, OpenDocsConfig as ot, DocsAgentFeedbackData as p, PageSidebarFrontmatter as pt, DocsSearchEmbeddingsConfig as q, AlgoliaDocsSearchConfig as r, LlmsTxtConfig as rt, ChangelogConfig as s, OpenDocsProvider as st, AIConfig as t, GithubConfig as tt, CopyMarkdownConfig as u, PageActionsConfig as ut, DocsAnalyticsEvent as v, SidebarConfig as vt, DocsAskAIActionType as w, SimpleDocsSearchConfig as wt, DocsAnalyticsInput as x, SidebarNode as xt, DocsAnalyticsEventInput as y, SidebarFolderIndexBehavior as yt, DocsObservabilityEventInput as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",