@farming-labs/docs 0.2.77 → 0.2.78
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-SRIJ-oF8.mjs → agent-Ba94vwM2.mjs} +4282 -334
- package/dist/{agent-DRKj42ht.d.mts → agent-CHgWJcK_.d.mts} +45 -3
- package/dist/{agent-D4hNGatV.mjs → agent-CM-hzhfh.mjs} +2 -2
- package/dist/{agent-evals-DmFoKy_y.mjs → agent-evals-C8dkgJMN.mjs} +1 -1
- package/dist/{agent-export-CM-p9_YD.mjs → agent-export-DdF-IVfg.mjs} +6 -5
- package/dist/agent-provenance-D8UBpnMc.mjs +463 -0
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-server-CJ4D0G9P.d.mts → agent-skills-server-zvs0Yknt.d.mts} +2 -2
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/{agents-BeLDNCnE.mjs → agents-v0Em2KZo.mjs} +4 -4
- package/dist/cli/index.mjs +14 -14
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-ask-ai-BCgHPxew.d.mts → cloud-ask-ai-BwsdF7AQ.d.mts} +1 -1
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/{doctor-DhMVKHjp.mjs → doctor-BbrN0rdC.mjs} +8 -8
- package/dist/{golden-evaluations-VzE6juQl.mjs → golden-evaluations-Bk9t-HNq.mjs} +7 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{mcp-CZkQJXtA.mjs → mcp-DT-WNsA-.mjs} +4 -4
- package/dist/mcp.d.mts +5 -4
- package/dist/mcp.mjs +193 -3
- package/dist/{prompt-references-B6L3AD98.mjs → prompt-references-CoDorsvS.mjs} +2 -2
- package/dist/{retrieval-digest-rponR4jM.d.mts → retrieval-digest-CO3wqeMk.d.mts} +85 -4
- package/dist/{review-nxoV8jIm.mjs → review-DrCaaT7G.mjs} +4 -4
- package/dist/{robots-CgH6Stqn.mjs → robots-C_v2HK43.mjs} +1 -1
- package/dist/{robots-CiQT8mX2.mjs → robots-izJbM9cv.mjs} +2 -2
- package/dist/{search-BTUIkhnT.mjs → search-YiZMZDfb.mjs} +4 -4
- package/dist/server.d.mts +6 -6
- package/dist/server.mjs +5 -5
- package/dist/{sitemap-e0_GeCWJ.mjs → sitemap-NO8UMO6Y.mjs} +4 -4
- package/dist/{sitemap-server-DHaxyPAd.mjs → sitemap-server-Dgxs9V6S.mjs} +1 -1
- package/dist/{standards-discovery-BbslY4id.d.mts → standards-discovery-BWyNgZSs.d.mts} +1 -1
- package/dist/{types-B-5Kzmkn.d.mts → types-CpLnwHak.d.mts} +125 -4
- package/package.json +1 -1
- package/dist/search-Da2AKaFJ.mjs +0 -3992
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as DocsA2AAgentCardOptions, R as DocsDiscoveryApiRouteOptions, z as DocsPublishedAgentSkill } from "./standards-discovery-
|
|
1
|
+
import { $n as LlmsTxtMaxCharsMode, At as DocsConfig, F as DocsAgentContentChangesConfig, Fn as DocsSearchSourcePage, K as DocsAgentFeedbackData, Qn as LlmsTxtMaxCharsConfig, Rn as DocsSitemapConfig, Sr as ResolvedDocsRelatedLink, Vt as DocsI18nConfig, Zn as LlmsTxtConfig, er as LlmsTxtSectionConfig, mn as DocsRobotsConfig, mr as PageAgentFrontmatter, qn as FeedbackConfig, qt as DocsMcpConfig, xn as DocsSearchConfig } from "./types-CpLnwHak.mjs";
|
|
2
|
+
import { O as DocsA2AAgentCardOptions, R as DocsDiscoveryApiRouteOptions, z as DocsPublishedAgentSkill } from "./standards-discovery-BWyNgZSs.mjs";
|
|
3
3
|
import { DocsMcpPage, DocsMcpResolvedConfig } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/i18n.d.ts
|
|
@@ -204,6 +204,7 @@ interface DocsDiagnosticsFeature {
|
|
|
204
204
|
routes?: Record<string, string | null>;
|
|
205
205
|
agentEndpoint?: string | null;
|
|
206
206
|
structuredAgentEndpoint?: string | null;
|
|
207
|
+
facetsEndpoint?: string | null;
|
|
207
208
|
audienceParam?: string;
|
|
208
209
|
defaultAudience?: "human" | "agent";
|
|
209
210
|
supportedAudiences?: Array<"human" | "agent">;
|
|
@@ -214,8 +215,17 @@ interface DocsDiagnosticsFeature {
|
|
|
214
215
|
tags: "tags";
|
|
215
216
|
};
|
|
216
217
|
responseFormat?: "docs-search.v1";
|
|
218
|
+
facetsResponseFormat?: "docs-search-facets.v1";
|
|
219
|
+
format?: string;
|
|
220
|
+
sinceParam?: string;
|
|
221
|
+
generationField?: string;
|
|
222
|
+
resetRequiredField?: string;
|
|
217
223
|
warningsField?: "warnings";
|
|
218
|
-
/**
|
|
224
|
+
/** Facet field selected for facet-value continuation. */
|
|
225
|
+
facetParam?: "facet";
|
|
226
|
+
/** Page-size parameter accepted by structured search and facet discovery. */
|
|
227
|
+
limitParam?: "limit";
|
|
228
|
+
/** Opaque continuation token accepted by structured search and facet discovery. */
|
|
219
229
|
cursorParam?: "cursor";
|
|
220
230
|
/** Optional continuation token returned when another result page is available. */
|
|
221
231
|
nextCursorField?: "nextCursor";
|
|
@@ -248,6 +258,7 @@ interface DocsDiagnostics {
|
|
|
248
258
|
skill: string;
|
|
249
259
|
search: string | null;
|
|
250
260
|
agentSearch: string | null;
|
|
261
|
+
contentChanges: string | null;
|
|
251
262
|
askAi: string | null;
|
|
252
263
|
mcp: string | null;
|
|
253
264
|
llmsTxt: string | null;
|
|
@@ -264,6 +275,7 @@ interface DocsDiagnostics {
|
|
|
264
275
|
diagnostics: DocsDiagnosticsFeature;
|
|
265
276
|
apiCatalog: DocsDiagnosticsFeature;
|
|
266
277
|
search: DocsDiagnosticsFeature;
|
|
278
|
+
contentChanges: DocsDiagnosticsFeature;
|
|
267
279
|
ai: DocsDiagnosticsFeature;
|
|
268
280
|
mcp: DocsDiagnosticsFeature;
|
|
269
281
|
feedback: DocsDiagnosticsFeature;
|
|
@@ -348,6 +360,8 @@ interface DocsAgentDiscoverySpecOptions extends DocsDiscoveryApiRouteOptions {
|
|
|
348
360
|
apiCatalog?: boolean;
|
|
349
361
|
i18n?: ResolvedDocsI18n | null;
|
|
350
362
|
search?: boolean | DocsSearchConfig;
|
|
363
|
+
/** Runtime metadata-only document synchronization feed. Defaults to enabled. */
|
|
364
|
+
contentChanges?: boolean | DocsAgentContentChangesConfig;
|
|
351
365
|
mcp: DocsMcpResolvedConfig;
|
|
352
366
|
feedback?: DocsAgentFeedbackDiscoveryConfig;
|
|
353
367
|
llms?: DocsLlmsDiscoveryConfig;
|
|
@@ -372,6 +386,8 @@ interface DocsSkillDocumentOptions extends DocsDiscoveryApiRouteOptions {
|
|
|
372
386
|
/** Whether this deployment actually serves the RFC 9727 API catalog. Defaults to true. */
|
|
373
387
|
apiCatalog?: boolean;
|
|
374
388
|
search?: boolean | DocsSearchConfig;
|
|
389
|
+
/** Runtime metadata-only document synchronization feed. Defaults to enabled. */
|
|
390
|
+
contentChanges?: boolean | DocsAgentContentChangesConfig;
|
|
375
391
|
mcp: DocsMcpResolvedConfig;
|
|
376
392
|
feedback?: DocsAgentFeedbackDiscoveryConfig;
|
|
377
393
|
llms?: DocsLlmsDiscoveryConfig;
|
|
@@ -632,6 +648,7 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
632
648
|
apiCatalog: explicitApiCatalog,
|
|
633
649
|
i18n,
|
|
634
650
|
search,
|
|
651
|
+
contentChanges,
|
|
635
652
|
mcp,
|
|
636
653
|
feedback,
|
|
637
654
|
llms,
|
|
@@ -673,6 +690,7 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
673
690
|
agentSkillsDiscovery: boolean;
|
|
674
691
|
mcp: boolean;
|
|
675
692
|
search: boolean;
|
|
693
|
+
contentChanges: boolean;
|
|
676
694
|
sitemap: boolean;
|
|
677
695
|
robots: boolean;
|
|
678
696
|
structuredData: boolean;
|
|
@@ -682,6 +700,7 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
682
700
|
locales: boolean;
|
|
683
701
|
};
|
|
684
702
|
api: {
|
|
703
|
+
contentChanges?: string | undefined;
|
|
685
704
|
openapi: string;
|
|
686
705
|
agentCard?: string | undefined;
|
|
687
706
|
agentSkillsIndex: string;
|
|
@@ -818,6 +837,7 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
818
837
|
endpoint: string;
|
|
819
838
|
agentEndpoint: string;
|
|
820
839
|
structuredAgentEndpoint: string;
|
|
840
|
+
facetsEndpoint: string;
|
|
821
841
|
method: string;
|
|
822
842
|
queryParam: string;
|
|
823
843
|
localeParam: string;
|
|
@@ -826,7 +846,9 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
826
846
|
supportedAudiences: string[];
|
|
827
847
|
responseParam: string;
|
|
828
848
|
structuredResponseValue: string;
|
|
849
|
+
facetsResponseValue: string;
|
|
829
850
|
responseFormat: string;
|
|
851
|
+
facetsResponseFormat: string;
|
|
830
852
|
filterParams: {
|
|
831
853
|
framework: string;
|
|
832
854
|
version: string;
|
|
@@ -835,11 +857,30 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
835
857
|
};
|
|
836
858
|
repeatedFilterParams: string[];
|
|
837
859
|
warningsField: string;
|
|
860
|
+
facetParam: string;
|
|
861
|
+
limitParam: string;
|
|
838
862
|
cursorParam: string;
|
|
839
863
|
nextCursorField: string;
|
|
840
864
|
hasMoreField: string;
|
|
841
865
|
totalField: string;
|
|
842
866
|
};
|
|
867
|
+
contentChanges: {
|
|
868
|
+
enabled: boolean;
|
|
869
|
+
endpoint: string | null;
|
|
870
|
+
method: string;
|
|
871
|
+
audienceParam: string;
|
|
872
|
+
defaultAudience: string;
|
|
873
|
+
supportedAudiences: string[];
|
|
874
|
+
responseParam: string;
|
|
875
|
+
responseValue: string;
|
|
876
|
+
sinceParam: string;
|
|
877
|
+
format: string;
|
|
878
|
+
generationField: string;
|
|
879
|
+
resetRequiredField: string;
|
|
880
|
+
modes: string[];
|
|
881
|
+
bodyFree: boolean;
|
|
882
|
+
etag: boolean;
|
|
883
|
+
};
|
|
843
884
|
agents: {
|
|
844
885
|
enabled: boolean;
|
|
845
886
|
file: string;
|
|
@@ -911,6 +952,7 @@ declare function buildDocsAgentDiscoverySpec({
|
|
|
911
952
|
listTasks?: boolean;
|
|
912
953
|
readTask?: boolean;
|
|
913
954
|
searchDocs: boolean;
|
|
955
|
+
searchFacets?: boolean;
|
|
914
956
|
getNavigation: boolean;
|
|
915
957
|
getCodeExamples: boolean;
|
|
916
958
|
getConfigSchema: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as findDocsMarkdownPage, at as renderDocsMarkdownDocument } from "./agent-
|
|
1
|
+
import { B as findDocsMarkdownPage, at as renderDocsMarkdownDocument } from "./agent-Ba94vwM2.mjs";
|
|
2
2
|
import { v as normalizePageAgentFrontmatter, x as stripGeneratedPageAgentContractMarkdown } from "./markdown-sections-7OoA7ylx.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as parseGeneratedAgentDocument, n as GENERATED_AGENT_PROVENANCE_VERSION, o as serializeGeneratedAgentDocument, r as hashGeneratedAgentContent } from "./agent-provenance-D8UBpnMc.mjs";
|
|
4
4
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
5
5
|
import { _ as resolveDocsContentDir, a as loadDocsConfigModule, c as loadProjectEnv, d as readNavTitle, f as readNumberProperty, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral, u as readEnvReferenceProperty } from "./config-Wcdj-D0a.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { An as normalizeAgentScopeValues, Dn as agentVersionConstraintsOverlap, En as agentVersionConstraintMatches, On as normalizeAgentFramework, Tn as agentVersionConstraintGroupsOverlap, Xt as buildDocsAskAIContext, jn as normalizeAgentVersion, kn as normalizeAgentLocale, ln as normalizeDocsSearchFilters, un as performDocsSearch, vn as resolveSearchRequestConfig } from "./agent-Ba94vwM2.mjs";
|
|
1
2
|
import { S as upsertPageAgentContractMarkdown, l as stripDocsGeneratedAgentContractMarkers, o as findDocsMarkdownSection } from "./markdown-sections-7OoA7ylx.mjs";
|
|
2
|
-
import { C as agentVersionConstraintGroupsOverlap, D as normalizeAgentLocale, E as normalizeAgentFramework, O as normalizeAgentScopeValues, S as resolveSearchRequestConfig, T as agentVersionConstraintsOverlap, k as normalizeAgentVersion, m as performDocsSearch, n as buildDocsAskAIContext, p as normalizeDocsSearchFilters, w as agentVersionConstraintMatches } from "./search-Da2AKaFJ.mjs";
|
|
3
3
|
import { buildDocsMcpContext } from "./mcp.mjs";
|
|
4
4
|
import { i as validateCodeBlockPlans, n as planCodeBlockTargets, r as resolveDocsCodeBlocksValidateConfig, t as extractCodeBlocksFromMarkdown } from "./code-blocks-DnNVNK2M.mjs";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { A as buildDocsAgentDiscoverySpec,
|
|
1
|
+
import { A as buildDocsAgentDiscoverySpec, Ft as renderDocsSitemapXml, It as resolveDocsSitemapConfig, Pt as renderDocsSitemapMarkdown, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, a as DEFAULT_AGENT_MD_ROUTE, at as renderDocsMarkdownDocument, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, it as renderDocsLlmsTxt, jt as buildDocsSitemapManifest, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, lt as resolveDocsAgentFeedbackConfig, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, rt as renderDocsAgentsDocument, st as renderDocsSkillDocument, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, wt as toDocsMarkdownUrl, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-Ba94vwM2.mjs";
|
|
2
2
|
import "./markdown-sections-7OoA7ylx.mjs";
|
|
3
3
|
import { A as buildDocsLegacySkillsIndex, D as buildDocsA2AAgentCard, L as resolveDocsPublishedAgentSkill, O as buildDocsAgentSkillsIndex, a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, x as DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery-BKlEnK_H.mjs";
|
|
4
|
-
import "./
|
|
4
|
+
import "./agent-provenance-D8UBpnMc.mjs";
|
|
5
5
|
import { t as resolveDocsI18n } from "./i18n-hHVWcflJ.mjs";
|
|
6
|
-
import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-
|
|
7
|
-
import "./sitemap-server-
|
|
8
|
-
import "./agent-evals-
|
|
6
|
+
import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-C_v2HK43.mjs";
|
|
7
|
+
import "./sitemap-server-Dgxs9V6S.mjs";
|
|
8
|
+
import "./agent-evals-C8dkgJMN.mjs";
|
|
9
9
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
10
10
|
import "./code-blocks-DnNVNK2M.mjs";
|
|
11
11
|
import { t as resolveConfiguredAgentSkills } from "./agent-skills-server-B2EXn2QD.mjs";
|
|
@@ -697,6 +697,7 @@ async function exportAgentBundle(options = {}) {
|
|
|
697
697
|
apiRoute: config?.cloud?.apiRoute,
|
|
698
698
|
apiCatalog: false,
|
|
699
699
|
search: false,
|
|
700
|
+
contentChanges: false,
|
|
700
701
|
mcp,
|
|
701
702
|
feedback,
|
|
702
703
|
llms,
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { G as isDocsAgentDiscoveryRequest, K as isDocsAgentsRequest, Kt as isDocsContentChangesRequest, Q as isDocsSkillRequest, _t as resolveDocsMarkdownRequest, dt as resolveDocsAgentsFormat, lt as resolveDocsAgentFeedbackConfig, pt as resolveDocsLlmsTxtRequest, qt as resolveDocsContentChangesConfig, ut as resolveDocsAgentFeedbackRequest, xt as resolveDocsSkillFormat } from "./agent-Ba94vwM2.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/telemetry.ts
|
|
4
|
+
const DOCS_PACKAGE_NAME = "@farming-labs/docs";
|
|
5
|
+
const DOCS_PACKAGE_VERSION = "0.2.25";
|
|
6
|
+
const DEFAULT_DOCS_TELEMETRY_ENDPOINT = "https://docs.farming-labs.dev/api/telemetry/events";
|
|
7
|
+
const PROJECT_TELEMETRY_CACHE_TTL_MS = 1440 * 60 * 1e3;
|
|
8
|
+
const PROJECT_TELEMETRY_CACHE_MAX_KEYS = 256;
|
|
9
|
+
function getRuntimeEnv() {
|
|
10
|
+
if (typeof process === "undefined" || !process.env) return;
|
|
11
|
+
return process.env;
|
|
12
|
+
}
|
|
13
|
+
function readRuntimeEnv(name) {
|
|
14
|
+
const value = getRuntimeEnv()?.[name]?.trim();
|
|
15
|
+
return value ? value : void 0;
|
|
16
|
+
}
|
|
17
|
+
function isTruthyEnv(value) {
|
|
18
|
+
return /^(1|true|yes|on)$/i.test(value ?? "");
|
|
19
|
+
}
|
|
20
|
+
function isFalsyEnv(value) {
|
|
21
|
+
return /^(0|false|no|off)$/i.test(value ?? "");
|
|
22
|
+
}
|
|
23
|
+
function isBrowserRuntime() {
|
|
24
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
25
|
+
}
|
|
26
|
+
function isProductionTelemetryRuntime() {
|
|
27
|
+
if (isBrowserRuntime()) return false;
|
|
28
|
+
const env = getRuntimeEnv();
|
|
29
|
+
if (!env) return true;
|
|
30
|
+
if (env.NODE_ENV === "test") return false;
|
|
31
|
+
if (env.VERCEL_ENV === "production") return true;
|
|
32
|
+
if (env.CONTEXT === "production" && isTruthyEnv(env.NETLIFY)) return true;
|
|
33
|
+
if (isTruthyEnv(env.CF_PAGES)) return true;
|
|
34
|
+
if (env.RENDER_SERVICE_ID || env.FLY_APP_NAME || env.RAILWAY_ENVIRONMENT) return true;
|
|
35
|
+
return env.NODE_ENV === "production";
|
|
36
|
+
}
|
|
37
|
+
function resolveDocsTelemetryConfig(telemetry) {
|
|
38
|
+
const envToggle = readRuntimeEnv("DOCS_TELEMETRY");
|
|
39
|
+
const envDisabled = readRuntimeEnv("DOCS_TELEMETRY_DISABLED");
|
|
40
|
+
if (isFalsyEnv(envToggle) || isTruthyEnv(envDisabled) || telemetry === false) return { enabled: false };
|
|
41
|
+
const objectConfig = telemetry && typeof telemetry === "object" ? telemetry : void 0;
|
|
42
|
+
if (objectConfig?.enabled === false) return { enabled: false };
|
|
43
|
+
return {
|
|
44
|
+
enabled: telemetry === true || objectConfig?.enabled === true || isTruthyEnv(envToggle) || isProductionTelemetryRuntime(),
|
|
45
|
+
endpoint: objectConfig?.endpoint?.trim() || readRuntimeEnv("DOCS_TELEMETRY_ENDPOINT") || DEFAULT_DOCS_TELEMETRY_ENDPOINT
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function readRequestOrigin(request) {
|
|
49
|
+
if (!request?.url) return void 0;
|
|
50
|
+
try {
|
|
51
|
+
return new URL(request.url).origin;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Normalize an HTTP(S) telemetry site value to its origin. */
|
|
57
|
+
function normalizeDocsTelemetryOrigin(candidate) {
|
|
58
|
+
if (typeof candidate !== "string") return void 0;
|
|
59
|
+
const trimmed = candidate.trim();
|
|
60
|
+
if (!trimmed) return void 0;
|
|
61
|
+
try {
|
|
62
|
+
const hasScheme = /^[a-z][a-z\d+.-]*:(?!\d)/i.test(trimmed);
|
|
63
|
+
const url = new URL(hasScheme ? trimmed : `https://${trimmed}`);
|
|
64
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return void 0;
|
|
65
|
+
return url.origin;
|
|
66
|
+
} catch {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Return whether a telemetry origin points at a local development server. */
|
|
71
|
+
function isLocalDocsTelemetryOrigin(candidate) {
|
|
72
|
+
const origin = normalizeDocsTelemetryOrigin(candidate);
|
|
73
|
+
if (!origin) return false;
|
|
74
|
+
const hostname = new URL(origin).hostname.toLowerCase().replace(/^\[|\]$/g, "").replace(/\.+$/, "");
|
|
75
|
+
if ([
|
|
76
|
+
"localhost",
|
|
77
|
+
"localhost.localdomain",
|
|
78
|
+
"localhost6",
|
|
79
|
+
"localhost6.localdomain6",
|
|
80
|
+
"ip6-localhost",
|
|
81
|
+
"ip6-loopback"
|
|
82
|
+
].includes(hostname) || hostname.endsWith(".localhost")) return true;
|
|
83
|
+
if (hostname === "::" || hostname === "::1") return true;
|
|
84
|
+
const ipv4 = hostname.split(".").map((part) => Number(part));
|
|
85
|
+
if (ipv4.length === 4 && ipv4.every((part) => Number.isInteger(part) && part >= 0 && part <= 255)) return ipv4[0] === 127 || ipv4.every((part) => part === 0);
|
|
86
|
+
return /^::ffff:7f[0-9a-f]{2}:/.test(hostname) || hostname === "::ffff:0:0";
|
|
87
|
+
}
|
|
88
|
+
function isBlockedDocsTelemetryOrigin(candidate) {
|
|
89
|
+
if (candidate === void 0) return false;
|
|
90
|
+
return !normalizeDocsTelemetryOrigin(candidate) || isLocalDocsTelemetryOrigin(candidate);
|
|
91
|
+
}
|
|
92
|
+
function readDeploymentOrigin() {
|
|
93
|
+
const candidates = [
|
|
94
|
+
readRuntimeEnv("DOCS_SITE_URL"),
|
|
95
|
+
readRuntimeEnv("NEXT_PUBLIC_BASE_URL"),
|
|
96
|
+
readRuntimeEnv("NEXT_PUBLIC_SITE_URL"),
|
|
97
|
+
readRuntimeEnv("SITE_URL"),
|
|
98
|
+
readRuntimeEnv("URL"),
|
|
99
|
+
readRuntimeEnv("CF_PAGES_URL"),
|
|
100
|
+
readRuntimeEnv("VERCEL_PROJECT_PRODUCTION_URL"),
|
|
101
|
+
readRuntimeEnv("VERCEL_URL"),
|
|
102
|
+
readRuntimeEnv("DEPLOY_PRIME_URL")
|
|
103
|
+
];
|
|
104
|
+
for (const candidate of candidates) {
|
|
105
|
+
const origin = normalizeDocsTelemetryOrigin(candidate);
|
|
106
|
+
if (origin) return origin;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function detectDeployment() {
|
|
110
|
+
const env = getRuntimeEnv();
|
|
111
|
+
if (!env) return void 0;
|
|
112
|
+
if (env.VERCEL || env.VERCEL_ENV) return {
|
|
113
|
+
provider: "vercel",
|
|
114
|
+
environment: env.VERCEL_ENV,
|
|
115
|
+
id: env.VERCEL_DEPLOYMENT_ID ?? env.VERCEL_GIT_COMMIT_SHA,
|
|
116
|
+
region: env.VERCEL_REGION
|
|
117
|
+
};
|
|
118
|
+
if (env.NETLIFY) return {
|
|
119
|
+
provider: "netlify",
|
|
120
|
+
environment: env.CONTEXT,
|
|
121
|
+
id: env.DEPLOY_ID ?? env.COMMIT_REF
|
|
122
|
+
};
|
|
123
|
+
if (env.CF_PAGES) return {
|
|
124
|
+
provider: "cloudflare-pages",
|
|
125
|
+
environment: env.CF_PAGES_BRANCH,
|
|
126
|
+
id: env.CF_PAGES_COMMIT_SHA
|
|
127
|
+
};
|
|
128
|
+
if (env.RENDER_SERVICE_ID) return {
|
|
129
|
+
provider: "render",
|
|
130
|
+
environment: env.RENDER_ENV,
|
|
131
|
+
id: env.RENDER_SERVICE_ID
|
|
132
|
+
};
|
|
133
|
+
if (env.FLY_APP_NAME) return {
|
|
134
|
+
provider: "fly",
|
|
135
|
+
environment: env.FLY_APP_NAME,
|
|
136
|
+
id: env.FLY_ALLOC_ID,
|
|
137
|
+
region: env.FLY_REGION
|
|
138
|
+
};
|
|
139
|
+
if (env.RAILWAY_ENVIRONMENT) return {
|
|
140
|
+
provider: "railway",
|
|
141
|
+
environment: env.RAILWAY_ENVIRONMENT,
|
|
142
|
+
id: env.RAILWAY_DEPLOYMENT_ID
|
|
143
|
+
};
|
|
144
|
+
return env.NODE_ENV === "production" ? { environment: "production" } : void 0;
|
|
145
|
+
}
|
|
146
|
+
function detectRuntime() {
|
|
147
|
+
if (typeof process !== "undefined" && process.versions?.node) return {
|
|
148
|
+
name: "node",
|
|
149
|
+
version: process.versions.node
|
|
150
|
+
};
|
|
151
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) return { name: "web-standard" };
|
|
152
|
+
}
|
|
153
|
+
function isObjectConfigEnabled(value, defaultEnabled) {
|
|
154
|
+
if (value === false) return false;
|
|
155
|
+
if (value === true) return true;
|
|
156
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
157
|
+
const enabled = value.enabled;
|
|
158
|
+
return enabled === false ? false : defaultEnabled || enabled === true;
|
|
159
|
+
}
|
|
160
|
+
return defaultEnabled;
|
|
161
|
+
}
|
|
162
|
+
function hasObjectConfig(value) {
|
|
163
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
164
|
+
}
|
|
165
|
+
function getDocsTelemetryFeatures(config) {
|
|
166
|
+
const pageActions = config.pageActions;
|
|
167
|
+
const feedback = config.feedback;
|
|
168
|
+
return {
|
|
169
|
+
search: isObjectConfigEnabled(config.search, true),
|
|
170
|
+
contentChanges: resolveDocsContentChangesConfig(config.agent?.contentChanges, { staticExport: config.staticExport === true }).enabled,
|
|
171
|
+
ai: isObjectConfigEnabled(config.ai, false),
|
|
172
|
+
mcp: isObjectConfigEnabled(config.mcp, true),
|
|
173
|
+
llmsTxt: isObjectConfigEnabled(config.llmsTxt, true),
|
|
174
|
+
pageActions: hasObjectConfig(pageActions),
|
|
175
|
+
feedback: feedback === true || hasObjectConfig(feedback) && feedback.enabled !== false,
|
|
176
|
+
agentFeedback: feedback !== false && !(hasObjectConfig(feedback) && feedback.agent === false) && !(hasObjectConfig(feedback) && hasObjectConfig(feedback.agent) && feedback.agent.enabled === false),
|
|
177
|
+
sitemap: isObjectConfigEnabled(config.sitemap, true),
|
|
178
|
+
robots: isObjectConfigEnabled(config.robots, true),
|
|
179
|
+
apiReference: isObjectConfigEnabled(config.apiReference, false),
|
|
180
|
+
staticExport: config.staticExport === true,
|
|
181
|
+
changelog: isObjectConfigEnabled(config.changelog, false),
|
|
182
|
+
cloud: typeof config.cloud !== "undefined" && isObjectConfigEnabled(config.cloud, true),
|
|
183
|
+
review: isObjectConfigEnabled(config.review, true),
|
|
184
|
+
codeBlocksValidate: hasObjectConfig(config.codeBlocks) && Boolean(config.codeBlocks.validate)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function createDocsTelemetryEvent(config, input, context = {}) {
|
|
188
|
+
const telemetryConfig = config.telemetry && typeof config.telemetry === "object" ? config.telemetry : void 0;
|
|
189
|
+
const siteOriginCandidates = [
|
|
190
|
+
context.siteOrigin,
|
|
191
|
+
input.site?.origin,
|
|
192
|
+
telemetryConfig?.siteOrigin,
|
|
193
|
+
readRequestOrigin(context.request),
|
|
194
|
+
readDeploymentOrigin()
|
|
195
|
+
];
|
|
196
|
+
if (siteOriginCandidates.some(isBlockedDocsTelemetryOrigin)) return void 0;
|
|
197
|
+
const siteOrigin = siteOriginCandidates.map(normalizeDocsTelemetryOrigin).find((origin) => Boolean(origin));
|
|
198
|
+
const deployment = input.deployment ?? detectDeployment();
|
|
199
|
+
const properties = context.properties || input.properties ? {
|
|
200
|
+
...input.properties,
|
|
201
|
+
...context.properties
|
|
202
|
+
} : void 0;
|
|
203
|
+
return {
|
|
204
|
+
...input,
|
|
205
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
206
|
+
package: {
|
|
207
|
+
name: DOCS_PACKAGE_NAME,
|
|
208
|
+
version: DOCS_PACKAGE_VERSION,
|
|
209
|
+
...input.package
|
|
210
|
+
},
|
|
211
|
+
framework: input.framework ?? context.framework,
|
|
212
|
+
runtime: input.runtime ?? detectRuntime(),
|
|
213
|
+
site: siteOrigin ? { origin: siteOrigin } : input.site,
|
|
214
|
+
deployment,
|
|
215
|
+
features: input.features ?? getDocsTelemetryFeatures(config),
|
|
216
|
+
properties
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function projectEventKey(event) {
|
|
220
|
+
return [
|
|
221
|
+
event.package.name,
|
|
222
|
+
event.package.version,
|
|
223
|
+
event.framework ?? "",
|
|
224
|
+
event.site?.origin ?? "",
|
|
225
|
+
event.deployment?.provider ?? "",
|
|
226
|
+
event.deployment?.environment ?? "",
|
|
227
|
+
event.deployment?.id ?? ""
|
|
228
|
+
].join("|");
|
|
229
|
+
}
|
|
230
|
+
function getSentProjectKeys() {
|
|
231
|
+
const globalValue = globalThis;
|
|
232
|
+
globalValue.__farmingLabsDocsTelemetryProjectKeys__ ??= /* @__PURE__ */ new Map();
|
|
233
|
+
return globalValue.__farmingLabsDocsTelemetryProjectKeys__;
|
|
234
|
+
}
|
|
235
|
+
function pruneSentProjectKeys(sent, now) {
|
|
236
|
+
for (const [key, expiresAt] of sent) if (expiresAt <= now) sent.delete(key);
|
|
237
|
+
while (sent.size >= PROJECT_TELEMETRY_CACHE_MAX_KEYS) {
|
|
238
|
+
const oldestKey = sent.keys().next().value;
|
|
239
|
+
if (!oldestKey) return;
|
|
240
|
+
sent.delete(oldestKey);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async function emitDocsTelemetryEvent(telemetry, event) {
|
|
244
|
+
const resolved = resolveDocsTelemetryConfig(telemetry);
|
|
245
|
+
const eventSiteOrigin = event.site?.origin;
|
|
246
|
+
const normalizedSiteOrigin = normalizeDocsTelemetryOrigin(eventSiteOrigin);
|
|
247
|
+
if (!resolved.enabled || !resolved.endpoint || typeof fetch !== "function" || eventSiteOrigin !== void 0 && (!normalizedSiteOrigin || isLocalDocsTelemetryOrigin(eventSiteOrigin))) return;
|
|
248
|
+
const eventToSend = normalizedSiteOrigin ? {
|
|
249
|
+
...event,
|
|
250
|
+
site: { origin: normalizedSiteOrigin }
|
|
251
|
+
} : event;
|
|
252
|
+
try {
|
|
253
|
+
const ingestKey = readRuntimeEnv("DOCS_TELEMETRY_INGEST_KEY");
|
|
254
|
+
const headers = { "content-type": "application/json" };
|
|
255
|
+
if (ingestKey) headers["x-docs-telemetry-key"] = ingestKey;
|
|
256
|
+
await fetch(resolved.endpoint, {
|
|
257
|
+
method: "POST",
|
|
258
|
+
headers,
|
|
259
|
+
body: JSON.stringify({ event: eventToSend }),
|
|
260
|
+
keepalive: true
|
|
261
|
+
});
|
|
262
|
+
} catch {}
|
|
263
|
+
}
|
|
264
|
+
function emitDocsTelemetryProjectEvent(config, context = {}) {
|
|
265
|
+
const event = createDocsTelemetryEvent(config, { type: "project_detected" }, context);
|
|
266
|
+
if (!event) return;
|
|
267
|
+
const key = projectEventKey(event);
|
|
268
|
+
const sent = getSentProjectKeys();
|
|
269
|
+
const now = Date.now();
|
|
270
|
+
const expiresAt = sent.get(key);
|
|
271
|
+
if (expiresAt && expiresAt > now) return;
|
|
272
|
+
if (typeof expiresAt === "number") sent.delete(key);
|
|
273
|
+
pruneSentProjectKeys(sent, now);
|
|
274
|
+
sent.set(key, now + PROJECT_TELEMETRY_CACHE_TTL_MS);
|
|
275
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
276
|
+
}
|
|
277
|
+
function emitDocsTelemetryAgentSurfaceEvent(config, context) {
|
|
278
|
+
const event = createDocsTelemetryEvent(config, {
|
|
279
|
+
type: context.surface === "mcp" ? "mcp_request" : "agent_surface_used",
|
|
280
|
+
properties: { surface: context.surface }
|
|
281
|
+
}, context);
|
|
282
|
+
if (!event) return;
|
|
283
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
284
|
+
}
|
|
285
|
+
function emitDocsTelemetryMcpToolEvent(config, context) {
|
|
286
|
+
const event = createDocsTelemetryEvent(config, {
|
|
287
|
+
type: "mcp_tool_used",
|
|
288
|
+
properties: {
|
|
289
|
+
tool: context.tool,
|
|
290
|
+
locale: context.locale,
|
|
291
|
+
resultCount: context.resultCount
|
|
292
|
+
}
|
|
293
|
+
}, context);
|
|
294
|
+
if (!event) return;
|
|
295
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
296
|
+
}
|
|
297
|
+
function inferDocsTelemetryAgentSurface(request, options) {
|
|
298
|
+
const url = new URL(request.url);
|
|
299
|
+
const method = request.method.toUpperCase();
|
|
300
|
+
const feedbackRequest = resolveDocsAgentFeedbackRequest(url, resolveDocsAgentFeedbackConfig(options.feedback));
|
|
301
|
+
if ((method === "GET" || method === "HEAD") && isDocsAgentDiscoveryRequest(url)) return "agent_spec";
|
|
302
|
+
if ((method === "GET" || method === "HEAD") && feedbackRequest?.kind === "schema") return "agent_feedback_schema";
|
|
303
|
+
if (method === "POST" && feedbackRequest?.kind === "submit") return "agent_feedback_submit";
|
|
304
|
+
if (method === "GET" || method === "HEAD") {
|
|
305
|
+
if (isDocsContentChangesRequest(url)) return "content_changes";
|
|
306
|
+
if (isDocsAgentsRequest(url) || resolveDocsAgentsFormat(url) === "agents") return "agents";
|
|
307
|
+
if (isDocsSkillRequest(url) || resolveDocsSkillFormat(url) === "skill") return "skill";
|
|
308
|
+
if (resolveDocsMarkdownRequest(options.entry, url, request)) return "markdown";
|
|
309
|
+
if (resolveDocsLlmsTxtRequest(url, options.llmsTxt, options.entry)) return "llms";
|
|
310
|
+
}
|
|
311
|
+
if (method === "POST") return "ask_ai";
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/sidebar.ts
|
|
316
|
+
function resolvePageSidebarFolderIndexBehavior(sidebar) {
|
|
317
|
+
if (!sidebar || typeof sidebar !== "object") return void 0;
|
|
318
|
+
const value = sidebar.folderIndexBehavior;
|
|
319
|
+
return value === "link" || value === "toggle" || value === "hidden" ? value : void 0;
|
|
320
|
+
}
|
|
321
|
+
function normalizeSidebarFolderBehaviorPath(path) {
|
|
322
|
+
if (!path) return void 0;
|
|
323
|
+
let value = path.trim();
|
|
324
|
+
if (!value) return void 0;
|
|
325
|
+
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(value)) try {
|
|
326
|
+
value = new URL(value).pathname;
|
|
327
|
+
} catch {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
else value = value.split("#", 1)[0]?.split("?", 1)[0] ?? value;
|
|
331
|
+
if (!value.startsWith("/")) value = `/${value}`;
|
|
332
|
+
return value.replace(/\/$/, "") || "/";
|
|
333
|
+
}
|
|
334
|
+
function resolveSidebarFolderIndexBehavior(sidebar, defaultBehavior = "link") {
|
|
335
|
+
if (sidebar === void 0 || sidebar === true || sidebar === false) return defaultBehavior;
|
|
336
|
+
if (sidebar.folderIndexBehavior === "toggle") return "toggle";
|
|
337
|
+
if (sidebar.folderIndexBehavior === "hidden") return "hidden";
|
|
338
|
+
if (sidebar.folderIndexBehavior === "link") return "link";
|
|
339
|
+
return defaultBehavior;
|
|
340
|
+
}
|
|
341
|
+
function resolveSidebarFolderIndexBehaviorForPath(sidebar, folderPath, defaultBehavior = "link") {
|
|
342
|
+
const fallback = resolveSidebarFolderIndexBehavior(sidebar, defaultBehavior);
|
|
343
|
+
if (!sidebar || typeof sidebar !== "object") return fallback;
|
|
344
|
+
const normalizedPath = normalizeSidebarFolderBehaviorPath(folderPath);
|
|
345
|
+
if (!normalizedPath) return fallback;
|
|
346
|
+
for (const [rawPath, override] of Object.entries(sidebar.folderIndexBehaviorOverrides ?? {})) if (normalizeSidebarFolderBehaviorPath(rawPath) === normalizedPath) return override === "link" || override === "toggle" || override === "hidden" ? override : fallback;
|
|
347
|
+
return fallback;
|
|
348
|
+
}
|
|
349
|
+
function applySidebarFolderIndexBehavior(tree, behaviorOrOptions) {
|
|
350
|
+
const resolveBehavior = typeof behaviorOrOptions === "string" ? () => behaviorOrOptions : (folderPath) => resolveSidebarFolderIndexBehaviorForPath(behaviorOrOptions.sidebar, folderPath, behaviorOrOptions.defaultBehavior);
|
|
351
|
+
function mapNode(node) {
|
|
352
|
+
if (!node || typeof node !== "object") return node;
|
|
353
|
+
const candidate = node;
|
|
354
|
+
if (candidate.type !== "folder" || !Array.isArray(candidate.children)) return node;
|
|
355
|
+
const children = candidate.children.map(mapNode);
|
|
356
|
+
const index = candidate.index ? mapNode(candidate.index) : void 0;
|
|
357
|
+
const folderPath = (typeof candidate.url === "string" ? candidate.url : void 0) || (candidate.index && typeof candidate.index === "object" && "url" in candidate.index && typeof candidate.index.url === "string" ? candidate.index.url ?? void 0 : void 0);
|
|
358
|
+
const behavior = (candidate.folderIndexBehavior === "link" || candidate.folderIndexBehavior === "toggle" || candidate.folderIndexBehavior === "hidden" ? candidate.folderIndexBehavior : void 0) ?? resolveBehavior(folderPath);
|
|
359
|
+
if (behavior === "link") return {
|
|
360
|
+
...candidate,
|
|
361
|
+
folderIndexBehavior: void 0,
|
|
362
|
+
index,
|
|
363
|
+
children
|
|
364
|
+
};
|
|
365
|
+
if (behavior === "hidden") return {
|
|
366
|
+
...candidate,
|
|
367
|
+
folderIndexBehavior: void 0,
|
|
368
|
+
index: void 0,
|
|
369
|
+
url: void 0,
|
|
370
|
+
children
|
|
371
|
+
};
|
|
372
|
+
return {
|
|
373
|
+
...candidate,
|
|
374
|
+
folderIndexBehavior: void 0,
|
|
375
|
+
index: void 0,
|
|
376
|
+
url: void 0,
|
|
377
|
+
children: index ? [index, ...children] : children
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
return {
|
|
381
|
+
...tree,
|
|
382
|
+
children: tree.children.map(mapNode)
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/agent-provenance.ts
|
|
388
|
+
const GENERATED_AGENT_PROVENANCE_MARKER = "@farming-labs/docs:generated";
|
|
389
|
+
const GENERATED_AGENT_PROVENANCE_VERSION = 1;
|
|
390
|
+
function normalizeLineEndings(value) {
|
|
391
|
+
return value.replace(/\r\n?/g, "\n").replace(/^\uFEFF/, "");
|
|
392
|
+
}
|
|
393
|
+
function normalizeGeneratedAgentContent(value) {
|
|
394
|
+
return normalizeLineEndings(value).trimEnd();
|
|
395
|
+
}
|
|
396
|
+
function hashGeneratedAgentContent(value) {
|
|
397
|
+
const normalized = normalizeGeneratedAgentContent(value);
|
|
398
|
+
const bytes = new TextEncoder().encode(normalized);
|
|
399
|
+
let hash = 14695981039346656037n;
|
|
400
|
+
for (const byte of bytes) {
|
|
401
|
+
hash ^= BigInt(byte);
|
|
402
|
+
hash = BigInt.asUintN(64, hash * 1099511628211n);
|
|
403
|
+
}
|
|
404
|
+
return `fnv1a64:${hash.toString(16).padStart(16, "0")}`;
|
|
405
|
+
}
|
|
406
|
+
function parseProvenanceBlock(rawBlock) {
|
|
407
|
+
const entries = /* @__PURE__ */ new Map();
|
|
408
|
+
for (const line of rawBlock.split("\n")) {
|
|
409
|
+
const trimmed = line.trim();
|
|
410
|
+
if (!trimmed) continue;
|
|
411
|
+
const separatorIndex = trimmed.indexOf("=");
|
|
412
|
+
if (separatorIndex <= 0) continue;
|
|
413
|
+
const key = trimmed.slice(0, separatorIndex).trim();
|
|
414
|
+
const value = trimmed.slice(separatorIndex + 1).trim();
|
|
415
|
+
if (!key || !value) continue;
|
|
416
|
+
entries.set(key, value);
|
|
417
|
+
}
|
|
418
|
+
const version = Number.parseInt(entries.get("version") ?? "", 10);
|
|
419
|
+
const sourceKind = entries.get("sourceKind");
|
|
420
|
+
const sourceHash = entries.get("sourceHash");
|
|
421
|
+
const settingsHash = entries.get("settingsHash");
|
|
422
|
+
const outputHash = entries.get("outputHash");
|
|
423
|
+
const generatedAt = entries.get("generatedAt");
|
|
424
|
+
if (!Number.isFinite(version) || sourceKind !== "resolved-page" && sourceKind !== "agent-md" || !sourceHash || !settingsHash || !outputHash || !generatedAt) return;
|
|
425
|
+
return {
|
|
426
|
+
version,
|
|
427
|
+
sourceKind,
|
|
428
|
+
sourceHash,
|
|
429
|
+
settingsHash,
|
|
430
|
+
outputHash,
|
|
431
|
+
generatedAt
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function parseGeneratedAgentDocument(raw) {
|
|
435
|
+
const normalized = normalizeLineEndings(raw);
|
|
436
|
+
const headerPattern = new RegExp(`^<!-- ${GENERATED_AGENT_PROVENANCE_MARKER}\\n([\\s\\S]*?)\\n-->\\n?`);
|
|
437
|
+
const match = normalized.match(headerPattern);
|
|
438
|
+
if (!match) return { content: normalized };
|
|
439
|
+
return {
|
|
440
|
+
provenance: parseProvenanceBlock(match[1]),
|
|
441
|
+
content: normalized.slice(match[0].length)
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function stripGeneratedAgentProvenance(raw) {
|
|
445
|
+
return parseGeneratedAgentDocument(raw).content;
|
|
446
|
+
}
|
|
447
|
+
function serializeGeneratedAgentDocument(content, provenance) {
|
|
448
|
+
const normalizedContent = normalizeGeneratedAgentContent(content);
|
|
449
|
+
return `${[
|
|
450
|
+
`<!-- ${GENERATED_AGENT_PROVENANCE_MARKER}`,
|
|
451
|
+
`version=${provenance.version}`,
|
|
452
|
+
`sourceKind=${provenance.sourceKind}`,
|
|
453
|
+
`sourceHash=${provenance.sourceHash}`,
|
|
454
|
+
`settingsHash=${provenance.settingsHash}`,
|
|
455
|
+
`outputHash=${provenance.outputHash}`,
|
|
456
|
+
`generatedAt=${provenance.generatedAt}`,
|
|
457
|
+
"-->",
|
|
458
|
+
normalizedContent
|
|
459
|
+
].join("\n")}\n`;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
//#endregion
|
|
463
|
+
export { inferDocsTelemetryAgentSurface as _, parseGeneratedAgentDocument as a, resolveDocsTelemetryConfig as b, applySidebarFolderIndexBehavior as c, resolveSidebarFolderIndexBehaviorForPath as d, emitDocsTelemetryAgentSurfaceEvent as f, getDocsTelemetryFeatures as g, emitDocsTelemetryProjectEvent as h, normalizeGeneratedAgentContent as i, resolvePageSidebarFolderIndexBehavior as l, emitDocsTelemetryMcpToolEvent as m, GENERATED_AGENT_PROVENANCE_VERSION as n, serializeGeneratedAgentDocument as o, emitDocsTelemetryEvent as p, hashGeneratedAgentContent as r, stripGeneratedAgentProvenance as s, GENERATED_AGENT_PROVENANCE_MARKER as t, resolveSidebarFolderIndexBehavior as u, isLocalDocsTelemetryOrigin as v, normalizeDocsTelemetryOrigin as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z as DocsPublishedAgentSkill } from "./standards-discovery-
|
|
1
|
+
import { et as DocsAgentSkillsInput } from "./types-CpLnwHak.mjs";
|
|
2
|
+
import { z as DocsPublishedAgentSkill } from "./standards-discovery-BWyNgZSs.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/agent-skills-server.d.ts
|
|
5
5
|
interface ResolveConfiguredAgentSkillsOptions {
|