@farming-labs/svelte 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/content.d.ts +2 -1
- package/dist/content.js +2 -1
- package/dist/server.js +29 -6
- package/package.json +2 -2
package/dist/content.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* extracts frontmatter, and builds a navigation tree compatible
|
|
6
6
|
* with @farming-labs/docs DocsConfig.
|
|
7
7
|
*/
|
|
8
|
-
import { type OrderingItem, type PageAgentFrontmatter, type ResolvedDocsRelatedLink, type SidebarFolderIndexBehavior } from "@farming-labs/docs";
|
|
8
|
+
import { type OrderingItem, type PageAgentFrontmatter, type DocsOkfTrustMetadataInput, type ResolvedDocsRelatedLink, type SidebarFolderIndexBehavior } from "@farming-labs/docs";
|
|
9
9
|
export interface PageNode {
|
|
10
10
|
type: "page";
|
|
11
11
|
name: string;
|
|
@@ -33,6 +33,7 @@ export interface ContentPage {
|
|
|
33
33
|
description?: string;
|
|
34
34
|
related?: ResolvedDocsRelatedLink[];
|
|
35
35
|
agent?: PageAgentFrontmatter;
|
|
36
|
+
okf?: DocsOkfTrustMetadataInput;
|
|
36
37
|
icon?: string;
|
|
37
38
|
sourcePath?: string;
|
|
38
39
|
lastmod?: string;
|
package/dist/content.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import matter from "gray-matter";
|
|
11
|
-
import { normalizeDocsRelated, normalizePageAgentFrontmatter, resolveDocsAudienceMdxContent, resolvePageSidebarFolderIndexBehavior, } from "@farming-labs/docs";
|
|
11
|
+
import { normalizeDocsRelated, normalizePageAgentFrontmatter, normalizeDocsOkfTrustMetadataInput, resolveDocsAudienceMdxContent, resolvePageSidebarFolderIndexBehavior, } from "@farming-labs/docs";
|
|
12
12
|
export function normalizeDocsFrontmatterLastmod(value) {
|
|
13
13
|
if (typeof value === "string")
|
|
14
14
|
return value;
|
|
@@ -60,6 +60,7 @@ export function loadDocsContent(contentDir, entry = "docs") {
|
|
|
60
60
|
description: data.description,
|
|
61
61
|
...(related.length > 0 ? { related } : {}),
|
|
62
62
|
agent: normalizePageAgentFrontmatter(data.agent),
|
|
63
|
+
okf: normalizeDocsOkfTrustMetadataInput(data.okf),
|
|
63
64
|
icon: data.icon,
|
|
64
65
|
sourcePath: full.replace(/\\/g, "/"),
|
|
65
66
|
lastmod: normalizeDocsFrontmatterLastmod(data.lastmod),
|
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, buildDocsSearchFacets, buildDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsContentChangeFeed, createDocsContentChangesHttpResponse, createDocsCacheableResponse, createDocsStandardsDiscoveryResponse, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsAgentManifestLinkHeader, getDocsDiscoveryLinkHeader, isDocsAgentDiscoveryRequest, isDocsContentChangesRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, parseDocsAgentFeedbackData, performDocsSearch, performDocsSearchWithMetadata, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveDocsSearchAudience, resolveDocsSearchError, resolveDocsSearchRequest, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsContentChangesConfig, resolveDocsRequestApiRoute, resolveDocsRetrievalLastModified, resolveDocsPublishedAgentSkill, resolveDocsStandardsDiscoveryRequest, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
|
-
import { buildApiReferenceOpenApiDocumentAsync, createDocsCloudAskAIResponse, createDocsMcpHttpHandler, isDocsCloudAskAIProvider, readDocsSitemapManifest, resolveApiReferenceOpenApiDiscovery, resolveDocsMcpConfig, resolveConfiguredAgentSkills, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
33
|
+
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsSearchFacets, buildDocsAgentDiscoverySpec, compactDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsContentChangeFeed, createDocsContentChangesHttpResponse, createDocsCacheableResponse, createDocsStandardsDiscoveryResponse, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, getDocsAgentManifestLinkHeader, getDocsDiscoveryLinkHeader, isDocsAgentDiscoveryRequest, isDocsContentChangesRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, normalizeDocsOkfTrustMetadataInput, parseDocsAgentFeedbackData, performDocsSearch, performDocsSearchWithMetadata, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveDocsSearchAudience, resolveDocsSearchError, resolveDocsSearchRequest, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsContentChangesConfig, resolveDocsRequestApiRoute, resolveDocsRetrievalLastModified, resolveDocsPublishedAgentSkill, resolveDocsStandardsDiscoveryRequest, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
|
+
import { buildApiReferenceOpenApiDocumentAsync, createDocsCloudAskAIResponse, createDocsMcpHttpHandler, isDocsCloudAskAIProvider, readDocsSitemapManifest, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveDocsMcpConfig, resolveConfiguredAgentSkills, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
35
35
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree, normalizeDocsFrontmatterLastmod, } from "./content.js";
|
|
36
36
|
import { renderMarkdown } from "./markdown.js";
|
|
37
37
|
export { createSvelteApiReference } from "./api-reference.js";
|
|
@@ -328,6 +328,7 @@ function searchIndexFromMap(contentMap, dirPrefix, entry, locale, sitemapManifes
|
|
|
328
328
|
description: data.description,
|
|
329
329
|
...(related.length > 0 ? { related } : {}),
|
|
330
330
|
agent: normalizePageAgentFrontmatter(data.agent),
|
|
331
|
+
okf: normalizeDocsOkfTrustMetadataInput(data.okf),
|
|
331
332
|
icon: data.icon,
|
|
332
333
|
lastmod: normalizeDocsFrontmatterLastmod(data.lastmod),
|
|
333
334
|
locale: typeof data.locale === "string" ? data.locale : undefined,
|
|
@@ -709,8 +710,13 @@ export function createDocsServer(config = {}) {
|
|
|
709
710
|
const page = findDocsMarkdownPage(entry, getSearchIndex(ctx), requestedPath);
|
|
710
711
|
return page
|
|
711
712
|
? {
|
|
712
|
-
document: renderDocsMarkdownDocument(page, {
|
|
713
|
+
document: renderDocsMarkdownDocument(page, {
|
|
714
|
+
origin,
|
|
715
|
+
sitemap: config.sitemap,
|
|
716
|
+
okf: config.agent?.okf,
|
|
717
|
+
}),
|
|
713
718
|
lastModified: resolveDocsRetrievalLastModified(page, "agent"),
|
|
719
|
+
access: page.agent?.access,
|
|
714
720
|
}
|
|
715
721
|
: null;
|
|
716
722
|
}
|
|
@@ -798,7 +804,7 @@ export function createDocsServer(config = {}) {
|
|
|
798
804
|
if (standardsDiscoveryResponse)
|
|
799
805
|
return standardsDiscoveryResponse;
|
|
800
806
|
if (isDocsAgentDiscoveryRequest(event.url, { apiRoute: discoveryApiRoute })) {
|
|
801
|
-
const
|
|
807
|
+
const fullSpec = buildDocsAgentDiscoverySpec({
|
|
802
808
|
...discoveryOptions,
|
|
803
809
|
publishedSkills: [
|
|
804
810
|
await resolveDocsPublishedAgentSkill({
|
|
@@ -808,13 +814,16 @@ export function createDocsServer(config = {}) {
|
|
|
808
814
|
...(await getPublishedAgentSkills()),
|
|
809
815
|
],
|
|
810
816
|
agentCard: config.agent?.a2a,
|
|
811
|
-
})
|
|
817
|
+
});
|
|
818
|
+
const compact = event.url.searchParams.get("profile") === "compact";
|
|
819
|
+
const spec = compact ? compactDocsAgentDiscoverySpec(fullSpec) : fullSpec;
|
|
820
|
+
const content = `${JSON.stringify(spec, null, compact ? undefined : 2)}\n`;
|
|
812
821
|
return createDocsCacheableResponse({
|
|
813
822
|
request: event.request,
|
|
814
823
|
content,
|
|
815
824
|
headers: {
|
|
816
825
|
"Content-Type": "application/json; charset=utf-8",
|
|
817
|
-
"Cache-Control": "public, max-age=0, s-maxage=3600",
|
|
826
|
+
"Cache-Control": "public, max-age=0, s-maxage=3600, stale-while-revalidate=86400",
|
|
818
827
|
"X-Robots-Tag": "noindex",
|
|
819
828
|
Link: agentManifestLinkHeader,
|
|
820
829
|
},
|
|
@@ -953,6 +962,7 @@ export function createDocsServer(config = {}) {
|
|
|
953
962
|
origin: markdownOrigin,
|
|
954
963
|
locale: ctx.locale,
|
|
955
964
|
lastModified: representation?.lastModified,
|
|
965
|
+
access: representation?.access,
|
|
956
966
|
pages: getSearchIndex(ctx),
|
|
957
967
|
sitemap: config.sitemap,
|
|
958
968
|
});
|
|
@@ -1622,6 +1632,7 @@ export function createDocsServer(config = {}) {
|
|
|
1622
1632
|
const mcpSiteTitle = typeof config.nav?.title === "string"
|
|
1623
1633
|
? config.nav.title
|
|
1624
1634
|
: "Documentation";
|
|
1635
|
+
const mcpApiReference = resolveApiReferenceConfig(config.apiReference).mcp;
|
|
1625
1636
|
const MCP = createDocsMcpHttpHandler({
|
|
1626
1637
|
source: {
|
|
1627
1638
|
entry,
|
|
@@ -1674,8 +1685,20 @@ export function createDocsServer(config = {}) {
|
|
|
1674
1685
|
},
|
|
1675
1686
|
},
|
|
1676
1687
|
mcp: config.mcp,
|
|
1688
|
+
okf: config.agent?.okf,
|
|
1689
|
+
openapi: mcpApiReference
|
|
1690
|
+
? {
|
|
1691
|
+
config: mcpApiReference,
|
|
1692
|
+
document: () => buildApiReferenceOpenApiDocumentAsync(config, {
|
|
1693
|
+
framework: "sveltekit",
|
|
1694
|
+
rootDir,
|
|
1695
|
+
baseUrl: markdownMetadataBaseUrl || undefined,
|
|
1696
|
+
}),
|
|
1697
|
+
}
|
|
1698
|
+
: undefined,
|
|
1677
1699
|
contentChanges: config.agent?.contentChanges,
|
|
1678
1700
|
evaluations: config.agent?.evaluations,
|
|
1701
|
+
feedback: config.feedback,
|
|
1679
1702
|
contentChangeFeed,
|
|
1680
1703
|
analytics,
|
|
1681
1704
|
telemetry: config.telemetry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.105",
|
|
4
4
|
"description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/node": "^22.10.0",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
59
|
"vitest": "^4.1.8",
|
|
60
|
-
"@farming-labs/docs": "0.2.
|
|
60
|
+
"@farming-labs/docs": "0.2.105"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@farming-labs/docs": ">=0.2.73"
|