@farming-labs/docs 0.1.72 → 0.1.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-D87B57Wv.mjs → agent-BixrmwIT.mjs} +1 -1
- package/dist/{agent-beh4aVYP.mjs → agent-mISJm3qa.mjs} +2 -2
- package/dist/cli/index.mjs +5 -5
- package/dist/{doctor-BUI3LchV.mjs → doctor-CHneFdd6.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{mcp-obMYAPqu.mjs → mcp-Cz0c3Aoj.mjs} +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.mjs +1 -1
- package/dist/{search-BzMf2w0H.mjs → search-BxhAshfT.mjs} +1 -1
- package/dist/{search-COyfvf6H.d.mts → search-K4fg0Zzw.d.mts} +39 -2
- package/dist/{search-Bk7rg-AY.mjs → search-kP0mAXCp.mjs} +317 -4
- package/dist/server.d.mts +3 -3
- package/dist/server.mjs +2 -2
- package/dist/{types-CgBlM_yI.d.mts → types-OyUzNy83.d.mts} +113 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as renderDocsMarkdownDocument, g as findDocsMarkdownPage } from "./agent-
|
|
2
|
-
import {
|
|
1
|
+
import { C as renderDocsMarkdownDocument, g as findDocsMarkdownPage } from "./agent-BixrmwIT.mjs";
|
|
2
|
+
import { _ as parseGeneratedAgentDocument, h as hashGeneratedAgentContent, m as GENERATED_AGENT_PROVENANCE_VERSION, v as serializeGeneratedAgentDocument } from "./search-kP0mAXCp.mjs";
|
|
3
3
|
import "./index.mjs";
|
|
4
4
|
import "./prompt-utils-8nmFLQVH.mjs";
|
|
5
5
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
package/dist/cli/index.mjs
CHANGED
|
@@ -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-
|
|
86
|
+
const { runMcp } = await import("../mcp-Cz0c3Aoj.mjs");
|
|
87
87
|
await runMcp(mcpOptions);
|
|
88
88
|
} else if (parsedCommand.command === "agent" && subcommand === "compact") {
|
|
89
|
-
const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-
|
|
89
|
+
const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-mISJm3qa.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-
|
|
99
|
+
const { printAgentCompactHelp } = await import("../agent-mISJm3qa.mjs");
|
|
100
100
|
printAgentCompactHelp();
|
|
101
101
|
process.exit(1);
|
|
102
102
|
} else if (parsedCommand.command === "doctor") {
|
|
103
|
-
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-
|
|
103
|
+
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-CHneFdd6.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-
|
|
111
|
+
const { syncSearch } = await import("../search-BxhAshfT.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-
|
|
2
|
-
import "./search-
|
|
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-BixrmwIT.mjs";
|
|
2
|
+
import "./search-kP0mAXCp.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-
|
|
7
|
+
import { inspectAgentCompactionState, scanDocsPageTargets } from "./agent-mISJm3qa.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
|
|
2
|
-
import { _ as
|
|
1
|
+
import { $ as DocsTheme, A as DocsConfig, B as DocsObservabilityEventInput, C as DocsAskAIActionData, Ct as SidebarPageNode, D as DocsAskAIFeedbackMessage, Dt as TypesenseDocsSearchConfig, E as DocsAskAIFeedbackData, Et as ThemeToggleConfig, F as DocsMcpToolsConfig, G as DocsSearchChunkingConfig, H as DocsSearchAdapter, I as DocsMetadata, J as DocsSearchEmbeddingsConfig, K as DocsSearchConfig, L as DocsNav, M as DocsFeedbackValue, N as DocsI18nConfig, O as DocsAskAIFeedbackValue, Ot as TypographyConfig, P as DocsMcpConfig, Q as DocsSearchSourcePage, R as DocsObservabilityConfig, S as DocsAnalyticsSource, St as SidebarNode, T as DocsAskAIFeedbackConfig, Tt as SimpleDocsSearchConfig, U as DocsSearchAdapterContext, V as DocsRelatedItem, W as DocsSearchAdapterFactory, X as DocsSearchResult, Y as DocsSearchQuery, Z as DocsSearchResultType, _ as DocsAnalyticsConfig, _t as ResolvedDocsRelatedLink, a as ApiReferenceRenderer, at as McpDocsSearchConfig, b as DocsAnalyticsEventType, bt as SidebarFolderIndexBehavior, c as ChangelogFrontmatter, ct as OpenDocsProvider, d as CustomDocsSearchConfig, dt as PageActionsConfig, et as FeedbackConfig, f as DocsAgentFeedbackContext, ft as PageFrontmatter, g as DocsAgentTraceStatus, gt as ReadingTimeConfig, h as DocsAgentTraceEventType, ht as PageTwitter, i as ApiReferenceConfig, it as LlmsTxtConfig, j as DocsFeedbackData, k as DocsAskAIMcpConfig, kt as UIConfig, l as CodeBlockCopyData, lt as OpenGraphImage, m as DocsAgentTraceEventInput, mt as PageSidebarFrontmatter, n as AgentFeedbackConfig, nt as GithubConfig, o as BreadcrumbConfig, ot as OGConfig, p as DocsAgentFeedbackData, pt as PageOpenGraph, q as DocsSearchDocument, r as AlgoliaDocsSearchConfig, rt as LastUpdatedConfig, s as ChangelogConfig, st as OpenDocsConfig, t as AIConfig, tt as FontStyle, u as CopyMarkdownConfig, ut as OrderingItem, v as DocsAnalyticsEvent, vt as SidebarComponentProps, w as DocsAskAIActionType, wt as SidebarTree, x as DocsAnalyticsInput, xt as SidebarFolderNode, y as DocsAnalyticsEventInput, yt as SidebarConfig, z as DocsObservabilityEvent } from "./types-OyUzNy83.mjs";
|
|
2
|
+
import { C as resolveDocsObservabilityConfig, S as resolveDocsAnalyticsConfig, T as createDocsCloudAnalytics, _ as createDocsAgentTraceContext, a as createMcpSearchAdapter, b as emitDocsAnalyticsEvent, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as ResolvedDocsObservabilityConfig, h as ResolvedDocsAnalyticsConfig, i as createCustomSearchAdapter, l as inferDocsAskAIPackageHints, m as DocsAgentTraceContext, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as createDocsAgentTraceId, w as DocsCloudAnalyticsOptions, x as emitDocsObservabilityEvent, y as emitDocsAgentTraceEvent } from "./search-K4fg0Zzw.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 DocsAskAIMcpConfig, 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, resolveAskAISearchRequestConfig, 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-
|
|
2
|
-
import { A as
|
|
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-BixrmwIT.mjs";
|
|
2
|
+
import { A as emitDocsAnalyticsEvent, C as resolveSidebarFolderIndexBehaviorForPath, D as createDocsAgentTraceContext, E as DOCS_AGENT_TRACE_EVENT_TYPES, M as resolveDocsAnalyticsConfig, N as resolveDocsObservabilityConfig, O as createDocsAgentTraceId, P as createDocsCloudAnalytics, S as resolveSidebarFolderIndexBehavior, T as renderDocsRelatedMarkdownLines, _ as parseGeneratedAgentDocument, a as createMcpSearchAdapter, b as applySidebarFolderIndexBehavior, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as normalizeGeneratedAgentContent, h as hashGeneratedAgentContent, i as createCustomSearchAdapter, j as emitDocsObservabilityEvent, k as emitDocsAgentTraceEvent, l as inferDocsAskAIPackageHints, m as GENERATED_AGENT_PROVENANCE_VERSION, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as GENERATED_AGENT_PROVENANCE_MARKER, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as serializeGeneratedAgentDocument, w as normalizeDocsRelated, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-kP0mAXCp.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, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as DocsSearchConfig, P as DocsMcpConfig, Q as DocsSearchSourcePage, R as DocsObservabilityConfig, _ as DocsAnalyticsConfig, ut as OrderingItem } from "./types-OyUzNy83.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 {
|
|
1
|
+
import { A as emitDocsAnalyticsEvent, D as createDocsAgentTraceContext, O as createDocsAgentTraceId, T as renderDocsRelatedMarkdownLines, k as emitDocsAgentTraceEvent, u as performDocsSearch, w as normalizeDocsRelated, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-kP0mAXCp.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
|
|
1
|
+
import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-kP0mAXCp.mjs";
|
|
2
2
|
import "./prompt-utils-8nmFLQVH.mjs";
|
|
3
3
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
4
4
|
import "./server.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as DocsObservabilityEventInput, Dt as TypesenseDocsSearchConfig, G as DocsSearchChunkingConfig, H as DocsSearchAdapter, K as DocsSearchConfig, Q as DocsSearchSourcePage, R as DocsObservabilityConfig, W as DocsSearchAdapterFactory, X as DocsSearchResult, _ as DocsAnalyticsConfig, at as McpDocsSearchConfig, d as CustomDocsSearchConfig, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, q as DocsSearchDocument, r as AlgoliaDocsSearchConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-OyUzNy83.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cloud-analytics.d.ts
|
|
4
4
|
interface DocsCloudAnalyticsOptions {
|
|
@@ -39,10 +39,35 @@ 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;
|
|
45
62
|
declare function resolveSearchRequestConfig(search: boolean | DocsSearchConfig | undefined, requestUrl?: string): boolean | DocsSearchConfig | undefined;
|
|
63
|
+
declare function resolveAskAISearchRequestConfig(options: {
|
|
64
|
+
search: boolean | DocsSearchConfig | undefined;
|
|
65
|
+
useMcp?: boolean | DocsAskAIMcpConfig;
|
|
66
|
+
mcpEndpoint?: string;
|
|
67
|
+
mcpEnabled?: boolean;
|
|
68
|
+
mcpSearchEnabled?: boolean;
|
|
69
|
+
requestUrl?: string;
|
|
70
|
+
}): boolean | DocsSearchConfig | undefined;
|
|
46
71
|
declare function createMcpSearchAdapter(config: McpDocsSearchConfig): DocsSearchAdapter;
|
|
47
72
|
declare function createAlgoliaSearchAdapter(config: AlgoliaDocsSearchConfig): DocsSearchAdapter;
|
|
48
73
|
declare function performDocsSearch(options: {
|
|
@@ -54,6 +79,18 @@ declare function performDocsSearch(options: {
|
|
|
54
79
|
siteTitle?: string;
|
|
55
80
|
limit?: number;
|
|
56
81
|
}): Promise<DocsSearchResult[]>;
|
|
82
|
+
declare function buildDocsAskAIContext(options: {
|
|
83
|
+
pages: DocsSearchSourcePage[];
|
|
84
|
+
query: string;
|
|
85
|
+
search?: boolean | DocsSearchConfig;
|
|
86
|
+
locale?: string;
|
|
87
|
+
pathname?: string;
|
|
88
|
+
siteTitle?: string;
|
|
89
|
+
baseUrl?: string;
|
|
90
|
+
limit?: number;
|
|
91
|
+
maxContextChars?: number;
|
|
92
|
+
maxResultChars?: number;
|
|
93
|
+
}): Promise<DocsAskAIContext>;
|
|
57
94
|
declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
|
|
58
95
|
//#endregion
|
|
59
|
-
export {
|
|
96
|
+
export { resolveDocsObservabilityConfig as C, resolveDocsAnalyticsConfig as S, createDocsCloudAnalytics as T, createDocsAgentTraceContext as _, createMcpSearchAdapter as a, emitDocsAnalyticsEvent as b, formatDocsAskAIPackageHints as c, resolveAskAISearchRequestConfig as d, resolveSearchRequestConfig as f, ResolvedDocsObservabilityConfig as g, ResolvedDocsAnalyticsConfig as h, createCustomSearchAdapter as i, inferDocsAskAIPackageHints as l, DocsAgentTraceContext as m, buildDocsSearchDocuments as n, createSimpleSearchAdapter as o, DOCS_AGENT_TRACE_EVENT_TYPES as p, createAlgoliaSearchAdapter as r, createTypesenseSearchAdapter as s, buildDocsAskAIContext as t, performDocsSearch as u, createDocsAgentTraceId as v, DocsCloudAnalyticsOptions as w, emitDocsObservabilityEvent as x, emitDocsAgentTraceEvent as y };
|
|
@@ -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]
|
|
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().
|
|
731
|
+
const q = normalizeWhitespace(query.toLowerCase().replace(/[?!.,;:]+$/g, ""));
|
|
511
732
|
if (!q) return 0;
|
|
512
|
-
const words =
|
|
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;
|
|
@@ -889,6 +1116,18 @@ function resolveSearchRequestConfig(search, requestUrl) {
|
|
|
889
1116
|
endpoint: new URL(search.endpoint, requestUrl).toString()
|
|
890
1117
|
};
|
|
891
1118
|
}
|
|
1119
|
+
function resolveAskAISearchRequestConfig(options) {
|
|
1120
|
+
if (!options.useMcp) return resolveSearchRequestConfig(options.search, options.requestUrl);
|
|
1121
|
+
if (typeof options.useMcp === "object") return resolveSearchRequestConfig({
|
|
1122
|
+
...options.useMcp,
|
|
1123
|
+
provider: "mcp"
|
|
1124
|
+
}, options.requestUrl);
|
|
1125
|
+
if (options.mcpEnabled === false || options.mcpSearchEnabled === false || !options.mcpEndpoint) return resolveSearchRequestConfig(options.search, options.requestUrl);
|
|
1126
|
+
return resolveSearchRequestConfig({
|
|
1127
|
+
provider: "mcp",
|
|
1128
|
+
endpoint: options.mcpEndpoint
|
|
1129
|
+
}, options.requestUrl);
|
|
1130
|
+
}
|
|
892
1131
|
function createMcpSearchAdapter(config) {
|
|
893
1132
|
return {
|
|
894
1133
|
name: "mcp",
|
|
@@ -1077,6 +1316,80 @@ async function performDocsSearch(options) {
|
|
|
1077
1316
|
return createSimpleSearchAdapter().search(query, context);
|
|
1078
1317
|
}
|
|
1079
1318
|
}
|
|
1319
|
+
async function buildDocsAskAIContext(options) {
|
|
1320
|
+
const limit = options.limit ?? 5;
|
|
1321
|
+
const searchLimit = Math.max(limit * 2, limit);
|
|
1322
|
+
const initialSearch = options.search === false ? true : options.search;
|
|
1323
|
+
const primarySearch = normalizeDocsSearchConfig(initialSearch).enabled ? initialSearch : true;
|
|
1324
|
+
const primarySearchConfig = normalizeDocsSearchConfig(primarySearch);
|
|
1325
|
+
const searchResults = mergeSearchResults(await performDocsSearch({
|
|
1326
|
+
pages: options.pages,
|
|
1327
|
+
query: options.query,
|
|
1328
|
+
search: primarySearch,
|
|
1329
|
+
locale: options.locale,
|
|
1330
|
+
pathname: options.pathname,
|
|
1331
|
+
siteTitle: options.siteTitle,
|
|
1332
|
+
limit: searchLimit
|
|
1333
|
+
}), shouldSupplementAskAIWithSimpleSearch(primarySearchConfig) ? await performDocsSearch({
|
|
1334
|
+
pages: options.pages,
|
|
1335
|
+
query: options.query,
|
|
1336
|
+
search: {
|
|
1337
|
+
provider: "simple",
|
|
1338
|
+
enabled: true,
|
|
1339
|
+
chunking: primarySearchConfig.chunking,
|
|
1340
|
+
maxResults: searchLimit
|
|
1341
|
+
},
|
|
1342
|
+
locale: options.locale,
|
|
1343
|
+
pathname: options.pathname,
|
|
1344
|
+
siteTitle: options.siteTitle,
|
|
1345
|
+
limit: searchLimit
|
|
1346
|
+
}) : []);
|
|
1347
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1348
|
+
const maxResultChars = options.maxResultChars ?? DEFAULT_ASK_AI_RESULT_CHARS;
|
|
1349
|
+
const rankedResults = searchResults.map((result, index) => {
|
|
1350
|
+
const formatted = formatAskAIContextResult({
|
|
1351
|
+
result,
|
|
1352
|
+
page: findPageForSearchResult(options.pages, result),
|
|
1353
|
+
maxChars: maxResultChars,
|
|
1354
|
+
baseUrl: options.baseUrl
|
|
1355
|
+
});
|
|
1356
|
+
return {
|
|
1357
|
+
result,
|
|
1358
|
+
formatted,
|
|
1359
|
+
index,
|
|
1360
|
+
rank: rankAskAIContextResult(options.query, formatted)
|
|
1361
|
+
};
|
|
1362
|
+
}).sort((a, b) => b.rank - a.rank || a.index - b.index);
|
|
1363
|
+
const formattedResults = rankedResults.map((item) => item.formatted);
|
|
1364
|
+
const sectionResultPaths = new Set(formattedResults.filter((result) => result.section).map((result) => normalizeUrlPathname(result.url)));
|
|
1365
|
+
const results = formattedResults.filter((result) => result.section || !sectionResultPaths.has(normalizeUrlPathname(result.url))).filter((result) => {
|
|
1366
|
+
const key = getSearchResultKey(result);
|
|
1367
|
+
if (seen.has(key)) return false;
|
|
1368
|
+
seen.add(key);
|
|
1369
|
+
return result.contextContent.length > 0;
|
|
1370
|
+
}).slice(0, limit);
|
|
1371
|
+
const maxContextChars = options.maxContextChars ?? DEFAULT_ASK_AI_CONTEXT_CHARS;
|
|
1372
|
+
const blocks = [];
|
|
1373
|
+
let usedChars = 0;
|
|
1374
|
+
for (const result of results) {
|
|
1375
|
+
const block = buildAskAIContextBlock(result);
|
|
1376
|
+
const separatorChars = blocks.length === 0 ? 0 : 7;
|
|
1377
|
+
if (usedChars + separatorChars + block.length > maxContextChars) {
|
|
1378
|
+
const remaining = maxContextChars - usedChars - separatorChars;
|
|
1379
|
+
if (remaining > 400) blocks.push(clampText(block, remaining));
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
blocks.push(block);
|
|
1383
|
+
usedChars += separatorChars + block.length;
|
|
1384
|
+
}
|
|
1385
|
+
const context = blocks.join("\n\n---\n\n");
|
|
1386
|
+
return {
|
|
1387
|
+
context,
|
|
1388
|
+
results: results.slice(0, blocks.length),
|
|
1389
|
+
searchResults: rankedResults.map((item) => item.result),
|
|
1390
|
+
packageHints: inferDocsAskAIPackageHints(context)
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1080
1393
|
function createCustomSearchAdapter(adapter) {
|
|
1081
1394
|
return {
|
|
1082
1395
|
provider: "custom",
|
|
@@ -1085,4 +1398,4 @@ function createCustomSearchAdapter(adapter) {
|
|
|
1085
1398
|
}
|
|
1086
1399
|
|
|
1087
1400
|
//#endregion
|
|
1088
|
-
export {
|
|
1401
|
+
export { emitDocsAnalyticsEvent as A, resolveSidebarFolderIndexBehaviorForPath as C, createDocsAgentTraceContext as D, DOCS_AGENT_TRACE_EVENT_TYPES as E, resolveDocsAnalyticsConfig as M, resolveDocsObservabilityConfig as N, createDocsAgentTraceId as O, createDocsCloudAnalytics as P, resolveSidebarFolderIndexBehavior as S, renderDocsRelatedMarkdownLines as T, parseGeneratedAgentDocument as _, createMcpSearchAdapter as a, applySidebarFolderIndexBehavior as b, formatDocsAskAIPackageHints as c, resolveAskAISearchRequestConfig as d, resolveSearchRequestConfig as f, normalizeGeneratedAgentContent as g, hashGeneratedAgentContent as h, createCustomSearchAdapter as i, emitDocsObservabilityEvent as j, emitDocsAgentTraceEvent as k, inferDocsAskAIPackageHints as l, GENERATED_AGENT_PROVENANCE_VERSION as m, buildDocsSearchDocuments as n, createSimpleSearchAdapter as o, GENERATED_AGENT_PROVENANCE_MARKER as p, createAlgoliaSearchAdapter as r, createTypesenseSearchAdapter as s, buildDocsAskAIContext as t, performDocsSearch as u, serializeGeneratedAgentDocument as v, normalizeDocsRelated as w, resolvePageSidebarFolderIndexBehavior as x, stripGeneratedAgentProvenance as y };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
1
|
+
import { A as DocsConfig, B as DocsObservabilityEventInput, D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, H as DocsSearchAdapter, K as DocsSearchConfig, O as DocsAskAIFeedbackValue, Q as DocsSearchSourcePage, R as DocsObservabilityConfig, T as DocsAskAIFeedbackConfig, U as DocsSearchAdapterContext, W as DocsSearchAdapterFactory, X as DocsSearchResult, Y as DocsSearchQuery, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, at as McpDocsSearchConfig, ct as OpenDocsProvider, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, q as DocsSearchDocument, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-OyUzNy83.mjs";
|
|
2
|
+
import { C as resolveDocsObservabilityConfig, S as resolveDocsAnalyticsConfig, T as createDocsCloudAnalytics, _ as createDocsAgentTraceContext, a as createMcpSearchAdapter, b as emitDocsAnalyticsEvent, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as ResolvedDocsObservabilityConfig, h as ResolvedDocsAnalyticsConfig, i as createCustomSearchAdapter, l as inferDocsAskAIPackageHints, m as DocsAgentTraceContext, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DOCS_AGENT_TRACE_EVENT_TYPES, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as createDocsAgentTraceId, w as DocsCloudAnalyticsOptions, x as emitDocsObservabilityEvent, y as emitDocsAgentTraceEvent } from "./search-K4fg0Zzw.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 DocsAskAIMcpConfig, 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, resolveAskAISearchRequestConfig, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProviders };
|
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as emitDocsAnalyticsEvent, D as createDocsAgentTraceContext, E as DOCS_AGENT_TRACE_EVENT_TYPES, M as resolveDocsAnalyticsConfig, N as resolveDocsObservabilityConfig, O as createDocsAgentTraceId, P as createDocsCloudAnalytics, a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, i as createCustomSearchAdapter, j as emitDocsObservabilityEvent, k as emitDocsAgentTraceEvent, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch } from "./search-kP0mAXCp.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, resolveAskAISearchRequestConfig, 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
|
}
|
|
@@ -935,6 +936,9 @@ interface McpDocsSearchConfig {
|
|
|
935
936
|
maxResults?: number;
|
|
936
937
|
chunking?: DocsSearchChunkingConfig;
|
|
937
938
|
}
|
|
939
|
+
type DocsAskAIMcpConfig = Omit<McpDocsSearchConfig, "provider"> & {
|
|
940
|
+
provider?: "mcp";
|
|
941
|
+
};
|
|
938
942
|
interface CustomDocsSearchConfig {
|
|
939
943
|
provider: "custom";
|
|
940
944
|
enabled?: boolean;
|
|
@@ -1016,6 +1020,51 @@ interface GithubConfig {
|
|
|
1016
1020
|
*/
|
|
1017
1021
|
directory?: string;
|
|
1018
1022
|
}
|
|
1023
|
+
type DocsAskAIFeedbackValue = "like" | "dislike";
|
|
1024
|
+
type DocsAskAIActionType = "copy" | DocsAskAIFeedbackValue;
|
|
1025
|
+
interface DocsAskAIFeedbackMessage {
|
|
1026
|
+
role: "user" | "assistant";
|
|
1027
|
+
content: string;
|
|
1028
|
+
}
|
|
1029
|
+
interface DocsAskAIActionData {
|
|
1030
|
+
type: DocsAskAIActionType;
|
|
1031
|
+
value?: DocsAskAIFeedbackValue;
|
|
1032
|
+
question: string;
|
|
1033
|
+
answer: string;
|
|
1034
|
+
messageId?: string;
|
|
1035
|
+
messageIndex?: number;
|
|
1036
|
+
model?: string;
|
|
1037
|
+
surface?: string;
|
|
1038
|
+
url?: string;
|
|
1039
|
+
path?: string;
|
|
1040
|
+
messages?: DocsAskAIFeedbackMessage[];
|
|
1041
|
+
copied?: boolean;
|
|
1042
|
+
}
|
|
1043
|
+
interface DocsAskAIFeedbackData {
|
|
1044
|
+
value: DocsAskAIFeedbackValue;
|
|
1045
|
+
question: string;
|
|
1046
|
+
answer: string;
|
|
1047
|
+
messageId?: string;
|
|
1048
|
+
messageIndex?: number;
|
|
1049
|
+
model?: string;
|
|
1050
|
+
surface?: string;
|
|
1051
|
+
url?: string;
|
|
1052
|
+
path?: string;
|
|
1053
|
+
messages?: DocsAskAIFeedbackMessage[];
|
|
1054
|
+
}
|
|
1055
|
+
interface DocsAskAIFeedbackConfig {
|
|
1056
|
+
/**
|
|
1057
|
+
* Whether to show the copy, like, and dislike action row after each completed Ask AI answer.
|
|
1058
|
+
* @default true
|
|
1059
|
+
*/
|
|
1060
|
+
enabled?: boolean;
|
|
1061
|
+
/** Label for the positive rating button. @default "Helpful" */
|
|
1062
|
+
positiveLabel?: string;
|
|
1063
|
+
/** Label for the negative rating button. @default "Not helpful" */
|
|
1064
|
+
negativeLabel?: string;
|
|
1065
|
+
/** Called when a user rates an Ask AI response. */
|
|
1066
|
+
onFeedback?: (data: DocsAskAIFeedbackData) => void | Promise<void>;
|
|
1067
|
+
}
|
|
1019
1068
|
/**
|
|
1020
1069
|
* Configuration for "Ask AI" — a RAG-powered chat that lets users
|
|
1021
1070
|
* ask questions about the documentation content.
|
|
@@ -1244,6 +1293,27 @@ interface AIConfig {
|
|
|
1244
1293
|
* @default 5
|
|
1245
1294
|
*/
|
|
1246
1295
|
maxResults?: number;
|
|
1296
|
+
/**
|
|
1297
|
+
* Route Ask AI retrieval through the configured MCP `search_docs` tool.
|
|
1298
|
+
*
|
|
1299
|
+
* - `true` uses the MCP server this docs site already exposes at `mcp.route`
|
|
1300
|
+
* (default `/api/docs/mcp`)
|
|
1301
|
+
* - an object can point Ask AI at another Streamable HTTP MCP endpoint
|
|
1302
|
+
*
|
|
1303
|
+
* This only affects Ask AI retrieval. The normal docs search API still uses
|
|
1304
|
+
* the top-level `search` config.
|
|
1305
|
+
*
|
|
1306
|
+
* @default false
|
|
1307
|
+
*
|
|
1308
|
+
* @example
|
|
1309
|
+
* ```ts
|
|
1310
|
+
* ai: {
|
|
1311
|
+
* enabled: true,
|
|
1312
|
+
* useMcp: true,
|
|
1313
|
+
* }
|
|
1314
|
+
* ```
|
|
1315
|
+
*/
|
|
1316
|
+
useMcp?: boolean | DocsAskAIMcpConfig;
|
|
1247
1317
|
/**
|
|
1248
1318
|
* Pre-filled suggested questions shown in the AI chat when empty.
|
|
1249
1319
|
* When a user clicks one, it fills the input and submits automatically.
|
|
@@ -1277,8 +1347,8 @@ interface AIConfig {
|
|
|
1277
1347
|
*/
|
|
1278
1348
|
aiLabel?: string;
|
|
1279
1349
|
/**
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1350
|
+
* Optional npm package-name override used in import examples.
|
|
1351
|
+
* Ask AI normally infers package names and exact imports from retrieved docs context.
|
|
1282
1352
|
*
|
|
1283
1353
|
* @example
|
|
1284
1354
|
* ```ts
|
|
@@ -1352,6 +1422,45 @@ interface AIConfig {
|
|
|
1352
1422
|
loadingComponent?: (props: {
|
|
1353
1423
|
name: string;
|
|
1354
1424
|
}) => unknown;
|
|
1425
|
+
/**
|
|
1426
|
+
* Copy, like, and dislike action row for generated Ask AI answers.
|
|
1427
|
+
*
|
|
1428
|
+
* Set to `false` to hide the row. Pass an object to customize rating labels
|
|
1429
|
+
* and receive legacy like/dislike callback payloads.
|
|
1430
|
+
*
|
|
1431
|
+
* @default true
|
|
1432
|
+
*
|
|
1433
|
+
* @example
|
|
1434
|
+
* ```ts
|
|
1435
|
+
* ai: {
|
|
1436
|
+
* enabled: true,
|
|
1437
|
+
* feedback: {
|
|
1438
|
+
* onFeedback(data) {
|
|
1439
|
+
* console.log(data.value, data.question, data.answer);
|
|
1440
|
+
* },
|
|
1441
|
+
* },
|
|
1442
|
+
* }
|
|
1443
|
+
* ```
|
|
1444
|
+
*/
|
|
1445
|
+
feedback?: boolean | DocsAskAIFeedbackConfig;
|
|
1446
|
+
/**
|
|
1447
|
+
* Called when a user clicks an Ask AI response action.
|
|
1448
|
+
*
|
|
1449
|
+
* `data.type` is `"copy"`, `"like"`, or `"dislike"`.
|
|
1450
|
+
*
|
|
1451
|
+
* @example
|
|
1452
|
+
* ```ts
|
|
1453
|
+
* ai: {
|
|
1454
|
+
* enabled: true,
|
|
1455
|
+
* onActions(data) {
|
|
1456
|
+
* if (data.type === "copy") console.log("Copied", data.answer);
|
|
1457
|
+
* if (data.type === "like") console.log("Helpful", data.question);
|
|
1458
|
+
* if (data.type === "dislike") console.log("Not helpful", data.question);
|
|
1459
|
+
* },
|
|
1460
|
+
* }
|
|
1461
|
+
* ```
|
|
1462
|
+
*/
|
|
1463
|
+
onActions?: (data: DocsAskAIActionData) => void | Promise<void>;
|
|
1355
1464
|
}
|
|
1356
1465
|
/**
|
|
1357
1466
|
* A single item in the slug-based sidebar ordering.
|
|
@@ -2107,4 +2216,4 @@ interface DocsConfig {
|
|
|
2107
2216
|
og?: OGConfig;
|
|
2108
2217
|
}
|
|
2109
2218
|
//#endregion
|
|
2110
|
-
export {
|
|
2219
|
+
export { DocsTheme as $, DocsConfig as A, DocsObservabilityEventInput as B, DocsAskAIActionData as C, SidebarPageNode as Ct, DocsAskAIFeedbackMessage as D, TypesenseDocsSearchConfig as Dt, DocsAskAIFeedbackData as E, ThemeToggleConfig as Et, DocsMcpToolsConfig as F, DocsSearchChunkingConfig as G, DocsSearchAdapter as H, DocsMetadata as I, DocsSearchEmbeddingsConfig as J, DocsSearchConfig as K, DocsNav as L, DocsFeedbackValue as M, DocsI18nConfig as N, DocsAskAIFeedbackValue as O, TypographyConfig as Ot, DocsMcpConfig as P, DocsSearchSourcePage as Q, DocsObservabilityConfig as R, DocsAnalyticsSource as S, SidebarNode as St, DocsAskAIFeedbackConfig as T, SimpleDocsSearchConfig as Tt, DocsSearchAdapterContext as U, DocsRelatedItem as V, DocsSearchAdapterFactory as W, DocsSearchResult as X, DocsSearchQuery as Y, DocsSearchResultType as Z, DocsAnalyticsConfig as _, ResolvedDocsRelatedLink as _t, ApiReferenceRenderer as a, McpDocsSearchConfig as at, DocsAnalyticsEventType as b, SidebarFolderIndexBehavior as bt, ChangelogFrontmatter as c, OpenDocsProvider as ct, CustomDocsSearchConfig as d, PageActionsConfig as dt, FeedbackConfig as et, DocsAgentFeedbackContext as f, PageFrontmatter as ft, DocsAgentTraceStatus as g, ReadingTimeConfig as gt, DocsAgentTraceEventType as h, PageTwitter as ht, ApiReferenceConfig as i, LlmsTxtConfig as it, DocsFeedbackData as j, DocsAskAIMcpConfig as k, UIConfig as kt, CodeBlockCopyData as l, OpenGraphImage as lt, DocsAgentTraceEventInput as m, PageSidebarFrontmatter as mt, AgentFeedbackConfig as n, GithubConfig as nt, BreadcrumbConfig as o, OGConfig as ot, DocsAgentFeedbackData as p, PageOpenGraph as pt, DocsSearchDocument as q, AlgoliaDocsSearchConfig as r, LastUpdatedConfig as rt, ChangelogConfig as s, OpenDocsConfig as st, AIConfig as t, FontStyle as tt, CopyMarkdownConfig as u, OrderingItem as ut, DocsAnalyticsEvent as v, SidebarComponentProps as vt, DocsAskAIActionType as w, SidebarTree as wt, DocsAnalyticsInput as x, SidebarFolderNode as xt, DocsAnalyticsEventInput as y, SidebarConfig as yt, DocsObservabilityEvent as z };
|