@farming-labs/docs 0.2.104 → 0.2.105
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-NerpHcQB.mjs → agent-CaCWThBY.mjs} +4 -4
- package/dist/{agent-PSrgiJD8.mjs → agent-DCTGj6J7.mjs} +48 -12
- package/dist/{agent-evals-U9d_db2u.mjs → agent-evals-D-sPJfXz.mjs} +5 -5
- package/dist/{agent-export-DlBUKkTt.mjs → agent-export-GcTZPLfB.mjs} +19 -17
- package/dist/agent-feedback-evaluations-DQCTFegz.mjs +240 -0
- package/dist/agent-maintenance-CuZ7iAKq.mjs +289 -0
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-progressive-disclosure-CfIsq4Ew.mjs → agent-skills-progressive-disclosure-DL-q4JZo.mjs} +1 -1
- package/dist/{agent-skills-server-CIoL58X7.d.mts → agent-skills-server-D34054x5.d.mts} +2 -2
- package/dist/{agent-skills-server-DFqQyO_V.mjs → agent-skills-server-Ddbf15pY.mjs} +1 -1
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +2 -2
- package/dist/{agents-D3SLnQet.mjs → agents-e1SYT64z.mjs} +11 -11
- package/dist/{analytics-Bx44lg6d.mjs → analytics-CqfcIBdg.mjs} +1 -1
- package/dist/{analytics-B-jz7re8.d.mts → analytics-aeXwEvQX.d.mts} +1 -1
- package/dist/{authoring-BsWXMH43.mjs → authoring-Do87QzBd.mjs} +6 -6
- package/dist/{authoring-mcp-BCM5CJbJ.mjs → authoring-mcp-Be7quE5R.mjs} +2 -2
- package/dist/browser.d.mts +3 -3
- package/dist/browser.mjs +2 -2
- package/dist/cli/index.mjs +71 -35
- package/dist/client/react.d.mts +1 -1
- package/dist/client/react.mjs +1 -1
- package/dist/{cloud-BLxt_HYO.mjs → cloud-Bvof6mET.mjs} +3 -3
- package/dist/{cloud-ask-ai-19G2HJ62.d.mts → cloud-ask-ai-BqfiQaNZ.d.mts} +1 -1
- package/dist/{cloud-ask-ai-DeojA5lB.mjs → cloud-ask-ai-CK2qlNns.mjs} +1 -1
- package/dist/{codeblocks-qHdKGVaE.mjs → codeblocks-C911CdyJ.mjs} +2 -2
- package/dist/{agent-C9IdC__R.d.mts → content-change-hydration-CoYRs3pC.d.mts} +704 -678
- package/dist/{dev-B0iHJjTz.mjs → dev-Bx0JNglW.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +2 -2
- package/dist/{doctor-x3k6aE2I.mjs → doctor-CtK1CRPj.mjs} +17 -17
- package/dist/{downgrade-Dd3vvVdD.mjs → downgrade-BXmQMkMy.mjs} +2 -2
- package/dist/{feedback-DdWc33oO.mjs → feedback-DWVUMrxy.mjs} +1 -1
- package/dist/feedback-evals-k0sFDdms.mjs +146 -0
- package/dist/{golden-evaluations-7k7Akp3R.mjs → golden-evaluations-De4KwoYr.mjs} +3 -3
- package/dist/index.d.mts +174 -9
- package/dist/index.mjs +14 -11
- package/dist/{init-DKukQdOQ.mjs → init-CCV2eRNB.mjs} +3 -3
- package/dist/markdown-rendering.mjs +1 -1
- package/dist/{markdown-sections-7OoA7ylx.mjs → markdown-sections-BKy4labo.mjs} +110 -2
- package/dist/{mcp-B6ZZdp6F.mjs → mcp-DsjWxF7g.mjs} +11 -11
- package/dist/mcp.d.mts +5 -3
- package/dist/mcp.mjs +92 -29
- package/dist/{metadata-D4v_R1t5.mjs → metadata-7htr-Xj_.mjs} +1 -1
- package/dist/{openapi-mcp-B7u7Y0gB.mjs → openapi-mcp-DQ3xptKo.mjs} +68 -4
- package/dist/openapi-mcp-node-vO3IXVGI.mjs +43 -0
- package/dist/{package-version-P4TT_9IO.mjs → package-version-Ci99L0yo.mjs} +1 -1
- package/dist/{prompt-references-Ca2Rcrpw.mjs → prompt-references-1Wce71c7.mjs} +3 -3
- package/dist/propose-DJOiHu9Y.mjs +73 -0
- package/dist/retrieval-digest-B-SgtXKK.mjs +177 -0
- package/dist/retrieval-digest-DyNRD-mt.d.mts +467 -0
- package/dist/{review-DgaNTtP0.mjs → review-XI9FXeos.mjs} +12 -12
- package/dist/{robots-DNod0XKB.mjs → robots-BOjWB1ky.mjs} +2 -2
- package/dist/{robots-msD1xoH5.mjs → robots-CzKesbdX.mjs} +6 -6
- package/dist/{search-CNzq9S5S.mjs → search-DwAoC9X7.mjs} +12 -12
- package/dist/server.d.mts +6 -308
- package/dist/server.mjs +13 -12
- package/dist/{sidebar-DmXRpAAK.d.mts → sidebar-CJze8SBi.d.mts} +1 -1
- package/dist/{sitemap-CHvips7o.mjs → sitemap-DOaJIKJf.mjs} +11 -11
- package/dist/{sitemap-server-C2TauhKa.mjs → sitemap-server-NeVu8W38.mjs} +1 -1
- package/dist/{skills-aaE5L1go.mjs → skills-BILSESek.mjs} +11 -11
- package/dist/{standards-discovery-Ckx0tN7B.mjs → standards-discovery-Bpz90VYq.mjs} +2 -177
- package/dist/{standards-discovery-Cqq8QmlH.d.mts → standards-discovery-Xm84bS4M.d.mts} +1 -1
- package/dist/{types-BthCiAD9.d.mts → types-QhYMnKvb.d.mts} +35 -2
- package/dist/{upgrade-B0OA_7jE.mjs → upgrade-B92U83xo.mjs} +2 -2
- package/package.json +1 -1
- package/dist/retrieval-digest-DT9Ktc4C.d.mts +0 -164
- /package/dist/{agent-feedback-loop-CGrc-gDW.mjs → agent-feedback-loop-vaC-M1sx.mjs} +0 -0
- /package/dist/{audience-exposure-BW13cI2O.d.mts → audience-exposure-CkNZNeVX.d.mts} +0 -0
- /package/dist/{cloud-analytics-CSyFE6SS.mjs → cloud-analytics-Ci1yiwD8.mjs} +0 -0
- /package/dist/{code-blocks-c3nIrWOM.mjs → code-blocks-D90CCJFs.mjs} +0 -0
- /package/dist/{config-BhF6J2N4.mjs → config-DrZ3fXgf.mjs} +0 -0
- /package/dist/{errors-B5KTe1Xo.mjs → errors-BDmra6mz.mjs} +0 -0
- /package/dist/{i18n-B3BIxShC.mjs → i18n-B1gJ9EW0.mjs} +0 -0
- /package/dist/{sidebar-IcpElOVH.mjs → sidebar-3W51s2sF.mjs} +0 -0
- /package/dist/{templates-m_j4ARnu.mjs → templates-DdB4BBGq.mjs} +0 -0
- /package/dist/{utils-DcCUwxqS.mjs → utils-Cc1SrVza.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { v as normalizePageAgentFrontmatter, x as stripGeneratedPageAgentContractMarkdown } from "./markdown-sections-BKy4labo.mjs";
|
|
2
|
+
import { V as findDocsMarkdownPage, ot as renderDocsMarkdownDocument } from "./agent-DCTGj6J7.mjs";
|
|
3
|
+
import { d as GENERATED_AGENT_PROVENANCE_VERSION, f as hashGeneratedAgentContent, h as serializeGeneratedAgentDocument, m as parseGeneratedAgentDocument } from "./openapi-mcp-DQ3xptKo.mjs";
|
|
4
4
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
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-
|
|
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-DrZ3fXgf.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import matter from "gray-matter";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { S as upsertPageAgentContractMarkdown, a as findDocsGeneratedAgentContractRanges, b as renderPageAgentFrontmatterYamlLines, d as PAGE_AGENT_CONTRACT_END_MARKER, l as stripDocsGeneratedAgentContractMarkers, m as PAGE_AGENT_CONTRACT_START_MARKER, o as findDocsMarkdownSection, p as PAGE_AGENT_CONTRACT_FIELD_SCHEMA, s as parseDocsMarkdownSections, y as renderPageAgentContractMarkdown } from "./markdown-sections-
|
|
2
|
-
import {
|
|
1
|
+
import { C as filterDocsPagesByAccess, S as upsertPageAgentContractMarkdown, T as isDocsPageAccessAllowed, a as findDocsGeneratedAgentContractRanges, b as renderPageAgentFrontmatterYamlLines, d as PAGE_AGENT_CONTRACT_END_MARKER, l as stripDocsGeneratedAgentContractMarkers, m as PAGE_AGENT_CONTRACT_START_MARKER, o as findDocsMarkdownSection, p as PAGE_AGENT_CONTRACT_FIELD_SCHEMA, s as parseDocsMarkdownSections, y as renderPageAgentContractMarkdown } from "./markdown-sections-BKy4labo.mjs";
|
|
2
|
+
import { n as digestDocsRetrievalContent, r as isDocsRetrievalCanonicalUrl } from "./retrieval-digest-B-SgtXKK.mjs";
|
|
3
3
|
import { t as resolveDocsAudienceExposure } from "./audience-exposure-DVsfT9Sx.mjs";
|
|
4
|
+
import { B as createDocsCacheableResponse, F as isDocsStandardsDiscoveryRequest, I as resolveDocsDiscoveryApiRoute, M as createDocsStandardsResponse, S as DOCS_AGENT_MANIFEST_FORMAT, T as DOCS_AGENT_MANIFEST_VERSION, W as resolveDocsHttpDate, _ as DEFAULT_API_CATALOG_FORMAT, a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, c as DEFAULT_AGENT_SKILLS_ARCHIVE_ROUTE_PATTERN, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, k as buildDocsApiCatalog, 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, w as DOCS_AGENT_MANIFEST_SCHEMA_URI } from "./standards-discovery-Bpz90VYq.mjs";
|
|
4
5
|
import { createProcessor } from "@mdx-js/mdx";
|
|
5
6
|
|
|
6
7
|
//#region src/okf.ts
|
|
@@ -3134,17 +3135,18 @@ async function buildDocsSearchIndexGeneration(pages, options) {
|
|
|
3134
3135
|
* locale, base URL, and chunking policy.
|
|
3135
3136
|
*/
|
|
3136
3137
|
async function buildDocsContentSnapshot(options) {
|
|
3138
|
+
const pages = filterDocsPagesByAccess(options.pages, options.principal);
|
|
3137
3139
|
const audience = resolveDocsSearchAudience(options.audience);
|
|
3138
3140
|
const search = normalizeDocsSearchConfig(options.search);
|
|
3139
3141
|
const digestCache = /* @__PURE__ */ new Map();
|
|
3140
|
-
const indexGeneration = options.indexGeneration ?? await buildDocsSearchIndexGeneration(
|
|
3142
|
+
const indexGeneration = options.indexGeneration ?? await buildDocsSearchIndexGeneration(pages, {
|
|
3141
3143
|
audience,
|
|
3142
3144
|
chunking: search.chunking,
|
|
3143
3145
|
locale: options.locale,
|
|
3144
3146
|
baseUrl: options.baseUrl,
|
|
3145
3147
|
digestCache
|
|
3146
3148
|
});
|
|
3147
|
-
const documents = await Promise.all(
|
|
3149
|
+
const documents = await Promise.all(pages.map(async (page) => {
|
|
3148
3150
|
const localizedPage = localizeDocsSearchPage(page, options.locale);
|
|
3149
3151
|
const source = await buildDocsRetrievalSource(page, localizedPage.url, {
|
|
3150
3152
|
audience,
|
|
@@ -5131,7 +5133,9 @@ async function performDocsSearchInternal(options) {
|
|
|
5131
5133
|
const audience = resolveDocsSearchAudience(options.audience);
|
|
5132
5134
|
const filters = normalizeDocsSearchFilters(options.filters);
|
|
5133
5135
|
const hasFilters = hasDocsSearchFilters(filters);
|
|
5134
|
-
const
|
|
5136
|
+
const accessiblePages = filterDocsPagesByAccess(options.pages, options.principal);
|
|
5137
|
+
const accessibleGenerationPages = filterDocsPagesByAccess(options.generationPages ?? options.pages, options.principal);
|
|
5138
|
+
const corpusPages = accessiblePages.map((page) => localizeDocsSearchPage(page, options.locale));
|
|
5135
5139
|
const indexBaseUrl = options.syncBaseUrl === null ? void 0 : options.syncBaseUrl ?? options.baseUrl;
|
|
5136
5140
|
const scopedPages = hasFilters ? corpusPages.filter((page) => docsSearchPageMatchesFilters(resolveDocsSearchPageScope(page), filters)) : corpusPages;
|
|
5137
5141
|
let resolvedDocuments;
|
|
@@ -5170,7 +5174,7 @@ async function performDocsSearchInternal(options) {
|
|
|
5170
5174
|
};
|
|
5171
5175
|
let currentIndexGeneration;
|
|
5172
5176
|
const getCurrentIndexGeneration = () => {
|
|
5173
|
-
currentIndexGeneration ??= options.indexGeneration ? Promise.resolve(options.indexGeneration) : buildDocsSearchIndexGeneration(
|
|
5177
|
+
currentIndexGeneration ??= options.indexGeneration ? Promise.resolve(options.indexGeneration) : buildDocsSearchIndexGeneration(accessibleGenerationPages, {
|
|
5174
5178
|
audience,
|
|
5175
5179
|
chunking: search.chunking,
|
|
5176
5180
|
locale: options.locale,
|
|
@@ -5181,7 +5185,7 @@ async function performDocsSearchInternal(options) {
|
|
|
5181
5185
|
const requireCurrentIndexGeneration = search.provider === "algolia" || search.provider === "typesense";
|
|
5182
5186
|
let hostedIndexGeneration;
|
|
5183
5187
|
const getHostedIndexGeneration = () => {
|
|
5184
|
-
hostedIndexGeneration ??= audience === "human" ? getCurrentIndexGeneration() : buildDocsSearchIndexGeneration(
|
|
5188
|
+
hostedIndexGeneration ??= audience === "human" ? getCurrentIndexGeneration() : buildDocsSearchIndexGeneration(accessibleGenerationPages, {
|
|
5185
5189
|
audience: "human",
|
|
5186
5190
|
chunking: search.chunking,
|
|
5187
5191
|
locale: options.locale,
|
|
@@ -5435,8 +5439,9 @@ async function buildDocsSearchFacets(options) {
|
|
|
5435
5439
|
const requestedLimit = options.limit ?? MAX_SEARCH_FACET_VALUES;
|
|
5436
5440
|
if (!Number.isSafeInteger(requestedLimit) || requestedLimit < 1 || requestedLimit > MAX_SEARCH_FACET_VALUES) throw new DocsSearchRequestError("Search limit must be an integer between 1 and 100.");
|
|
5437
5441
|
if (options.cursor !== void 0 && options.facet === void 0) throw new DocsSearchRequestError("Facet continuation cursors require a `facet` field.");
|
|
5438
|
-
const
|
|
5439
|
-
const
|
|
5442
|
+
const accessiblePages = filterDocsPagesByAccess(options.pages, options.principal);
|
|
5443
|
+
const pages = accessiblePages.map((page) => localizeDocsSearchPage(page, options.locale)).map((page) => ({ scope: resolveDocsSearchPageScope(page) }));
|
|
5444
|
+
const indexGeneration = options.indexGeneration ?? await buildDocsSearchIndexGeneration(accessiblePages, {
|
|
5440
5445
|
audience,
|
|
5441
5446
|
chunking: search.chunking,
|
|
5442
5447
|
locale: options.locale,
|
|
@@ -5581,7 +5586,7 @@ async function performDocsSearchWithMetadata(options) {
|
|
|
5581
5586
|
const search = normalizeDocsSearchConfig(options.search);
|
|
5582
5587
|
const requestedLimit = options.limit ?? search.maxResults ?? DEFAULT_SEARCH_LIMIT;
|
|
5583
5588
|
const limit = Number.isFinite(requestedLimit) && requestedLimit > 0 ? Math.max(1, Math.floor(requestedLimit)) : DEFAULT_SEARCH_LIMIT;
|
|
5584
|
-
const indexGeneration = options.indexGeneration ?? await buildDocsSearchIndexGeneration(options.generationPages ?? options.pages, {
|
|
5589
|
+
const indexGeneration = options.indexGeneration ?? await buildDocsSearchIndexGeneration(filterDocsPagesByAccess(options.generationPages ?? options.pages, options.principal), {
|
|
5585
5590
|
audience,
|
|
5586
5591
|
chunking: search.chunking,
|
|
5587
5592
|
locale: options.locale,
|
|
@@ -7299,6 +7304,7 @@ function renderLlmsFullTxtPages(pages, baseUrl) {
|
|
|
7299
7304
|
return content;
|
|
7300
7305
|
}
|
|
7301
7306
|
function renderDocsLlmsTxt(pages, options = {}) {
|
|
7307
|
+
pages = filterDocsPagesByAccess(pages);
|
|
7302
7308
|
const siteTitle = options.siteTitle ?? "Documentation";
|
|
7303
7309
|
const siteDescription = options.siteDescription;
|
|
7304
7310
|
const baseUrl = options.baseUrl ?? "";
|
|
@@ -8148,7 +8154,7 @@ function appendDocsMarkdownSectionQuery(value, sectionRequest) {
|
|
|
8148
8154
|
}
|
|
8149
8155
|
/** Build one standards-aware Markdown response for every framework adapter. */
|
|
8150
8156
|
function createDocsMarkdownResponse(options) {
|
|
8151
|
-
const { request, document, entry = "docs", requestedPath, origin = new URL(request.url).origin, pages, sitemap, locale } = options;
|
|
8157
|
+
const { request, document, entry = "docs", requestedPath, origin = new URL(request.url).origin, pages: rawPages, sitemap, locale } = options;
|
|
8152
8158
|
const canonicalUrl = options.canonicalUrl ?? resolveDocsMarkdownCanonicalUrl({
|
|
8153
8159
|
origin,
|
|
8154
8160
|
entry,
|
|
@@ -8165,6 +8171,15 @@ function createDocsMarkdownResponse(options) {
|
|
|
8165
8171
|
...locale ? { "Content-Language": locale } : {},
|
|
8166
8172
|
...varyHeader ? { Vary: varyHeader } : {}
|
|
8167
8173
|
};
|
|
8174
|
+
const pages = rawPages ? filterDocsPagesByAccess(rawPages, options.principal) : void 0;
|
|
8175
|
+
if (!isDocsPageAccessAllowed(options.access, options.principal)) return new Response("Not Found", {
|
|
8176
|
+
status: 404,
|
|
8177
|
+
headers: {
|
|
8178
|
+
...baseSharedHeaders,
|
|
8179
|
+
"Cache-Control": "private, no-store",
|
|
8180
|
+
"Content-Type": "text/plain; charset=utf-8"
|
|
8181
|
+
}
|
|
8182
|
+
});
|
|
8168
8183
|
if (!document) {
|
|
8169
8184
|
const recovery = resolveDocsMarkdownRecovery({
|
|
8170
8185
|
entry,
|
|
@@ -8512,6 +8527,12 @@ function buildDocsAgentDiscoverySpec({ origin, entry = "docs", apiRoute, apiCata
|
|
|
8512
8527
|
format: DOCS_AGENT_MANIFEST_FORMAT,
|
|
8513
8528
|
version: DOCS_AGENT_MANIFEST_VERSION,
|
|
8514
8529
|
name: "@farming-labs/docs",
|
|
8530
|
+
profile: "full",
|
|
8531
|
+
profiles: {
|
|
8532
|
+
default: "full",
|
|
8533
|
+
full: DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
|
|
8534
|
+
compact: `${DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE}?profile=compact`
|
|
8535
|
+
},
|
|
8515
8536
|
baseUrl: origin,
|
|
8516
8537
|
site: {
|
|
8517
8538
|
title: llms?.siteTitle ?? "Documentation",
|
|
@@ -8829,6 +8850,21 @@ function buildDocsAgentDiscoverySpec({ origin, entry = "docs", apiRoute, apiCata
|
|
|
8829
8850
|
}
|
|
8830
8851
|
};
|
|
8831
8852
|
}
|
|
8853
|
+
/** Remove first-hop file inventories while retaining every discovery route and capability. */
|
|
8854
|
+
function compactDocsAgentDiscoverySpec(spec) {
|
|
8855
|
+
return {
|
|
8856
|
+
...spec,
|
|
8857
|
+
profile: "compact",
|
|
8858
|
+
skills: {
|
|
8859
|
+
...spec.skills,
|
|
8860
|
+
published: spec.skills.published.map((skill) => ({
|
|
8861
|
+
...skill,
|
|
8862
|
+
fileCount: skill.files.length,
|
|
8863
|
+
files: []
|
|
8864
|
+
}))
|
|
8865
|
+
}
|
|
8866
|
+
};
|
|
8867
|
+
}
|
|
8832
8868
|
function acceptsDocsMarkdown(request) {
|
|
8833
8869
|
const accept = request.headers.get("accept");
|
|
8834
8870
|
if (!accept) return false;
|
|
@@ -8921,4 +8957,4 @@ function toYamlString(value) {
|
|
|
8921
8957
|
}
|
|
8922
8958
|
|
|
8923
8959
|
//#endregion
|
|
8924
|
-
export {
|
|
8960
|
+
export { isDocsSkillRequest as $, normalizeDocsMcpEndpointPath as $n, buildDocsContentSnapshot as $t, buildDocsAgentDiscoverySpec as A, normalizeAgentFramework as An, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as At, detectDocsMarkdownAgentRequest as B, DEFAULT_MCP_PROTECTED_RESOURCE_METADATA_ROUTE as Bn, toDocsSitemapMarkdownUrl as Bt, DOCS_AI_AGENT_USER_AGENT_HEADER_PATTERN as C, findDocsAudienceMdxIssues as Cn, selectDocsLlmsTxtContent as Ct, DOCS_MARKDOWN_SIGNATURE_AGENT_HEADER as D, agentVersionConstraintGroupsOverlap as Dn, DEFAULT_SITEMAP_MANIFEST_PATH as Dt, DOCS_MARKDOWN_SECTION_INDEX_FORMAT as E, resolveDocsAudienceMdxContent as En, validateDocsAgentFeedbackPayload as Et, buildDocsMcpEndpointCandidates as F, createDocsPaginationCursor as Fn, renderDocsSitemapMarkdown as Ft, hasDocsMarkdownSignatureAgent as G, getDocsMcpProtectedResourceMetadataRoutes as Gn, createDocsContentChangeFeed as Gt, getDocsLlmsTxtMaxCharsIssue as H, DEFAULT_MCP_ROUTE as Hn, DOCS_CONTENT_CHANGES_RESPONSE_VALUE as Ht, collectDocsMarkdownSections as I, paginateDocsItems as In, renderDocsSitemapXml as It, isDocsConfigRequest as J, isDocsMcpOAuthScopeToken as Jn, isDocsContentChangesRequest as Jt, isDocsAgentDiscoveryRequest as K, getDocsMcpResourcePaths as Kn, createDocsContentChangesHttpResponse as Kt, compactDocsAgentDiscoverySpec as L, resolveDocsPaginationOffset as Ln, resolveDocsSitemapConfig as Lt, buildDocsConfigMap as M, normalizeAgentScopeValues as Mn, buildDocsSitemapManifest as Mt, buildDocsDiagnostics as N, normalizeAgentVersion as Nn, createDocsSitemapResponse as Nt, DOCS_TRADITIONAL_BOT_USER_AGENT_HEADER_PATTERN as O, agentVersionConstraintMatches as On, DEFAULT_SITEMAP_MD_DOCS_ROUTE as Ot, buildDocsMarkdownSectionIndex as P, DocsPaginationCursorError as Pn, readDocsSitemapManifestFromContentMap as Pt, isDocsPublicGetRequest as Q, normalizeDocsMcpAuthorizationServerUrls as Qn, buildDocsAskAIContext as Qt, createDocsMarkdownResponse as R, normalizeDocsRelated as Rn, resolveDocsSitemapPageLastmod as Rt, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE as S, extractDocsMarkdownPromptBlocks as Sn, resolveDocsSkillFormat as St, DOCS_CONFIG_MAP_TOP_LEVEL_KEYS as T, resolveDocsAgentMdxContent as Tn, toDocsMarkdownUrl as Tt, getDocsMarkdownCanonicalLinkHeader as U, DEFAULT_MCP_WELL_KNOWN_ROUTE as Un, DOCS_CONTENT_SNAPSHOT_FORMAT as Ut, findDocsMarkdownPage as V, DEFAULT_MCP_PUBLIC_ROUTE as Vn, DOCS_CONTENT_CHANGES_FORMAT as Vt, getDocsMarkdownVaryHeader as W, buildDocsMcpProtectedResourceMetadataRoute as Wn, DocsContentChangesRequestError as Wt, isDocsLlmsTxtPublicRequest as X, isDocsMcpRequest as Xn, resolveDocsContentChangesRequest as Xt, isDocsDiagnosticsRequest as Y, isDocsMcpProtectedResourceMetadataPath as Yn, resolveDocsContentChangesConfig as Yt, isDocsMarkdownSectionIndexRequest as Z, isDocsMcpResourcePath as Zn, DocsSearchRequestError as Zt, DEFAULT_LLMS_TXT_MAX_CHARS as _, resolveDocsSearchError as _n, resolveDocsMarkdownRecovery as _t, DEFAULT_AGENT_MD_ROUTE as a, createMcpSearchAdapter as an, buildDocsOkfBundle as ar, renderDocsLlmsTxt as at, DEFAULT_OPENAPI_SCHEMA_ROUTE as b, resolveLocalDocsMcpSearchConfig as bn, resolveDocsOpenApiDiscoveryConfig as bt, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE as c, enrichDocsSearchDocumentsWithProvenance as cn, resolveDocsOkfTrustMetadata as cr, renderDocsSkillDocument as ct, DEFAULT_DOCS_CONFIG_FORMAT as d, normalizeDocsSearchFilters as dn, resolveDocsAgentFeedbackRequest as dt, buildDocsRetrievalDigestProjection as en, resolveDocsMcpProtectedResourceMetadataLocation as er, matchesDocsLlmsTxtSection as et, DEFAULT_DOCS_CONFIG_ROUTE as f, performDocsSearch as fn, resolveDocsAgentsFormat as ft, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE as g, resolveDocsSearchAudience as gn, resolveDocsMarkdownCanonicalUrl as gt, DEFAULT_LLMS_FULL_TXT_ROUTE as h, resolveDocsRetrievalLastModified as hn, resolveDocsLlmsTxtSections as ht, DEFAULT_AGENT_FEEDBACK_ROUTE as i, createCustomSearchAdapter as in, DOCS_OKF_VERSION as ir, renderDocsAgentsDocument as it, buildDocsAgentFeedbackSchema as j, normalizeAgentLocale as jn, DEFAULT_SITEMAP_XML_ROUTE as jt, acceptsDocsMarkdown as k, agentVersionConstraintsOverlap as kn, DEFAULT_SITEMAP_MD_ROUTE as kt, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE as l, formatDocsAskAIPackageHints as ln, resolveDocsAgentContractMcpTools as lt, DEFAULT_DOCS_DIAGNOSTICS_ROUTE as m, resolveAskAISearchRequestConfig as mn, resolveDocsLlmsTxtRequest as mt, DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE as n, buildDocsSearchFacets as nn, DEFAULT_DOCS_OKF_ROUTE as nr, normalizeDocsUrlPath as nt, DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE as o, createSimpleSearchAdapter as on, normalizeDocsOkfTrustMetadataInput as or, renderDocsMarkdownDocument as ot, DEFAULT_DOCS_DIAGNOSTICS_FORMAT as p, performDocsSearchWithMetadata as pn, resolveDocsLlmsTxtFormat as pt, isDocsAgentsRequest as q, hasDocsMcpProtectedResourceConfig as qn, isDocsContentChangeGeneration as qt, DEFAULT_AGENT_FEEDBACK_PAYLOAD_SCHEMA as r, createAlgoliaSearchAdapter as rn, DOCS_OKF_BUNDLE_FORMAT as rr, parseDocsAgentFeedbackData as rt, DEFAULT_AGENT_SPEC_ROUTE as s, createTypesenseSearchAdapter as sn, resolveDocsOkfConfig as sr, renderDocsMarkdownNotFound as st, DEFAULT_AGENTS_MD_ROUTE as t, buildDocsSearchDocuments as tn, resolveDocsMcpResourceLocation as tr, normalizeDocsPathSegment as tt, DEFAULT_DOCS_API_ROUTE as u, inferDocsAskAIPackageHints as un, resolveDocsAgentFeedbackConfig as ut, DEFAULT_LLMS_TXT_ROUTE as v, resolveDocsSearchFilters as vn, resolveDocsMarkdownRequest as vt, DOCS_BOT_LIKE_USER_AGENT_HEADER_PATTERN as w, findDocsAudienceMdxTags as wn, selectDocsMarkdownSection as wt, DEFAULT_SKILL_MD_ROUTE as x, resolveSearchRequestConfig as xn, resolveDocsRequestApiRoute as xt, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE as y, resolveDocsSearchRequest as yn, resolveDocsMarkdownSectionRequest as yt, createDocsStandardsDiscoveryResponse as z, renderDocsRelatedMarkdownLines as zn, resolveDocsSitemapRequest as zt };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as getDocsAgentSkillsConfiguredPaths } from "./agent-skills-server-
|
|
1
|
+
import { S as upsertPageAgentContractMarkdown, l as stripDocsGeneratedAgentContractMarkers, o as findDocsMarkdownSection } from "./markdown-sections-BKy4labo.mjs";
|
|
2
|
+
import { An as normalizeAgentFramework, Dn as agentVersionConstraintGroupsOverlap, Mn as normalizeAgentScopeValues, Nn as normalizeAgentVersion, On as agentVersionConstraintMatches, Qt as buildDocsAskAIContext, dn as normalizeDocsSearchFilters, en as buildDocsRetrievalDigestProjection, fn as performDocsSearch, jn as normalizeAgentLocale, kn as agentVersionConstraintsOverlap, xn as resolveSearchRequestConfig } from "./agent-DCTGj6J7.mjs";
|
|
3
|
+
import { n as digestDocsRetrievalContent } from "./retrieval-digest-B-SgtXKK.mjs";
|
|
4
|
+
import { t as getDocsAgentSkillsConfiguredPaths } from "./agent-skills-server-Ddbf15pY.mjs";
|
|
5
5
|
import { buildDocsMcpContext } from "./mcp.mjs";
|
|
6
|
-
import { i as validateCodeBlockPlans, n as planCodeBlockTargets, r as resolveDocsCodeBlocksValidateConfig, t as extractCodeBlocksFromMarkdown } from "./code-blocks-
|
|
6
|
+
import { i as validateCodeBlockPlans, n as planCodeBlockTargets, r as resolveDocsCodeBlocksValidateConfig, t as extractCodeBlocksFromMarkdown } from "./code-blocks-D90CCJFs.mjs";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
9
9
|
import { createJiti } from "jiti";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import { A as buildDocsLegacySkillsIndex, D as buildDocsA2AAgentCard, L as resolveDocsPublishedAgentSkill, O as buildDocsAgentSkillsIndex, V as formatDocsContentDigest, W as resolveDocsHttpDate, 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-
|
|
4
|
-
import "./openapi-mcp-
|
|
5
|
-
import { t as resolveDocsI18n } from "./i18n-
|
|
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 { r as resolveConfiguredAgentSkills } from "./agent-skills-server-
|
|
9
|
-
import "./agent-evals-
|
|
1
|
+
import { w as isDocsAgentPageAccessible } from "./markdown-sections-BKy4labo.mjs";
|
|
2
|
+
import { A as buildDocsAgentDiscoverySpec, Ft as renderDocsSitemapMarkdown, It as renderDocsSitemapXml, Lt as resolveDocsSitemapConfig, Mt as buildDocsSitemapManifest, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Tt as toDocsMarkdownUrl, a as DEFAULT_AGENT_MD_ROUTE, ar as buildDocsOkfBundle, at as renderDocsLlmsTxt, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, ct as renderDocsSkillDocument, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, it as renderDocsAgentsDocument, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, ot as renderDocsMarkdownDocument, sr as resolveDocsOkfConfig, t as DEFAULT_AGENTS_MD_ROUTE, ut as resolveDocsAgentFeedbackConfig, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-DCTGj6J7.mjs";
|
|
3
|
+
import { A as buildDocsLegacySkillsIndex, D as buildDocsA2AAgentCard, L as resolveDocsPublishedAgentSkill, O as buildDocsAgentSkillsIndex, V as formatDocsContentDigest, W as resolveDocsHttpDate, 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-Bpz90VYq.mjs";
|
|
4
|
+
import "./openapi-mcp-DQ3xptKo.mjs";
|
|
5
|
+
import { t as resolveDocsI18n } from "./i18n-B1gJ9EW0.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-BOjWB1ky.mjs";
|
|
7
|
+
import "./sitemap-server-NeVu8W38.mjs";
|
|
8
|
+
import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-Ddbf15pY.mjs";
|
|
9
|
+
import "./agent-evals-D-sPJfXz.mjs";
|
|
10
10
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
11
|
-
import "./authoring-mcp-
|
|
12
|
-
import "./code-blocks-
|
|
11
|
+
import "./authoring-mcp-Be7quE5R.mjs";
|
|
12
|
+
import "./code-blocks-D90CCJFs.mjs";
|
|
13
13
|
import "./server.mjs";
|
|
14
|
-
import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-
|
|
15
|
-
import { t as detectFramework } from "./utils-
|
|
14
|
+
import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-DrZ3fXgf.mjs";
|
|
15
|
+
import { t as detectFramework } from "./utils-Cc1SrVza.mjs";
|
|
16
16
|
import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
17
17
|
import path from "node:path";
|
|
18
18
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -685,7 +685,8 @@ async function exportAgentBundle(options = {}) {
|
|
|
685
685
|
};
|
|
686
686
|
});
|
|
687
687
|
if (localizedPages.length === 0) throw new Error(`No docs content was found under ${contentDir}.`);
|
|
688
|
-
const
|
|
688
|
+
const publishablePages = localizedPages.filter(({ page }) => isDocsAgentPageAccessible(page));
|
|
689
|
+
const pages = publishablePages.map(({ page }) => page);
|
|
689
690
|
const okfConfig = resolveDocsOkfConfig(config?.agent?.okf);
|
|
690
691
|
const sitemap = resolveDocsSitemapConfig(sitemapInput, { baseUrl });
|
|
691
692
|
const robots = resolveDocsRobotsConfig(robotsInput, { baseUrl: typeof robotsInput === "object" ? robotsInput.baseUrl ?? sitemap.baseUrl : sitemap.baseUrl });
|
|
@@ -728,7 +729,7 @@ async function exportAgentBundle(options = {}) {
|
|
|
728
729
|
const configuredAgentSkills = await resolveConfiguredAgentSkills(config?.agent?.skills, { rootDir });
|
|
729
730
|
let outputs = [];
|
|
730
731
|
const internalOutputs = [];
|
|
731
|
-
for (const { page } of
|
|
732
|
+
for (const { page } of publishablePages) {
|
|
732
733
|
const output = addOutput(outputs, publicDir, staticMarkdownRoute(page, sourceEntry, routeEntry), "page", "text/markdown", renderDocsMarkdownDocument({
|
|
733
734
|
...page,
|
|
734
735
|
markdownUrl: staticMarkdownRoute(page, sourceEntry, routeEntry)
|
|
@@ -758,7 +759,8 @@ async function exportAgentBundle(options = {}) {
|
|
|
758
759
|
agentContent: page.agentContent,
|
|
759
760
|
agentRawContent: page.agentRawContent,
|
|
760
761
|
agentFallbackContent: page.agentFallbackContent,
|
|
761
|
-
agentFallbackRawContent: page.agentFallbackRawContent
|
|
762
|
+
agentFallbackRawContent: page.agentFallbackRawContent,
|
|
763
|
+
agent: page.agent
|
|
762
764
|
})), llms);
|
|
763
765
|
for (const route of [DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE]) addOutput(outputs, publicDir, route, "llms", "text/plain", llmsContent.llmsTxt);
|
|
764
766
|
for (const route of [DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE]) addOutput(outputs, publicDir, route, "llms", "text/plain", llmsContent.llmsFullTxt);
|
|
@@ -888,7 +890,7 @@ async function exportAgentBundle(options = {}) {
|
|
|
888
890
|
internalOutputs,
|
|
889
891
|
orphanedFiles,
|
|
890
892
|
orphanedInternalFiles,
|
|
891
|
-
pages:
|
|
893
|
+
pages: publishablePages
|
|
892
894
|
});
|
|
893
895
|
const manifestJson = `${JSON.stringify(manifest, null, 2)}\n`;
|
|
894
896
|
const changed = changedOutputs(outputs);
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { i as sha256DocsContent } from "./retrieval-digest-B-SgtXKK.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/agent-feedback-evaluations.ts
|
|
4
|
+
const DOCS_AGENT_FEEDBACK_EVALUATION_CANDIDATES_FORMAT = "farming-labs-agent-feedback-evaluation-candidates.v1";
|
|
5
|
+
const DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT = "farming-labs-agent-feedback-evaluation-baseline.v1";
|
|
6
|
+
const DOCS_AGENT_FEEDBACK_EVALUATION_REGRESSION_FORMAT = "farming-labs-agent-feedback-evaluation-regression.v1";
|
|
7
|
+
const SECRET_PATTERNS = [
|
|
8
|
+
{
|
|
9
|
+
pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/gu,
|
|
10
|
+
replacement: "[redacted-private-key]"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
pattern: /\b(?:sk-[A-Za-z0-9_-]{12,}|gh[pousr]_[A-Za-z0-9_]{12,}|github_pat_[A-Za-z0-9_]{12,}|xox[baprs]-[A-Za-z0-9-]{12,})\b/gu,
|
|
14
|
+
replacement: "[redacted-token]"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/giu,
|
|
18
|
+
replacement: "Bearer [redacted-token]"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/giu,
|
|
22
|
+
replacement: "[redacted-email]"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
pattern: /([?&](?:api[_-]?key|password|secret|signature|token)=)[^&#\s]+/giu,
|
|
26
|
+
replacement: (match) => `${match.slice(0, match.indexOf("=") + 1)}[redacted]`
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
function sanitizeText(value, maxLength) {
|
|
30
|
+
if (typeof value !== "string") return { redactions: 0 };
|
|
31
|
+
let output = value.split("").map((character) => {
|
|
32
|
+
const code = character.charCodeAt(0);
|
|
33
|
+
return code <= 31 || code === 127 ? " " : character;
|
|
34
|
+
}).join("").trim().replace(/\s+/g, " ");
|
|
35
|
+
let redactions = 0;
|
|
36
|
+
for (const { pattern, replacement } of SECRET_PATTERNS) {
|
|
37
|
+
pattern.lastIndex = 0;
|
|
38
|
+
output = output.replace(pattern, (match) => {
|
|
39
|
+
redactions += 1;
|
|
40
|
+
return typeof replacement === "function" ? replacement(match) : replacement;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return output ? {
|
|
44
|
+
value: output.slice(0, maxLength),
|
|
45
|
+
redactions
|
|
46
|
+
} : { redactions };
|
|
47
|
+
}
|
|
48
|
+
function sanitizeStringList(value, maxItems, maxLength) {
|
|
49
|
+
if (!Array.isArray(value)) return {
|
|
50
|
+
values: [],
|
|
51
|
+
redactions: 0
|
|
52
|
+
};
|
|
53
|
+
const values = [];
|
|
54
|
+
let redactions = 0;
|
|
55
|
+
for (const item of value.slice(0, maxItems)) {
|
|
56
|
+
const sanitized = sanitizeText(item, maxLength);
|
|
57
|
+
redactions += sanitized.redactions;
|
|
58
|
+
if (sanitized.value && !values.includes(sanitized.value)) values.push(sanitized.value);
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
values,
|
|
62
|
+
redactions
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function slugify(value) {
|
|
66
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 96) || "feedback-evaluation";
|
|
67
|
+
}
|
|
68
|
+
function fingerprintTask(task) {
|
|
69
|
+
const sources = [...task.expect.relevantSources ?? []].sort();
|
|
70
|
+
return `sha256:${sha256DocsContent(JSON.stringify({
|
|
71
|
+
query: task.query.trim().toLowerCase(),
|
|
72
|
+
sources,
|
|
73
|
+
filters: task.filters ?? null
|
|
74
|
+
}))}`;
|
|
75
|
+
}
|
|
76
|
+
function sanitizeClusterTask(cluster) {
|
|
77
|
+
const rawTask = cluster.goldenTask;
|
|
78
|
+
if (!rawTask) return { redactions: 0 };
|
|
79
|
+
const query = sanitizeText(rawTask.query, 500);
|
|
80
|
+
const relevant = sanitizeStringList(rawTask.expect?.relevantSources, 20, 500);
|
|
81
|
+
const citations = sanitizeStringList(rawTask.expect?.requiredCitations, 20, 500);
|
|
82
|
+
const id = sanitizeText(rawTask.id, 120);
|
|
83
|
+
const redactions = query.redactions + relevant.redactions + citations.redactions + id.redactions;
|
|
84
|
+
if (!query.value || relevant.values.length === 0) return { redactions };
|
|
85
|
+
const taskId = slugify(id.value ?? `feedback-${cluster.id}`);
|
|
86
|
+
const topK = typeof rawTask.topK === "number" && Number.isFinite(rawTask.topK) ? Math.min(100, Math.max(1, Math.floor(rawTask.topK))) : 3;
|
|
87
|
+
return {
|
|
88
|
+
redactions,
|
|
89
|
+
task: {
|
|
90
|
+
id: taskId,
|
|
91
|
+
query: query.value,
|
|
92
|
+
tokenBudget: typeof rawTask.tokenBudget === "number" && Number.isFinite(rawTask.tokenBudget) ? Math.min(1e6, Math.max(1, Math.floor(rawTask.tokenBudget))) : 4e3,
|
|
93
|
+
topK,
|
|
94
|
+
expect: {
|
|
95
|
+
relevantSources: relevant.values,
|
|
96
|
+
requiredCitations: citations.values.length > 0 ? citations.values : relevant.values,
|
|
97
|
+
minRecallAtK: 1,
|
|
98
|
+
maxFirstRelevantRank: topK
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function buildDocsAgentFeedbackEvaluationCandidates(report, options = {}) {
|
|
104
|
+
if (report.format !== "farming-labs-agent-feedback-improvements.v1") throw new Error("Input is not a supported agent feedback improvement report.");
|
|
105
|
+
const existingTasks = options.existingTasks ?? [];
|
|
106
|
+
const existingIds = new Set(existingTasks.map((task) => task.id));
|
|
107
|
+
const existingFingerprints = new Set(existingTasks.map(fingerprintTask));
|
|
108
|
+
const candidateFingerprints = /* @__PURE__ */ new Set();
|
|
109
|
+
const candidates = [];
|
|
110
|
+
const duplicates = [];
|
|
111
|
+
let redactionCount = 0;
|
|
112
|
+
for (const cluster of report.clusters) {
|
|
113
|
+
const clusterId = sanitizeText(cluster.id, 200);
|
|
114
|
+
const sanitized = sanitizeClusterTask(cluster);
|
|
115
|
+
redactionCount += clusterId.redactions + sanitized.redactions;
|
|
116
|
+
if (!sanitized.task) continue;
|
|
117
|
+
const fingerprint = fingerprintTask(sanitized.task);
|
|
118
|
+
const reason = existingIds.has(sanitized.task.id) ? "existing-id" : existingFingerprints.has(fingerprint) ? "existing-fingerprint" : candidateFingerprints.has(fingerprint) ? "duplicate-candidate" : void 0;
|
|
119
|
+
if (reason) {
|
|
120
|
+
duplicates.push({
|
|
121
|
+
clusterId: slugify(clusterId.value ?? "feedback"),
|
|
122
|
+
taskId: sanitized.task.id,
|
|
123
|
+
fingerprint,
|
|
124
|
+
reason
|
|
125
|
+
});
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
candidateFingerprints.add(fingerprint);
|
|
129
|
+
const page = sanitizeText(cluster.page, 500);
|
|
130
|
+
const outcomes = sanitizeStringList(cluster.outcomes, 20, 200);
|
|
131
|
+
redactionCount += page.redactions + outcomes.redactions;
|
|
132
|
+
candidates.push({
|
|
133
|
+
id: `candidate-${slugify(clusterId.value ?? "feedback")}`,
|
|
134
|
+
fingerprint,
|
|
135
|
+
state: "candidate",
|
|
136
|
+
task: sanitized.task,
|
|
137
|
+
evidence: {
|
|
138
|
+
clusterId: slugify(clusterId.value ?? "feedback"),
|
|
139
|
+
page: page.value ?? "(unknown page)",
|
|
140
|
+
occurrences: Math.max(1, Math.floor(cluster.occurrences)),
|
|
141
|
+
outcomes: outcomes.values
|
|
142
|
+
},
|
|
143
|
+
sanitization: { redactionCount: sanitized.redactions + clusterId.redactions + page.redactions + outcomes.redactions },
|
|
144
|
+
promotion: {
|
|
145
|
+
target: "agent.evaluations.tasks",
|
|
146
|
+
requiresHumanReview: true
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
candidates.sort((left, right) => left.id.localeCompare(right.id));
|
|
151
|
+
return {
|
|
152
|
+
format: DOCS_AGENT_FEEDBACK_EVALUATION_CANDIDATES_FORMAT,
|
|
153
|
+
generatedAt: options.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
154
|
+
sourceFeedbackCount: report.feedbackCount,
|
|
155
|
+
sourceClusterCount: report.recurringClusterCount,
|
|
156
|
+
candidateCount: candidates.length,
|
|
157
|
+
duplicateCount: duplicates.length,
|
|
158
|
+
redactionCount,
|
|
159
|
+
candidates,
|
|
160
|
+
duplicates,
|
|
161
|
+
promotion: {
|
|
162
|
+
mode: "review-required",
|
|
163
|
+
automaticallyUpdatesConfig: false,
|
|
164
|
+
automaticallyPublishes: false
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function createDocsAgentFeedbackEvaluationBaseline(report, generatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
169
|
+
if (report.score === null || report.taskCount === 0) throw new Error("Cannot create a baseline from an unmeasured evaluation report.");
|
|
170
|
+
return {
|
|
171
|
+
format: DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT,
|
|
172
|
+
generatedAt,
|
|
173
|
+
score: report.score,
|
|
174
|
+
taskCount: report.taskCount,
|
|
175
|
+
passedTaskCount: report.passedTaskCount,
|
|
176
|
+
tasks: report.tasks.map((task) => ({
|
|
177
|
+
id: task.id,
|
|
178
|
+
passed: task.passed,
|
|
179
|
+
score: task.score
|
|
180
|
+
})).sort((left, right) => left.id.localeCompare(right.id))
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function round(value) {
|
|
184
|
+
return Math.round(value * 100) / 100;
|
|
185
|
+
}
|
|
186
|
+
function compareDocsAgentFeedbackEvaluationBaseline(current, baseline, options = {}) {
|
|
187
|
+
if (current.score === null) throw new Error("Current evaluation report is unmeasured.");
|
|
188
|
+
if (baseline.format !== DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT) throw new Error("Evaluation baseline format is not supported.");
|
|
189
|
+
const requestedScoreDrop = options.maxScoreDrop ?? 0;
|
|
190
|
+
if (!Number.isFinite(requestedScoreDrop) || requestedScoreDrop < 0 || requestedScoreDrop > 100) throw new Error("maxScoreDrop must be a number from 0 through 100.");
|
|
191
|
+
const maxScoreDrop = requestedScoreDrop;
|
|
192
|
+
const regressions = [];
|
|
193
|
+
const scoreDelta = round(current.score - baseline.score);
|
|
194
|
+
if (scoreDelta < -maxScoreDrop) regressions.push({
|
|
195
|
+
kind: "suite-score-drop",
|
|
196
|
+
message: `Suite score dropped from ${baseline.score} to ${current.score}.`
|
|
197
|
+
});
|
|
198
|
+
const currentById = new Map(current.tasks.map((task) => [task.id, task]));
|
|
199
|
+
const baselineIds = new Set(baseline.tasks.map((task) => task.id));
|
|
200
|
+
for (const expected of baseline.tasks) {
|
|
201
|
+
const actual = currentById.get(expected.id);
|
|
202
|
+
if (!actual) {
|
|
203
|
+
regressions.push({
|
|
204
|
+
kind: "missing-task",
|
|
205
|
+
taskId: expected.id,
|
|
206
|
+
message: `Baseline task ${expected.id} is missing from the current report.`
|
|
207
|
+
});
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (expected.passed && !actual.passed) regressions.push({
|
|
211
|
+
kind: "pass-to-fail",
|
|
212
|
+
taskId: expected.id,
|
|
213
|
+
message: `Task ${expected.id} changed from passing to failing.`
|
|
214
|
+
});
|
|
215
|
+
if (actual.score < expected.score - maxScoreDrop) regressions.push({
|
|
216
|
+
kind: "score-drop",
|
|
217
|
+
taskId: expected.id,
|
|
218
|
+
message: `Task ${expected.id} score dropped from ${expected.score} to ${actual.score}.`
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
if (options.failOnNewFailures !== false) {
|
|
222
|
+
for (const task of current.tasks) if (!baselineIds.has(task.id) && !task.passed) regressions.push({
|
|
223
|
+
kind: "new-failure",
|
|
224
|
+
taskId: task.id,
|
|
225
|
+
message: `New task ${task.id} is failing.`
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
format: DOCS_AGENT_FEEDBACK_EVALUATION_REGRESSION_FORMAT,
|
|
230
|
+
passed: regressions.length === 0,
|
|
231
|
+
baselineScore: baseline.score,
|
|
232
|
+
currentScore: current.score,
|
|
233
|
+
scoreDelta,
|
|
234
|
+
maxScoreDrop,
|
|
235
|
+
regressions
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
//#endregion
|
|
240
|
+
export { compareDocsAgentFeedbackEvaluationBaseline as a, buildDocsAgentFeedbackEvaluationCandidates as i, DOCS_AGENT_FEEDBACK_EVALUATION_CANDIDATES_FORMAT as n, createDocsAgentFeedbackEvaluationBaseline as o, DOCS_AGENT_FEEDBACK_EVALUATION_REGRESSION_FORMAT as r, DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT as t };
|