@farming-labs/svelte 0.2.59 → 0.2.61
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/server.js +52 -4
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
import fs from "node:fs";
|
|
31
31
|
import path from "node:path";
|
|
32
32
|
import matter from "gray-matter";
|
|
33
|
-
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsStandardsDiscoveryResponse, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsDiscoveryLinkHeader, isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, isDocsStandardsDiscoveryRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsRequestApiRoute, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
|
-
import { buildApiReferenceOpenApiDocumentAsync, createDocsCloudAskAIResponse, createDocsMcpHttpHandler, isDocsCloudAskAIProvider, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
33
|
+
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsStandardsDiscoveryResponse, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsDiscoveryLinkHeader, isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, isDocsStandardsDiscoveryRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsRequestApiRoute, resolveDocsPublishedAgentSkill, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
|
+
import { buildApiReferenceOpenApiDocumentAsync, createDocsCloudAskAIResponse, createDocsMcpHttpHandler, isDocsCloudAskAIProvider, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig, resolveConfiguredAgentSkills, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
35
35
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree } from "./content.js";
|
|
36
36
|
import { renderMarkdown } from "./markdown.js";
|
|
37
37
|
export { createSvelteApiReference } from "./api-reference.js";
|
|
@@ -405,6 +405,9 @@ export function createDocsServer(config = {}) {
|
|
|
405
405
|
const observability = config.observability;
|
|
406
406
|
const contentDirBase = config.contentDir ?? entry;
|
|
407
407
|
const rootDir = path.resolve(config.rootDir ?? process.cwd());
|
|
408
|
+
const publishedAgentSkills = Array.isArray(config._preloadedAgentSkills)
|
|
409
|
+
? Promise.resolve(config._preloadedAgentSkills)
|
|
410
|
+
: resolveConfiguredAgentSkills(config.agent?.skills, { rootDir });
|
|
408
411
|
const i18n = resolveDocsI18n(config.i18n);
|
|
409
412
|
const githubRaw = config.github;
|
|
410
413
|
const github = typeof githubRaw === "string" ? { url: githubRaw } : (githubRaw ?? null);
|
|
@@ -646,6 +649,7 @@ export function createDocsServer(config = {}) {
|
|
|
646
649
|
: undefined;
|
|
647
650
|
const discoveryLinkHeader = getDocsDiscoveryLinkHeader({
|
|
648
651
|
includeApiCatalog: apiCatalogEnabled,
|
|
652
|
+
includeAgentCard: Boolean(config.agent?.a2a),
|
|
649
653
|
});
|
|
650
654
|
const openapiDiscovery = resolveApiReferenceOpenApiDiscovery(config.apiReference);
|
|
651
655
|
const mcpConfig = resolveDocsMcpConfig(config.mcp, {
|
|
@@ -764,7 +768,7 @@ export function createDocsServer(config = {}) {
|
|
|
764
768
|
robots: config.robots,
|
|
765
769
|
openapi: openapiDiscovery,
|
|
766
770
|
markdown: {
|
|
767
|
-
acceptHeader:
|
|
771
|
+
acceptHeader: true,
|
|
768
772
|
},
|
|
769
773
|
};
|
|
770
774
|
if (isDocsStandardsDiscoveryRequest(event.url, { apiRoute: discoveryApiRoute })) {
|
|
@@ -773,12 +777,24 @@ export function createDocsServer(config = {}) {
|
|
|
773
777
|
...discoveryOptions,
|
|
774
778
|
preferredSkillDocument: readRootSkillDocument(preloaded, rootDir),
|
|
775
779
|
fallbackSkillDocument: renderDocsSkillDocument(discoveryOptions),
|
|
780
|
+
publishedSkills: await publishedAgentSkills,
|
|
781
|
+
agentCard: config.agent?.a2a,
|
|
776
782
|
});
|
|
777
783
|
if (standardsDiscoveryResponse)
|
|
778
784
|
return standardsDiscoveryResponse;
|
|
779
785
|
}
|
|
780
786
|
if (isDocsAgentDiscoveryRequest(event.url, { apiRoute: discoveryApiRoute })) {
|
|
781
|
-
return new Response(JSON.stringify(buildDocsAgentDiscoverySpec(
|
|
787
|
+
return new Response(JSON.stringify(buildDocsAgentDiscoverySpec({
|
|
788
|
+
...discoveryOptions,
|
|
789
|
+
publishedSkills: [
|
|
790
|
+
await resolveDocsPublishedAgentSkill({
|
|
791
|
+
preferredDocument: readRootSkillDocument(preloaded, rootDir),
|
|
792
|
+
fallbackDocument: renderDocsSkillDocument(discoveryOptions),
|
|
793
|
+
}),
|
|
794
|
+
...(await publishedAgentSkills),
|
|
795
|
+
],
|
|
796
|
+
agentCard: config.agent?.a2a,
|
|
797
|
+
}), null, 2), {
|
|
782
798
|
headers: {
|
|
783
799
|
"Content-Type": "application/json; charset=utf-8",
|
|
784
800
|
"Cache-Control": "public, max-age=0, s-maxage=3600",
|
|
@@ -864,6 +880,7 @@ export function createDocsServer(config = {}) {
|
|
|
864
880
|
if (sitemapResponse)
|
|
865
881
|
return sitemapResponse;
|
|
866
882
|
const robotsResponse = createDocsRobotsResponse({
|
|
883
|
+
agentCard: Boolean(config.agent?.a2a),
|
|
867
884
|
request: event.request,
|
|
868
885
|
entry,
|
|
869
886
|
apiCatalog: apiCatalogEnabled,
|
|
@@ -1516,6 +1533,37 @@ export function createDocsServer(config = {}) {
|
|
|
1516
1533
|
defaultBehavior: "toggle",
|
|
1517
1534
|
});
|
|
1518
1535
|
},
|
|
1536
|
+
async getSkills(context) {
|
|
1537
|
+
const origin = context?.request
|
|
1538
|
+
? new URL(context.request.url).origin
|
|
1539
|
+
: llmsBaseUrl || "http://localhost";
|
|
1540
|
+
const skillOptions = {
|
|
1541
|
+
origin,
|
|
1542
|
+
entry,
|
|
1543
|
+
apiRoute: configuredApiRoute,
|
|
1544
|
+
docsPath: config.docsPath,
|
|
1545
|
+
apiCatalog: apiCatalogEnabled,
|
|
1546
|
+
i18n,
|
|
1547
|
+
search: config.search,
|
|
1548
|
+
mcp: mcpConfig,
|
|
1549
|
+
feedback: agentFeedbackDiscovery,
|
|
1550
|
+
llms: {
|
|
1551
|
+
enabled: llmsEnabled,
|
|
1552
|
+
apiCatalog: apiCatalogEnabled,
|
|
1553
|
+
baseUrl: llmsBaseUrl || undefined,
|
|
1554
|
+
siteTitle: llmsTitle,
|
|
1555
|
+
siteDescription: llmsDesc,
|
|
1556
|
+
},
|
|
1557
|
+
sitemap: config.sitemap,
|
|
1558
|
+
robots: config.robots,
|
|
1559
|
+
openapi: openapiDiscovery,
|
|
1560
|
+
};
|
|
1561
|
+
const rootSkill = await resolveDocsPublishedAgentSkill({
|
|
1562
|
+
preferredDocument: readRootSkillDocument(preloaded, rootDir),
|
|
1563
|
+
fallbackDocument: renderDocsSkillDocument(skillOptions),
|
|
1564
|
+
});
|
|
1565
|
+
return [rootSkill, ...(await publishedAgentSkills)];
|
|
1566
|
+
},
|
|
1519
1567
|
},
|
|
1520
1568
|
mcp: config.mcp,
|
|
1521
1569
|
analytics,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.61",
|
|
4
4
|
"description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.10.0",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"@farming-labs/docs": "0.2.
|
|
59
|
+
"@farming-labs/docs": "0.2.61"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@farming-labs/docs": "*"
|