@farming-labs/docs 0.2.80 → 0.2.82
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-aWl_O6xn.mjs → agent-Biyd8A98.mjs} +2 -2
- package/dist/{agent-Cj50nyeV.mjs → agent-Dze2Cy5B.mjs} +1 -1
- package/dist/{agent-DGALg9hQ.d.mts → agent-WS4GXGh6.d.mts} +88 -3
- package/dist/{agent-evals-DvQQtN62.mjs → agent-evals-Burrzyam.mjs} +19 -4
- package/dist/{agent-export-BISSb83U.mjs → agent-export-whKAZQUI.mjs} +8 -8
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-server-B2EXn2QD.mjs → agent-skills-server-D5qYU19g.mjs} +16 -7
- package/dist/{agent-skills-server-Daq-FOay.d.mts → agent-skills-server-q4B9kRGg.d.mts} +2 -2
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +1 -1
- package/dist/{agents-DLNUgcgU.mjs → agents-B_980VCs.mjs} +6 -6
- package/dist/cli/index.mjs +16 -16
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-ask-ai-o41WfOTk.d.mts → cloud-ask-ai-BQAeHkpZ.d.mts} +1 -1
- package/dist/{codeblocks-CFuurVIH.mjs → codeblocks-CPA6Ae5r.mjs} +1 -1
- package/dist/{agent-provenance-C_jgqNTW.mjs → content-change-hydration-DpQ0KdAD.mjs} +218 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +1 -1
- package/dist/{doctor-BxP-UHaE.mjs → doctor-WjuyRWYT.mjs} +32 -15
- package/dist/{golden-evaluations-Bk8MBi3Z.mjs → golden-evaluations-B2GHnoFa.mjs} +307 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{mcp-BU63wzaM.mjs → mcp-bhIsgqxy.mjs} +6 -6
- package/dist/mcp.d.mts +6 -5
- package/dist/mcp.mjs +199 -25
- package/dist/{prompt-references-CMMoF6AY.mjs → prompt-references-embiJdYt.mjs} +2 -2
- package/dist/{retrieval-digest-DIbiu0TW.d.mts → retrieval-digest-DRRHA1B3.d.mts} +2 -2
- package/dist/{review-D14mUw5D.mjs → review-2e4TXoGS.mjs} +71 -10
- package/dist/{robots-DmczzidR.mjs → robots-BIySk2gE.mjs} +2 -2
- package/dist/{robots-BukukxNm.mjs → robots-D96X6eVX.mjs} +1 -1
- package/dist/{search-DP96dV3e.mjs → search-DfB3LQ4s.mjs} +6 -6
- package/dist/server.d.mts +6 -6
- package/dist/server.mjs +8 -8
- package/dist/{sitemap-DuosRvmn.mjs → sitemap-AcwP8jIo.mjs} +6 -6
- package/dist/{sitemap-server-DzlV1NOB.mjs → sitemap-server-BefXEox6.mjs} +1 -1
- package/dist/{standards-discovery-C2cUIQzW.d.mts → standards-discovery-DPUEcUmb.d.mts} +1 -1
- package/dist/{types-o-ULHPK6.d.mts → types-lGEHcx_6.d.mts} +44 -1
- package/package.json +1 -1
- /package/dist/{cloud-ask-ai-sbpjOR2K.mjs → cloud-ask-ai-BRBK4RBG.mjs} +0 -0
- /package/dist/{code-blocks-DnNVNK2M.mjs → code-blocks-0wjOsqdJ.mjs} +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { G as isDocsAgentDiscoveryRequest, Jt as resolveDocsContentChangesConfig, K as isDocsAgentsRequest, Q as isDocsSkillRequest, _t as resolveDocsMarkdownRequest, dt as resolveDocsAgentsFormat, lt as resolveDocsAgentFeedbackConfig, pt as resolveDocsLlmsTxtRequest, qt as isDocsContentChangesRequest, ut as resolveDocsAgentFeedbackRequest, xt as resolveDocsSkillFormat } from "./agent-
|
|
1
|
+
import { $t as buildDocsRetrievalDigestProjection, Fn as createDocsPaginationCursor, G as isDocsAgentDiscoveryRequest, Jt as resolveDocsContentChangesConfig, K as isDocsAgentsRequest, Ln as resolveDocsPaginationOffset, Pn as DocsPaginationCursorError, Q as isDocsSkillRequest, Rn as digestDocsRetrievalContent, _t as resolveDocsMarkdownRequest, dt as resolveDocsAgentsFormat, lt as resolveDocsAgentFeedbackConfig, pt as resolveDocsLlmsTxtRequest, qt as isDocsContentChangesRequest, ut as resolveDocsAgentFeedbackRequest, xt as resolveDocsSkillFormat } from "./agent-Dze2Cy5B.mjs";
|
|
2
|
+
import { s as parseDocsMarkdownSections } from "./markdown-sections-7OoA7ylx.mjs";
|
|
3
|
+
import matter from "gray-matter";
|
|
2
4
|
|
|
3
5
|
//#region src/telemetry.ts
|
|
4
6
|
const DOCS_PACKAGE_NAME = "@farming-labs/docs";
|
|
@@ -460,4 +462,218 @@ function serializeGeneratedAgentDocument(content, provenance) {
|
|
|
460
462
|
}
|
|
461
463
|
|
|
462
464
|
//#endregion
|
|
463
|
-
|
|
465
|
+
//#region src/content-change-hydration.ts
|
|
466
|
+
const DOCS_CONTENT_CHANGE_HYDRATION_FORMAT = "docs-content-change-hydration.v1";
|
|
467
|
+
const DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET = 5e3;
|
|
468
|
+
const MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET = 4;
|
|
469
|
+
const MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET = 32e3;
|
|
470
|
+
const DOCS_CONTENT_CHANGE_HYDRATION_PAGE_SIZE = 25;
|
|
471
|
+
const DOCS_CONTENT_CHANGE_HYDRATION_CURSOR_KIND = "mcp.tool/hydrate_content_changes";
|
|
472
|
+
function docsHydrationUtf8Bytes(value) {
|
|
473
|
+
return new TextEncoder().encode(value).byteLength;
|
|
474
|
+
}
|
|
475
|
+
function appendDocsHydrationLocale(url, locale) {
|
|
476
|
+
if (!locale) return url;
|
|
477
|
+
const hashIndex = url.indexOf("#");
|
|
478
|
+
const withoutHash = hashIndex >= 0 ? url.slice(0, hashIndex) : url;
|
|
479
|
+
const hash = hashIndex >= 0 ? url.slice(hashIndex) : "";
|
|
480
|
+
const queryIndex = withoutHash.indexOf("?");
|
|
481
|
+
const rawQuery = queryIndex >= 0 ? withoutHash.slice(queryIndex + 1) : "";
|
|
482
|
+
if (new URLSearchParams(rawQuery).has("lang")) return url;
|
|
483
|
+
return `${withoutHash}${queryIndex >= 0 ? "&" : "?"}lang=${encodeURIComponent(locale)}${hash}`;
|
|
484
|
+
}
|
|
485
|
+
function splitDocsHydrationChunk(value, maxUtf8Bytes) {
|
|
486
|
+
if (docsHydrationUtf8Bytes(value) <= maxUtf8Bytes) return [value, ""];
|
|
487
|
+
const encoder = new TextEncoder();
|
|
488
|
+
let usedUtf8Bytes = 0;
|
|
489
|
+
let endOffset = 0;
|
|
490
|
+
let paragraphOffset = -1;
|
|
491
|
+
let lineOffset = -1;
|
|
492
|
+
for (const character of value) {
|
|
493
|
+
const characterUtf8Bytes = encoder.encode(character).byteLength;
|
|
494
|
+
if (usedUtf8Bytes + characterUtf8Bytes > maxUtf8Bytes) break;
|
|
495
|
+
usedUtf8Bytes += characterUtf8Bytes;
|
|
496
|
+
endOffset += character.length;
|
|
497
|
+
if (value.slice(Math.max(0, endOffset - 2), endOffset) === "\n\n") paragraphOffset = endOffset;
|
|
498
|
+
else if (character === "\n") lineOffset = endOffset;
|
|
499
|
+
}
|
|
500
|
+
const minimumUsefulBoundary = Math.floor(endOffset * .5);
|
|
501
|
+
const boundary = paragraphOffset >= minimumUsefulBoundary ? paragraphOffset : lineOffset >= minimumUsefulBoundary ? lineOffset : endOffset;
|
|
502
|
+
return [value.slice(0, boundary), value.slice(boundary)];
|
|
503
|
+
}
|
|
504
|
+
function splitDocsHydrationContent(value, maxUtf8Bytes) {
|
|
505
|
+
if (!value) return [""];
|
|
506
|
+
const chunks = [];
|
|
507
|
+
let remaining = value;
|
|
508
|
+
while (remaining) {
|
|
509
|
+
const [chunk, next] = splitDocsHydrationChunk(remaining, maxUtf8Bytes);
|
|
510
|
+
if (!chunk && next === remaining) throw new TypeError("Unable to split changed content within the requested token budget.");
|
|
511
|
+
chunks.push(chunk);
|
|
512
|
+
remaining = next;
|
|
513
|
+
}
|
|
514
|
+
return chunks;
|
|
515
|
+
}
|
|
516
|
+
function partitionDocsHydrationSections(document, page) {
|
|
517
|
+
const body = matter(document).content.trim();
|
|
518
|
+
const parsed = parseDocsMarkdownSections(body);
|
|
519
|
+
if (parsed.length === 0) return [{
|
|
520
|
+
id: "document",
|
|
521
|
+
heading: page.title,
|
|
522
|
+
level: 1,
|
|
523
|
+
content: body
|
|
524
|
+
}];
|
|
525
|
+
const lines = body.split(/\r?\n/u);
|
|
526
|
+
return parsed.map((section, index) => {
|
|
527
|
+
const startLine = index === 0 ? 0 : Math.max(0, section.startLine - 1);
|
|
528
|
+
const nextStartLine = parsed[index + 1]?.startLine;
|
|
529
|
+
const endLine = nextStartLine ? Math.max(startLine, nextStartLine - 1) : lines.length;
|
|
530
|
+
return {
|
|
531
|
+
id: section.anchor,
|
|
532
|
+
heading: section.title,
|
|
533
|
+
level: section.level,
|
|
534
|
+
content: lines.slice(startLine, endLine).join("\n").trim()
|
|
535
|
+
};
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function toHydrationContentUnits(change, kind, page, maxUtf8Bytes) {
|
|
539
|
+
return partitionDocsHydrationSections(buildDocsRetrievalDigestProjection(page, "agent"), page).flatMap((section) => {
|
|
540
|
+
const sectionDigest = digestDocsRetrievalContent(section.content);
|
|
541
|
+
const chunks = splitDocsHydrationContent(section.content, maxUtf8Bytes);
|
|
542
|
+
return chunks.map((content, index) => ({
|
|
543
|
+
type: "content",
|
|
544
|
+
change: kind,
|
|
545
|
+
url: change.url,
|
|
546
|
+
canonicalUrl: change.canonicalUrl,
|
|
547
|
+
digest: change.digest,
|
|
548
|
+
..."previousDigest" in change ? { previousDigest: change.previousDigest } : {},
|
|
549
|
+
...change.lastModified ? { lastModified: change.lastModified } : {},
|
|
550
|
+
..."previousLastModified" in change && change.previousLastModified ? { previousLastModified: change.previousLastModified } : {},
|
|
551
|
+
section: {
|
|
552
|
+
id: section.id,
|
|
553
|
+
heading: section.heading,
|
|
554
|
+
level: section.level
|
|
555
|
+
},
|
|
556
|
+
sectionDigest,
|
|
557
|
+
chunkDigest: digestDocsRetrievalContent(content),
|
|
558
|
+
chunk: {
|
|
559
|
+
index,
|
|
560
|
+
count: chunks.length
|
|
561
|
+
},
|
|
562
|
+
content,
|
|
563
|
+
utf8Bytes: docsHydrationUtf8Bytes(content)
|
|
564
|
+
}));
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
function buildDocsHydrationUnits(changes, pages, maxUtf8Bytes) {
|
|
568
|
+
const pagesByUrl = /* @__PURE__ */ new Map();
|
|
569
|
+
for (const page of pages) {
|
|
570
|
+
pagesByUrl.set(page.url, page);
|
|
571
|
+
pagesByUrl.set(appendDocsHydrationLocale(page.url, changes.locale), page);
|
|
572
|
+
}
|
|
573
|
+
const currentUnits = [...changes.added.map((change) => [change, "added"]), ...changes.changed.map((change) => [change, "changed"])].flatMap(([change, kind]) => {
|
|
574
|
+
const page = pagesByUrl.get(change.url);
|
|
575
|
+
if (!page) throw new TypeError(`Unable to hydrate changed documentation content for ${change.url}.`);
|
|
576
|
+
return toHydrationContentUnits(change, kind, page, maxUtf8Bytes);
|
|
577
|
+
});
|
|
578
|
+
const tombstones = changes.deleted.map((change) => ({
|
|
579
|
+
type: "tombstone",
|
|
580
|
+
change: "deleted",
|
|
581
|
+
url: change.url,
|
|
582
|
+
canonicalUrl: change.canonicalUrl,
|
|
583
|
+
digest: change.digest,
|
|
584
|
+
...change.lastModified ? { lastModified: change.lastModified } : {}
|
|
585
|
+
}));
|
|
586
|
+
return [...currentUnits, ...tombstones];
|
|
587
|
+
}
|
|
588
|
+
function resolveDocsHydrationTokenBudget(value) {
|
|
589
|
+
const tokenBudget = value ?? DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET;
|
|
590
|
+
if (!Number.isSafeInteger(tokenBudget) || tokenBudget < MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET || tokenBudget > MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET) throw new TypeError(`Content-change hydration tokenBudget must be between ${MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET} and ${MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET}.`);
|
|
591
|
+
return tokenBudget;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Hydrate only the current bodies named by a content-change delta.
|
|
595
|
+
*
|
|
596
|
+
* The conservative budget treats one UTF-8 byte as at most one token. Cursors are
|
|
597
|
+
* bound to the requested generation, current generation, locale, and budget.
|
|
598
|
+
*/
|
|
599
|
+
function hydrateDocsContentChanges(options) {
|
|
600
|
+
if (options.changes.audience !== "agent") throw new TypeError("MCP content-change hydration requires the agent audience.");
|
|
601
|
+
if (options.changes.since !== options.since) throw new TypeError("Content-change hydration must use the resolved delta generation.");
|
|
602
|
+
const tokenBudget = resolveDocsHydrationTokenBudget(options.tokenBudget);
|
|
603
|
+
const units = buildDocsHydrationUnits(options.changes, options.pages, tokenBudget);
|
|
604
|
+
const hydrationSnapshot = digestDocsRetrievalContent(JSON.stringify({
|
|
605
|
+
format: DOCS_CONTENT_CHANGE_HYDRATION_FORMAT,
|
|
606
|
+
since: options.since,
|
|
607
|
+
indexGeneration: options.changes.indexGeneration,
|
|
608
|
+
mode: options.changes.mode,
|
|
609
|
+
resetRequired: options.changes.resetRequired,
|
|
610
|
+
units: units.map((unit) => unit.type === "content" ? {
|
|
611
|
+
type: unit.type,
|
|
612
|
+
change: unit.change,
|
|
613
|
+
canonicalUrl: unit.canonicalUrl,
|
|
614
|
+
digest: unit.digest,
|
|
615
|
+
section: unit.section.id,
|
|
616
|
+
sectionDigest: unit.sectionDigest,
|
|
617
|
+
chunk: unit.chunk.index,
|
|
618
|
+
chunkDigest: unit.chunkDigest
|
|
619
|
+
} : {
|
|
620
|
+
type: unit.type,
|
|
621
|
+
canonicalUrl: unit.canonicalUrl,
|
|
622
|
+
digest: unit.digest
|
|
623
|
+
})
|
|
624
|
+
}));
|
|
625
|
+
const paginationOptions = {
|
|
626
|
+
kind: DOCS_CONTENT_CHANGE_HYDRATION_CURSOR_KIND,
|
|
627
|
+
scope: JSON.stringify({
|
|
628
|
+
server: options.cursorScope,
|
|
629
|
+
since: options.since,
|
|
630
|
+
locale: options.changes.locale ?? null,
|
|
631
|
+
tokenBudget
|
|
632
|
+
}),
|
|
633
|
+
snapshot: hydrationSnapshot
|
|
634
|
+
};
|
|
635
|
+
const offset = resolveDocsPaginationOffset(options.cursor, paginationOptions);
|
|
636
|
+
if (options.cursor !== void 0 && offset >= units.length) throw new DocsPaginationCursorError();
|
|
637
|
+
const selected = [];
|
|
638
|
+
let usedUtf8Bytes = 0;
|
|
639
|
+
for (let index = offset; index < units.length && selected.length < DOCS_CONTENT_CHANGE_HYDRATION_PAGE_SIZE; index += 1) {
|
|
640
|
+
const unit = units[index];
|
|
641
|
+
const unitUtf8Bytes = unit.type === "content" ? unit.utf8Bytes : 0;
|
|
642
|
+
if (unitUtf8Bytes > 0 && usedUtf8Bytes + unitUtf8Bytes > tokenBudget) break;
|
|
643
|
+
selected.push(unit);
|
|
644
|
+
usedUtf8Bytes += unitUtf8Bytes;
|
|
645
|
+
}
|
|
646
|
+
const nextOffset = offset + selected.length;
|
|
647
|
+
const hasMore = nextOffset < units.length;
|
|
648
|
+
const nextCursor = hasMore ? createDocsPaginationCursor(nextOffset, paginationOptions) : void 0;
|
|
649
|
+
const content = selected.filter((unit) => unit.type === "content");
|
|
650
|
+
const tombstones = selected.filter((unit) => unit.type === "tombstone");
|
|
651
|
+
return {
|
|
652
|
+
format: DOCS_CONTENT_CHANGE_HYDRATION_FORMAT,
|
|
653
|
+
audience: "agent",
|
|
654
|
+
...options.changes.locale ? { locale: options.changes.locale } : {},
|
|
655
|
+
since: options.since,
|
|
656
|
+
indexGeneration: options.changes.indexGeneration,
|
|
657
|
+
mode: options.changes.mode,
|
|
658
|
+
resetRequired: options.changes.resetRequired,
|
|
659
|
+
documentCount: options.changes.documentCount,
|
|
660
|
+
counts: { ...options.changes.counts },
|
|
661
|
+
budget: {
|
|
662
|
+
requestedTokens: tokenBudget,
|
|
663
|
+
strategy: "utf8-bytes",
|
|
664
|
+
maxUtf8Bytes: tokenBudget,
|
|
665
|
+
usedUtf8Bytes,
|
|
666
|
+
conservativeTokenUpperBound: usedUtf8Bytes,
|
|
667
|
+
remainingUtf8Bytes: Math.max(0, tokenBudget - usedUtf8Bytes)
|
|
668
|
+
},
|
|
669
|
+
resultCount: selected.length,
|
|
670
|
+
total: units.length,
|
|
671
|
+
hasMore,
|
|
672
|
+
...nextCursor ? { nextCursor } : {},
|
|
673
|
+
content,
|
|
674
|
+
tombstones
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
//#endregion
|
|
679
|
+
export { isLocalDocsTelemetryOrigin as C, inferDocsTelemetryAgentSurface as S, resolveDocsTelemetryConfig as T, emitDocsTelemetryAgentSurfaceEvent as _, hydrateDocsContentChanges as a, emitDocsTelemetryProjectEvent as b, hashGeneratedAgentContent as c, serializeGeneratedAgentDocument as d, stripGeneratedAgentProvenance as f, resolveSidebarFolderIndexBehaviorForPath as g, resolveSidebarFolderIndexBehavior as h, MIN_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET as i, normalizeGeneratedAgentContent as l, resolvePageSidebarFolderIndexBehavior as m, DOCS_CONTENT_CHANGE_HYDRATION_FORMAT as n, GENERATED_AGENT_PROVENANCE_MARKER as o, applySidebarFolderIndexBehavior as p, MAX_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET as r, GENERATED_AGENT_PROVENANCE_VERSION as s, DEFAULT_DOCS_CONTENT_CHANGE_HYDRATION_TOKEN_BUDGET as t, parseGeneratedAgentDocument as u, emitDocsTelemetryEvent as v, normalizeDocsTelemetryOrigin as w, getDocsTelemetryFeatures as x, emitDocsTelemetryMcpToolEvent as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as DocsCloudAskAIResponseOptions, t as DocsCloudAskAIConfig } from "./cloud-ask-ai-
|
|
1
|
+
import { ct as DocsAnalyticsEventInput, ot as DocsAnalyticsConfig, st as DocsAnalyticsEvent } from "./types-lGEHcx_6.mjs";
|
|
2
|
+
import { n as DocsCloudAskAIResponseOptions, t as DocsCloudAskAIConfig } from "./cloud-ask-ai-BQAeHkpZ.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/docs-cloud-server.d.ts
|
|
5
5
|
type DocsCloudRuntimeValue<T = string> = T | undefined | null | (() => T | undefined | null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as sendDocsCloudAnalyticsEvent } from "./cloud-analytics-CSyFE6SS.mjs";
|
|
2
|
-
import { t as createDocsCloudAskAIResponse } from "./cloud-ask-ai-
|
|
2
|
+
import { t as createDocsCloudAskAIResponse } from "./cloud-ask-ai-BRBK4RBG.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/docs-cloud-server.ts
|
|
5
5
|
const DEFAULT_DOCS_CLOUD_API_BASE_URL = "https://api.farming-labs.dev";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { i as scanDocsPageTargets, n as compactAgentDocs, r as inspectAgentCompactionState } from "./agent-
|
|
2
|
-
import { d as httpLinkHeaderHasTargetRelation, f as AGENT_SKILL_ARCHIVE_MAX_UNCOMPRESSED_BYTES, p as readAgentSkillDocumentFromTar } from "./prompt-references-
|
|
3
|
-
import { A as buildDocsAgentDiscoverySpec, At as DEFAULT_SITEMAP_XML_ROUTE, F as buildDocsMcpEndpointCandidates, Gn as
|
|
1
|
+
import { i as scanDocsPageTargets, n as compactAgentDocs, r as inspectAgentCompactionState } from "./agent-Biyd8A98.mjs";
|
|
2
|
+
import { d as httpLinkHeaderHasTargetRelation, f as AGENT_SKILL_ARCHIVE_MAX_UNCOMPRESSED_BYTES, p as readAgentSkillDocumentFromTar } from "./prompt-references-embiJdYt.mjs";
|
|
3
|
+
import { A as buildDocsAgentDiscoverySpec, At as DEFAULT_SITEMAP_XML_ROUTE, F as buildDocsMcpEndpointCandidates, Gn as DEFAULT_MCP_WELL_KNOWN_ROUTE, It as resolveDocsSitemapConfig, M as buildDocsConfigMap, Ot as DEFAULT_SITEMAP_MD_ROUTE, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, Un as DEFAULT_MCP_PUBLIC_ROUTE, Xn as isDocsMcpOAuthScopeToken, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, er as normalizeDocsMcpAuthorizationServerUrls, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, kt as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, pn as resolveAskAISearchRequestConfig, qn as getDocsMcpProtectedResourceMetadataRoutes, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-Dze2Cy5B.mjs";
|
|
4
4
|
import { f as PAGE_AGENT_CONTRACT_FIELDS } from "./markdown-sections-7OoA7ylx.mjs";
|
|
5
5
|
import { isDocsAgentSkillName, validateDocsAgentSkillFrontmatter } from "./agent-skills-spec.mjs";
|
|
6
6
|
import { I as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, n as API_CATALOG_MEDIA_TYPE, r as API_CATALOG_PROFILE_URI, t as AGENT_SKILLS_DISCOVERY_SCHEMA_URI, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE } from "./standards-discovery-BKlEnK_H.mjs";
|
|
7
|
-
import "./
|
|
8
|
-
import { a as analyzeDocsRobotsTxt, n as DEFAULT_ROBOTS_TXT_ROUTE, u as resolveDocsRobotsConfig } from "./robots-
|
|
7
|
+
import "./content-change-hydration-DpQ0KdAD.mjs";
|
|
8
|
+
import { a as analyzeDocsRobotsTxt, n as DEFAULT_ROBOTS_TXT_ROUTE, u as resolveDocsRobotsConfig } from "./robots-D96X6eVX.mjs";
|
|
9
9
|
import { a as resolveDocsMetadataBaseUrl } from "./metadata-N252j5_a.mjs";
|
|
10
|
-
import "./sitemap-server-
|
|
11
|
-
import {
|
|
10
|
+
import "./sitemap-server-BefXEox6.mjs";
|
|
11
|
+
import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-D5qYU19g.mjs";
|
|
12
|
+
import { t as runDocsGoldenTasks } from "./agent-evals-Burrzyam.mjs";
|
|
12
13
|
import { createFilesystemDocsMcpSource, getDocsConfigSchema, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
13
|
-
import "./code-blocks-
|
|
14
|
-
import { t as resolveConfiguredAgentSkills } from "./agent-skills-server-B2EXn2QD.mjs";
|
|
14
|
+
import "./code-blocks-0wjOsqdJ.mjs";
|
|
15
15
|
import "./server.mjs";
|
|
16
16
|
import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, r as extractTopLevelConfigObject, s as loadDocsConfigModuleResultWithProjectEnv, t as extractNestedObjectLiteral } from "./config-Wcdj-D0a.mjs";
|
|
17
17
|
import { t as detectFramework } from "./utils-DpiIioYb.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { a as createAgentUsefulnessPagesFromMcp, i as analyzeAgentUsefulness, n as analyzeConfiguredAgentSkillsProgressiveDisclosure, r as analyzeAgentSurfaceDrift, t as resolveGoldenEvaluationInput } from "./golden-evaluations-B2GHnoFa.mjs";
|
|
19
19
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
20
20
|
import path from "node:path";
|
|
21
|
-
import { LATEST_PROTOCOL_VERSION } from "@modelcontextprotocol/server";
|
|
22
21
|
import { createHash } from "node:crypto";
|
|
23
22
|
import { gunzipSync } from "node:zlib";
|
|
23
|
+
import { LATEST_PROTOCOL_VERSION } from "@modelcontextprotocol/server";
|
|
24
24
|
import pc from "picocolors";
|
|
25
25
|
|
|
26
26
|
//#region src/cli/doctor.ts
|
|
@@ -606,6 +606,7 @@ function navigationScore(navigationCoverage) {
|
|
|
606
606
|
const AGENT_OPTIMIZATION_BLOCKING_CHECKS = new Set([
|
|
607
607
|
"surface-drift",
|
|
608
608
|
"agent-skills-frontmatter",
|
|
609
|
+
"agent-skills-progressive-disclosure",
|
|
609
610
|
"agent-context-quality",
|
|
610
611
|
"agent-task-completeness",
|
|
611
612
|
"agent-applicability",
|
|
@@ -1680,11 +1681,20 @@ async function inspectAgentReadiness(options = {}) {
|
|
|
1680
1681
|
const config = configLoad.status === "evaluated" ? configLoad.config : void 0;
|
|
1681
1682
|
let configuredAgentSkillNames;
|
|
1682
1683
|
let configuredAgentSkillsError;
|
|
1684
|
+
let configuredAgentSkillsDisclosure;
|
|
1685
|
+
let configuredAgentSkillsDisclosureError;
|
|
1683
1686
|
const configuredAgentSkills = config?.agent?.skills;
|
|
1684
|
-
if (configuredAgentSkills)
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1687
|
+
if (configuredAgentSkills) {
|
|
1688
|
+
try {
|
|
1689
|
+
configuredAgentSkillNames = (await resolveConfiguredAgentSkills(configuredAgentSkills, { rootDir })).map((skill) => skill.name);
|
|
1690
|
+
} catch (error) {
|
|
1691
|
+
configuredAgentSkillsError = error instanceof Error ? error.message : String(error);
|
|
1692
|
+
}
|
|
1693
|
+
try {
|
|
1694
|
+
configuredAgentSkillsDisclosure = analyzeConfiguredAgentSkillsProgressiveDisclosure(configuredAgentSkills, { rootDir });
|
|
1695
|
+
} catch (error) {
|
|
1696
|
+
configuredAgentSkillsDisclosureError = error instanceof Error ? error.message : String(error);
|
|
1697
|
+
}
|
|
1688
1698
|
}
|
|
1689
1699
|
const entry = config?.entry ?? readTopLevelStringProperty(configContent, "entry") ?? "docs";
|
|
1690
1700
|
const contentDir = config?.contentDir ?? resolveDocsContentDir(rootDir, configContent, entry);
|
|
@@ -1812,6 +1822,13 @@ async function inspectAgentReadiness(options = {}) {
|
|
|
1812
1822
|
const checks = [];
|
|
1813
1823
|
checks.push(makeCheck("config", "Docs config", configLoad.status === "evaluated" ? "pass" : "warn", configLoad.status === "evaluated" ? 10 : 2, configCheckMax, configLoad.status === "evaluated" ? `Resolved ${path.relative(rootDir, configLoad.path).replace(/\\/g, "/")} and evaluated the config module.` : `Resolved ${path.relative(rootDir, configPath).replace(/\\/g, "/")} using static parsing fallback.`, configLoad.status === "evaluated" ? void 0 : "Fix docs.config module evaluation before relying on resolved diagnostic scores."));
|
|
1814
1824
|
checks.push(makeCheck("agent-skills-frontmatter", "Configured Agent Skills frontmatter", configLoad.status !== "evaluated" ? "warn" : configuredAgentSkillsError ? "fail" : "pass", configLoad.status === "evaluated" && !configuredAgentSkillsError ? 1 : 0, 1, configLoad.status !== "evaluated" ? "Not verified because docs.config could not be evaluated." : configuredAgentSkillsError ? configuredAgentSkillsError : configuredAgentSkillNames ? `${configuredAgentSkillNames.length} configured Agent Skill${configuredAgentSkillNames.length === 1 ? "" : "s"} passed full frontmatter validation: ${configuredAgentSkillNames.join(", ")}.` : "No configured Agent Skills require validation.", configuredAgentSkillsError ? "Fix every configured SKILL.md field reported here before building or publishing the docs site." : void 0));
|
|
1825
|
+
const skillDisclosureIssues = configuredAgentSkillsDisclosure?.issues ?? [];
|
|
1826
|
+
const skillDisclosureHasErrors = skillDisclosureIssues.some((issue) => issue.severity === "error");
|
|
1827
|
+
const skillDisclosureStatus = configLoad.status !== "evaluated" ? "warn" : configuredAgentSkillsDisclosureError ? "fail" : skillDisclosureHasErrors ? "fail" : skillDisclosureIssues.length > 0 ? "warn" : "pass";
|
|
1828
|
+
const skillDisclosureDetail = configLoad.status !== "evaluated" ? "Not verified because docs.config could not be evaluated." : configuredAgentSkillsDisclosureError ? configuredAgentSkillsDisclosureError : configuredAgentSkillsDisclosure ? skillDisclosureIssues.length === 0 ? `${configuredAgentSkillsDisclosure.skills.length} configured Agent Skill${configuredAgentSkillsDisclosure.skills.length === 1 ? "" : "s"} stay within line/token budgets, use resolvable shallow references, declare required compatibility, and document bundled scripts.` : `${skillDisclosureIssues.length} progressive-disclosure issue${skillDisclosureIssues.length === 1 ? "" : "s"} across ${configuredAgentSkillsDisclosure.skills.length} configured skill${configuredAgentSkillsDisclosure.skills.length === 1 ? "" : "s"}: ${skillDisclosureIssues.slice(0, 4).map((issue) => {
|
|
1829
|
+
return `${path.relative(rootDir, issue.filePath).replace(/\\/g, "/")}${issue.line ? `:${issue.line}` : ""} ${issue.message}`;
|
|
1830
|
+
}).join(" ")}${skillDisclosureIssues.length > 4 ? ` (+${skillDisclosureIssues.length - 4} more)` : ""}` : "No configured Agent Skills require progressive-disclosure analysis.";
|
|
1831
|
+
checks.push(makeCheck("agent-skills-progressive-disclosure", "Agent Skills progressive disclosure", skillDisclosureStatus, skillDisclosureStatus === "pass" ? 5 : skillDisclosureStatus === "warn" ? 2 : 0, 5, skillDisclosureDetail, skillDisclosureStatus === "pass" ? void 0 : "Keep SKILL.md under its configured line and instruction-token budgets, repair local references, keep reference chains shallow, declare compatibility requirements, and document script dependencies and validation."));
|
|
1815
1832
|
const canScoreSurfaceDrift = configLoad.status === "evaluated";
|
|
1816
1833
|
checks.push(makeCheck("surface-drift", "Discovery/config/schema consistency", !canScoreSurfaceDrift ? "warn" : surfaceDrift.length === 0 ? "pass" : "fail", !canScoreSurfaceDrift ? 0 : surfaceDrift.length === 0 ? 10 : Math.max(0, 10 - surfaceDrift.length * 2), 10, !canScoreSurfaceDrift ? "Not scored because docs.config could not be evaluated; static parsing cannot prove discovery/config/schema consistency." : surfaceDrift.length === 0 ? "Resolved config, discovery metadata, MCP tool flags, config schema, and agent contract fields agree." : surfaceDrift.slice(0, 3).map((issue) => issue.message).join(" "), canScoreSurfaceDrift && surfaceDrift.length === 0 ? void 0 : canScoreSurfaceDrift ? "Align docs config, agent discovery (including API catalog and Agent Skills routes), MCP tools, config schema, and the canonical page agent contract before publishing." : "Fix docs.config module evaluation so doctor can compare resolved config with discovery and schema surfaces."));
|
|
1817
1834
|
const dynamicStaticFallback = configLoad.status === "static-fallback" && /(?:\.\.\.|process\.env|import\.meta\.env|\[[^\]]+\]\s*:|:\s*[A-Za-z_$][\w$]*\s*[,}])/u.test(configContent);
|