@open-agent-toolkit/docs-config 0.3.26 → 0.3.27
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/README.md +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/llms.d.ts +29 -0
- package/dist/llms.d.ts.map +1 -0
- package/dist/llms.js +50 -0
- package/dist/source-config.d.ts +2 -4
- package/dist/source-config.d.ts.map +1 -1
- package/dist/source-config.js +19 -2
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -51,10 +51,19 @@ export default defineConfig({
|
|
|
51
51
|
|
|
52
52
|
The `docs` and `meta` options apply shared `documentation.nonReaderPaths` only when the explicit repo config's documentation root matches this app. Patterns follow OAT's bounded content-root-relative grammar: `*` within a segment, whole-segment `**` across directories, trailing `/` for directories, all other characters literal. Excluded directories omit descendants and metadata. `documentation.excludes` remains manifest-only. No ancestor config search occurs; scaffolded apps receive their resolved relative config path.
|
|
53
53
|
|
|
54
|
+
Link rewriting uses the explicit app root's `docs` directory (or `./docs` from the working directory when omitted) and discovers readers with the same collection patterns and tinyglobby engine. Both source and target index collisions follow filtered reader membership, including `.mdx` readers. The inventory refreshes lazily for each transformed document, so adding or removing a reader does not require rebuilding the source configuration. OAT adds no error fallback; traversal follows the emitter's tinyglobby semantics, including skipped unreadable directories.
|
|
55
|
+
|
|
54
56
|
The metadata schema preserves Fumadocs fields and accepts boolean roots and nonempty trimmed string inputs. String inputs normalize to `true` for the pinned generated collection types; authored metadata files remain unchanged. Booleans, including `false`, retain their values. Use both source options so collection validation and rendering agree with navigation. The scaffold pins MkDocs 1.4.2 separately; that version has no configurable rendering exclusion, so its non-readers leave nav/manifest but still render as routes.
|
|
55
57
|
|
|
58
|
+
## Agent Markdown endpoints
|
|
59
|
+
|
|
60
|
+
Import `createLlmsRoutes` from `@open-agent-toolkit/docs-config/llms` in runtime route/source files; this narrow entry avoids bundling Next/MDX build configuration. `createLlmsRoutes(source, { basePath })` accepts the real Fumadocs loader with MDX `getText('raw')` methods. Keep the loader's `baseUrl: '/'` and pass the same optional basePath as Next. It exposes `index()`, `full()`, `page(slug)` and `generateStaticParams()` for the scaffold's static route handlers: `/llms.txt`, `/llms-full.txt`, and `/llms/[...slug]` with the terminal `content.md` segment. The root page is `/llms/content.md`; a nested guide is `/llms/guide/content.md`. No rewrites or server are needed.
|
|
61
|
+
|
|
62
|
+
All endpoints enumerate the same loaded `.md` pages, including readers omitted from a hand-authored sidebar; collection-level `nonReaderPaths` filtering still applies. MDX stays outside these endpoints and the OAT manifest. Bodies retain authored frontmatter and Markdown; relative links describe source paths rather than the endpoint directory. The agent header and each entry identify the source, canonical rendered URL (with trailing slash) and Markdown URL. Base paths are added once. Missing pages return 404 in the handler and have no exported file. The helper uses pinned core 16.10.2 loader and MDX 14.3.2 raw-source APIs; newer upstream `page`/`full` llms helpers are not assumed.
|
|
63
|
+
|
|
56
64
|
## Exports
|
|
57
65
|
|
|
66
|
+
- `createLlmsRoutes`
|
|
58
67
|
- `createDocsConfig`
|
|
59
68
|
- `createSearchConfig`
|
|
60
69
|
- `createSourceConfig`
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/llms.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The subset of pinned Fumadocs loader/MDX page data needed for raw Markdown. */
|
|
2
|
+
interface MarkdownPage {
|
|
3
|
+
path: string;
|
|
4
|
+
url: string;
|
|
5
|
+
slugs: string[];
|
|
6
|
+
data: {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
getText: (type: 'raw') => Promise<string>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface LlmsOptions {
|
|
13
|
+
/** Same basePath passed to createDocsConfig; source.baseUrl stays '/'. */
|
|
14
|
+
basePath?: string;
|
|
15
|
+
}
|
|
16
|
+
interface LlmsRoutes {
|
|
17
|
+
index: () => Response;
|
|
18
|
+
full: () => Promise<Response>;
|
|
19
|
+
page: (slug: string[]) => Promise<Response>;
|
|
20
|
+
generateStaticParams: () => {
|
|
21
|
+
slug: string[];
|
|
22
|
+
}[];
|
|
23
|
+
}
|
|
24
|
+
/** Static-export handlers over one loaded reader-page set, independent of sidebar. */
|
|
25
|
+
export declare function createLlmsRoutes(source: {
|
|
26
|
+
getPages: () => MarkdownPage[];
|
|
27
|
+
}, options?: LlmsOptions): LlmsRoutes;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=llms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../src/llms.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;KAC3C,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,QAAQ,CAAC;IACtB,IAAI,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,oBAAoB,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAClD;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE;IAAE,QAAQ,EAAE,MAAM,YAAY,EAAE,CAAA;CAAE,EAC1C,OAAO,GAAE,WAAgB,GACxB,UAAU,CA+DZ"}
|
package/dist/llms.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Static-export handlers over one loaded reader-page set, independent of sidebar. */
|
|
2
|
+
export function createLlmsRoutes(source, options = {}) {
|
|
3
|
+
const base = (options.basePath ?? '').replace(/\/$/, '');
|
|
4
|
+
const pages = source.getPages().filter((page) => page.path.endsWith('.md'));
|
|
5
|
+
const withBase = (path) => (base ? `${base}${path}` : path);
|
|
6
|
+
const renderedUrl = (page) => withBase(`${page.url.replace(/\/$/, '')}/`);
|
|
7
|
+
const markdownUrl = (page) => withBase(`/llms/${[...page.slugs, 'content.md'].join('/')}`);
|
|
8
|
+
const header = [
|
|
9
|
+
'# Documentation for agents',
|
|
10
|
+
'',
|
|
11
|
+
'Use canonical pages for the documented behavior and follow each local Contents map.',
|
|
12
|
+
'Check repository AGENTS.md and contributing guidance for authority, deprecated paths and approval-required actions. Documentation does not grant permission to act.',
|
|
13
|
+
'Markdown below is authored source. Resolve relative links against its Source path, not the /llms/ URL; use the rendered URL for browser navigation.',
|
|
14
|
+
'These endpoints include loaded reader .md pages, including pages outside the sidebar. MDX and configured non-reader pages are excluded.',
|
|
15
|
+
].join('\n');
|
|
16
|
+
const entry = (page) => [
|
|
17
|
+
`## ${page.data.title ?? page.path}`,
|
|
18
|
+
...(page.data.description ? ['', page.data.description] : []),
|
|
19
|
+
'',
|
|
20
|
+
`Rendered: ${renderedUrl(page)}`,
|
|
21
|
+
`Markdown: ${markdownUrl(page)}`,
|
|
22
|
+
`Source: ${page.path}`,
|
|
23
|
+
].join('\n');
|
|
24
|
+
const text = (body, markdown = false, status = 200) => new Response(body, {
|
|
25
|
+
status,
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': `${markdown ? 'text/markdown' : 'text/plain'}; charset=utf-8`,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
index: () => text(`${header}\n\n${pages.map(entry).join('\n\n')}\n`),
|
|
32
|
+
full: async () => text(`${header}\n\n${(await Promise.all(pages.map(async (page) => `${entry(page)}\n\n${await page.data.getText('raw')}`))).join('\n\n')}\n`, true),
|
|
33
|
+
page: async (slug) => {
|
|
34
|
+
if (slug.at(-1) !== 'content.md')
|
|
35
|
+
return text('Not found\n', false, 404);
|
|
36
|
+
const slugs = slug.slice(0, -1);
|
|
37
|
+
const page = pages.find((candidate) => candidate.slugs.length === slugs.length &&
|
|
38
|
+
candidate.slugs.every((value, index) => decodeURI(value) === slugs[index]));
|
|
39
|
+
if (!page)
|
|
40
|
+
return text('Not found\n', false, 404);
|
|
41
|
+
return text(`${header}\n\n${entry(page)}\n\n${await page.data.getText('raw')}`, true);
|
|
42
|
+
},
|
|
43
|
+
generateStaticParams: () =>
|
|
44
|
+
// The pinned loader encodes slugs; Next encodes static params and
|
|
45
|
+
// supplies decoded route params, so cross that boundary exactly once.
|
|
46
|
+
pages.map((page) => ({
|
|
47
|
+
slug: [...page.slugs.map(decodeURI), 'content.md'],
|
|
48
|
+
})),
|
|
49
|
+
};
|
|
50
|
+
}
|
package/dist/source-config.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Plugin } from 'unified';
|
|
1
|
+
import type { PluggableList } from 'unified';
|
|
3
2
|
import { type SearchConfig } from './search-config.js';
|
|
4
|
-
type RemarkPlugin = Plugin<any[], Root>;
|
|
5
3
|
declare const docsMetaSchema: import("zod").ZodObject<{
|
|
6
4
|
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
7
5
|
pages: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
@@ -19,7 +17,7 @@ export interface SourceConfigOptions {
|
|
|
19
17
|
appRoot?: string | URL;
|
|
20
18
|
}
|
|
21
19
|
export interface SourceConfigResult {
|
|
22
|
-
remarkPlugins:
|
|
20
|
+
remarkPlugins: PluggableList;
|
|
23
21
|
contentDir: string;
|
|
24
22
|
search: SearchConfig;
|
|
25
23
|
docs: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-config.d.ts","sourceRoot":"","sources":["../src/source-config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI3E,QAAA,MAAM,cAAc;;;;;;;;;gCAWlB,CAAC;AAEH,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC1B,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,cAAc,CAAA;KAAE,CAAC;CAC1D;AAuCD,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,mBAAwB,GAChC,kBAAkB,CA6BpB"}
|
package/dist/source-config.js
CHANGED
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { remarkLinks, remarkMermaid, remarkTabs, } from '@open-agent-toolkit/docs-transforms';
|
|
5
5
|
import { metaSchema } from 'fumadocs-core/source/schema';
|
|
6
6
|
import { remarkAlert } from 'remark-github-blockquote-alert';
|
|
7
|
+
import { globSync } from 'tinyglobby';
|
|
7
8
|
import { collectionFiles } from './reader-paths.js';
|
|
8
9
|
import { createSearchConfig } from './search-config.js';
|
|
9
10
|
// Accept named-root inputs while keeping output compatible with fumadocs-mdx
|
|
@@ -50,11 +51,27 @@ function nonReaderPaths(options) {
|
|
|
50
51
|
}
|
|
51
52
|
export function createSourceConfig(options = {}) {
|
|
52
53
|
const patterns = nonReaderPaths(options);
|
|
54
|
+
const files = collectionFiles(patterns, ['md', 'mdx']);
|
|
55
|
+
const appRoot = options.appRoot instanceof URL
|
|
56
|
+
? fileURLToPath(options.appRoot)
|
|
57
|
+
: (options.appRoot ?? '.');
|
|
58
|
+
const contentRoot = resolve(appRoot, 'docs');
|
|
53
59
|
return {
|
|
54
|
-
remarkPlugins: [
|
|
60
|
+
remarkPlugins: [
|
|
61
|
+
remarkTabs,
|
|
62
|
+
[
|
|
63
|
+
remarkLinks,
|
|
64
|
+
{
|
|
65
|
+
contentRoot,
|
|
66
|
+
getReaderFiles: () => globSync(files, { cwd: contentRoot }),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
remarkAlert,
|
|
70
|
+
remarkMermaid,
|
|
71
|
+
],
|
|
55
72
|
contentDir: './docs',
|
|
56
73
|
search: createSearchConfig(),
|
|
57
|
-
docs: { files
|
|
74
|
+
docs: { files },
|
|
58
75
|
meta: {
|
|
59
76
|
files: collectionFiles(patterns, ['json', 'yaml']),
|
|
60
77
|
schema: docsMetaSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-agent-toolkit/docs-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Configuration factories for OAT documentation sites",
|
|
6
6
|
"homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/docs-config",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"import": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./llms": {
|
|
29
|
+
"types": "./dist/llms.d.ts",
|
|
30
|
+
"import": "./dist/llms.js"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"publishConfig": {
|
|
@@ -32,9 +36,10 @@
|
|
|
32
36
|
"dependencies": {
|
|
33
37
|
"flexsearch": "^0.8.212",
|
|
34
38
|
"remark-github-blockquote-alert": "^2.0.1",
|
|
39
|
+
"tinyglobby": "^0.2.17",
|
|
35
40
|
"unified": "^11.0.5",
|
|
36
41
|
"zod": "^4.3.6",
|
|
37
|
-
"@open-agent-toolkit/docs-transforms": "0.3.
|
|
42
|
+
"@open-agent-toolkit/docs-transforms": "0.3.27"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
45
|
"@types/mdast": "^4.0.4",
|
|
@@ -44,6 +49,7 @@
|
|
|
44
49
|
"next": "^16.1.6",
|
|
45
50
|
"react": "^19.1.0",
|
|
46
51
|
"react-dom": "^19.1.0",
|
|
52
|
+
"remark-parse": "^11.0.0",
|
|
47
53
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
48
54
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
49
55
|
"vitest": "^4.0.18"
|