@farming-labs/docs 0.2.120 → 0.2.122
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/README.md +8 -0
- package/dist/access.d.mts +13 -0
- package/dist/access.mjs +56 -0
- package/dist/agent-conformance.d.mts +60 -0
- package/dist/agent-conformance.mjs +538 -0
- package/dist/agent-contract.d.mts +47 -0
- package/dist/agent-contract.mjs +645 -0
- package/dist/agent-detection.d.mts +6 -0
- package/dist/agent-detection.mjs +83 -0
- package/dist/agent-evals.d.mts +224 -0
- package/dist/{agent-evals-BLNLvXbG.mjs → agent-evals.mjs} +7 -565
- package/dist/agent-feedback-evaluations-node.mjs +38 -0
- package/dist/agent-feedback-evaluations.d.mts +91 -0
- package/dist/{agent-feedback-evaluations-CcMGlgsO.mjs → agent-feedback-evaluations.mjs} +2 -2
- package/dist/agent-feedback-loop.d.mts +45 -0
- package/dist/{agent-feedback-loop-CcZL_sb1.mjs → agent-feedback-loop.mjs} +1 -1
- package/dist/agent-maintenance.d.mts +71 -0
- package/dist/{agent-maintenance-CuZ7iAKq.mjs → agent-maintenance.mjs} +1 -1
- package/dist/agent-provenance.d.mts +23 -0
- package/dist/agent-provenance.mjs +77 -0
- package/dist/agent-scope.mjs +321 -0
- package/dist/agent-skills-archive.mjs +86 -0
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-progressive-disclosure-PjPtTYL-.mjs → agent-skills-progressive-disclosure.mjs} +2 -2
- package/dist/{agent-skills-server-D5IuvwM7.d.mts → agent-skills-server.d.mts} +3 -3
- package/dist/{agent-skills-server-BC7md56k.mjs → agent-skills-server.mjs} +2 -2
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +1 -2
- package/dist/agent-surface-drift.mjs +236 -0
- package/dist/{golden-evaluations-CLUViycJ.mjs → agent-usefulness.mjs} +5 -290
- package/dist/{content-change-hydration-wqXIZHp6.d.mts → agent.d.mts} +10 -411
- package/dist/agent.mjs +2729 -0
- package/dist/{analytics-w3FDOksr.d.mts → analytics.d.mts} +2 -2
- package/dist/{analytics-p8Vhhu2P.mjs → analytics.mjs} +2 -2
- package/dist/{sitemap-server-BUdPBcGs.d.mts → api-reference.d.mts} +2 -6
- package/dist/api-reference.mjs +1481 -0
- package/dist/{audience-exposure-DBrFWULA.d.mts → audience-exposure.d.mts} +1 -1
- package/dist/audience-exposure.mjs +8 -0
- package/dist/audience.d.mts +44 -0
- package/dist/audience.mjs +1654 -0
- package/dist/authoring-mcp.d.mts +44 -0
- package/dist/{authoring-mcp-CiCUQe3o.mjs → authoring-mcp.mjs} +3 -3
- package/dist/browser.d.mts +6 -4
- package/dist/browser.mjs +6 -7
- package/dist/build.d.mts +8 -0
- package/dist/build.mjs +8 -0
- package/dist/changelog.d.mts +20 -0
- package/dist/changelog.mjs +39 -0
- package/dist/{agent-export-CA6IUQ7T.mjs → cli/agent-export.mjs} +19 -45
- package/dist/{agent-CYk2DxY7.mjs → cli/agent.mjs} +6 -35
- package/dist/{agents-BUiVmj8i.mjs → cli/agents.mjs} +5 -18
- package/dist/cli/api-doctor.mjs +206 -0
- package/dist/{authoring-C2ymvYWl.mjs → cli/authoring.mjs} +2 -8
- package/dist/{cloud-6eKrlmKd.mjs → cli/cloud.mjs} +3 -3
- package/dist/{codeblocks-CHpgAwY-.mjs → cli/codeblocks.mjs} +2 -2
- package/dist/cli/config.d.mts +11 -0
- package/dist/{config-BZnKAj_Y.mjs → cli/config.mjs} +1 -1
- package/dist/cli/dev-banner.mjs +58 -0
- package/dist/{dev-Bnn-NUNa.mjs → cli/dev.mjs} +3 -57
- package/dist/{doctor-Bfkrkzad.mjs → cli/doctor.mjs} +41 -226
- package/dist/{downgrade-CHMta85e.mjs → cli/downgrade.mjs} +2 -2
- package/dist/cli/errors.d.mts +4 -0
- package/dist/{errors-BtnVLhNF.mjs → cli/errors.mjs} +1 -1
- package/dist/{feedback-evals-DMilg9pY.mjs → cli/feedback-evals.mjs} +3 -36
- package/dist/{feedback-DL4T5oIO.mjs → cli/feedback.mjs} +1 -1
- package/dist/cli/git-dates.mjs +35 -0
- package/dist/cli/golden-evaluations.mjs +52 -0
- package/dist/cli/index.d.mts +2 -3
- package/dist/cli/index.mjs +38 -38
- package/dist/{init-K0LmXDZ5.mjs → cli/init.mjs} +3 -3
- package/dist/{mcp-iLCmnPJI.mjs → cli/mcp.mjs} +7 -19
- package/dist/{openapi-diff-HcpUNjA-.mjs → cli/openapi-diff.mjs} +2 -7
- package/dist/{openapi-sdk-BQKC6H-_.mjs → cli/openapi-sdk.mjs} +2 -7
- package/dist/{openapi-source-DK6ts_Bk.mjs → cli/openapi-source.mjs} +2 -2
- package/dist/{package-version-HJhYeq4M.mjs → cli/package-version.mjs} +2 -2
- package/dist/{propose-JmUv_BTt.mjs → cli/propose.mjs} +1 -1
- package/dist/{review-C6EmbV0l.mjs → cli/review.mjs} +16 -15
- package/dist/{robots-DteZB8vl.mjs → cli/robots.mjs} +3 -7
- package/dist/{search-Bhuv_YsL.mjs → cli/search.mjs} +7 -20
- package/dist/{sitemap-DW5LDKDa.mjs → cli/sitemap.mjs} +7 -42
- package/dist/{skills-BAPQLSCm.mjs → cli/skills.mjs} +5 -19
- package/dist/{templates-BuQ8YsGv.mjs → cli/templates.mjs} +1 -1
- package/dist/{upgrade-DlQMOFV1.mjs → cli/upgrade.mjs} +2 -2
- package/dist/{utils-C7KDrPpA.mjs → cli/utils.mjs} +1 -1
- package/dist/client/react.d.mts +2 -18
- package/dist/client/react.mjs +1 -157
- package/dist/{cloud-analytics-D14HplI7.mjs → cloud-analytics.mjs} +1 -1
- package/dist/{cloud-ask-ai-BrsTXQf6.d.mts → cloud-ask-ai.d.mts} +2 -2
- package/dist/{cloud-ask-ai-BqKhjpS5.mjs → cloud-ask-ai.mjs} +3 -3
- package/dist/code-blocks.d.mts +51 -0
- package/dist/{code-blocks-GYdvS3BH.mjs → code-blocks.mjs} +2 -2
- package/dist/code-group-mdx.d.mts +11 -0
- package/dist/code-group-mdx.mjs +57 -0
- package/dist/content-change-hydration.d.mts +87 -0
- package/dist/{openapi-mcp-BIOTLiA7.mjs → content-change-hydration.mjs} +5 -210
- package/dist/content-changes.d.mts +47 -0
- package/dist/content-changes.mjs +216 -0
- package/dist/create-theme.d.mts +48 -0
- package/dist/create-theme.mjs +57 -0
- package/dist/date.d.mts +5 -0
- package/dist/date.mjs +17 -0
- package/dist/define-docs.d.mts +9 -0
- package/dist/define-docs.mjs +46 -0
- package/dist/docs-cloud-client.d.mts +18 -0
- package/dist/docs-cloud-client.mjs +161 -0
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +2 -3
- package/dist/heading-toc.d.mts +10 -0
- package/dist/heading-toc.mjs +23 -0
- package/dist/http-body.d.mts +14 -0
- package/dist/{http-body-DkAPk6D5.mjs → http-body.mjs} +1 -1
- package/dist/http-cache.d.mts +25 -0
- package/dist/http-cache.mjs +140 -0
- package/dist/http-link.mjs +81 -0
- package/dist/i18n.d.mts +18 -0
- package/dist/{i18n-B1gJ9EW0.mjs → i18n.mjs} +1 -1
- package/dist/index.d.mts +42 -674
- package/dist/index.mjs +40 -14
- package/dist/markdown-rendering.mjs +1 -1
- package/dist/markdown-section-cache.mjs +49 -0
- package/dist/markdown-sections.d.mts +47 -0
- package/dist/{markdown-sections-9Oxr33b-.mjs → markdown-sections.mjs} +29 -703
- package/dist/mcp-auth.d.mts +14 -0
- package/dist/mcp-auth.mjs +99 -0
- package/dist/mcp.d.mts +5 -3
- package/dist/mcp.mjs +21 -9
- package/dist/mdx.d.mts +6 -0
- package/dist/mdx.mjs +7 -0
- package/dist/metadata.d.mts +60 -0
- package/dist/{metadata-BOHn0Y5K.mjs → metadata.mjs} +2 -2
- package/dist/native-api-reference.mjs +968 -0
- package/dist/okf.d.mts +42 -0
- package/dist/okf.mjs +145 -0
- package/dist/openapi-contract.mjs +154 -0
- package/dist/{openapi-mcp-node-C4jUpZG6.mjs → openapi-mcp-node.mjs} +1 -1
- package/dist/openapi-mcp.d.mts +26 -0
- package/dist/openapi-mcp.mjs +132 -0
- package/dist/openapi-operations.d.mts +71 -0
- package/dist/{openapi-operations-DFpaqOqA.mjs → openapi-operations.mjs} +1 -1
- package/dist/openapi-overlays.mjs +221 -0
- package/dist/openapi-references.mjs +233 -0
- package/dist/pagination.d.mts +7 -0
- package/dist/pagination.mjs +100 -0
- package/dist/prompt-references.d.mts +12 -0
- package/dist/prompt-references.mjs +132 -0
- package/dist/prompt-utils.d.mts +36 -0
- package/dist/{prompt-utils-B5g-bv7o.mjs → prompt-utils.mjs} +1 -57
- package/dist/reading-time.d.mts +23 -0
- package/dist/reading-time.mjs +58 -0
- package/dist/related.d.mts +7 -0
- package/dist/related.mjs +50 -0
- package/dist/retrieval-digest.d.mts +16 -0
- package/dist/{retrieval-digest-CT-eIEcp.mjs → retrieval-digest.mjs} +1 -1
- package/dist/review.d.mts +69 -0
- package/dist/review.mjs +562 -0
- package/dist/robots.d.mts +54 -0
- package/dist/{robots-BYJAVeI6.mjs → robots.mjs} +5 -3
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.mjs +3 -9
- package/dist/search.d.mts +210 -0
- package/dist/search.mjs +3401 -0
- package/dist/server.d.mts +22 -198
- package/dist/server.mjs +21 -19
- package/dist/sidebar.d.mts +15 -0
- package/dist/sidebar.mjs +73 -0
- package/dist/sitemap-server.d.mts +7 -0
- package/dist/{sitemap-server-Lg3YhUx4.mjs → sitemap-server.mjs} +2 -2
- package/dist/{sitemap-Cl8vrixd.d.mts → sitemap.d.mts} +3 -3
- package/dist/sitemap.mjs +254 -0
- package/dist/{standards-discovery-BHPc7YIX.d.mts → standards-discovery.d.mts} +2 -2
- package/dist/{standards-discovery-sSEojU80.mjs → standards-discovery.mjs} +3 -139
- package/dist/telemetry-runtime.d.mts +42 -0
- package/dist/telemetry-runtime.mjs +238 -0
- package/dist/telemetry.d.mts +15 -0
- package/dist/telemetry.mjs +117 -0
- package/dist/{types-BJFeMXWZ.d.mts → types.d.mts} +3 -2
- package/dist/urls.d.mts +7 -0
- package/dist/urls.mjs +21 -0
- package/dist/utils.d.mts +8 -0
- package/dist/utils.mjs +22 -0
- package/package.json +21 -3
- package/dist/agent-DkAidqtV.mjs +0 -9026
- package/dist/api-reference-BYee4zMo.mjs +0 -3046
- package/dist/prompt-references-DMgbu_dz.mjs +0 -1082
- package/dist/retrieval-digest-AOx2-LbC.d.mts +0 -367
- package/dist/sidebar-CFHBj29f.mjs +0 -421
- package/dist/sidebar-CMPbVfGP.d.mts +0 -63
- /package/dist/{openapi-CfCzX_a1.mjs → cli/openapi.mjs} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { hasStructuredPageAgentContract, normalizePageAgentFrontmatter } from "./agent-contract.mjs";
|
|
2
|
+
import { agentVersionConstraintsOverlap, normalizeAgentFramework, normalizeAgentVersion } from "./agent-scope.mjs";
|
|
3
|
+
import { findDocsAudienceMdxTags, resolveDocsAudienceMdxContent } from "./audience.mjs";
|
|
4
|
+
import { extractCodeBlocksFromMarkdown } from "./code-blocks.mjs";
|
|
4
5
|
import { isMap, isScalar, isSeq, parseDocument } from "yaml";
|
|
5
6
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
6
7
|
import path from "node:path";
|
|
@@ -1656,290 +1657,4 @@ function clampRatio(value) {
|
|
|
1656
1657
|
}
|
|
1657
1658
|
|
|
1658
1659
|
//#endregion
|
|
1659
|
-
|
|
1660
|
-
function isRecord(value) {
|
|
1661
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1662
|
-
}
|
|
1663
|
-
function normalizeDotPath(value) {
|
|
1664
|
-
const segments = value.trim().replace(/\[\d+\]/gu, "[]").replace(/^\/+|\/+$/g, "").replaceAll("/", ".").split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
1665
|
-
const normalized = [];
|
|
1666
|
-
for (const segment of segments) {
|
|
1667
|
-
if (/^\d+$/u.test(segment) && normalized.length > 0) {
|
|
1668
|
-
normalized[normalized.length - 1] = `${normalized.at(-1)}[]`;
|
|
1669
|
-
continue;
|
|
1670
|
-
}
|
|
1671
|
-
normalized.push(segment);
|
|
1672
|
-
}
|
|
1673
|
-
return normalized.join(".");
|
|
1674
|
-
}
|
|
1675
|
-
function collectSchemaPaths(options) {
|
|
1676
|
-
const paths = /* @__PURE__ */ new Set();
|
|
1677
|
-
const visited = /* @__PURE__ */ new Set();
|
|
1678
|
-
const visit = (option) => {
|
|
1679
|
-
if (visited.has(option)) return;
|
|
1680
|
-
visited.add(option);
|
|
1681
|
-
const optionPath = normalizeDotPath(option.path);
|
|
1682
|
-
if (optionPath) paths.add(optionPath);
|
|
1683
|
-
for (const child of option.children ?? []) visit(child);
|
|
1684
|
-
};
|
|
1685
|
-
for (const option of options) visit(option);
|
|
1686
|
-
return paths;
|
|
1687
|
-
}
|
|
1688
|
-
function schemaCoversConfigPath(schemaPaths, configPath) {
|
|
1689
|
-
if (schemaPaths.has(configPath)) return true;
|
|
1690
|
-
if (configPath.endsWith("[]") && schemaPaths.has(configPath.slice(0, -2))) return true;
|
|
1691
|
-
for (const schemaPath of schemaPaths) {
|
|
1692
|
-
if (!schemaPath.endsWith(".*")) continue;
|
|
1693
|
-
const prefix = schemaPath.slice(0, -1);
|
|
1694
|
-
if (configPath.startsWith(prefix) && configPath.length > prefix.length) return true;
|
|
1695
|
-
}
|
|
1696
|
-
return false;
|
|
1697
|
-
}
|
|
1698
|
-
function readPath(root, dotPath) {
|
|
1699
|
-
const normalized = normalizeDotPath(dotPath);
|
|
1700
|
-
if (!normalized) return {
|
|
1701
|
-
present: true,
|
|
1702
|
-
value: root
|
|
1703
|
-
};
|
|
1704
|
-
let current = root;
|
|
1705
|
-
for (const segment of normalized.split(".")) {
|
|
1706
|
-
if (!isRecord(current) || !Object.prototype.hasOwnProperty.call(current, segment)) return {
|
|
1707
|
-
present: false,
|
|
1708
|
-
value: void 0
|
|
1709
|
-
};
|
|
1710
|
-
current = current[segment];
|
|
1711
|
-
}
|
|
1712
|
-
return {
|
|
1713
|
-
present: true,
|
|
1714
|
-
value: current
|
|
1715
|
-
};
|
|
1716
|
-
}
|
|
1717
|
-
function stableJsonValue(value) {
|
|
1718
|
-
if (Array.isArray(value)) return value.map(stableJsonValue);
|
|
1719
|
-
if (!isRecord(value)) return value;
|
|
1720
|
-
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, stableJsonValue(value[key])]));
|
|
1721
|
-
}
|
|
1722
|
-
function displayValue(value, present = true) {
|
|
1723
|
-
if (!present || value === void 0) return "<missing>";
|
|
1724
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
1725
|
-
if (typeof value === "number" || typeof value === "boolean" || value === null) return String(value);
|
|
1726
|
-
try {
|
|
1727
|
-
return JSON.stringify(stableJsonValue(value));
|
|
1728
|
-
} catch {
|
|
1729
|
-
return "<unserializable>";
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
function valuesMatch(actual, expected) {
|
|
1733
|
-
if (!actual.present) return false;
|
|
1734
|
-
if (Object.is(actual.value, expected)) return true;
|
|
1735
|
-
if ((Array.isArray(actual.value) || isRecord(actual.value)) && (Array.isArray(expected) || isRecord(expected))) return displayValue(actual.value) === displayValue(expected);
|
|
1736
|
-
return false;
|
|
1737
|
-
}
|
|
1738
|
-
function mismatchIssue(code, path, expected, actual, label) {
|
|
1739
|
-
const expectedDisplay = displayValue(expected);
|
|
1740
|
-
const actualDisplay = displayValue(actual.value, actual.present);
|
|
1741
|
-
return {
|
|
1742
|
-
code,
|
|
1743
|
-
path,
|
|
1744
|
-
expected: expectedDisplay,
|
|
1745
|
-
actual: actualDisplay,
|
|
1746
|
-
message: `${label} is ${actualDisplay}; expected ${expectedDisplay}.`
|
|
1747
|
-
};
|
|
1748
|
-
}
|
|
1749
|
-
function compareExpectedValue(issues, discovery, code, path, expected, label) {
|
|
1750
|
-
const actual = readPath(discovery, path);
|
|
1751
|
-
if (!valuesMatch(actual, expected)) issues.push(mismatchIssue(code, path, expected, actual, label));
|
|
1752
|
-
}
|
|
1753
|
-
/**
|
|
1754
|
-
* Compare independently resolved docs values with the public agent discovery and
|
|
1755
|
-
* config-schema surfaces. The helper is intentionally pure so doctor, review,
|
|
1756
|
-
* and golden evaluations can use the same deterministic drift rules.
|
|
1757
|
-
*/
|
|
1758
|
-
function analyzeAgentSurfaceDrift(options) {
|
|
1759
|
-
const issues = [];
|
|
1760
|
-
const schemaPaths = collectSchemaPaths(options.schemaOptions);
|
|
1761
|
-
const configPaths = Array.from(new Set(options.configOptionPaths.map(normalizeDotPath).filter(Boolean))).sort();
|
|
1762
|
-
for (const configPath of configPaths) {
|
|
1763
|
-
if (schemaCoversConfigPath(schemaPaths, configPath)) continue;
|
|
1764
|
-
issues.push({
|
|
1765
|
-
code: "config-schema-omission",
|
|
1766
|
-
path: configPath,
|
|
1767
|
-
expected: "documented schema option",
|
|
1768
|
-
actual: "<missing>",
|
|
1769
|
-
message: `Config option ${JSON.stringify(configPath)} is present but missing from the published config schema.`
|
|
1770
|
-
});
|
|
1771
|
-
}
|
|
1772
|
-
const canonicalFields = Array.from(new Set(options.agentContractFields.map((field) => field.trim()).filter(Boolean))).sort();
|
|
1773
|
-
const discoveredFieldsValue = readPath(options.discovery, "agentContract.fields");
|
|
1774
|
-
const discoveredFields = isRecord(discoveredFieldsValue.value) ? Object.keys(discoveredFieldsValue.value).sort() : [];
|
|
1775
|
-
const canonicalFieldSet = new Set(canonicalFields);
|
|
1776
|
-
const discoveredFieldSet = new Set(discoveredFields);
|
|
1777
|
-
for (const field of canonicalFields) {
|
|
1778
|
-
if (discoveredFieldSet.has(field)) continue;
|
|
1779
|
-
const issuePath = `agentContract.fields.${field}`;
|
|
1780
|
-
issues.push({
|
|
1781
|
-
code: "agent-contract-field-missing",
|
|
1782
|
-
path: issuePath,
|
|
1783
|
-
expected: "canonical field",
|
|
1784
|
-
actual: "<missing>",
|
|
1785
|
-
message: `Discovery agent contract is missing canonical field ${JSON.stringify(field)}.`
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
for (const field of discoveredFields) {
|
|
1789
|
-
if (canonicalFieldSet.has(field)) continue;
|
|
1790
|
-
const issuePath = `agentContract.fields.${field}`;
|
|
1791
|
-
issues.push({
|
|
1792
|
-
code: "agent-contract-field-unexpected",
|
|
1793
|
-
path: issuePath,
|
|
1794
|
-
expected: "<absent>",
|
|
1795
|
-
actual: "declared field",
|
|
1796
|
-
message: `Discovery agent contract advertises non-canonical field ${JSON.stringify(field)}.`
|
|
1797
|
-
});
|
|
1798
|
-
}
|
|
1799
|
-
compareExpectedValue(issues, options.discovery, "entry-mismatch", "site.entry", options.expected.entry, "Discovery site.entry");
|
|
1800
|
-
compareExpectedValue(issues, options.discovery, "search-enabled-mismatch", "search.enabled", options.expected.search.enabled, "Discovery search.enabled");
|
|
1801
|
-
compareExpectedValue(issues, options.discovery, "search-capability-mismatch", "capabilities.search", options.expected.search.enabled, "Discovery capabilities.search");
|
|
1802
|
-
compareExpectedValue(issues, options.discovery, "search-route-mismatch", "search.endpoint", options.expected.search.endpoint, "Discovery search.endpoint");
|
|
1803
|
-
const expectedAgentSearchEndpoint = options.expected.search.endpoint === null ? null : `${options.expected.search.endpoint}${options.expected.search.endpoint.includes("?") ? "&" : "?"}audience=agent`;
|
|
1804
|
-
compareExpectedValue(issues, options.discovery, "search-audience-mismatch", "search.agentEndpoint", expectedAgentSearchEndpoint, "Discovery search.agentEndpoint");
|
|
1805
|
-
compareExpectedValue(issues, options.discovery, "search-audience-mismatch", "search.audienceParam", "audience", "Discovery search.audienceParam");
|
|
1806
|
-
compareExpectedValue(issues, options.discovery, "search-audience-mismatch", "search.defaultAudience", "human", "Discovery search.defaultAudience");
|
|
1807
|
-
compareExpectedValue(issues, options.discovery, "search-audience-mismatch", "search.supportedAudiences", ["human", "agent"], "Discovery search.supportedAudiences");
|
|
1808
|
-
const expectedStructuredAgentSearchEndpoint = expectedAgentSearchEndpoint === null ? null : `${expectedAgentSearchEndpoint}&response=structured`;
|
|
1809
|
-
const expectedSearchFacetsEndpoint = expectedAgentSearchEndpoint === null ? null : expectedAgentSearchEndpoint.replace("query={query}&audience=agent", "audience=agent&response=facets");
|
|
1810
|
-
const expectedExplainedAgentSearchEndpoint = expectedStructuredAgentSearchEndpoint === null ? null : `${expectedStructuredAgentSearchEndpoint}&explain=true`;
|
|
1811
|
-
for (const [path, expected] of [
|
|
1812
|
-
["search.structuredAgentEndpoint", expectedStructuredAgentSearchEndpoint],
|
|
1813
|
-
["search.explainedAgentEndpoint", expectedExplainedAgentSearchEndpoint],
|
|
1814
|
-
["search.facetsEndpoint", expectedSearchFacetsEndpoint],
|
|
1815
|
-
["search.responseParam", "response"],
|
|
1816
|
-
["search.structuredResponseValue", "structured"],
|
|
1817
|
-
["search.facetsResponseValue", "facets"],
|
|
1818
|
-
["search.responseFormat", "docs-search.v1"],
|
|
1819
|
-
["search.explainParam", "explain"],
|
|
1820
|
-
["search.explainValue", "true"],
|
|
1821
|
-
["search.explanationField", "explanation"],
|
|
1822
|
-
["search.explanationFormat", "docs-search-explanation.v1"],
|
|
1823
|
-
["search.facetsResponseFormat", "docs-search-facets.v1"],
|
|
1824
|
-
["search.filterParams", {
|
|
1825
|
-
framework: "framework",
|
|
1826
|
-
version: "version",
|
|
1827
|
-
package: "package",
|
|
1828
|
-
tags: "tags"
|
|
1829
|
-
}],
|
|
1830
|
-
["search.repeatedFilterParams", [
|
|
1831
|
-
"framework",
|
|
1832
|
-
"version",
|
|
1833
|
-
"package",
|
|
1834
|
-
"tags"
|
|
1835
|
-
]],
|
|
1836
|
-
["search.warningsField", "warnings"],
|
|
1837
|
-
["search.facetParam", "facet"],
|
|
1838
|
-
["search.limitParam", "limit"],
|
|
1839
|
-
["search.cursorParam", "cursor"],
|
|
1840
|
-
["search.nextCursorField", "nextCursor"],
|
|
1841
|
-
["search.hasMoreField", "hasMore"],
|
|
1842
|
-
["search.totalField", "total"]
|
|
1843
|
-
]) compareExpectedValue(issues, options.discovery, "search-scope-mismatch", path, expected, `Discovery ${path}`);
|
|
1844
|
-
compareExpectedValue(issues, options.discovery, "mcp-enabled-mismatch", "mcp.enabled", options.expected.mcp.enabled, "Discovery mcp.enabled");
|
|
1845
|
-
compareExpectedValue(issues, options.discovery, "mcp-capability-mismatch", "capabilities.mcp", options.expected.mcp.enabled, "Discovery capabilities.mcp");
|
|
1846
|
-
compareExpectedValue(issues, options.discovery, "mcp-route-mismatch", "mcp.endpoint", options.expected.mcp.endpoint, "Discovery mcp.endpoint");
|
|
1847
|
-
if (options.expected.mcp.protectedResource !== void 0) {
|
|
1848
|
-
const expectedProtectedResource = options.expected.mcp.protectedResource;
|
|
1849
|
-
const discoveredProtectedResource = readPath(options.discovery, "mcp.protectedResource");
|
|
1850
|
-
if (expectedProtectedResource === null) {
|
|
1851
|
-
if (discoveredProtectedResource.present) issues.push(mismatchIssue("mcp-protected-resource-mismatch", "mcp.protectedResource", void 0, discoveredProtectedResource, "Discovery mcp.protectedResource"));
|
|
1852
|
-
} else for (const field of [
|
|
1853
|
-
"metadataEndpoints",
|
|
1854
|
-
"authorizationServers",
|
|
1855
|
-
"scopesSupported",
|
|
1856
|
-
"requiredScopes"
|
|
1857
|
-
]) compareExpectedValue(issues, options.discovery, "mcp-protected-resource-mismatch", `mcp.protectedResource.${field}`, expectedProtectedResource[field], `Discovery mcp.protectedResource.${field}`);
|
|
1858
|
-
}
|
|
1859
|
-
const expectedToolNames = Object.keys(options.expected.mcp.tools).sort();
|
|
1860
|
-
const expectedToolSet = new Set(expectedToolNames);
|
|
1861
|
-
const discoveredToolsValue = readPath(options.discovery, "mcp.tools");
|
|
1862
|
-
const discoveredTools = isRecord(discoveredToolsValue.value) ? discoveredToolsValue.value : {};
|
|
1863
|
-
for (const toolName of expectedToolNames) {
|
|
1864
|
-
const expected = options.expected.mcp.tools[toolName];
|
|
1865
|
-
const path = `mcp.tools.${toolName}`;
|
|
1866
|
-
const actual = Object.prototype.hasOwnProperty.call(discoveredTools, toolName) ? {
|
|
1867
|
-
present: true,
|
|
1868
|
-
value: discoveredTools[toolName]
|
|
1869
|
-
} : {
|
|
1870
|
-
present: false,
|
|
1871
|
-
value: void 0
|
|
1872
|
-
};
|
|
1873
|
-
if (!valuesMatch(actual, expected)) issues.push(mismatchIssue("mcp-tool-mismatch", path, expected, actual, `Discovery ${path}`));
|
|
1874
|
-
}
|
|
1875
|
-
for (const toolName of Object.keys(discoveredTools).sort()) {
|
|
1876
|
-
if (expectedToolSet.has(toolName)) continue;
|
|
1877
|
-
const path = `mcp.tools.${toolName}`;
|
|
1878
|
-
issues.push({
|
|
1879
|
-
code: "mcp-tool-unexpected",
|
|
1880
|
-
path,
|
|
1881
|
-
expected: "<absent>",
|
|
1882
|
-
actual: displayValue(discoveredTools[toolName]),
|
|
1883
|
-
message: `Discovery MCP tools advertise unexpected tool flag ${JSON.stringify(toolName)}.`
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
for (const routePath of Object.keys(options.expected.routes).sort()) {
|
|
1887
|
-
const expected = options.expected.routes[routePath];
|
|
1888
|
-
compareExpectedValue(issues, options.discovery, "route-mismatch", routePath, expected, `Discovery ${routePath}`);
|
|
1889
|
-
}
|
|
1890
|
-
return issues.sort((left, right) => left.path.localeCompare(right.path) || left.code.localeCompare(right.code) || left.message.localeCompare(right.message));
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
//#endregion
|
|
1894
|
-
//#region src/cli/golden-evaluations.ts
|
|
1895
|
-
function isPlainRecord(value) {
|
|
1896
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1897
|
-
}
|
|
1898
|
-
/** Normalize the runtime docs.config evaluation shape shared by doctor and review. */
|
|
1899
|
-
function resolveGoldenEvaluationInput(evaluationInput) {
|
|
1900
|
-
if (evaluationInput === void 0 || typeof evaluationInput === "boolean") return {
|
|
1901
|
-
tasks: void 0,
|
|
1902
|
-
options: {}
|
|
1903
|
-
};
|
|
1904
|
-
if (!isPlainRecord(evaluationInput)) return {
|
|
1905
|
-
tasks: { evaluationConfig: evaluationInput },
|
|
1906
|
-
options: {}
|
|
1907
|
-
};
|
|
1908
|
-
const options = {
|
|
1909
|
-
surface: evaluationInput.surface,
|
|
1910
|
-
allowNetwork: evaluationInput.allowNetwork,
|
|
1911
|
-
searchTimeoutMs: evaluationInput.searchTimeoutMs,
|
|
1912
|
-
answer: evaluationInput.answer
|
|
1913
|
-
};
|
|
1914
|
-
if (evaluationInput.enabled === false) return {
|
|
1915
|
-
tasks: void 0,
|
|
1916
|
-
options
|
|
1917
|
-
};
|
|
1918
|
-
if ("enabled" in evaluationInput && typeof evaluationInput.enabled !== "boolean") return {
|
|
1919
|
-
tasks: evaluationInput,
|
|
1920
|
-
options
|
|
1921
|
-
};
|
|
1922
|
-
if (!("tasks" in evaluationInput)) return {
|
|
1923
|
-
tasks: void 0,
|
|
1924
|
-
options
|
|
1925
|
-
};
|
|
1926
|
-
const runtimeTasks = evaluationInput.tasks;
|
|
1927
|
-
if (!Array.isArray(runtimeTasks)) return {
|
|
1928
|
-
tasks: runtimeTasks,
|
|
1929
|
-
options
|
|
1930
|
-
};
|
|
1931
|
-
return {
|
|
1932
|
-
tasks: runtimeTasks.map((task) => {
|
|
1933
|
-
if (!isPlainRecord(task)) return task;
|
|
1934
|
-
return {
|
|
1935
|
-
...task,
|
|
1936
|
-
tokenBudget: task.tokenBudget ?? evaluationInput.tokenBudget,
|
|
1937
|
-
topK: task.topK ?? evaluationInput.topK
|
|
1938
|
-
};
|
|
1939
|
-
}),
|
|
1940
|
-
options
|
|
1941
|
-
};
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
//#endregion
|
|
1945
|
-
export { extractAgentBlocks as a, createAgentUsefulnessPagesFromMcp as i, analyzeAgentSurfaceDrift as n, analyzeAgentUsefulness as r, resolveGoldenEvaluationInput as t };
|
|
1660
|
+
export { analyzeAgentUsefulness, createAgentUsefulnessPagesFromMcp, extractAgentBlocks };
|