@farming-labs/docs 0.2.61 → 0.2.62
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/package.json +1 -1
- package/dist/agent-DFHlw_JC.mjs +0 -624
- package/dist/agent-Fl0pjVNF.mjs +0 -4352
- package/dist/agent-evals-f4_OL10T.mjs +0 -2144
- package/dist/agent-export-D0zQhasD.mjs +0 -910
- package/dist/agent-scope-C_U--OZ7.mjs +0 -283
- package/dist/agent-skills-bundle.d.mts +0 -13
- package/dist/agent-skills-bundle.mjs +0 -12
- package/dist/agent-skills-server-CIeBszxp.mjs +0 -263
- package/dist/agent-skills-server-CKq3_jMj.d.mts +0 -12
- package/dist/agent-skills-vite.d.mts +0 -31
- package/dist/agent-skills-vite.mjs +0 -70
- package/dist/agents-ibnXrWyp.mjs +0 -221
- package/dist/analytics-Bx44lg6d.mjs +0 -177
- package/dist/cli/index.d.mts +0 -15
- package/dist/cli/index.mjs +0 -452
- package/dist/client/react.d.mts +0 -45
- package/dist/client/react.mjs +0 -223
- package/dist/cloud-analytics-CSyFE6SS.mjs +0 -132
- package/dist/cloud-ask-ai-D7ZgF47y.d.mts +0 -23
- package/dist/cloud-ask-ai-sbpjOR2K.mjs +0 -382
- package/dist/cloud-pdNC-tyj.mjs +0 -1615
- package/dist/code-blocks-DnNVNK2M.mjs +0 -871
- package/dist/codeblocks-CFuurVIH.mjs +0 -250
- package/dist/config-Wcdj-D0a.mjs +0 -369
- package/dist/dev-Cmy6DtdF.mjs +0 -1333
- package/dist/docs-cloud-server.d.mts +0 -70
- package/dist/docs-cloud-server.mjs +0 -310
- package/dist/doctor-CXostbsI.mjs +0 -2036
- package/dist/downgrade-w7e6Se0L.mjs +0 -184
- package/dist/errors-DbOhkE1h.mjs +0 -20
- package/dist/golden-evaluations-CBZ_JZjf.mjs +0 -1498
- package/dist/i18n-CCaFUnAN.mjs +0 -40
- package/dist/index.d.mts +0 -1141
- package/dist/index.mjs +0 -10
- package/dist/init-CQY0Woe3.mjs +0 -1264
- package/dist/mcp-DyPcoLwm.mjs +0 -156
- package/dist/mcp.d.mts +0 -298
- package/dist/mcp.mjs +0 -4426
- package/dist/metadata-Dv1ah0Aj.mjs +0 -237
- package/dist/package-version-n5AFur8a.mjs +0 -128
- package/dist/reading-time-C-SAhQT9.mjs +0 -742
- package/dist/review-D2UBrxFq.mjs +0 -673
- package/dist/robots-5Yqz9mz7.mjs +0 -179
- package/dist/robots-C08kDLsz.mjs +0 -201
- package/dist/search-9OnMGMvt.mjs +0 -1758
- package/dist/search-C6heDO8h.d.mts +0 -274
- package/dist/search-CNsRpz90.mjs +0 -104
- package/dist/server.d.mts +0 -342
- package/dist/server.mjs +0 -13
- package/dist/sitemap-BpYnSsfJ.mjs +0 -249
- package/dist/sitemap-server-D_0Kzanj.mjs +0 -1137
- package/dist/standards-discovery-C4HUqMd2.d.mts +0 -227
- package/dist/standards-discovery-C54V_aJH.mjs +0 -510
- package/dist/templates-Bq_P7ctv.mjs +0 -2465
- package/dist/types-EhFhYGfr.d.mts +0 -3305
- package/dist/upgrade-oz-GChgt.mjs +0 -56
- package/dist/utils-DpiIioYb.mjs +0 -225
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { k as DocsDiscoveryApiRouteOptions } from "./standards-discovery-C4HUqMd2.mjs";
|
|
2
|
-
import { B as DocsAnalyticsEventInput, Dt as DocsObservabilityConfig, F as DocsAgentTraceEventInput, Ht as DocsSearchChunkingConfig, Ot as DocsObservabilityEvent, Pn as ResolvedDocsRelatedLink, R as DocsAnalyticsConfig, Ut as DocsSearchConfig, Vt as DocsSearchAdapterFactory, Wn as TypesenseDocsSearchConfig, Wt as DocsSearchDocument, X as DocsAskAIMcpConfig, Xt as DocsSitemapConfig, Yt as DocsSearchSourcePage, f as CustomDocsSearchConfig, gn as OpenDocsProvider, kt as DocsObservabilityEventInput, pn as McpDocsSearchConfig, qt as DocsSearchResult, r as AlgoliaDocsSearchConfig, yn as OpenDocsTarget, z as DocsAnalyticsEvent, zt as DocsSearchAdapter } from "./types-EhFhYGfr.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/analytics.d.ts
|
|
5
|
-
declare const DOCS_AGENT_TRACE_EVENT_TYPES: readonly ["run.start", "run.end", "run.error", "user.input", "prompt.build", "retrieval.query", "retrieval.result", "retrieval.error", "model.call", "model.response", "model.stream", "model.error", "tool.call", "tool.result", "tool.error", "retry", "timeout", "error", "agent.final"];
|
|
6
|
-
interface DocsAgentTraceContext {
|
|
7
|
-
traceId: string;
|
|
8
|
-
name: string;
|
|
9
|
-
startedAt: string;
|
|
10
|
-
startedMs: number;
|
|
11
|
-
}
|
|
12
|
-
interface ResolvedDocsAnalyticsConfig {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
console: false | "log" | "info" | "debug";
|
|
15
|
-
includeInputs: boolean;
|
|
16
|
-
onEvent?: (event: DocsAnalyticsEvent) => void | Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
interface ResolvedDocsObservabilityConfig {
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
console: false | "log" | "info" | "debug";
|
|
21
|
-
includeInputs: boolean;
|
|
22
|
-
onEvent?: (event: DocsObservabilityEvent) => void | Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
declare function createDocsAgentTraceId(prefix?: string): string;
|
|
25
|
-
declare function createDocsAgentTraceContext(name?: string): DocsAgentTraceContext;
|
|
26
|
-
declare function getDocsRequestAnalyticsProperties(request: Request): Record<string, unknown>;
|
|
27
|
-
declare function resolveDocsAnalyticsConfig(analytics?: boolean | DocsAnalyticsConfig): ResolvedDocsAnalyticsConfig;
|
|
28
|
-
declare function resolveDocsObservabilityConfig(observability?: boolean | DocsObservabilityConfig): ResolvedDocsObservabilityConfig;
|
|
29
|
-
declare function emitDocsAnalyticsEvent(analytics: boolean | DocsAnalyticsConfig | undefined, event: DocsAnalyticsEventInput): Promise<void>;
|
|
30
|
-
declare function emitDocsObservabilityEvent(observability: boolean | DocsObservabilityConfig | undefined, event: DocsObservabilityEventInput): Promise<void>;
|
|
31
|
-
declare function emitDocsAgentTraceEvent(observability: boolean | DocsObservabilityConfig | undefined, event: DocsAgentTraceEventInput): Promise<void>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/audience.d.ts
|
|
34
|
-
/** The two content projections emitted by the docs framework. */
|
|
35
|
-
type DocsContentAudience = "human" | "agent";
|
|
36
|
-
/** Resolve whether content with an optional audience restriction is visible. */
|
|
37
|
-
declare function resolveDocsAudienceExposure(only: unknown, audience: DocsContentAudience): boolean;
|
|
38
|
-
interface DocsAudienceMdxIssue {
|
|
39
|
-
code: "missing-only" | "invalid-only" | "dynamic-only" | "ignored-agent-only" | "ignored-human-only";
|
|
40
|
-
index: number;
|
|
41
|
-
message: string;
|
|
42
|
-
}
|
|
43
|
-
/** Find audience declarations that cannot be projected consistently at build time. */
|
|
44
|
-
declare function findDocsAudienceMdxIssues(content: string): DocsAudienceMdxIssue[];
|
|
45
|
-
/**
|
|
46
|
-
* Resolve MDX into its human or agent projection.
|
|
47
|
-
*
|
|
48
|
-
* `<Agent>` is shorthand for `<Audience only="agent">`, while `<Human>` is
|
|
49
|
-
* shorthand for `<Audience only="human">`. Unknown `Audience.only` values are
|
|
50
|
-
* treated as shared content so an authoring typo never silently deletes content.
|
|
51
|
-
* These primitives shape content for each surface; they are not an access-control boundary.
|
|
52
|
-
*/
|
|
53
|
-
declare function resolveDocsAudienceMdxContent(content: string, audience: DocsContentAudience): string;
|
|
54
|
-
/** Backwards-compatible name retained for existing integrations. */
|
|
55
|
-
declare function resolveDocsAgentMdxContent(content: string, audience: DocsContentAudience): string;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/prompt-utils.d.ts
|
|
58
|
-
type PromptAction = "copy" | "open";
|
|
59
|
-
interface SerializedOpenDocsProvider {
|
|
60
|
-
name: string;
|
|
61
|
-
iconHtml?: string;
|
|
62
|
-
urlTemplate: string;
|
|
63
|
-
promptUrlTemplate?: string;
|
|
64
|
-
target?: OpenDocsTarget;
|
|
65
|
-
prompt?: string;
|
|
66
|
-
}
|
|
67
|
-
interface PromptProviderChoice {
|
|
68
|
-
name: string;
|
|
69
|
-
iconHtml?: string;
|
|
70
|
-
urlTemplate: string;
|
|
71
|
-
}
|
|
72
|
-
type PromptProviderInput = Pick<SerializedOpenDocsProvider, "name" | "iconHtml"> & Partial<Pick<SerializedOpenDocsProvider, "promptUrlTemplate" | "urlTemplate">>;
|
|
73
|
-
interface SerializeOpenDocsProviderOptions {
|
|
74
|
-
target?: OpenDocsTarget;
|
|
75
|
-
prompt?: string;
|
|
76
|
-
}
|
|
77
|
-
declare const DEFAULT_PROMPT_PROVIDER_TEMPLATES: Record<string, string>;
|
|
78
|
-
declare const DEFAULT_OPEN_DOCS_TARGET: OpenDocsTarget;
|
|
79
|
-
declare const DEFAULT_OPEN_DOCS_PROMPT = "Read this documentation: {url}";
|
|
80
|
-
declare const DEFAULT_OPEN_DOCS_PROVIDER_IDS: readonly ["chatgpt", "claude"];
|
|
81
|
-
declare function normalizePromptProviderName(name: string): string;
|
|
82
|
-
declare function serializeDocsIcon(icon: unknown): string | undefined;
|
|
83
|
-
declare function serializeDocsIconRegistry(icons?: Record<string, unknown>): Record<string, string> | undefined;
|
|
84
|
-
declare function serializeOpenDocsProviders(providers?: OpenDocsProvider[], options?: SerializeOpenDocsProviderOptions): SerializedOpenDocsProvider[] | undefined;
|
|
85
|
-
declare function serializeOpenDocsProvider(provider: OpenDocsProvider, options?: SerializeOpenDocsProviderOptions): SerializedOpenDocsProvider | undefined;
|
|
86
|
-
declare function parsePromptStringArray(value: unknown): string[] | undefined;
|
|
87
|
-
declare function resolvePromptProviderChoices(availableProviders?: PromptProviderInput[], preferredNames?: string[]): PromptProviderChoice[];
|
|
88
|
-
declare function sanitizePromptText(text: string): string;
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/sitemap.d.ts
|
|
91
|
-
declare const DEFAULT_SITEMAP_XML_ROUTE = "/sitemap.xml";
|
|
92
|
-
declare const DEFAULT_SITEMAP_MD_ROUTE = "/sitemap.md";
|
|
93
|
-
declare const DEFAULT_SITEMAP_MD_DOCS_ROUTE = "/docs/sitemap.md";
|
|
94
|
-
declare const DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE = "/.well-known/sitemap.md";
|
|
95
|
-
declare const DEFAULT_SITEMAP_MANIFEST_PATH = ".farming-labs/sitemap-manifest.json";
|
|
96
|
-
type DocsSitemapFormat = "xml" | "markdown";
|
|
97
|
-
interface DocsSitemapPageInput {
|
|
98
|
-
slug?: string;
|
|
99
|
-
url: string;
|
|
100
|
-
/** Override the public Markdown representation URL when it differs from `${url}.md`. */
|
|
101
|
-
markdownUrl?: string;
|
|
102
|
-
title: string;
|
|
103
|
-
description?: string;
|
|
104
|
-
related?: ResolvedDocsRelatedLink[];
|
|
105
|
-
sourcePath?: string;
|
|
106
|
-
lastmod?: string;
|
|
107
|
-
lastModified?: string;
|
|
108
|
-
}
|
|
109
|
-
interface DocsSitemapManifestPage {
|
|
110
|
-
url: string;
|
|
111
|
-
absoluteUrl?: string;
|
|
112
|
-
markdownUrl: string;
|
|
113
|
-
title: string;
|
|
114
|
-
description?: string;
|
|
115
|
-
sourcePath?: string;
|
|
116
|
-
lastmod?: string;
|
|
117
|
-
lastmodSource?: "git" | "filesystem" | "frontmatter" | "manifest" | "unknown";
|
|
118
|
-
related?: string[];
|
|
119
|
-
}
|
|
120
|
-
interface DocsSitemapManifest {
|
|
121
|
-
version: 1;
|
|
122
|
-
generatedAt: string;
|
|
123
|
-
baseUrl?: string;
|
|
124
|
-
entry: string;
|
|
125
|
-
siteTitle?: string;
|
|
126
|
-
pages: DocsSitemapManifestPage[];
|
|
127
|
-
}
|
|
128
|
-
interface DocsSitemapResolvedConfig {
|
|
129
|
-
enabled: boolean;
|
|
130
|
-
routePrefix: string;
|
|
131
|
-
baseUrl?: string;
|
|
132
|
-
manifestPath: string;
|
|
133
|
-
xml: {
|
|
134
|
-
enabled: boolean;
|
|
135
|
-
includeLastmod: boolean;
|
|
136
|
-
route: string;
|
|
137
|
-
};
|
|
138
|
-
markdown: {
|
|
139
|
-
enabled: boolean;
|
|
140
|
-
includeDescriptions: boolean;
|
|
141
|
-
includeLastmod: boolean;
|
|
142
|
-
linkTarget: "html" | "markdown" | "both";
|
|
143
|
-
route: string;
|
|
144
|
-
docsRoute?: string;
|
|
145
|
-
wellKnownRoute: string;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
interface CreateDocsSitemapResponseOptions extends DocsDiscoveryApiRouteOptions {
|
|
149
|
-
request: Request;
|
|
150
|
-
sitemap?: boolean | DocsSitemapConfig;
|
|
151
|
-
entry?: string;
|
|
152
|
-
siteTitle?: string;
|
|
153
|
-
baseUrl?: string;
|
|
154
|
-
pages: DocsSitemapPageInput[];
|
|
155
|
-
manifest?: DocsSitemapManifest | null;
|
|
156
|
-
}
|
|
157
|
-
declare function resolveDocsSitemapConfig(sitemap?: boolean | DocsSitemapConfig, defaults?: {
|
|
158
|
-
baseUrl?: string;
|
|
159
|
-
}): DocsSitemapResolvedConfig;
|
|
160
|
-
declare function resolveDocsSitemapRequest(url: URL, sitemap?: boolean | DocsSitemapConfig, options?: DocsDiscoveryApiRouteOptions): DocsSitemapFormat | null;
|
|
161
|
-
declare function toDocsSitemapMarkdownUrl(url: string): string;
|
|
162
|
-
declare function buildDocsSitemapManifest(options: {
|
|
163
|
-
pages: DocsSitemapPageInput[];
|
|
164
|
-
entry?: string;
|
|
165
|
-
siteTitle?: string;
|
|
166
|
-
baseUrl?: string;
|
|
167
|
-
generatedAt?: string;
|
|
168
|
-
resolveLastmod?: (page: DocsSitemapPageInput) => {
|
|
169
|
-
lastmod?: string;
|
|
170
|
-
lastmodSource?: DocsSitemapManifestPage["lastmodSource"];
|
|
171
|
-
} | undefined;
|
|
172
|
-
}): DocsSitemapManifest;
|
|
173
|
-
declare function renderDocsSitemapXml(manifest: DocsSitemapManifest, options?: {
|
|
174
|
-
baseUrl?: string;
|
|
175
|
-
includeLastmod?: boolean;
|
|
176
|
-
}): string;
|
|
177
|
-
declare function renderDocsSitemapMarkdown(manifest: DocsSitemapManifest, options?: {
|
|
178
|
-
baseUrl?: string;
|
|
179
|
-
includeDescriptions?: boolean;
|
|
180
|
-
includeLastmod?: boolean;
|
|
181
|
-
linkTarget?: "html" | "markdown" | "both";
|
|
182
|
-
}): string;
|
|
183
|
-
declare function readDocsSitemapManifestFromContentMap(contentMap?: Record<string, string> | null): DocsSitemapManifest | null;
|
|
184
|
-
declare function resolveDocsSitemapPageLastmod(manifest: DocsSitemapManifest | null | undefined, url: string): string | undefined;
|
|
185
|
-
declare function createDocsSitemapResponse({
|
|
186
|
-
request,
|
|
187
|
-
apiRoute,
|
|
188
|
-
sitemap,
|
|
189
|
-
entry,
|
|
190
|
-
siteTitle,
|
|
191
|
-
baseUrl,
|
|
192
|
-
pages,
|
|
193
|
-
manifest
|
|
194
|
-
}: CreateDocsSitemapResponseOptions): Response | null;
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/search.d.ts
|
|
197
|
-
interface DocsAskAIContextResult extends DocsSearchResult {
|
|
198
|
-
title: string;
|
|
199
|
-
contextContent: string;
|
|
200
|
-
}
|
|
201
|
-
interface DocsAskAIContext {
|
|
202
|
-
context: string;
|
|
203
|
-
/** Structured production context blocks; avoids reparsing markdown horizontal rules. */
|
|
204
|
-
blocks: Array<{
|
|
205
|
-
text: string;
|
|
206
|
-
result: DocsAskAIContextResult;
|
|
207
|
-
}>;
|
|
208
|
-
results: DocsAskAIContextResult[];
|
|
209
|
-
searchResults: DocsSearchResult[];
|
|
210
|
-
packageHints: DocsAskAIPackageHints;
|
|
211
|
-
}
|
|
212
|
-
interface DocsAskAIPackageHints {
|
|
213
|
-
packages: string[];
|
|
214
|
-
imports: string[];
|
|
215
|
-
installCommands: string[];
|
|
216
|
-
}
|
|
217
|
-
declare function inferDocsAskAIPackageHints(content: string): DocsAskAIPackageHints;
|
|
218
|
-
declare function formatDocsAskAIPackageHints(hints: DocsAskAIPackageHints, packageName?: string): string | undefined;
|
|
219
|
-
declare function buildDocsSearchDocuments(pages: DocsSearchSourcePage[], chunking?: DocsSearchChunkingConfig, audience?: DocsContentAudience): DocsSearchDocument[];
|
|
220
|
-
declare function createSimpleSearchAdapter(): DocsSearchAdapter;
|
|
221
|
-
declare function createTypesenseSearchAdapter(config: TypesenseDocsSearchConfig): DocsSearchAdapter;
|
|
222
|
-
declare function resolveSearchRequestConfig(search: boolean | DocsSearchConfig | undefined, requestUrl?: string): boolean | DocsSearchConfig | undefined;
|
|
223
|
-
declare function resolveAskAISearchRequestConfig(options: {
|
|
224
|
-
search: boolean | DocsSearchConfig | undefined;
|
|
225
|
-
useMcp?: boolean | DocsAskAIMcpConfig;
|
|
226
|
-
mcpEndpoint?: string;
|
|
227
|
-
mcpEnabled?: boolean;
|
|
228
|
-
mcpSearchEnabled?: boolean;
|
|
229
|
-
requestUrl?: string;
|
|
230
|
-
}): boolean | DocsSearchConfig | undefined;
|
|
231
|
-
declare function createMcpSearchAdapter(config: McpDocsSearchConfig): DocsSearchAdapter;
|
|
232
|
-
declare function createAlgoliaSearchAdapter(config: AlgoliaDocsSearchConfig): DocsSearchAdapter;
|
|
233
|
-
declare function performDocsSearch(options: {
|
|
234
|
-
pages: DocsSearchSourcePage[];
|
|
235
|
-
query: string;
|
|
236
|
-
search?: boolean | DocsSearchConfig; /** Selects which audience projection is searchable. Public site search defaults to human. */
|
|
237
|
-
audience?: DocsContentAudience;
|
|
238
|
-
locale?: string;
|
|
239
|
-
pathname?: string;
|
|
240
|
-
siteTitle?: string; /** Canonical docs URL used to distinguish same-site absolute hits from foreign MCP results. */
|
|
241
|
-
baseUrl?: string;
|
|
242
|
-
limit?: number;
|
|
243
|
-
/**
|
|
244
|
-
* Controls provider failures. Runtime search keeps the resilient `fallback` default;
|
|
245
|
-
* diagnostics can request `throw` so a broken configured provider cannot be scored as
|
|
246
|
-
* successful simple search.
|
|
247
|
-
*/
|
|
248
|
-
failureMode?: "fallback" | "throw";
|
|
249
|
-
/**
|
|
250
|
-
* Whether non-simple provider hits are supplemented with exact/local simple results.
|
|
251
|
-
* Runtime search defaults to true; provider diagnostics can disable supplementation.
|
|
252
|
-
*/
|
|
253
|
-
supplementExternalResults?: boolean; /** Fail closed on absolute provider hits when no canonical docs origin is available. */
|
|
254
|
-
strictExternalOrigins?: boolean; /** Optional cancellation signal forwarded to adapters and their managed requests. */
|
|
255
|
-
signal?: AbortSignal;
|
|
256
|
-
}): Promise<DocsSearchResult[]>;
|
|
257
|
-
declare function buildDocsAskAIContext(options: {
|
|
258
|
-
pages: DocsSearchSourcePage[];
|
|
259
|
-
query: string;
|
|
260
|
-
search?: boolean | DocsSearchConfig;
|
|
261
|
-
locale?: string;
|
|
262
|
-
pathname?: string;
|
|
263
|
-
siteTitle?: string;
|
|
264
|
-
baseUrl?: string;
|
|
265
|
-
limit?: number;
|
|
266
|
-
maxContextChars?: number;
|
|
267
|
-
maxResultChars?: number; /** See `performDocsSearch.failureMode`. Defaults to resilient runtime fallback. */
|
|
268
|
-
searchFailureMode?: "fallback" | "throw"; /** See `performDocsSearch.strictExternalOrigins`. */
|
|
269
|
-
strictExternalOrigins?: boolean; /** Optional cancellation signal forwarded to the configured search provider. */
|
|
270
|
-
signal?: AbortSignal;
|
|
271
|
-
}): Promise<DocsAskAIContext>;
|
|
272
|
-
declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
|
|
273
|
-
//#endregion
|
|
274
|
-
export { resolveDocsAudienceMdxContent as $, resolveDocsSitemapRequest as A, normalizePromptProviderName as B, buildDocsSitemapManifest as C, renderDocsSitemapXml as D, renderDocsSitemapMarkdown as E, DEFAULT_PROMPT_PROVIDER_TEMPLATES as F, serializeDocsIconRegistry as G, resolvePromptProviderChoices as H, PromptAction as I, DocsAudienceMdxIssue as J, serializeOpenDocsProvider as K, PromptProviderChoice as L, DEFAULT_OPEN_DOCS_PROMPT as M, DEFAULT_OPEN_DOCS_PROVIDER_IDS as N, resolveDocsSitemapConfig as O, DEFAULT_OPEN_DOCS_TARGET as P, resolveDocsAudienceExposure as Q, SerializeOpenDocsProviderOptions as R, DocsSitemapResolvedConfig as S, readDocsSitemapManifestFromContentMap as T, sanitizePromptText as U, parsePromptStringArray as V, serializeDocsIcon as W, findDocsAudienceMdxIssues as X, DocsContentAudience as Y, resolveDocsAgentMdxContent as Z, DEFAULT_SITEMAP_XML_ROUTE as _, createMcpSearchAdapter as a, createDocsAgentTraceId as at, DocsSitemapManifestPage as b, formatDocsAskAIPackageHints as c, emitDocsObservabilityEvent as ct, resolveAskAISearchRequestConfig as d, resolveDocsObservabilityConfig as dt, DOCS_AGENT_TRACE_EVENT_TYPES as et, resolveSearchRequestConfig as f, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as g, DEFAULT_SITEMAP_MD_ROUTE as h, createCustomSearchAdapter as i, createDocsAgentTraceContext as it, toDocsSitemapMarkdownUrl as j, resolveDocsSitemapPageLastmod as k, inferDocsAskAIPackageHints as l, getDocsRequestAnalyticsProperties as lt, DEFAULT_SITEMAP_MD_DOCS_ROUTE as m, buildDocsSearchDocuments as n, ResolvedDocsAnalyticsConfig as nt, createSimpleSearchAdapter as o, emitDocsAgentTraceEvent as ot, DEFAULT_SITEMAP_MANIFEST_PATH as p, serializeOpenDocsProviders as q, createAlgoliaSearchAdapter as r, ResolvedDocsObservabilityConfig as rt, createTypesenseSearchAdapter as s, emitDocsAnalyticsEvent as st, buildDocsAskAIContext as t, DocsAgentTraceContext as tt, performDocsSearch as u, resolveDocsAnalyticsConfig as ut, DocsSitemapFormat as v, createDocsSitemapResponse as w, DocsSitemapPageInput as x, DocsSitemapManifest as y, SerializedOpenDocsProvider as z };
|
package/dist/search-CNsRpz90.mjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import "./agent-Fl0pjVNF.mjs";
|
|
2
|
-
import "./standards-discovery-C54V_aJH.mjs";
|
|
3
|
-
import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-9OnMGMvt.mjs";
|
|
4
|
-
import "./sitemap-server-D_0Kzanj.mjs";
|
|
5
|
-
import "./agent-evals-f4_OL10T.mjs";
|
|
6
|
-
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
7
|
-
import "./code-blocks-DnNVNK2M.mjs";
|
|
8
|
-
import "./agent-skills-server-CIeBszxp.mjs";
|
|
9
|
-
import "./server.mjs";
|
|
10
|
-
import { _ as resolveDocsContentDir, c as loadProjectEnv, g as resolveDocsConfigPath, h as readTopLevelStringProperty } from "./config-Wcdj-D0a.mjs";
|
|
11
|
-
import { readFileSync } from "node:fs";
|
|
12
|
-
import pc from "picocolors";
|
|
13
|
-
|
|
14
|
-
//#region src/cli/search.ts
|
|
15
|
-
function getEnvValue(loadedEnv, key) {
|
|
16
|
-
return process.env[key] ?? loadedEnv[key];
|
|
17
|
-
}
|
|
18
|
-
function resolveSearchSyncProvider(options, loadedEnv) {
|
|
19
|
-
if (options.typesense && options.algolia) throw new Error("Use only one provider flag: --typesense or --algolia.");
|
|
20
|
-
if (options.typesense) return "typesense";
|
|
21
|
-
if (options.algolia) return "algolia";
|
|
22
|
-
if (options.provider === "typesense" || options.provider === "algolia") return options.provider;
|
|
23
|
-
if (options.provider) throw new Error(`Unsupported search provider: ${options.provider}.`);
|
|
24
|
-
if (options.baseUrl || getEnvValue(loadedEnv, "TYPESENSE_URL")) return "typesense";
|
|
25
|
-
if (options.appId || getEnvValue(loadedEnv, "ALGOLIA_APP_ID")) return "algolia";
|
|
26
|
-
throw new Error("Could not determine a search provider. Use --typesense, --algolia, or --provider <name>.");
|
|
27
|
-
}
|
|
28
|
-
function resolveTypesenseSyncConfig(options, loadedEnv) {
|
|
29
|
-
const baseUrl = options.baseUrl ?? getEnvValue(loadedEnv, "TYPESENSE_URL") ?? getEnvValue(loadedEnv, "TYPESENSE_BASE_URL");
|
|
30
|
-
const collection = options.collection ?? getEnvValue(loadedEnv, "TYPESENSE_COLLECTION") ?? "docs";
|
|
31
|
-
const apiKey = options.apiKey ?? getEnvValue(loadedEnv, "TYPESENSE_SEARCH_API_KEY") ?? getEnvValue(loadedEnv, "TYPESENSE_API_KEY");
|
|
32
|
-
const adminApiKey = options.adminApiKey ?? getEnvValue(loadedEnv, "TYPESENSE_ADMIN_API_KEY") ?? getEnvValue(loadedEnv, "TYPESENSE_API_KEY");
|
|
33
|
-
const mode = options.mode === "hybrid" ? "hybrid" : "keyword";
|
|
34
|
-
const ollamaModel = options.ollamaModel ?? getEnvValue(loadedEnv, "TYPESENSE_OLLAMA_MODEL");
|
|
35
|
-
const ollamaBaseUrl = options.ollamaBaseUrl ?? getEnvValue(loadedEnv, "TYPESENSE_OLLAMA_BASE_URL");
|
|
36
|
-
if (!baseUrl) throw new Error("Missing Typesense base URL. Set TYPESENSE_URL or pass --base-url.");
|
|
37
|
-
if (!apiKey) throw new Error("Missing Typesense API key. Set TYPESENSE_API_KEY or pass --api-key.");
|
|
38
|
-
if (!adminApiKey) throw new Error("Missing Typesense admin-capable key for sync. Set TYPESENSE_ADMIN_API_KEY or pass --admin-api-key.");
|
|
39
|
-
return {
|
|
40
|
-
provider: "typesense",
|
|
41
|
-
baseUrl,
|
|
42
|
-
collection,
|
|
43
|
-
apiKey,
|
|
44
|
-
adminApiKey,
|
|
45
|
-
mode,
|
|
46
|
-
...mode === "hybrid" ? ollamaModel ? { embeddings: {
|
|
47
|
-
provider: "ollama",
|
|
48
|
-
model: ollamaModel,
|
|
49
|
-
baseUrl: ollamaBaseUrl
|
|
50
|
-
} } : (() => {
|
|
51
|
-
throw new Error("Typesense hybrid sync needs an embeddings model. Set TYPESENSE_OLLAMA_MODEL or pass --ollama-model.");
|
|
52
|
-
})() : {}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function resolveAlgoliaSyncConfig(options, loadedEnv) {
|
|
56
|
-
const appId = options.appId ?? getEnvValue(loadedEnv, "ALGOLIA_APP_ID");
|
|
57
|
-
const indexName = options.indexName ?? getEnvValue(loadedEnv, "ALGOLIA_INDEX_NAME") ?? "docs";
|
|
58
|
-
const adminApiKey = options.adminApiKey ?? getEnvValue(loadedEnv, "ALGOLIA_ADMIN_API_KEY");
|
|
59
|
-
const searchApiKey = options.searchApiKey ?? getEnvValue(loadedEnv, "ALGOLIA_SEARCH_API_KEY") ?? adminApiKey;
|
|
60
|
-
if (!appId) throw new Error("Missing Algolia app id. Set ALGOLIA_APP_ID or pass --app-id.");
|
|
61
|
-
if (!adminApiKey) throw new Error("Missing Algolia admin API key for sync. Set ALGOLIA_ADMIN_API_KEY or pass --admin-api-key.");
|
|
62
|
-
if (!searchApiKey) throw new Error("Missing Algolia search API key. Set ALGOLIA_SEARCH_API_KEY or pass --search-api-key.");
|
|
63
|
-
return {
|
|
64
|
-
provider: "algolia",
|
|
65
|
-
appId,
|
|
66
|
-
indexName,
|
|
67
|
-
searchApiKey,
|
|
68
|
-
adminApiKey
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
async function syncSearch(options = {}) {
|
|
72
|
-
const rootDir = process.cwd();
|
|
73
|
-
const configContent = readFileSync(resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
|
|
74
|
-
const loadedEnv = loadProjectEnv(rootDir);
|
|
75
|
-
const provider = resolveSearchSyncProvider(options, loadedEnv);
|
|
76
|
-
const entry = readTopLevelStringProperty(configContent, "entry") ?? "docs";
|
|
77
|
-
const contentDir = resolveDocsContentDir(rootDir, configContent, entry);
|
|
78
|
-
const source = createFilesystemDocsMcpSource({
|
|
79
|
-
rootDir,
|
|
80
|
-
entry,
|
|
81
|
-
contentDir,
|
|
82
|
-
siteTitle: "Documentation"
|
|
83
|
-
});
|
|
84
|
-
const pages = await source.getPages();
|
|
85
|
-
const documents = buildDocsSearchDocuments(pages);
|
|
86
|
-
const context = {
|
|
87
|
-
pages,
|
|
88
|
-
documents,
|
|
89
|
-
siteTitle: source.siteTitle
|
|
90
|
-
};
|
|
91
|
-
if (documents.length === 0) throw new Error(`No docs content was found under ${contentDir}.`);
|
|
92
|
-
if (provider === "typesense") {
|
|
93
|
-
const config = resolveTypesenseSyncConfig(options, loadedEnv);
|
|
94
|
-
await createTypesenseSearchAdapter(config).index?.(context);
|
|
95
|
-
console.log(pc.green(`Synced ${documents.length} docs search documents to Typesense collection "${config.collection}".`));
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const config = resolveAlgoliaSyncConfig(options, loadedEnv);
|
|
99
|
-
await createAlgoliaSearchAdapter(config).index?.(context);
|
|
100
|
-
console.log(pc.green(`Synced ${documents.length} docs search documents to Algolia index "${config.indexName}".`));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
104
|
-
export { syncSearch };
|