@farming-labs/docs 0.2.52 → 0.2.54
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-BXvi0uhS.mjs +623 -0
- package/dist/{agent-CaOBIVFy.mjs → agent-DXkXi-pS.mjs} +765 -22
- package/dist/agent-evals-BD17jOqL.mjs +1166 -0
- package/dist/agent-export-n-a0GbeU.mjs +854 -0
- package/dist/agent-scope-B8lptqCd.mjs +283 -0
- package/dist/agent-surface-drift-LS8zQgbq.mjs +1429 -0
- package/dist/{agents-DjhjZaNP.mjs → agents-BJaRQimo.mjs} +7 -5
- package/dist/{analytics-BZEwTK-8.mjs → analytics-Bx44lg6d.mjs} +1 -1
- package/dist/cli/index.mjs +43 -28
- package/dist/client/react.d.mts +1 -1
- package/dist/client/react.mjs +1 -1
- package/dist/{cloud-C_Ok9rC5.mjs → cloud-HWFlbfLJ.mjs} +4 -4
- package/dist/{cloud-ask-ai-Cl-xaV8j.mjs → cloud-ask-ai-1k0q6OAH.mjs} +1 -1
- package/dist/{cloud-ask-ai-DcMe6xOf.d.mts → cloud-ask-ai-466g6uAi.d.mts} +1 -1
- package/dist/code-blocks-C9awWzEQ.mjs +871 -0
- package/dist/codeblocks-BzfkREEC.mjs +250 -0
- package/dist/{config-tiQCZ46q.mjs → config-CydaZ5PB.mjs} +52 -11
- package/dist/{dev-Tm9Ss4D6.mjs → dev-BA2kRuCn.mjs} +3 -3
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +2 -2
- package/dist/{doctor-O9o9kjN8.mjs → doctor-CQpQ2zZm.mjs} +177 -47
- package/dist/{downgrade-CYEaOctn.mjs → downgrade-BStNhyCc.mjs} +2 -2
- package/dist/i18n-CAlj1ADU.mjs +40 -0
- package/dist/index.d.mts +158 -3
- package/dist/index.mjs +7 -6
- package/dist/{init-Ch5On0zm.mjs → init-gnHQ_Pz9.mjs} +3 -3
- package/dist/{mcp-DuCPNHS-.mjs → mcp-DnxZZWpY.mjs} +10 -5
- package/dist/mcp.d.mts +122 -6
- package/dist/mcp.mjs +1943 -86
- package/dist/{package-version-C8PigBZk.mjs → package-version-DRIc08EU.mjs} +1 -1
- package/dist/{reading-time-CPAy1SWO.mjs → reading-time-BrTd3DIh.mjs} +277 -33
- package/dist/{review-lm3dt7yy.mjs → review-B6gyEFkD.mjs} +184 -14
- package/dist/{robots-DV7u4Ire.mjs → robots-4BUJxlvV.mjs} +4 -4
- package/dist/{robots-XVPs9lVz.mjs → robots-DAptQnkx.mjs} +1 -1
- package/dist/{search-BWuU70B0.mjs → search-CJIC1Cqo.mjs} +173 -79
- package/dist/{search-B6nEkx86.mjs → search-CbPm2x5g.mjs} +6 -4
- package/dist/{search-DFEhf9-s.d.mts → search-CfWvmVYA.d.mts} +3 -1
- package/dist/server.d.mts +108 -5
- package/dist/server.mjs +9 -8
- package/dist/{sitemap-BEiKy4Iy.mjs → sitemap-D6nP3J1Q.mjs} +8 -6
- package/dist/{sitemap-server-xEHtDUDB.mjs → sitemap-server-wsNLyVkb.mjs} +1 -1
- package/dist/{templates-uaauJcTO.mjs → templates-1Cod8KrJ.mjs} +11 -5
- package/dist/{types-XqGLsmOD.d.mts → types-BVgucdVm.d.mts} +194 -2
- package/dist/{upgrade-DzQtpgJM.mjs → upgrade-CXYRNV0C.mjs} +2 -2
- package/package.json +1 -1
- package/dist/agent-DXDOMJBw.mjs +0 -9
- package/dist/codeblocks-z9iT794h.mjs +0 -1713
- package/dist/review-B7goPYUb.mjs +0 -541
- /package/dist/{cloud-analytics-Dlk_byos.mjs → cloud-analytics-CSyFE6SS.mjs} +0 -0
- /package/dist/{errors-CW1LnxaQ.mjs → errors-BFUtdZfC.mjs} +0 -0
- /package/dist/{utils-D-xTRNuh.mjs → utils-DBCCkkJS.mjs} +0 -0
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ft as DocsSearchSourcePage, Rt as DocsTelemetryConfig, T as DocsAnalyticsConfig, Ut as DocsTelemetryFramework, fn as PageAgentFrontmatter, kt as DocsSearchConfig, nt as DocsMcpAuthPrincipal, ot as DocsMcpConfig, pt as DocsObservabilityConfig, rt as DocsMcpAuthenticate, sn as OrderingItem, tt as DocsMcpAllowedOrigins } from "./types-BVgucdVm.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
@@ -8,9 +8,14 @@ interface DocsMcpPage {
|
|
|
8
8
|
title: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
related?: DocsSearchSourcePage["related"];
|
|
11
|
+
agent?: PageAgentFrontmatter;
|
|
11
12
|
icon?: string;
|
|
12
13
|
sourcePath?: string;
|
|
13
14
|
lastModified?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
framework?: string;
|
|
17
|
+
version?: string;
|
|
18
|
+
tags?: string[];
|
|
14
19
|
content: string;
|
|
15
20
|
rawContent?: string;
|
|
16
21
|
agentContent?: string;
|
|
@@ -41,10 +46,26 @@ interface DocsMcpDocsPageSummary {
|
|
|
41
46
|
url: string;
|
|
42
47
|
title: string;
|
|
43
48
|
description?: string;
|
|
49
|
+
agent?: DocsMcpAgentContractSummary;
|
|
44
50
|
icon?: string;
|
|
45
51
|
sourcePath?: string;
|
|
46
52
|
lastModified?: string;
|
|
47
53
|
}
|
|
54
|
+
interface DocsMcpAgentContractSummary {
|
|
55
|
+
hasContract: boolean;
|
|
56
|
+
task?: string;
|
|
57
|
+
outcome?: string;
|
|
58
|
+
appliesTo?: PageAgentFrontmatter["appliesTo"];
|
|
59
|
+
}
|
|
60
|
+
interface DocsMcpTaskSummary {
|
|
61
|
+
slug: string;
|
|
62
|
+
url: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
task?: string;
|
|
66
|
+
outcome?: string;
|
|
67
|
+
appliesTo?: PageAgentFrontmatter["appliesTo"];
|
|
68
|
+
}
|
|
48
69
|
interface DocsMcpDocsSection {
|
|
49
70
|
slug: string;
|
|
50
71
|
title: string;
|
|
@@ -70,8 +91,8 @@ interface DocsMcpConfigSchemaOption {
|
|
|
70
91
|
default?: string | boolean | number | null;
|
|
71
92
|
description: string;
|
|
72
93
|
docs?: string;
|
|
73
|
-
values?: string[];
|
|
74
|
-
children?: DocsMcpConfigSchemaOption[];
|
|
94
|
+
values?: readonly string[];
|
|
95
|
+
children?: readonly DocsMcpConfigSchemaOption[];
|
|
75
96
|
}
|
|
76
97
|
interface DocsMcpConfigSchema {
|
|
77
98
|
schemaVersion: 1;
|
|
@@ -88,6 +109,62 @@ interface DocsMcpConfigSchema {
|
|
|
88
109
|
code: string;
|
|
89
110
|
}>;
|
|
90
111
|
}
|
|
112
|
+
interface DocsMcpContextSource {
|
|
113
|
+
id: string;
|
|
114
|
+
title: string;
|
|
115
|
+
/** Page URL without a fragment. */
|
|
116
|
+
pageUrl: string;
|
|
117
|
+
/** Source URL for this exact context chunk, including its heading anchor when available. */
|
|
118
|
+
url: string;
|
|
119
|
+
section?: string;
|
|
120
|
+
anchor?: string;
|
|
121
|
+
sourcePath?: string;
|
|
122
|
+
lastModified?: string;
|
|
123
|
+
locale?: string;
|
|
124
|
+
framework?: string;
|
|
125
|
+
version?: string;
|
|
126
|
+
tags?: string[];
|
|
127
|
+
score?: number;
|
|
128
|
+
content: string;
|
|
129
|
+
/** JavaScript string length for this source's content only. */
|
|
130
|
+
chars: number;
|
|
131
|
+
/** Encoded UTF-8 bytes for this source's content only. */
|
|
132
|
+
utf8Bytes: number;
|
|
133
|
+
truncated: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface DocsMcpContextResult {
|
|
136
|
+
query: string;
|
|
137
|
+
filters: {
|
|
138
|
+
framework?: string;
|
|
139
|
+
version?: string;
|
|
140
|
+
locale?: string;
|
|
141
|
+
};
|
|
142
|
+
budget: {
|
|
143
|
+
/** Caller-provided token target; retained as the stable input contract. */requestedTokens: number; /** Dependency-free conservative accounting strategy. */
|
|
144
|
+
strategy: "utf8-bytes"; /** Hard UTF-8 byte ceiling for the complete assembled `context`. */
|
|
145
|
+
maxUtf8Bytes: number; /** Exact UTF-8 bytes used by the complete assembled `context`. */
|
|
146
|
+
usedUtf8Bytes: number; /** Conservative token-count upper bound derived from `usedUtf8Bytes`. */
|
|
147
|
+
conservativeTokenUpperBound: number;
|
|
148
|
+
remainingUtf8Bytes: number;
|
|
149
|
+
truncated: boolean;
|
|
150
|
+
};
|
|
151
|
+
resultCount: number;
|
|
152
|
+
candidateCount: number;
|
|
153
|
+
context: string;
|
|
154
|
+
sources: DocsMcpContextSource[];
|
|
155
|
+
}
|
|
156
|
+
interface DocsMcpContextOptions {
|
|
157
|
+
pages: readonly DocsMcpPage[];
|
|
158
|
+
query: string;
|
|
159
|
+
framework?: string;
|
|
160
|
+
version?: string;
|
|
161
|
+
locale?: string;
|
|
162
|
+
tokenBudget: number;
|
|
163
|
+
entry?: string;
|
|
164
|
+
siteTitle?: string;
|
|
165
|
+
/** Maximum number of ranked, deduplicated candidates to render. Defaults to 50. */
|
|
166
|
+
maxResults?: number;
|
|
167
|
+
}
|
|
91
168
|
interface DocsMcpPageNode {
|
|
92
169
|
type: "page";
|
|
93
170
|
name: string;
|
|
@@ -110,8 +187,27 @@ interface DocsMcpNavigationTree {
|
|
|
110
187
|
interface DocsMcpSource {
|
|
111
188
|
entry?: string;
|
|
112
189
|
siteTitle?: string;
|
|
113
|
-
getPages(locale?: string): DocsMcpPage[] | Promise<DocsMcpPage[]>;
|
|
114
|
-
getNavigation(locale?: string): DocsMcpNavigationTree | Promise<DocsMcpNavigationTree>;
|
|
190
|
+
getPages(locale?: string, context?: DocsMcpRequestContext): DocsMcpPage[] | Promise<DocsMcpPage[]>;
|
|
191
|
+
getNavigation(locale?: string, context?: DocsMcpRequestContext): DocsMcpNavigationTree | Promise<DocsMcpNavigationTree>;
|
|
192
|
+
}
|
|
193
|
+
/** Request-scoped identity available to custom MCP sources. */
|
|
194
|
+
interface DocsMcpRequestContext {
|
|
195
|
+
transport: "http" | "stdio";
|
|
196
|
+
request?: Request;
|
|
197
|
+
auth?: DocsMcpAuthPrincipal;
|
|
198
|
+
}
|
|
199
|
+
interface DocsMcpResolvedSecurityConfig {
|
|
200
|
+
allowedOrigins: DocsMcpAllowedOrigins;
|
|
201
|
+
authenticate?: DocsMcpAuthenticate;
|
|
202
|
+
maxBodyBytes: number;
|
|
203
|
+
cors: DocsMcpResolvedCorsConfig;
|
|
204
|
+
}
|
|
205
|
+
interface DocsMcpResolvedCorsConfig {
|
|
206
|
+
enabled: boolean;
|
|
207
|
+
allowedHeaders: string[];
|
|
208
|
+
exposedHeaders: string[];
|
|
209
|
+
allowCredentials: boolean;
|
|
210
|
+
maxAgeSeconds: number;
|
|
115
211
|
}
|
|
116
212
|
interface DocsMcpResolvedConfig {
|
|
117
213
|
enabled: boolean;
|
|
@@ -122,11 +218,16 @@ interface DocsMcpResolvedConfig {
|
|
|
122
218
|
listDocs: boolean;
|
|
123
219
|
listPages: boolean;
|
|
124
220
|
readPage: boolean;
|
|
221
|
+
listTasks?: boolean;
|
|
222
|
+
readTask?: boolean;
|
|
125
223
|
searchDocs: boolean;
|
|
126
224
|
getNavigation: boolean;
|
|
127
225
|
getCodeExamples: boolean;
|
|
128
226
|
getConfigSchema: boolean;
|
|
227
|
+
getContext: boolean;
|
|
129
228
|
};
|
|
229
|
+
/** Resolved HTTP-only security policy. Omitted on manually constructed legacy values. */
|
|
230
|
+
security?: DocsMcpResolvedSecurityConfig;
|
|
130
231
|
}
|
|
131
232
|
interface DocsMcpHttpHandlers {
|
|
132
233
|
GET: (context: {
|
|
@@ -138,6 +239,9 @@ interface DocsMcpHttpHandlers {
|
|
|
138
239
|
DELETE: (context: {
|
|
139
240
|
request: Request;
|
|
140
241
|
}) => Promise<Response>;
|
|
242
|
+
OPTIONS: (context: {
|
|
243
|
+
request: Request;
|
|
244
|
+
}) => Promise<Response>;
|
|
141
245
|
}
|
|
142
246
|
interface CreateDocsMcpServerOptions {
|
|
143
247
|
source: DocsMcpSource;
|
|
@@ -149,6 +253,8 @@ interface CreateDocsMcpServerOptions {
|
|
|
149
253
|
observability?: boolean | DocsObservabilityConfig;
|
|
150
254
|
defaultName?: string;
|
|
151
255
|
defaultVersion?: string;
|
|
256
|
+
/** Internal request context used to expose an authenticated principal to custom sources. */
|
|
257
|
+
requestContext?: DocsMcpRequestContext;
|
|
152
258
|
}
|
|
153
259
|
interface CreateFilesystemDocsMcpSourceOptions {
|
|
154
260
|
rootDir?: string;
|
|
@@ -157,6 +263,11 @@ interface CreateFilesystemDocsMcpSourceOptions {
|
|
|
157
263
|
siteTitle?: string;
|
|
158
264
|
ordering?: "alphabetical" | "numeric" | OrderingItem[];
|
|
159
265
|
}
|
|
266
|
+
declare const DEFAULT_DOCS_MCP_MAX_BODY_BYTES: number;
|
|
267
|
+
declare const DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS = 600;
|
|
268
|
+
declare const DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS: readonly string[];
|
|
269
|
+
declare const DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS: readonly string[];
|
|
270
|
+
declare const DOCS_CONFIG_SCHEMA_OPTIONS: readonly DocsMcpConfigSchemaOption[];
|
|
160
271
|
declare function normalizeDocsMcpRoute(route?: string): string;
|
|
161
272
|
declare function resolveDocsMcpConfig(mcp?: boolean | DocsMcpConfig, defaults?: {
|
|
162
273
|
defaultName?: string;
|
|
@@ -167,5 +278,10 @@ declare function createFilesystemDocsMcpSource(options?: CreateFilesystemDocsMcp
|
|
|
167
278
|
declare function createDocsMcpServer(options: CreateDocsMcpServerOptions): Promise<McpServer>;
|
|
168
279
|
declare function createDocsMcpHttpHandler(options: CreateDocsMcpServerOptions): DocsMcpHttpHandlers;
|
|
169
280
|
declare function runDocsMcpStdio(options: CreateDocsMcpServerOptions): Promise<void>;
|
|
281
|
+
declare function getDocsConfigSchema(filters?: {
|
|
282
|
+
option?: string;
|
|
283
|
+
query?: string;
|
|
284
|
+
}): DocsMcpConfigSchema;
|
|
285
|
+
declare function buildDocsMcpContext(options: DocsMcpContextOptions): Promise<DocsMcpContextResult>;
|
|
170
286
|
//#endregion
|
|
171
|
-
export { DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio };
|
|
287
|
+
export { CreateDocsMcpServerOptions, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DOCS_CONFIG_SCHEMA_OPTIONS, DocsMcpAgentContractSummary, DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpContextOptions, DocsMcpContextResult, DocsMcpContextSource, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpFolderNode, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpPageNode, DocsMcpRequestContext, DocsMcpResolvedConfig, DocsMcpResolvedCorsConfig, DocsMcpResolvedSecurityConfig, DocsMcpSource, DocsMcpTaskSummary, buildDocsMcpContext, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio };
|