@ agentmarkup/ 核心
框架不可知性 llms.txt选项 llms-full.txt,可选 A2A 代理卡,JSON-LD,标记下镜,AI 爬行器 robots.txt,标题,以及机器可读网站的验证原始.
安装
pnpm add -D @agentmarkup/core
使用量
@agentmarkup/core 用于适配器作者和已经拥有自定义的先发或后发管道的站点.
软件包家族还包括Vite、Astro和Next.js的专用适配器,因为这些框架拥有足够的最终建设产出.
帮助者是友好共存的: patchRobotsTxt() 匹配手动爬行器规则的叶子没有被修改过,在核心上建造的适配器可以保存所保存的 llms.txt 默认情况下,文件或现有的JSON-LD.
llmsTxt.whenToUse 需要一份简短、具体的声明清单,其中说明网站应该从事的工作。 它们是作为标有标记的子弹清单在自由式细节块中提供的 llms.txt 财务报告和审定财务报表 llms-full.txt在第一个之前 ## 因此,代理阅读列表 学习何时到达网站 而不是猜测 从营销副本.
何时 markdownPages.enabled 开始, generateLlmsTxt() 默认情况下, 更喜欢同一站点的标记下镜像 URL 用于页面条目, 所以代理先发现清除路径 。 这通常在生的HTML薄或吵时最有用. 设定 llmsTxt.preferMarkdownMirrors: false 将 HTML URL 保留在 llms.txt。 。 。 .
markdownPages.exclude 使用不应获得镜像的页面路径,匹配方式与 pages[].path。用于已存在但不包含内容的页面 404 页面是常见的情况,因为镜像发布一个URL,用"找不到"的文本回答200个,并用"cononicalise"回答404s的URL. 被排除在外的页面总是在任何地方跳过:否 .md 文件,没有 text/markdown 交替链接, 无条形 Link 头部,没有标记下 URL llms.txt,并且没有"漏镜"验证警告.
import {
generateAgentCard,
generateContentSignalHeaders,
generateLlmsTxt,
generateMarkdownCanonicalHeaders,
generatePageMarkdown,
generateJsonLdTags,
patchRobotsTxt,
presetToJsonLd,
validateAgentCardConfig,
validateAgentCardJson,
validateExistingJsonLd,
validateLlmsTxt,
validateRobotsTxt,
} from '@agentmarkup/core';
const builtHtml = '<html><head><title>Pricing</title></head><body><main><h1>Pricing</h1><p>Plans and billing.</p></main></body></html>';
const llms = generateLlmsTxt({
site: 'https://example.com',
name: 'Example',
description: 'Machine-readable metadata for an example site.',
llmsTxt: {
whenToUse: [
'The user asks what an Example plan costs or which plan fits their use case.',
'The user needs current billing terms rather than a cached third-party summary.',
],
sections: [
{
title: 'Public pages',
entries: [{ title: 'Pricing', url: '/pricing', description: 'Plans and billing' }],
},
],
},
});
const agentCard = generateAgentCard({
site: 'https://example.com',
name: 'Example',
description: 'Machine-readable metadata for an example site.',
agentCard: {
version: '1.0.0',
supportedInterfaces: [
{
url: 'https://agent.example.com/a2a/v1',
protocolBinding: 'HTTP+JSON',
protocolVersion: '1.0',
},
],
skills: [],
},
});
const jsonLd = generateJsonLdTags([
presetToJsonLd({ preset: 'webSite', name: 'Example', url: 'https://example.com' }),
]);
const robots = patchRobotsTxt(existingRobotsTxt, {
GPTBot: 'allow',
ClaudeBot: 'allow',
});
const markdown = generatePageMarkdown({
html: builtHtml,
pagePath: '/pricing/',
siteUrl: 'https://example.com',
});
const headers = generateContentSignalHeaders({
aiTrain: 'yes',
search: 'yes',
aiInput: 'yes',
});
const markdownCanonicalHeaders = generateMarkdownCanonicalHeaders([
{
markdownPath: '/pricing.md',
canonicalUrl: 'https://example.com/pricing',
},
]);
const llmsIssues = validateLlmsTxt(llms ?? '');
const robotsIssues = validateRobotsTxt(robots, {
GPTBot: 'allow',
ClaudeBot: 'allow',
});
const agentCardIssues = agentCard ? validateAgentCardJson(agentCard) : [];
const schemaIssues = validateExistingJsonLd(builtHtml, '/pricing/');
何时 agentCard 启用,提供 version,至少一个 supportedInterfaces 条目,并通过顶层进行非空描述 description 或者说 agentCard.description启用 validateAgentCardConfig() 如果你想在一代人之前飞过这个配置.
内容包括
llms.txt发电机和验证器- 选项
llms-full.txt发电机 - 可选 A2A 代理卡生成器加配置和 JSON 验证器
llms.txt发现链接生成- JSON- LD 序列化和 HTML 注入辅助器
- 现有的JSON-LD检查和验证
- HTML 薄壳验证
- markdown 页面生成工具,用于更清洁的代理获取路径
- 标记下反向链接和镜像覆盖验证
- schema.org 预设构建器
- 人工智能爬行器
robots.txt生成和补丁 Content-Signal政策的生成和补丁robots.txt(动画)和_headers标题- 犬类
Link标记下镜像头生成 - 确定性计划和爬行者验证
维护者
版权(c)2026 塞巴斯蒂安·科奇内斯库麻省理工学院执照.
用于生产 阿尼玛·费利克斯。 。 。 .
许可证
麻省理工学院.