@farming-labs/docs 0.1.71 → 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.
- package/dist/{agent-BZ5t0H9t.mjs → agent-C3PhBE3t.mjs} +2 -1
- package/dist/{agent-BJxu7fth.mjs → agent-D94TCE7Q.mjs} +2 -2
- package/dist/cli/index.mjs +5 -5
- package/dist/{doctor-SBL9yJAm.mjs → doctor-BFq5YKLg.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{mcp-BCwCpF9Q.mjs → mcp-DaNntgC6.mjs} +1 -1
- package/dist/mcp.d.mts +2 -1
- package/dist/mcp.mjs +319 -93
- package/dist/{search-CiQhHxl4.mjs → search-BzavsA3i.mjs} +1 -1
- package/dist/{search-DQTtxgAV.mjs → search-DBZ6Tkij.mjs} +393 -6
- package/dist/search-DSKaQ2JH.d.mts +88 -0
- package/dist/server.d.mts +3 -3
- package/dist/server.mjs +2 -2
- package/dist/{types-BXgTvFFE.d.mts → types-D-OvczD4.d.mts} +156 -10
- package/package.json +1 -1
- package/dist/search-Gvi81BSo.d.mts +0 -41
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
@@ -18,6 +18,7 @@ function defineDocs(config) {
|
|
|
18
18
|
sidebar: config.sidebar,
|
|
19
19
|
components: config.components,
|
|
20
20
|
analytics: config.analytics,
|
|
21
|
+
observability: config.observability,
|
|
21
22
|
onCopyClick: config.onCopyClick,
|
|
22
23
|
feedback: config.feedback,
|
|
23
24
|
search: config.search,
|
|
@@ -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-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";
|
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-DaNntgC6.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-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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-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-
|
|
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
|
|
2
|
-
import { a as
|
|
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, type DocsAgentDiscoverySpecOptions, type DocsAgentFeedbackContext, type DocsAgentFeedbackData, type DocsAgentFeedbackDiscoveryConfig, 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 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 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, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAnalyticsEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, hashGeneratedAgentContent, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, 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-
|
|
2
|
-
import { C 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-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, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsCloudAnalytics, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAnalyticsEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, hashGeneratedAgentContent, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, 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 };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
@@ -69,6 +69,7 @@ interface CreateDocsMcpServerOptions {
|
|
|
69
69
|
mcp?: boolean | DocsMcpConfig;
|
|
70
70
|
search?: boolean | DocsSearchConfig;
|
|
71
71
|
analytics?: boolean | DocsAnalyticsConfig;
|
|
72
|
+
observability?: boolean | DocsObservabilityConfig;
|
|
72
73
|
defaultName?: string;
|
|
73
74
|
defaultVersion?: string;
|
|
74
75
|
}
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
@@ -130,21 +130,69 @@ async function createDocsMcpServer(options) {
|
|
|
130
130
|
annotations: { readOnlyHint: true }
|
|
131
131
|
}, async ({ locale }) => {
|
|
132
132
|
const startedAt = nowMs();
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
const trace = createDocsAgentTraceContext("mcp.tool.list_pages");
|
|
134
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
135
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
136
|
+
type: "tool.call",
|
|
136
137
|
source: "mcp",
|
|
138
|
+
traceId: trace.traceId,
|
|
139
|
+
spanId: callSpanId,
|
|
140
|
+
name: "list_pages",
|
|
141
|
+
startedAt: trace.startedAt,
|
|
142
|
+
status: "started",
|
|
137
143
|
locale,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
resultCount: pages.length,
|
|
141
|
-
durationMs: durationMs(startedAt)
|
|
142
|
-
}
|
|
144
|
+
inputPreview: { locale },
|
|
145
|
+
metadata: { tool: "list_pages" }
|
|
143
146
|
});
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
try {
|
|
148
|
+
const pages = toPageSummaries(dedupePages(await options.source.getPages(locale)));
|
|
149
|
+
const elapsed = durationMs(startedAt);
|
|
150
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
151
|
+
type: "mcp_tool",
|
|
152
|
+
source: "mcp",
|
|
153
|
+
locale,
|
|
154
|
+
properties: {
|
|
155
|
+
tool: "list_pages",
|
|
156
|
+
resultCount: pages.length,
|
|
157
|
+
durationMs: elapsed
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
161
|
+
type: "tool.result",
|
|
162
|
+
source: "mcp",
|
|
163
|
+
traceId: trace.traceId,
|
|
164
|
+
parentSpanId: callSpanId,
|
|
165
|
+
name: "list_pages",
|
|
166
|
+
startedAt: trace.startedAt,
|
|
167
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
168
|
+
durationMs: elapsed,
|
|
169
|
+
status: "success",
|
|
170
|
+
locale,
|
|
171
|
+
outputPreview: { resultCount: pages.length },
|
|
172
|
+
metadata: { tool: "list_pages" }
|
|
173
|
+
});
|
|
174
|
+
return { content: [{
|
|
175
|
+
type: "text",
|
|
176
|
+
text: JSON.stringify({ pages }, null, 2)
|
|
177
|
+
}] };
|
|
178
|
+
} catch (error) {
|
|
179
|
+
const elapsed = durationMs(startedAt);
|
|
180
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
181
|
+
type: "tool.error",
|
|
182
|
+
source: "mcp",
|
|
183
|
+
traceId: trace.traceId,
|
|
184
|
+
parentSpanId: callSpanId,
|
|
185
|
+
name: "list_pages",
|
|
186
|
+
startedAt: trace.startedAt,
|
|
187
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
188
|
+
durationMs: elapsed,
|
|
189
|
+
status: "error",
|
|
190
|
+
locale,
|
|
191
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
192
|
+
metadata: { tool: "list_pages" }
|
|
193
|
+
});
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
148
196
|
});
|
|
149
197
|
if (resolved.tools.getNavigation) server.registerTool("get_navigation", {
|
|
150
198
|
title: "Get docs navigation",
|
|
@@ -153,20 +201,68 @@ async function createDocsMcpServer(options) {
|
|
|
153
201
|
annotations: { readOnlyHint: true }
|
|
154
202
|
}, async ({ locale }) => {
|
|
155
203
|
const startedAt = nowMs();
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
204
|
+
const trace = createDocsAgentTraceContext("mcp.tool.get_navigation");
|
|
205
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
206
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
207
|
+
type: "tool.call",
|
|
159
208
|
source: "mcp",
|
|
209
|
+
traceId: trace.traceId,
|
|
210
|
+
spanId: callSpanId,
|
|
211
|
+
name: "get_navigation",
|
|
212
|
+
startedAt: trace.startedAt,
|
|
213
|
+
status: "started",
|
|
160
214
|
locale,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
durationMs: durationMs(startedAt)
|
|
164
|
-
}
|
|
215
|
+
inputPreview: { locale },
|
|
216
|
+
metadata: { tool: "get_navigation" }
|
|
165
217
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
218
|
+
try {
|
|
219
|
+
const text = renderNavigationTree(await options.source.getNavigation(locale));
|
|
220
|
+
const elapsed = durationMs(startedAt);
|
|
221
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
222
|
+
type: "mcp_tool",
|
|
223
|
+
source: "mcp",
|
|
224
|
+
locale,
|
|
225
|
+
properties: {
|
|
226
|
+
tool: "get_navigation",
|
|
227
|
+
durationMs: elapsed
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
231
|
+
type: "tool.result",
|
|
232
|
+
source: "mcp",
|
|
233
|
+
traceId: trace.traceId,
|
|
234
|
+
parentSpanId: callSpanId,
|
|
235
|
+
name: "get_navigation",
|
|
236
|
+
startedAt: trace.startedAt,
|
|
237
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
238
|
+
durationMs: elapsed,
|
|
239
|
+
status: "success",
|
|
240
|
+
locale,
|
|
241
|
+
outputPreview: { chars: text.length },
|
|
242
|
+
metadata: { tool: "get_navigation" }
|
|
243
|
+
});
|
|
244
|
+
return { content: [{
|
|
245
|
+
type: "text",
|
|
246
|
+
text
|
|
247
|
+
}] };
|
|
248
|
+
} catch (error) {
|
|
249
|
+
const elapsed = durationMs(startedAt);
|
|
250
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
251
|
+
type: "tool.error",
|
|
252
|
+
source: "mcp",
|
|
253
|
+
traceId: trace.traceId,
|
|
254
|
+
parentSpanId: callSpanId,
|
|
255
|
+
name: "get_navigation",
|
|
256
|
+
startedAt: trace.startedAt,
|
|
257
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
258
|
+
durationMs: elapsed,
|
|
259
|
+
status: "error",
|
|
260
|
+
locale,
|
|
261
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
262
|
+
metadata: { tool: "get_navigation" }
|
|
263
|
+
});
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
170
266
|
});
|
|
171
267
|
if (resolved.tools.searchDocs) server.registerTool("search_docs", {
|
|
172
268
|
title: "Search documentation",
|
|
@@ -175,31 +271,84 @@ async function createDocsMcpServer(options) {
|
|
|
175
271
|
annotations: { readOnlyHint: true }
|
|
176
272
|
}, async ({ query, limit, locale }) => {
|
|
177
273
|
const startedAt = nowMs();
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
siteTitle: options.source.siteTitle,
|
|
184
|
-
limit: limit ?? 10
|
|
185
|
-
});
|
|
186
|
-
await emitDocsAnalyticsEvent(options.analytics, {
|
|
187
|
-
type: "mcp_tool",
|
|
274
|
+
const resolvedLimit = limit ?? 10;
|
|
275
|
+
const trace = createDocsAgentTraceContext("mcp.tool.search_docs");
|
|
276
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
277
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
278
|
+
type: "tool.call",
|
|
188
279
|
source: "mcp",
|
|
280
|
+
traceId: trace.traceId,
|
|
281
|
+
spanId: callSpanId,
|
|
282
|
+
name: "search_docs",
|
|
283
|
+
startedAt: trace.startedAt,
|
|
284
|
+
status: "started",
|
|
189
285
|
locale,
|
|
190
|
-
|
|
191
|
-
properties: {
|
|
192
|
-
tool: "search_docs",
|
|
286
|
+
inputPreview: {
|
|
193
287
|
queryLength: query.length,
|
|
194
|
-
limit:
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
288
|
+
limit: resolvedLimit,
|
|
289
|
+
locale
|
|
290
|
+
},
|
|
291
|
+
metadata: { tool: "search_docs" }
|
|
198
292
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
293
|
+
try {
|
|
294
|
+
const results = await performDocsSearch({
|
|
295
|
+
pages: toSearchSourcePages(dedupePages(await options.source.getPages(locale))),
|
|
296
|
+
query,
|
|
297
|
+
search: toolSearchConfig ?? true,
|
|
298
|
+
locale,
|
|
299
|
+
siteTitle: options.source.siteTitle,
|
|
300
|
+
limit: resolvedLimit
|
|
301
|
+
});
|
|
302
|
+
const elapsed = durationMs(startedAt);
|
|
303
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
304
|
+
type: "mcp_tool",
|
|
305
|
+
source: "mcp",
|
|
306
|
+
locale,
|
|
307
|
+
input: { query },
|
|
308
|
+
properties: {
|
|
309
|
+
tool: "search_docs",
|
|
310
|
+
queryLength: query.length,
|
|
311
|
+
limit: resolvedLimit,
|
|
312
|
+
resultCount: results.length,
|
|
313
|
+
durationMs: elapsed
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
317
|
+
type: "tool.result",
|
|
318
|
+
source: "mcp",
|
|
319
|
+
traceId: trace.traceId,
|
|
320
|
+
parentSpanId: callSpanId,
|
|
321
|
+
name: "search_docs",
|
|
322
|
+
startedAt: trace.startedAt,
|
|
323
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
324
|
+
durationMs: elapsed,
|
|
325
|
+
status: "success",
|
|
326
|
+
locale,
|
|
327
|
+
outputPreview: { resultCount: results.length },
|
|
328
|
+
metadata: { tool: "search_docs" }
|
|
329
|
+
});
|
|
330
|
+
return { content: [{
|
|
331
|
+
type: "text",
|
|
332
|
+
text: JSON.stringify({ results }, null, 2)
|
|
333
|
+
}] };
|
|
334
|
+
} catch (error) {
|
|
335
|
+
const elapsed = durationMs(startedAt);
|
|
336
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
337
|
+
type: "tool.error",
|
|
338
|
+
source: "mcp",
|
|
339
|
+
traceId: trace.traceId,
|
|
340
|
+
parentSpanId: callSpanId,
|
|
341
|
+
name: "search_docs",
|
|
342
|
+
startedAt: trace.startedAt,
|
|
343
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
344
|
+
durationMs: elapsed,
|
|
345
|
+
status: "error",
|
|
346
|
+
locale,
|
|
347
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
348
|
+
metadata: { tool: "search_docs" }
|
|
349
|
+
});
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
203
352
|
});
|
|
204
353
|
if (resolved.tools.readPage) server.registerTool("read_page", {
|
|
205
354
|
title: "Read a docs page",
|
|
@@ -208,73 +357,150 @@ async function createDocsMcpServer(options) {
|
|
|
208
357
|
annotations: { readOnlyHint: true }
|
|
209
358
|
}, async ({ path: requestedPath, locale }) => {
|
|
210
359
|
const startedAt = nowMs();
|
|
211
|
-
const
|
|
212
|
-
|
|
360
|
+
const trace = createDocsAgentTraceContext("mcp.tool.read_page");
|
|
361
|
+
const callSpanId = createDocsAgentTraceId("span");
|
|
362
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
363
|
+
type: "tool.call",
|
|
364
|
+
source: "mcp",
|
|
365
|
+
traceId: trace.traceId,
|
|
366
|
+
spanId: callSpanId,
|
|
367
|
+
name: "read_page",
|
|
368
|
+
startedAt: trace.startedAt,
|
|
369
|
+
status: "started",
|
|
370
|
+
locale,
|
|
371
|
+
inputPreview: {
|
|
372
|
+
path: requestedPath,
|
|
373
|
+
locale
|
|
374
|
+
},
|
|
375
|
+
metadata: { tool: "read_page" }
|
|
376
|
+
});
|
|
377
|
+
try {
|
|
378
|
+
const page = findDocsPage(dedupePages(await options.source.getPages(locale)), requestedPath, options.source.entry);
|
|
379
|
+
if (!page) {
|
|
380
|
+
const elapsed = durationMs(startedAt);
|
|
381
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
382
|
+
type: "agent_read",
|
|
383
|
+
source: "mcp",
|
|
384
|
+
locale,
|
|
385
|
+
properties: {
|
|
386
|
+
delivery: "mcp_tool",
|
|
387
|
+
tool: "read_page",
|
|
388
|
+
requestedPath,
|
|
389
|
+
found: false,
|
|
390
|
+
durationMs: elapsed
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
await emitDocsAnalyticsEvent(options.analytics, {
|
|
394
|
+
type: "mcp_tool",
|
|
395
|
+
source: "mcp",
|
|
396
|
+
locale,
|
|
397
|
+
properties: {
|
|
398
|
+
tool: "read_page",
|
|
399
|
+
path: requestedPath,
|
|
400
|
+
found: false,
|
|
401
|
+
durationMs: elapsed
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
405
|
+
type: "tool.error",
|
|
406
|
+
source: "mcp",
|
|
407
|
+
traceId: trace.traceId,
|
|
408
|
+
parentSpanId: callSpanId,
|
|
409
|
+
name: "read_page",
|
|
410
|
+
startedAt: trace.startedAt,
|
|
411
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
412
|
+
durationMs: elapsed,
|
|
413
|
+
status: "error",
|
|
414
|
+
locale,
|
|
415
|
+
outputPreview: {
|
|
416
|
+
found: false,
|
|
417
|
+
path: requestedPath
|
|
418
|
+
},
|
|
419
|
+
metadata: {
|
|
420
|
+
tool: "read_page",
|
|
421
|
+
reason: "not_found"
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
return {
|
|
425
|
+
content: [{
|
|
426
|
+
type: "text",
|
|
427
|
+
text: JSON.stringify({ error: `No docs page matched "${requestedPath}".` }, null, 2)
|
|
428
|
+
}],
|
|
429
|
+
isError: true
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
const document = renderPageDocument(page);
|
|
433
|
+
const elapsed = durationMs(startedAt);
|
|
213
434
|
await emitDocsAnalyticsEvent(options.analytics, {
|
|
214
435
|
type: "agent_read",
|
|
215
436
|
source: "mcp",
|
|
216
437
|
locale,
|
|
438
|
+
path: page.url,
|
|
217
439
|
properties: {
|
|
218
440
|
delivery: "mcp_tool",
|
|
219
441
|
tool: "read_page",
|
|
220
442
|
requestedPath,
|
|
221
|
-
|
|
222
|
-
|
|
443
|
+
slug: page.slug,
|
|
444
|
+
found: true,
|
|
445
|
+
contentLength: document.length,
|
|
446
|
+
durationMs: elapsed
|
|
223
447
|
}
|
|
224
448
|
});
|
|
225
449
|
await emitDocsAnalyticsEvent(options.analytics, {
|
|
226
450
|
type: "mcp_tool",
|
|
227
451
|
source: "mcp",
|
|
228
452
|
locale,
|
|
453
|
+
path: page.url,
|
|
229
454
|
properties: {
|
|
230
455
|
tool: "read_page",
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
456
|
+
requestedPath,
|
|
457
|
+
slug: page.slug,
|
|
458
|
+
found: true,
|
|
459
|
+
contentLength: document.length,
|
|
460
|
+
durationMs: elapsed
|
|
234
461
|
}
|
|
235
462
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
463
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
464
|
+
type: "tool.result",
|
|
465
|
+
source: "mcp",
|
|
466
|
+
traceId: trace.traceId,
|
|
467
|
+
parentSpanId: callSpanId,
|
|
468
|
+
name: "read_page",
|
|
469
|
+
startedAt: trace.startedAt,
|
|
470
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
|
+
durationMs: elapsed,
|
|
472
|
+
status: "success",
|
|
473
|
+
locale,
|
|
474
|
+
path: page.url,
|
|
475
|
+
outputPreview: {
|
|
476
|
+
found: true,
|
|
477
|
+
chars: document.length,
|
|
478
|
+
slug: page.slug
|
|
479
|
+
},
|
|
480
|
+
metadata: { tool: "read_page" }
|
|
481
|
+
});
|
|
482
|
+
return { content: [{
|
|
483
|
+
type: "text",
|
|
484
|
+
text: document
|
|
485
|
+
}] };
|
|
486
|
+
} catch (error) {
|
|
487
|
+
const elapsed = durationMs(startedAt);
|
|
488
|
+
await emitDocsAgentTraceEvent(options.observability, {
|
|
489
|
+
type: "tool.error",
|
|
490
|
+
source: "mcp",
|
|
491
|
+
traceId: trace.traceId,
|
|
492
|
+
parentSpanId: callSpanId,
|
|
493
|
+
name: "read_page",
|
|
494
|
+
startedAt: trace.startedAt,
|
|
495
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
496
|
+
durationMs: elapsed,
|
|
497
|
+
status: "error",
|
|
498
|
+
locale,
|
|
499
|
+
outputPreview: { message: error instanceof Error ? error.message : "Unknown error" },
|
|
500
|
+
metadata: { tool: "read_page" }
|
|
501
|
+
});
|
|
502
|
+
throw error;
|
|
243
503
|
}
|
|
244
|
-
const document = renderPageDocument(page);
|
|
245
|
-
await emitDocsAnalyticsEvent(options.analytics, {
|
|
246
|
-
type: "agent_read",
|
|
247
|
-
source: "mcp",
|
|
248
|
-
locale,
|
|
249
|
-
path: page.url,
|
|
250
|
-
properties: {
|
|
251
|
-
delivery: "mcp_tool",
|
|
252
|
-
tool: "read_page",
|
|
253
|
-
requestedPath,
|
|
254
|
-
slug: page.slug,
|
|
255
|
-
found: true,
|
|
256
|
-
contentLength: document.length,
|
|
257
|
-
durationMs: durationMs(startedAt)
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
await emitDocsAnalyticsEvent(options.analytics, {
|
|
261
|
-
type: "mcp_tool",
|
|
262
|
-
source: "mcp",
|
|
263
|
-
locale,
|
|
264
|
-
path: page.url,
|
|
265
|
-
properties: {
|
|
266
|
-
tool: "read_page",
|
|
267
|
-
requestedPath,
|
|
268
|
-
slug: page.slug,
|
|
269
|
-
found: true,
|
|
270
|
-
contentLength: document.length,
|
|
271
|
-
durationMs: durationMs(startedAt)
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
return { content: [{
|
|
275
|
-
type: "text",
|
|
276
|
-
text: document
|
|
277
|
-
}] };
|
|
278
504
|
});
|
|
279
505
|
return server;
|
|
280
506
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
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";
|