@ontosdk/next 1.3.1 → 1.3.2

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,52 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
3
- import { OntoConfig } from './config.js';
4
-
5
- interface OntoProviderProps {
6
- /**
7
- * The base URL of your site (e.g., 'https://example.com')
8
- * Used to construct the full href for the AI discovery link tag.
9
- */
10
- baseUrl: string;
11
- /**
12
- * Child components to render
13
- */
14
- children: ReactNode;
15
- /**
16
- * Optional: Onto configuration for automatic JSON-LD schema injection
17
- * If provided, the provider will automatically inject JSON-LD schemas
18
- * based on the page type configuration
19
- */
20
- config?: OntoConfig;
21
- }
22
- /**
23
- * OntoProvider — Automatic AI Discovery Provider
24
- *
25
- * Wraps your application and automatically injects:
26
- * 1. `<link rel="alternate">` tags for AI discovery
27
- * 2. JSON-LD structured data schemas based on page type
28
- *
29
- * With config, automatically generates JSON-LD schemas:
30
- * - 'scoring' pages get Methodology schema with AIO weights (40/35/25)
31
- * - 'about' pages get Organization/AboutPage schema
32
- *
33
- * Usage in a Next.js App Router layout:
34
- * ```tsx
35
- * import { OntoProvider } from '@ontosdk/next/provider';
36
- * import config from '../onto.config';
37
- *
38
- * export default function RootLayout({ children }) {
39
- * return (
40
- * <OntoProvider baseUrl="https://example.com" config={config}>
41
- * <html>
42
- * <head />
43
- * <body>{children}</body>
44
- * </html>
45
- * </OntoProvider>
46
- * );
47
- * }
48
- * ```
49
- */
50
- declare function OntoProvider({ baseUrl, children, config }: OntoProviderProps): react_jsx_runtime.JSX.Element;
51
-
52
- export { OntoProvider, type OntoProviderProps };
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
package/dist/config.d.mts DELETED
@@ -1,85 +0,0 @@
1
- /**
2
- * Configuration schema for onto.config.ts
3
- * Used to dynamically generate llms.txt and other AI discovery files
4
- */
5
- type PageType = 'scoring' | 'about' | 'default';
6
- interface OntoRoute {
7
- /**
8
- * The URL path (e.g., '/docs', '/api/reference')
9
- */
10
- path: string;
11
- /**
12
- * Description of what this route contains
13
- */
14
- description: string;
15
- /**
16
- * Optional: Page type for automatic JSON-LD schema injection
17
- * - 'scoring': Injects Methodology schema with AIO scoring weights (40/35/25)
18
- * - 'about': Injects Organization/AboutPage schema
19
- * - 'default': No automatic schema injection
20
- */
21
- pageType?: PageType;
22
- }
23
- interface OntoConfig {
24
- /**
25
- * The name of your project or site (required)
26
- * Used as the H1 heading in llms.txt
27
- */
28
- name: string;
29
- /**
30
- * A short summary of your project (required)
31
- * Displayed as a blockquote in llms.txt
32
- * Should contain key information necessary for understanding the rest of the file
33
- */
34
- summary: string;
35
- /**
36
- * The base URL of your site (e.g., 'https://example.com')
37
- */
38
- baseUrl: string;
39
- /**
40
- * Optional: Additional sections to include in llms.txt
41
- * Each section can contain any markdown content
42
- */
43
- sections?: {
44
- heading: string;
45
- content: string;
46
- }[];
47
- /**
48
- * Key routes that AI agents should know about
49
- * These will be formatted as a markdown list in llms.txt
50
- */
51
- routes?: OntoRoute[];
52
- /**
53
- * Optional: Links to external resources (documentation, API references, etc.)
54
- */
55
- externalLinks?: {
56
- title: string;
57
- url: string;
58
- description?: string;
59
- }[];
60
- /**
61
- * Optional: Organization information for JSON-LD schemas
62
- */
63
- organization?: {
64
- name: string;
65
- description?: string;
66
- url?: string;
67
- logo?: string;
68
- foundingDate?: string;
69
- };
70
- }
71
- /**
72
- * Load the onto.config.ts file from the user's project
73
- * This is used by the middleware to dynamically generate llms.txt
74
- */
75
- declare function loadOntoConfig(): Promise<OntoConfig | null>;
76
- /**
77
- * Generate llms.txt content from OntoConfig
78
- * Follows the llms.txt specification:
79
- * - H1 with project name
80
- * - Blockquote with summary
81
- * - Additional markdown sections
82
- */
83
- declare function generateLlmsTxt(config: OntoConfig): string;
84
-
85
- export { type OntoConfig, type OntoRoute, type PageType, generateLlmsTxt, loadOntoConfig };
package/dist/config.d.ts DELETED
@@ -1,85 +0,0 @@
1
- /**
2
- * Configuration schema for onto.config.ts
3
- * Used to dynamically generate llms.txt and other AI discovery files
4
- */
5
- type PageType = 'scoring' | 'about' | 'default';
6
- interface OntoRoute {
7
- /**
8
- * The URL path (e.g., '/docs', '/api/reference')
9
- */
10
- path: string;
11
- /**
12
- * Description of what this route contains
13
- */
14
- description: string;
15
- /**
16
- * Optional: Page type for automatic JSON-LD schema injection
17
- * - 'scoring': Injects Methodology schema with AIO scoring weights (40/35/25)
18
- * - 'about': Injects Organization/AboutPage schema
19
- * - 'default': No automatic schema injection
20
- */
21
- pageType?: PageType;
22
- }
23
- interface OntoConfig {
24
- /**
25
- * The name of your project or site (required)
26
- * Used as the H1 heading in llms.txt
27
- */
28
- name: string;
29
- /**
30
- * A short summary of your project (required)
31
- * Displayed as a blockquote in llms.txt
32
- * Should contain key information necessary for understanding the rest of the file
33
- */
34
- summary: string;
35
- /**
36
- * The base URL of your site (e.g., 'https://example.com')
37
- */
38
- baseUrl: string;
39
- /**
40
- * Optional: Additional sections to include in llms.txt
41
- * Each section can contain any markdown content
42
- */
43
- sections?: {
44
- heading: string;
45
- content: string;
46
- }[];
47
- /**
48
- * Key routes that AI agents should know about
49
- * These will be formatted as a markdown list in llms.txt
50
- */
51
- routes?: OntoRoute[];
52
- /**
53
- * Optional: Links to external resources (documentation, API references, etc.)
54
- */
55
- externalLinks?: {
56
- title: string;
57
- url: string;
58
- description?: string;
59
- }[];
60
- /**
61
- * Optional: Organization information for JSON-LD schemas
62
- */
63
- organization?: {
64
- name: string;
65
- description?: string;
66
- url?: string;
67
- logo?: string;
68
- foundingDate?: string;
69
- };
70
- }
71
- /**
72
- * Load the onto.config.ts file from the user's project
73
- * This is used by the middleware to dynamically generate llms.txt
74
- */
75
- declare function loadOntoConfig(): Promise<OntoConfig | null>;
76
- /**
77
- * Generate llms.txt content from OntoConfig
78
- * Follows the llms.txt specification:
79
- * - H1 with project name
80
- * - Blockquote with summary
81
- * - Additional markdown sections
82
- */
83
- declare function generateLlmsTxt(config: OntoConfig): string;
84
-
85
- export { type OntoConfig, type OntoRoute, type PageType, generateLlmsTxt, loadOntoConfig };
package/dist/index.d.mts DELETED
@@ -1,25 +0,0 @@
1
- export { OntoConfig, OntoConfig as OntoConfigType, OntoRoute, OntoRoute as OntoRouteType, PageType, generateLlmsTxt, loadOntoConfig } from './config.mjs';
2
- export { AIOMethodologySchema, AboutPageSchema, OrganizationSchema, generateAIOMethodologySchema, generateAboutPageSchema, generateOrganizationSchema, generateSchemaForPageType, serializeSchema } from './schemas.mjs';
3
-
4
- interface ExtractionResult {
5
- markdown: string;
6
- metadata: {
7
- title: string;
8
- description: string;
9
- jsonLd: any[];
10
- };
11
- stats: {
12
- originalHtmlSize: number;
13
- markdownSize: number;
14
- tokenReductionRatio: number;
15
- };
16
- }
17
- /**
18
- * Extracts pure semantic markdown and metadata from rendered Next.js HTML strings.
19
- * @param html The raw HTML string.
20
- * @param sourceUrl (Optional) the URL this was generated from, to attach as metadata.
21
- * @returns {ExtractionResult} The extracted payload.
22
- */
23
- declare function extractContent(html: string, sourceUrl?: string): ExtractionResult;
24
-
25
- export { extractContent };
package/dist/index.d.ts DELETED
@@ -1,25 +0,0 @@
1
- export { OntoConfig, OntoConfig as OntoConfigType, OntoRoute, OntoRoute as OntoRouteType, PageType, generateLlmsTxt, loadOntoConfig } from './config.js';
2
- export { AIOMethodologySchema, AboutPageSchema, OrganizationSchema, generateAIOMethodologySchema, generateAboutPageSchema, generateOrganizationSchema, generateSchemaForPageType, serializeSchema } from './schemas.js';
3
-
4
- interface ExtractionResult {
5
- markdown: string;
6
- metadata: {
7
- title: string;
8
- description: string;
9
- jsonLd: any[];
10
- };
11
- stats: {
12
- originalHtmlSize: number;
13
- markdownSize: number;
14
- tokenReductionRatio: number;
15
- };
16
- }
17
- /**
18
- * Extracts pure semantic markdown and metadata from rendered Next.js HTML strings.
19
- * @param html The raw HTML string.
20
- * @param sourceUrl (Optional) the URL this was generated from, to attach as metadata.
21
- * @returns {ExtractionResult} The extracted payload.
22
- */
23
- declare function extractContent(html: string, sourceUrl?: string): ExtractionResult;
24
-
25
- export { extractContent };
@@ -1,26 +0,0 @@
1
- import { NextRequest, NextResponse } from 'next/server';
2
- import { OntoConfig } from './config.mjs';
3
-
4
- /**
5
- * Comprehensive registry of AI bot user-agent strings.
6
- * The middleware uses this list to detect AI crawlers and serve optimized markdown.
7
- */
8
- interface AiBot {
9
- /** The user-agent substring to match against */
10
- name: string;
11
- /** The company operating this bot */
12
- company: string;
13
- }
14
- /**
15
- * Flat list of user-agent substrings for fast matching in the middleware.
16
- */
17
- declare const AI_BOT_USER_AGENTS: string[];
18
- /**
19
- * Given a raw user-agent string, returns the matched AiBot entry or undefined.
20
- * Comparison is case-insensitive to handle inconsistent agent casing.
21
- */
22
- declare function matchBot(userAgent: string | null): AiBot | undefined;
23
-
24
- declare function ontoMiddleware(request: NextRequest, config?: OntoConfig): Promise<NextResponse<unknown>>;
25
-
26
- export { AI_BOT_USER_AGENTS, type AiBot, matchBot, ontoMiddleware };
@@ -1,26 +0,0 @@
1
- import { NextRequest, NextResponse } from 'next/server';
2
- import { OntoConfig } from './config.js';
3
-
4
- /**
5
- * Comprehensive registry of AI bot user-agent strings.
6
- * The middleware uses this list to detect AI crawlers and serve optimized markdown.
7
- */
8
- interface AiBot {
9
- /** The user-agent substring to match against */
10
- name: string;
11
- /** The company operating this bot */
12
- company: string;
13
- }
14
- /**
15
- * Flat list of user-agent substrings for fast matching in the middleware.
16
- */
17
- declare const AI_BOT_USER_AGENTS: string[];
18
- /**
19
- * Given a raw user-agent string, returns the matched AiBot entry or undefined.
20
- * Comparison is case-insensitive to handle inconsistent agent casing.
21
- */
22
- declare function matchBot(userAgent: string | null): AiBot | undefined;
23
-
24
- declare function ontoMiddleware(request: NextRequest, config?: OntoConfig): Promise<NextResponse<unknown>>;
25
-
26
- export { AI_BOT_USER_AGENTS, type AiBot, matchBot, ontoMiddleware };
@@ -1,73 +0,0 @@
1
- import { OntoConfig } from './config.mjs';
2
-
3
- /**
4
- * JSON-LD Schema generators for automatic structured data injection
5
- * Follows Schema.org standards for AI-friendly metadata
6
- */
7
-
8
- /**
9
- * Standard AIO (AI Optimization) scoring methodology
10
- * Based on the Onto scoring algorithm:
11
- * - Content Negotiation: 40% (30 points)
12
- * - React Tax / Token Efficiency: 35% (30 points)
13
- * - Structured Data: 25% (25 points)
14
- * - Semantic HTML: Bonus (15 points)
15
- */
16
- interface AIOMethodologySchema {
17
- '@context': 'https://schema.org';
18
- '@type': 'HowTo';
19
- name: string;
20
- description: string;
21
- step: Array<{
22
- '@type': 'HowToStep';
23
- name: string;
24
- text: string;
25
- position: number;
26
- }>;
27
- }
28
- /**
29
- * Generate AIO Scoring Methodology JSON-LD schema
30
- * This explains to AI agents how the scoring system works
31
- */
32
- declare function generateAIOMethodologySchema(config: OntoConfig, pageUrl: string): AIOMethodologySchema;
33
- /**
34
- * Organization schema for About pages
35
- */
36
- interface OrganizationSchema {
37
- '@context': 'https://schema.org';
38
- '@type': 'Organization';
39
- name: string;
40
- url?: string;
41
- description?: string;
42
- logo?: string;
43
- foundingDate?: string;
44
- }
45
- /**
46
- * Generate Organization JSON-LD schema for About pages
47
- */
48
- declare function generateOrganizationSchema(config: OntoConfig, pageUrl: string): OrganizationSchema | null;
49
- /**
50
- * AboutPage schema combining Organization and WebPage
51
- */
52
- interface AboutPageSchema {
53
- '@context': 'https://schema.org';
54
- '@type': 'AboutPage';
55
- name: string;
56
- url: string;
57
- description?: string;
58
- mainEntity?: OrganizationSchema;
59
- }
60
- /**
61
- * Generate AboutPage JSON-LD schema
62
- */
63
- declare function generateAboutPageSchema(config: OntoConfig, pageUrl: string): AboutPageSchema;
64
- /**
65
- * Determine which schema to generate based on page type
66
- */
67
- declare function generateSchemaForPageType(pageType: 'scoring' | 'about' | 'default', config: OntoConfig, pageUrl: string): any | null;
68
- /**
69
- * Serialize schema to JSON-LD script tag content
70
- */
71
- declare function serializeSchema(schema: any | null): string | null;
72
-
73
- export { type AIOMethodologySchema, type AboutPageSchema, type OrganizationSchema, generateAIOMethodologySchema, generateAboutPageSchema, generateOrganizationSchema, generateSchemaForPageType, serializeSchema };
package/dist/schemas.d.ts DELETED
@@ -1,73 +0,0 @@
1
- import { OntoConfig } from './config.js';
2
-
3
- /**
4
- * JSON-LD Schema generators for automatic structured data injection
5
- * Follows Schema.org standards for AI-friendly metadata
6
- */
7
-
8
- /**
9
- * Standard AIO (AI Optimization) scoring methodology
10
- * Based on the Onto scoring algorithm:
11
- * - Content Negotiation: 40% (30 points)
12
- * - React Tax / Token Efficiency: 35% (30 points)
13
- * - Structured Data: 25% (25 points)
14
- * - Semantic HTML: Bonus (15 points)
15
- */
16
- interface AIOMethodologySchema {
17
- '@context': 'https://schema.org';
18
- '@type': 'HowTo';
19
- name: string;
20
- description: string;
21
- step: Array<{
22
- '@type': 'HowToStep';
23
- name: string;
24
- text: string;
25
- position: number;
26
- }>;
27
- }
28
- /**
29
- * Generate AIO Scoring Methodology JSON-LD schema
30
- * This explains to AI agents how the scoring system works
31
- */
32
- declare function generateAIOMethodologySchema(config: OntoConfig, pageUrl: string): AIOMethodologySchema;
33
- /**
34
- * Organization schema for About pages
35
- */
36
- interface OrganizationSchema {
37
- '@context': 'https://schema.org';
38
- '@type': 'Organization';
39
- name: string;
40
- url?: string;
41
- description?: string;
42
- logo?: string;
43
- foundingDate?: string;
44
- }
45
- /**
46
- * Generate Organization JSON-LD schema for About pages
47
- */
48
- declare function generateOrganizationSchema(config: OntoConfig, pageUrl: string): OrganizationSchema | null;
49
- /**
50
- * AboutPage schema combining Organization and WebPage
51
- */
52
- interface AboutPageSchema {
53
- '@context': 'https://schema.org';
54
- '@type': 'AboutPage';
55
- name: string;
56
- url: string;
57
- description?: string;
58
- mainEntity?: OrganizationSchema;
59
- }
60
- /**
61
- * Generate AboutPage JSON-LD schema
62
- */
63
- declare function generateAboutPageSchema(config: OntoConfig, pageUrl: string): AboutPageSchema;
64
- /**
65
- * Determine which schema to generate based on page type
66
- */
67
- declare function generateSchemaForPageType(pageType: 'scoring' | 'about' | 'default', config: OntoConfig, pageUrl: string): any | null;
68
- /**
69
- * Serialize schema to JSON-LD script tag content
70
- */
71
- declare function serializeSchema(schema: any | null): string | null;
72
-
73
- export { type AIOMethodologySchema, type AboutPageSchema, type OrganizationSchema, generateAIOMethodologySchema, generateAboutPageSchema, generateOrganizationSchema, generateSchemaForPageType, serializeSchema };