@farming-labs/theme 0.2.62 → 0.2.63

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.
@@ -1,4 +1,4 @@
1
- import { ChangelogConfig, DocsAnalyticsConfig, DocsAskAIMcpConfig, DocsConfig, DocsI18nConfig, DocsMcpConfig, DocsObservabilityConfig, DocsRobotsConfig, DocsSearchConfig, DocsSitemapConfig, DocsTelemetryConfig, FeedbackConfig, LlmsTxtConfig, OrderingItem } from "@farming-labs/docs";
1
+ import { ChangelogConfig, DocsAnalyticsConfig, DocsAskAIMcpConfig, DocsConfig, DocsI18nConfig, DocsMcpConfig, DocsObservabilityConfig, DocsPublishedAgentSkill, DocsRobotsConfig, DocsSearchConfig, DocsSitemapConfig, DocsTelemetryConfig, FeedbackConfig, LlmsTxtConfig, OrderingItem } from "@farming-labs/docs";
2
2
 
3
3
  //#region src/docs-api.d.ts
4
4
  interface AIProviderConfig {
@@ -80,6 +80,8 @@ interface DocsAPIOptions {
80
80
  metadata?: DocsConfig["metadata"];
81
81
  /** Reusable skill publication and optional real A2A service metadata. */
82
82
  agent?: DocsConfig["agent"];
83
+ /** @internal Build-time Agent Skills snapshot supplied by framework adapters. */
84
+ _preloadedAgentSkills?: readonly DocsPublishedAgentSkill[];
83
85
  }
84
86
  interface DocsMCPAPIOptions {
85
87
  rootDir?: string;
@@ -95,6 +97,8 @@ interface DocsMCPAPIOptions {
95
97
  telemetry?: boolean | DocsTelemetryConfig;
96
98
  observability?: boolean | DocsObservabilityConfig;
97
99
  agent?: DocsConfig["agent"];
100
+ /** @internal Build-time Agent Skills snapshot supplied by framework adapters. */
101
+ _preloadedAgentSkills?: readonly DocsPublishedAgentSkill[];
98
102
  }
99
103
  type LlmsTxtOptions = LlmsTxtConfig;
100
104
  /**
package/dist/docs-api.mjs CHANGED
@@ -2463,7 +2463,11 @@ function generateLlmsTxt(indexes, options) {
2463
2463
  */
2464
2464
  function createDocsAPI(options) {
2465
2465
  const root = options?.rootDir ?? process.cwd();
2466
- const publishedAgentSkills = resolveConfiguredAgentSkills(options?.agent?.skills, { rootDir: root });
2466
+ let publishedAgentSkills;
2467
+ function getPublishedAgentSkills() {
2468
+ if (!publishedAgentSkills) publishedAgentSkills = Array.isArray(options?._preloadedAgentSkills) ? Promise.resolve([...options._preloadedAgentSkills]) : resolveConfiguredAgentSkills(options?.agent?.skills, { rootDir: root });
2469
+ return publishedAgentSkills;
2470
+ }
2467
2471
  const entry = options?.entry ?? readEntry(root);
2468
2472
  const docsPath = normalizeDocsPublicPath(options?.docsPath ?? readDocsPath(root), entry);
2469
2473
  const analytics = options?.analytics;
@@ -2743,7 +2747,7 @@ function createDocsAPI(options) {
2743
2747
  request,
2744
2748
  preferredSkillDocument: needsSkill ? readRootSkillDocument(root) : null,
2745
2749
  fallbackSkillDocument,
2746
- publishedSkills: await publishedAgentSkills,
2750
+ publishedSkills: needsSkill ? await getPublishedAgentSkills() : [],
2747
2751
  agentCard: options?.agent?.a2a,
2748
2752
  origin: url.origin,
2749
2753
  entry,
@@ -2839,7 +2843,7 @@ function createDocsAPI(options) {
2839
2843
  robots: robotsConfig,
2840
2844
  openapi: openapiDiscovery
2841
2845
  })
2842
- }), ...await publishedAgentSkills],
2846
+ }), ...await getPublishedAgentSkills()],
2843
2847
  agentCard: options?.agent?.a2a
2844
2848
  }), { headers: {
2845
2849
  "Cache-Control": "public, max-age=0, s-maxage=3600",
@@ -3275,6 +3279,11 @@ function createDocsMCPAPI(options = {}) {
3275
3279
  const contentDir = options.contentDir ?? path.join(appDir, entry);
3276
3280
  const mcpConfig = options.mcp ?? readMcpConfig(rootDir, { rejectRuntimeSecurity: true });
3277
3281
  const navTitle = typeof options.nav?.title === "string" && options.nav.title.trim().length > 0 ? options.nav.title : "Documentation";
3282
+ let configuredAgentSkills;
3283
+ function getConfiguredAgentSkills() {
3284
+ if (!configuredAgentSkills) configuredAgentSkills = Array.isArray(options._preloadedAgentSkills) ? Promise.resolve([...options._preloadedAgentSkills]) : resolveConfiguredAgentSkills(options.agent?.skills, { rootDir });
3285
+ return configuredAgentSkills;
3286
+ }
3278
3287
  const handlers = createDocsMcpHttpHandler({
3279
3288
  source: {
3280
3289
  ...createFilesystemDocsMcpSource({
@@ -3285,7 +3294,7 @@ function createDocsMCPAPI(options = {}) {
3285
3294
  ordering: options.ordering
3286
3295
  }),
3287
3296
  async getSkills() {
3288
- const configured = await resolveConfiguredAgentSkills(options.agent?.skills, { rootDir });
3297
+ const configured = await getConfiguredAgentSkills();
3289
3298
  return [await resolveDocsPublishedAgentSkill({
3290
3299
  preferredDocument: readRootSkillDocument(rootDir),
3291
3300
  fallbackDocument: `---\nname: docs\ndescription: Use the project documentation through MCP resources and tools.\n---\n\n# Documentation\n`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/theme",
3
- "version": "0.2.62",
3
+ "version": "0.2.63",
4
4
  "description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
5
5
  "keywords": [
6
6
  "docs",
@@ -146,7 +146,7 @@
146
146
  "tsdown": "^0.20.3",
147
147
  "typescript": "^5.9.3",
148
148
  "vitest": "^4.1.8",
149
- "@farming-labs/docs": "0.2.62"
149
+ "@farming-labs/docs": "0.2.63"
150
150
  },
151
151
  "peerDependencies": {
152
152
  "@farming-labs/docs": ">=0.0.1",