@farming-labs/docs 0.2.57 → 0.2.58
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-v6R0V3lm.mjs → agent-BFtIbSyJ.mjs} +2 -2
- package/dist/agent-evals-BW0vEc-F.mjs +2144 -0
- package/dist/{agent-export-CZR20g0e.mjs → agent-export-vsdq0Huq.mjs} +6 -6
- package/dist/{agents-BPonjolo.mjs → agents-ChKj-VYw.mjs} +6 -6
- package/dist/cli/index.mjs +29 -29
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-C45jpBtp.mjs → cloud-BH_sHX64.mjs} +3 -3
- package/dist/{cloud-ask-ai-CvRVnwdK.d.mts → cloud-ask-ai-a5Juvlvh.d.mts} +1 -1
- package/dist/{code-blocks-C9awWzEQ.mjs → code-blocks-qe0T8-xe.mjs} +1 -1
- package/dist/{codeblocks-CSqgqbg-.mjs → codeblocks-Bq67u32v.mjs} +2 -2
- package/dist/{dev-BA2kRuCn.mjs → dev-CAQlbguk.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +1 -1
- package/dist/{doctor-svA9Flsx.mjs → doctor-H8gilyTg.mjs} +34 -31
- package/dist/{downgrade-BStNhyCc.mjs → downgrade-BZs86NVr.mjs} +2 -2
- package/dist/{agent-surface-drift-rGFS38Ak.mjs → golden-evaluations-BiUg5Xe_.mjs} +59 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -2
- package/dist/{init-Dm0yDz6v.mjs → init-B_9ENq8Z.mjs} +3 -3
- package/dist/{mcp-BYIgKsPn.mjs → mcp-CiNww-Wu.mjs} +5 -5
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.mjs +148 -6
- package/dist/metadata-3ljRN9MM.mjs +237 -0
- package/dist/{package-version-DRIc08EU.mjs → package-version-qik_4J6C.mjs} +1 -1
- package/dist/{reading-time-W_Id2ayC.mjs → reading-time-EaVom2cl.mjs} +2 -234
- package/dist/{review-DZ81wm7h.mjs → review-BEgX7ey7.mjs} +28 -27
- package/dist/{robots-mSc98PMp.mjs → robots-CFlsfYdA.mjs} +2 -2
- package/dist/{search-9uEaC23e.d.mts → search-BblemZl4.d.mts} +25 -3
- package/dist/{search-OHp36znm.mjs → search-Bo9ubPVO.mjs} +149 -38
- package/dist/{search-AMEoabYU.mjs → search-CoajN9X1.mjs} +5 -5
- package/dist/server.d.mts +107 -6
- package/dist/server.mjs +5 -5
- package/dist/{sitemap-Cyc0Bbbn.mjs → sitemap-D_aXWPdJ.mjs} +6 -6
- package/dist/{types-R-DN23yw.d.mts → types-C1nPRXqo.d.mts} +90 -6
- package/dist/{upgrade-CXYRNV0C.mjs → upgrade-BCJTCW3O.mjs} +2 -2
- package/package.json +1 -1
- package/dist/agent-evals-BD17jOqL.mjs +0 -1166
- /package/dist/{agent-scope-B8lptqCd.mjs → agent-scope-CCaIY1aK.mjs} +0 -0
- /package/dist/{cloud-ask-ai-1k0q6OAH.mjs → cloud-ask-ai-hnJfj8-X.mjs} +0 -0
- /package/dist/{config-DZbZiYEa.mjs → config-DASewQ0x.mjs} +0 -0
- /package/dist/{errors-BFUtdZfC.mjs → errors-CVqZ3kOO.mjs} +0 -0
- /package/dist/{sitemap-server-zFYctvCa.mjs → sitemap-server-BYwE0zXs.mjs} +0 -0
- /package/dist/{templates-1Cod8KrJ.mjs → templates-CfQjpDWW.mjs} +0 -0
- /package/dist/{utils-DBCCkkJS.mjs → utils-6UCLxv4B.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as devInstallCommand, c as fileExists, d as readFileSafe, f as spawnAndWaitFor, i as detectPackageManagerFromProject, l as formatPackageManagerDetection, n as detectGlobalCssFiles, o as exec, p as writeFileSafe, r as detectNextAppDir, t as detectFramework, u as installCommand } from "./utils-
|
|
2
|
-
import { $ as svelteDocsPublicHookTemplate, A as nextConfigMergedTemplate, B as nuxtServerApiDocsRouteTemplate, C as injectRootProviderIntoLayout, D as injectTanstackVitePlugins, E as injectTanstackRootProviderIntoRoute, F as nuxtDocsConfigTemplate, G as quickstartPageTemplate, H as nuxtServerDocsPublicMiddlewareTemplate, I as nuxtDocsPageTemplate, J as svelteDocsApiRouteTemplate, K as rootLayoutTemplate, L as nuxtGlobalCssTemplate, M as nextLocaleDocPageTemplate, N as nextLocalizedPageTemplate, O as installationPageTemplate, P as nuxtConfigTemplate, Q as svelteDocsPageTemplate, R as nuxtInstallationPageTemplate, S as injectNuxtCssImport, T as injectSvelteDocsPublicHook, U as nuxtWelcomePageTemplate, V as nuxtServerApiReferenceRouteTemplate, W as postcssConfigTemplate, X as svelteDocsLayoutServerTemplate, Y as svelteDocsConfigTemplate, Z as svelteDocsLayoutTemplate, _ as getAstroAdapterPkg, _t as tanstackViteConfigTemplate, a as astroDocsIndexTemplate, at as svelteWelcomePageTemplate, b as injectAstroDocsMiddleware, bt as welcomePageTemplate, c as astroDocsServerTemplate, ct as tanstackDocsCatchAllRouteTemplate, d as astroQuickstartPageTemplate, dt as tanstackDocsIndexRouteTemplate, et as svelteDocsServerTemplate, f as astroWelcomePageTemplate, ft as tanstackDocsPublicRouteTemplate, g as docsLayoutTemplate, gt as tanstackRootRouteTemplate, h as docsConfigTemplate, ht as tanstackQuickstartPageTemplate, i as astroDocsConfigTemplate, it as svelteRootLayoutTemplate, j as nextConfigTemplate, k as nextApiReferencePageTemplate, l as astroGlobalCssTemplate, lt as tanstackDocsConfigTemplate, m as customThemeTsTemplate, mt as tanstackInstallationPageTemplate, n as astroApiRouteTemplate, nt as svelteInstallationPageTemplate, o as astroDocsMiddlewareTemplate, ot as tanstackApiDocsRouteTemplate, p as customThemeCssTemplate, pt as tanstackDocsServerTemplate, q as svelteApiReferenceRouteTemplate, r as astroConfigTemplate, rt as svelteQuickstartPageTemplate, s as astroDocsPageTemplate, st as tanstackApiReferenceRouteTemplate, t as astroApiReferenceRouteTemplate, tt as svelteGlobalCssTemplate, u as astroInstallationPageTemplate, ut as tanstackDocsFunctionsTemplate, v as globalCssTemplate, vt as tanstackWelcomePageTemplate, w as injectSvelteCssImport, x as injectCssImport, y as injectAstroCssImport, yt as tsconfigTemplate, z as nuxtQuickstartPageTemplate } from "./templates-
|
|
1
|
+
import { a as devInstallCommand, c as fileExists, d as readFileSafe, f as spawnAndWaitFor, i as detectPackageManagerFromProject, l as formatPackageManagerDetection, n as detectGlobalCssFiles, o as exec, p as writeFileSafe, r as detectNextAppDir, t as detectFramework, u as installCommand } from "./utils-6UCLxv4B.mjs";
|
|
2
|
+
import { $ as svelteDocsPublicHookTemplate, A as nextConfigMergedTemplate, B as nuxtServerApiDocsRouteTemplate, C as injectRootProviderIntoLayout, D as injectTanstackVitePlugins, E as injectTanstackRootProviderIntoRoute, F as nuxtDocsConfigTemplate, G as quickstartPageTemplate, H as nuxtServerDocsPublicMiddlewareTemplate, I as nuxtDocsPageTemplate, J as svelteDocsApiRouteTemplate, K as rootLayoutTemplate, L as nuxtGlobalCssTemplate, M as nextLocaleDocPageTemplate, N as nextLocalizedPageTemplate, O as installationPageTemplate, P as nuxtConfigTemplate, Q as svelteDocsPageTemplate, R as nuxtInstallationPageTemplate, S as injectNuxtCssImport, T as injectSvelteDocsPublicHook, U as nuxtWelcomePageTemplate, V as nuxtServerApiReferenceRouteTemplate, W as postcssConfigTemplate, X as svelteDocsLayoutServerTemplate, Y as svelteDocsConfigTemplate, Z as svelteDocsLayoutTemplate, _ as getAstroAdapterPkg, _t as tanstackViteConfigTemplate, a as astroDocsIndexTemplate, at as svelteWelcomePageTemplate, b as injectAstroDocsMiddleware, bt as welcomePageTemplate, c as astroDocsServerTemplate, ct as tanstackDocsCatchAllRouteTemplate, d as astroQuickstartPageTemplate, dt as tanstackDocsIndexRouteTemplate, et as svelteDocsServerTemplate, f as astroWelcomePageTemplate, ft as tanstackDocsPublicRouteTemplate, g as docsLayoutTemplate, gt as tanstackRootRouteTemplate, h as docsConfigTemplate, ht as tanstackQuickstartPageTemplate, i as astroDocsConfigTemplate, it as svelteRootLayoutTemplate, j as nextConfigTemplate, k as nextApiReferencePageTemplate, l as astroGlobalCssTemplate, lt as tanstackDocsConfigTemplate, m as customThemeTsTemplate, mt as tanstackInstallationPageTemplate, n as astroApiRouteTemplate, nt as svelteInstallationPageTemplate, o as astroDocsMiddlewareTemplate, ot as tanstackApiDocsRouteTemplate, p as customThemeCssTemplate, pt as tanstackDocsServerTemplate, q as svelteApiReferenceRouteTemplate, r as astroConfigTemplate, rt as svelteQuickstartPageTemplate, s as astroDocsPageTemplate, st as tanstackApiReferenceRouteTemplate, t as astroApiReferenceRouteTemplate, tt as svelteGlobalCssTemplate, u as astroInstallationPageTemplate, ut as tanstackDocsFunctionsTemplate, v as globalCssTemplate, vt as tanstackWelcomePageTemplate, w as injectSvelteCssImport, x as injectCssImport, y as injectAstroCssImport, yt as tsconfigTemplate, z as nuxtQuickstartPageTemplate } from "./templates-CfQjpDWW.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import pc from "picocolors";
|
|
@@ -188,7 +188,7 @@ async function configureDocsCloudOnboarding(options) {
|
|
|
188
188
|
enabled = cloudAnswer;
|
|
189
189
|
}
|
|
190
190
|
if (!enabled) return;
|
|
191
|
-
const { initCloudConfig } = await import("./cloud-
|
|
191
|
+
const { initCloudConfig } = await import("./cloud-BH_sHX64.mjs");
|
|
192
192
|
printDocsCloudOnboardingInstructions(await initCloudConfig({
|
|
193
193
|
rootDir: options.rootDir,
|
|
194
194
|
configPath: getDocsCloudConfigPathForFramework(options.framework)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./agent-CxDzPqtl.mjs";
|
|
2
|
-
import "./search-
|
|
3
|
-
import "./sitemap-server-
|
|
4
|
-
import "./agent-evals-
|
|
2
|
+
import "./search-Bo9ubPVO.mjs";
|
|
3
|
+
import "./sitemap-server-BYwE0zXs.mjs";
|
|
4
|
+
import "./agent-evals-BW0vEc-F.mjs";
|
|
5
5
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
6
|
-
import "./code-blocks-
|
|
6
|
+
import "./code-blocks-qe0T8-xe.mjs";
|
|
7
7
|
import "./server.mjs";
|
|
8
|
-
import { d as readStringProperty, h as resolveDocsContentDir, l as readNavTitle, m as resolveDocsConfigPath, n as extractObjectLiteral, s as readBooleanProperty } from "./config-
|
|
8
|
+
import { d as readStringProperty, h as resolveDocsContentDir, l as readNavTitle, m as resolveDocsConfigPath, n as extractObjectLiteral, s as readBooleanProperty } from "./config-DASewQ0x.mjs";
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
10
|
import pc from "picocolors";
|
|
11
11
|
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as DocsTelemetryFramework, Ct as DocsObservabilityConfig, F as DocsAnalyticsConfig, Gt as DocsSearchSourcePage, Jt as DocsTelemetryConfig, Sn as PageAgentFrontmatter, _n as OrderingItem, dt as DocsMcpAllowedOrigins, ft as DocsMcpAuthPrincipal, gt as DocsMcpConfig, pt as DocsMcpAuthenticate, zt as DocsSearchConfig } from "./types-C1nPRXqo.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as emitDocsAnalyticsEvent, i as emitDocsAgentTraceEvent, n as createDocsAgentTraceContext, r as createDocsAgentTraceId } from "./analytics-Bx44lg6d.mjs";
|
|
2
2
|
import { Et as resolveDocsAudienceMdxContent, Ht as renderDocsRelatedMarkdownLines, Vt as normalizeDocsRelated, Xt as normalizePageAgentFrontmatter, Yt as hasStructuredPageAgentContract, en as upsertPageAgentContractMarkdown } from "./agent-CxDzPqtl.mjs";
|
|
3
|
-
import { C as resolvePageSidebarFolderIndexBehavior, E as emitDocsTelemetryAgentSurfaceEvent, O as emitDocsTelemetryMcpToolEvent, k as emitDocsTelemetryProjectEvent, m as parseDocsMarkdownSections, p as findDocsMarkdownSection, u as performDocsSearch, x as stripGeneratedAgentProvenance } from "./search-
|
|
4
|
-
import { a as normalizeAgentScopeValues, i as normalizeAgentLocale, n as agentVersionConstraintsOverlap, r as normalizeAgentFramework, t as agentVersionConstraintMatches } from "./agent-scope-
|
|
3
|
+
import { C as resolvePageSidebarFolderIndexBehavior, E as emitDocsTelemetryAgentSurfaceEvent, O as emitDocsTelemetryMcpToolEvent, k as emitDocsTelemetryProjectEvent, m as parseDocsMarkdownSections, p as findDocsMarkdownSection, u as performDocsSearch, x as stripGeneratedAgentProvenance } from "./search-Bo9ubPVO.mjs";
|
|
4
|
+
import { a as normalizeAgentScopeValues, i as normalizeAgentLocale, n as agentVersionConstraintsOverlap, r as normalizeAgentFramework, t as agentVersionConstraintMatches } from "./agent-scope-CCaIY1aK.mjs";
|
|
5
5
|
import matter from "gray-matter";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
@@ -220,7 +220,7 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
220
220
|
path: "agent",
|
|
221
221
|
name: "agent",
|
|
222
222
|
type: "DocsAgentConfig",
|
|
223
|
-
description: "Agent compaction defaults and
|
|
223
|
+
description: "Agent compaction defaults and offline-by-default usefulness evaluations.",
|
|
224
224
|
docs: "/docs/getting-started/agent-ready-docs",
|
|
225
225
|
children: [{
|
|
226
226
|
path: "agent.compact",
|
|
@@ -282,7 +282,7 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
282
282
|
path: "agent.evaluations",
|
|
283
283
|
name: "evaluations",
|
|
284
284
|
type: "boolean | DocsAgentEvaluationsConfig",
|
|
285
|
-
description: "
|
|
285
|
+
description: "Offline-by-default golden tasks for retrieval, citation, version, example, answer, and budget evaluation, with explicit external-provider and execution opt-ins.",
|
|
286
286
|
children: [
|
|
287
287
|
{
|
|
288
288
|
path: "agent.evaluations.enabled",
|
|
@@ -305,11 +305,77 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
305
305
|
default: 5,
|
|
306
306
|
description: "Default number of ranked search results evaluated per task."
|
|
307
307
|
},
|
|
308
|
+
{
|
|
309
|
+
path: "agent.evaluations.surface",
|
|
310
|
+
name: "surface",
|
|
311
|
+
type: "\"mcp-context\" | \"configured-search\" | \"ask-ai-context\"",
|
|
312
|
+
default: "mcp-context",
|
|
313
|
+
description: "Retrieval/context surface measured by the golden task suite."
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
path: "agent.evaluations.allowNetwork",
|
|
317
|
+
name: "allowNetwork",
|
|
318
|
+
type: "boolean",
|
|
319
|
+
default: false,
|
|
320
|
+
description: "Allow external search, HTTP answers, and explicit executable-example verification during evaluation."
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
path: "agent.evaluations.searchTimeoutMs",
|
|
324
|
+
name: "searchTimeoutMs",
|
|
325
|
+
type: "number",
|
|
326
|
+
default: 3e4,
|
|
327
|
+
description: "Per-task configured search and Ask AI retrieval timeout in milliseconds."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
path: "agent.evaluations.answer",
|
|
331
|
+
name: "answer",
|
|
332
|
+
type: "DocsAgentEvaluationAnswerProvider",
|
|
333
|
+
description: "Opt-in callback or HTTP provider used to evaluate actual generated answers and citations.",
|
|
334
|
+
children: [
|
|
335
|
+
{
|
|
336
|
+
path: "agent.evaluations.answer.provider",
|
|
337
|
+
name: "provider",
|
|
338
|
+
type: "\"callback\" | \"http\"",
|
|
339
|
+
description: "Answer evaluation provider kind."
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
path: "agent.evaluations.answer.run",
|
|
343
|
+
name: "run",
|
|
344
|
+
type: "DocsAgentEvaluationAnswerRunner",
|
|
345
|
+
description: "Callback invoked with retrieved context and source references."
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
path: "agent.evaluations.answer.endpoint",
|
|
349
|
+
name: "endpoint",
|
|
350
|
+
type: "string",
|
|
351
|
+
description: "HTTP endpoint used by the opt-in HTTP answer provider."
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
path: "agent.evaluations.answer.headers",
|
|
355
|
+
name: "headers",
|
|
356
|
+
type: "Record<string, string>",
|
|
357
|
+
description: "Optional HTTP request headers; values are never reported.",
|
|
358
|
+
children: [{
|
|
359
|
+
path: "agent.evaluations.answer.headers.*",
|
|
360
|
+
name: "header",
|
|
361
|
+
type: "string",
|
|
362
|
+
description: "One custom HTTP header value."
|
|
363
|
+
}]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
path: "agent.evaluations.answer.timeoutMs",
|
|
367
|
+
name: "timeoutMs",
|
|
368
|
+
type: "number",
|
|
369
|
+
default: 3e4,
|
|
370
|
+
description: "Callback or HTTP answer provider timeout in milliseconds."
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
},
|
|
308
374
|
{
|
|
309
375
|
path: "agent.evaluations.tasks",
|
|
310
376
|
name: "tasks",
|
|
311
377
|
type: "DocsAgentGoldenTask[]",
|
|
312
|
-
description: "
|
|
378
|
+
description: "Golden task fixtures evaluated by docs doctor and docs review; the default MCP context surface runs offline.",
|
|
313
379
|
children: [
|
|
314
380
|
{
|
|
315
381
|
path: "agent.evaluations.tasks[]",
|
|
@@ -341,6 +407,12 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
341
407
|
type: "number",
|
|
342
408
|
description: "Per-task ranked retrieval depth override."
|
|
343
409
|
},
|
|
410
|
+
{
|
|
411
|
+
path: "agent.evaluations.tasks[].surface",
|
|
412
|
+
name: "surface",
|
|
413
|
+
type: "\"mcp-context\" | \"configured-search\" | \"ask-ai-context\"",
|
|
414
|
+
description: "Per-task evaluation surface override."
|
|
415
|
+
},
|
|
344
416
|
{
|
|
345
417
|
path: "agent.evaluations.tasks[].filters",
|
|
346
418
|
name: "filters",
|
|
@@ -371,7 +443,7 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
371
443
|
path: "agent.evaluations.tasks[].expect",
|
|
372
444
|
name: "expect",
|
|
373
445
|
type: "DocsAgentGoldenTaskExpectation",
|
|
374
|
-
description: "
|
|
446
|
+
description: "Evaluator-only source, rank, citation, scope, answer, example, and budget expectations.",
|
|
375
447
|
children: [
|
|
376
448
|
{
|
|
377
449
|
path: "agent.evaluations.tasks[].expect.relevantSources",
|
|
@@ -416,6 +488,70 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
416
488
|
type: "number",
|
|
417
489
|
description: "Minimum share of context bytes supplied by relevant sources."
|
|
418
490
|
},
|
|
491
|
+
{
|
|
492
|
+
path: "agent.evaluations.tasks[].expect.scope",
|
|
493
|
+
name: "scope",
|
|
494
|
+
type: "DocsAgentGoldenTaskFilters",
|
|
495
|
+
description: "Framework, version, and locale assertions checked against returned sources without pre-filtering retrieval.",
|
|
496
|
+
children: [
|
|
497
|
+
{
|
|
498
|
+
path: "agent.evaluations.tasks[].expect.scope.framework",
|
|
499
|
+
name: "framework",
|
|
500
|
+
type: "string",
|
|
501
|
+
description: "Framework the returned sources must select."
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
path: "agent.evaluations.tasks[].expect.scope.version",
|
|
505
|
+
name: "version",
|
|
506
|
+
type: "string",
|
|
507
|
+
description: "Version the returned sources must select."
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
path: "agent.evaluations.tasks[].expect.scope.locale",
|
|
511
|
+
name: "locale",
|
|
512
|
+
type: "string",
|
|
513
|
+
description: "Locale the returned sources must select."
|
|
514
|
+
}
|
|
515
|
+
]
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
path: "agent.evaluations.tasks[].expect.answer",
|
|
519
|
+
name: "answer",
|
|
520
|
+
type: "DocsAgentGoldenAnswerExpectation",
|
|
521
|
+
description: "Required answer text and citation assertions for an explicitly configured answer provider.",
|
|
522
|
+
children: [
|
|
523
|
+
{
|
|
524
|
+
path: "agent.evaluations.tasks[].expect.answer.includes",
|
|
525
|
+
name: "includes",
|
|
526
|
+
type: "string[]",
|
|
527
|
+
description: "Literal fragments required in the actual answer."
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
path: "agent.evaluations.tasks[].expect.answer.excludes",
|
|
531
|
+
name: "excludes",
|
|
532
|
+
type: "string[]",
|
|
533
|
+
description: "Literal fragments forbidden in the actual answer."
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
path: "agent.evaluations.tasks[].expect.answer.requiredCitations",
|
|
537
|
+
name: "requiredCitations",
|
|
538
|
+
type: "string[]",
|
|
539
|
+
description: "Citations required in the actual answer."
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
path: "agent.evaluations.tasks[].expect.answer.allowedCitations",
|
|
543
|
+
name: "allowedCitations",
|
|
544
|
+
type: "string[]",
|
|
545
|
+
description: "Additional valid actual-answer citations."
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
path: "agent.evaluations.tasks[].expect.answer.forbiddenCitations",
|
|
549
|
+
name: "forbiddenCitations",
|
|
550
|
+
type: "string[]",
|
|
551
|
+
description: "Citations forbidden in the actual answer."
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
},
|
|
419
555
|
{
|
|
420
556
|
path: "agent.evaluations.tasks[].expect.examples",
|
|
421
557
|
name: "examples",
|
|
@@ -470,6 +606,12 @@ const DOCS_CONFIG_SCHEMA_OPTIONS_TEMPLATE = [
|
|
|
470
606
|
name: "includes",
|
|
471
607
|
type: "string[]",
|
|
472
608
|
description: "Literal code fragments that must appear."
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
path: "agent.evaluations.tasks[].expect.examples[].verification",
|
|
612
|
+
name: "verification",
|
|
613
|
+
type: "\"present\" | \"syntax\" | \"execute\"",
|
|
614
|
+
description: "Required verification strength; defaults to present when runnable is false and syntax otherwise. Runtime execution is always explicit."
|
|
473
615
|
}
|
|
474
616
|
]
|
|
475
617
|
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { Xt as normalizePageAgentFrontmatter, Yt as hasStructuredPageAgentContract } from "./agent-CxDzPqtl.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/metadata.ts
|
|
4
|
+
/**
|
|
5
|
+
* Resolve page title using metadata titleTemplate.
|
|
6
|
+
* %s is replaced with page title.
|
|
7
|
+
*/
|
|
8
|
+
function resolveTitle(pageTitle, metadata) {
|
|
9
|
+
return (metadata?.titleTemplate ?? "%s").replace("%s", pageTitle);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve OG image URL for a page.
|
|
13
|
+
* Prefers page.openGraph.images[0], then page.ogImage, then config endpoint/default.
|
|
14
|
+
*/
|
|
15
|
+
function resolveOGImage(page, ogConfig, baseUrl) {
|
|
16
|
+
if (page.openGraph?.images?.length) return resolveImageUrl(page.openGraph.images[0].url, baseUrl);
|
|
17
|
+
if (!ogConfig?.enabled) return void 0;
|
|
18
|
+
if (page.ogImage) return resolveImageUrl(page.ogImage, baseUrl);
|
|
19
|
+
if (ogConfig.type === "dynamic" && ogConfig.endpoint) return `${baseUrl ?? ""}${ogConfig.endpoint}`;
|
|
20
|
+
return ogConfig.defaultImage;
|
|
21
|
+
}
|
|
22
|
+
function resolveImageUrl(url, baseUrl) {
|
|
23
|
+
if (url.startsWith("/") || url.startsWith("http")) return url;
|
|
24
|
+
const base = baseUrl ?? "";
|
|
25
|
+
return `${base}${base.length > 0 && !base.endsWith("/") ? "/" : ""}${url}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the Open Graph metadata object for a page.
|
|
29
|
+
* When the page has openGraph in frontmatter, uses it (with title/description filled from page if omitted).
|
|
30
|
+
* Otherwise uses ogImage or config (dynamic endpoint / defaultImage).
|
|
31
|
+
*/
|
|
32
|
+
function buildPageOpenGraph(page, ogConfig, baseUrl) {
|
|
33
|
+
if (page.openGraph) {
|
|
34
|
+
const images = page.openGraph.images?.length ? page.openGraph.images.map((img) => ({
|
|
35
|
+
url: resolveImageUrl(img.url, baseUrl),
|
|
36
|
+
width: img.width ?? 1200,
|
|
37
|
+
height: img.height ?? 630
|
|
38
|
+
})) : void 0;
|
|
39
|
+
return {
|
|
40
|
+
title: page.openGraph.title ?? page.title,
|
|
41
|
+
description: page.openGraph.description ?? page.description,
|
|
42
|
+
...images && { images }
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const url = resolveOGImage(page, ogConfig, baseUrl);
|
|
46
|
+
if (!url) return void 0;
|
|
47
|
+
return {
|
|
48
|
+
title: page.title,
|
|
49
|
+
...page.description && { description: page.description },
|
|
50
|
+
images: [{
|
|
51
|
+
url,
|
|
52
|
+
width: 1200,
|
|
53
|
+
height: 630
|
|
54
|
+
}]
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build the Twitter card metadata object for a page.
|
|
59
|
+
* When the page has twitter in frontmatter, uses it.
|
|
60
|
+
* Otherwise builds from ogImage or config (dynamic endpoint).
|
|
61
|
+
*/
|
|
62
|
+
function buildPageTwitter(page, ogConfig, baseUrl) {
|
|
63
|
+
if (page.twitter) {
|
|
64
|
+
const images = page.twitter.images?.length ? page.twitter.images.map((url) => resolveImageUrl(url, baseUrl)) : void 0;
|
|
65
|
+
return {
|
|
66
|
+
...page.twitter.card && { card: page.twitter.card },
|
|
67
|
+
...page.twitter.title !== void 0 && { title: page.twitter.title },
|
|
68
|
+
...page.twitter.description !== void 0 && { description: page.twitter.description },
|
|
69
|
+
...images && { images }
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const url = resolveOGImage(page, ogConfig, baseUrl);
|
|
73
|
+
if (!url) return void 0;
|
|
74
|
+
return {
|
|
75
|
+
card: "summary_large_image",
|
|
76
|
+
title: page.title,
|
|
77
|
+
...page.description && { description: page.description },
|
|
78
|
+
images: [url]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function normalizeBaseUrl(value) {
|
|
82
|
+
if (!value) return void 0;
|
|
83
|
+
try {
|
|
84
|
+
const url = new URL(value);
|
|
85
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return void 0;
|
|
86
|
+
return url.toString().replace(/\/+$/, "");
|
|
87
|
+
} catch {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function absolutizeUrl(url, baseUrl) {
|
|
92
|
+
const base = normalizeBaseUrl(baseUrl);
|
|
93
|
+
if (!base) return url;
|
|
94
|
+
try {
|
|
95
|
+
return new URL(url, `${base}/`).toString();
|
|
96
|
+
} catch {
|
|
97
|
+
return url;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function titleFromSegment(segment) {
|
|
101
|
+
return segment.replace(/\.[a-z0-9]+$/i, "").replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
102
|
+
}
|
|
103
|
+
function normalizeRoutePath(url) {
|
|
104
|
+
try {
|
|
105
|
+
return new URL(url, "https://farming-labs.local").pathname.replace(/\/+$/, "") || "/";
|
|
106
|
+
} catch {
|
|
107
|
+
return `/${url.replace(/^\/+/, "")}`.replace(/\/+$/, "") || "/";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function buildDefaultBreadcrumbs(input) {
|
|
111
|
+
const routePath = normalizeRoutePath(input.url);
|
|
112
|
+
const entry = (input.entry ?? "docs").replace(/^\/+|\/+$/g, "") || "docs";
|
|
113
|
+
const segments = routePath.split("/").filter(Boolean);
|
|
114
|
+
const entryParts = entry.split("/").filter(Boolean);
|
|
115
|
+
const contentSegments = segments.slice(0, entryParts.length).join("/") === entryParts.join("/") ? segments.slice(entryParts.length) : segments;
|
|
116
|
+
const breadcrumbs = [{
|
|
117
|
+
name: titleFromSegment(entryParts[entryParts.length - 1] ?? "Docs"),
|
|
118
|
+
url: `/${entry}`
|
|
119
|
+
}];
|
|
120
|
+
let current = `/${entry}`;
|
|
121
|
+
contentSegments.forEach((segment, index) => {
|
|
122
|
+
current = `${current}/${segment}`.replace(/\/+/g, "/");
|
|
123
|
+
breadcrumbs.push({
|
|
124
|
+
name: index === contentSegments.length - 1 ? input.title : titleFromSegment(segment),
|
|
125
|
+
url: current
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
return breadcrumbs;
|
|
129
|
+
}
|
|
130
|
+
function normalizeDateModified(value) {
|
|
131
|
+
if (!value) return void 0;
|
|
132
|
+
const date = new Date(value);
|
|
133
|
+
return Number.isNaN(date.getTime()) ? value : date.toISOString();
|
|
134
|
+
}
|
|
135
|
+
function buildAgentContractHowTo(value, fallback) {
|
|
136
|
+
const agent = normalizePageAgentFrontmatter(value);
|
|
137
|
+
if (!agent || !hasStructuredPageAgentContract(agent)) return void 0;
|
|
138
|
+
const steps = [];
|
|
139
|
+
for (const command of agent.commands ?? []) {
|
|
140
|
+
const run = typeof command === "string" ? command : command.run;
|
|
141
|
+
const description = typeof command === "string" ? void 0 : command.description;
|
|
142
|
+
const cwd = typeof command === "string" ? void 0 : command.cwd;
|
|
143
|
+
steps.push({
|
|
144
|
+
"@type": "HowToStep",
|
|
145
|
+
position: steps.length + 1,
|
|
146
|
+
name: description ?? "Run command",
|
|
147
|
+
text: cwd ? `${run} (from ${cwd})` : run
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
for (const verification of agent.verification ?? []) {
|
|
151
|
+
const description = typeof verification === "string" ? verification : verification.description ?? "Verify the result";
|
|
152
|
+
const details = typeof verification === "string" ? verification : [verification.run, verification.expect ? `Expected: ${verification.expect}` : void 0].filter(Boolean).join(". ");
|
|
153
|
+
steps.push({
|
|
154
|
+
"@type": "HowToStep",
|
|
155
|
+
position: steps.length + 1,
|
|
156
|
+
name: description,
|
|
157
|
+
text: details || description
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const supplies = [...(agent.prerequisites ?? []).map((name) => ({
|
|
161
|
+
"@type": "HowToSupply",
|
|
162
|
+
name
|
|
163
|
+
})), ...(agent.files ?? []).map((name) => ({
|
|
164
|
+
"@type": "HowToSupply",
|
|
165
|
+
name
|
|
166
|
+
}))];
|
|
167
|
+
const about = Object.entries(agent.appliesTo ?? {}).flatMap(([kind, values]) => (typeof values === "string" ? [values] : values ?? []).map((name) => ({
|
|
168
|
+
"@type": "Thing",
|
|
169
|
+
name: `${kind}: ${name}`
|
|
170
|
+
})));
|
|
171
|
+
return {
|
|
172
|
+
"@type": "HowTo",
|
|
173
|
+
name: agent.task ?? fallback.title,
|
|
174
|
+
...agent.outcome ?? fallback.description ? { description: agent.outcome ?? fallback.description } : {},
|
|
175
|
+
...about.length > 0 ? { about } : {},
|
|
176
|
+
...supplies.length > 0 ? { supply: supplies } : {},
|
|
177
|
+
...steps.length > 0 ? { step: steps } : {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Resolve the public docs site URL from existing agent-facing config.
|
|
182
|
+
*
|
|
183
|
+
* The framework intentionally reuses `sitemap.baseUrl`, `llmsTxt.baseUrl`,
|
|
184
|
+
* `robots.baseUrl`, or `ai.docsUrl` instead of requiring another setting.
|
|
185
|
+
*/
|
|
186
|
+
function resolveDocsMetadataBaseUrl(config) {
|
|
187
|
+
return [
|
|
188
|
+
typeof config.sitemap === "object" ? config.sitemap.baseUrl : void 0,
|
|
189
|
+
typeof config.llmsTxt === "object" ? config.llmsTxt.baseUrl : void 0,
|
|
190
|
+
typeof config.robots === "object" ? config.robots.baseUrl : void 0,
|
|
191
|
+
config.ai?.docsUrl
|
|
192
|
+
].map((value) => normalizeBaseUrl(value)).find((value) => Boolean(value));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Build Schema.org JSON-LD for a docs page.
|
|
196
|
+
*
|
|
197
|
+
* The shape follows Vercel's agent readability guidance: a `TechArticle`
|
|
198
|
+
* with title, description, canonical URL, freshness, and breadcrumbs.
|
|
199
|
+
*/
|
|
200
|
+
function buildDocsPageStructuredData(input) {
|
|
201
|
+
const breadcrumbs = input.breadcrumbs?.length ? input.breadcrumbs : buildDefaultBreadcrumbs(input);
|
|
202
|
+
const result = {
|
|
203
|
+
"@context": "https://schema.org",
|
|
204
|
+
"@type": "TechArticle",
|
|
205
|
+
headline: input.title,
|
|
206
|
+
name: input.title,
|
|
207
|
+
url: absolutizeUrl(input.url, input.baseUrl),
|
|
208
|
+
mainEntityOfPage: {
|
|
209
|
+
"@type": "WebPage",
|
|
210
|
+
"@id": absolutizeUrl(input.url, input.baseUrl)
|
|
211
|
+
},
|
|
212
|
+
breadcrumb: {
|
|
213
|
+
"@type": "BreadcrumbList",
|
|
214
|
+
itemListElement: breadcrumbs.map((item, index) => ({
|
|
215
|
+
"@type": "ListItem",
|
|
216
|
+
position: index + 1,
|
|
217
|
+
name: item.name,
|
|
218
|
+
item: absolutizeUrl(item.url, input.baseUrl)
|
|
219
|
+
}))
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
if (input.description) result.description = input.description;
|
|
223
|
+
const agentContract = buildAgentContractHowTo(input.agent, input);
|
|
224
|
+
if (agentContract) result.mainEntity = agentContract;
|
|
225
|
+
const dateModified = normalizeDateModified(input.dateModified);
|
|
226
|
+
if (dateModified) result.dateModified = dateModified;
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Serialize Schema.org JSON-LD for safe insertion into a `<script>` tag.
|
|
231
|
+
*/
|
|
232
|
+
function renderDocsPageStructuredDataJson(input) {
|
|
233
|
+
return JSON.stringify(buildDocsPageStructuredData(input)).replace(/</g, "\\u003c");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
export { resolveDocsMetadataBaseUrl as a, renderDocsPageStructuredDataJson as i, buildPageOpenGraph as n, resolveOGImage as o, buildPageTwitter as r, resolveTitle as s, buildDocsPageStructuredData as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-
|
|
1
|
+
import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-6UCLxv4B.mjs";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
|