This commit is contained in:
eddiesoehnel committed 2026-10-11 16:58:11 -06:00
1 parent e1d8deb861
commit 83bb404a94
14 files changed
+292 -18

No files matched your search

+46 -1
View File
@@ -9,6 +9,7 @@ Outputs:
- public/.well-known/ai-catalog.json
- public/.well-known/security.txt
- public/.well-known/agent-card.json
- public/.well-known/poppy.json (draft 0.1, ordinary website access only)
"""
from __future__ import annotations
@@ -302,6 +303,7 @@ def build_llms_txt(entries: list[SitemapEntry]) -> str:
"## Machine-Readable URLs",
f"- {SITE_URL}/ai-index.json",
f"- {SITE_URL}/.well-known/ai-catalog.json",
f"- {SITE_URL}/.well-known/poppy.json (Personal Agent Protocol draft 0.1; ordinary website access)",
f"- {SITE_URL}/sitemap.xml",
"- /data/open/pages/**/chunks.json",
"- /data/open/pages/**/qa.json",
@@ -332,6 +334,7 @@ Canonical site: {SITE_URL}/
## Retrieval Policy
- Use `{SITE_URL}/.well-known/ai-catalog.json` to discover public agent-usable resources.
- `{SITE_URL}/.well-known/poppy.json` declares ordinary website access only (Personal Agent Protocol draft 0.1); it grants no session, account, API, or transaction access.
- Start with `{SITE_URL}/ai-index.json` to understand resources, artifacts, access type, and retrieval priority.
- Use `{SITE_URL}/sitemap.xml` for canonical human-facing URLs.
- Use `/data/open/pages/**/chunks.json` for semantic retrieval and `/data/open/pages/**/qa.json` for question-answer and workflow hints.
@@ -382,6 +385,7 @@ def build_agent_card_json() -> str:
"license": f"{SITE_URL}/wiki/license/",
"discovery": {
"ai_catalog": f"{SITE_URL}/.well-known/ai-catalog.json",
"poppy": f"{SITE_URL}/.well-known/poppy.json",
"ai_index": f"{SITE_URL}/ai-index.json",
"sitemap": f"{SITE_URL}/sitemap.xml",
"llms": f"{SITE_URL}/llms.txt",
@@ -401,6 +405,40 @@ def build_agent_card_json() -> str:
return json.dumps(payload, indent=2, ensure_ascii=False) + "\n"
def build_poppy_json() -> str:
"""Generate only the ordinary-web profile from Poppy draft 0.1 sections 3/5.
Do not advertise auth, APIs, agents, browser sessions, or extensions here.
They require a separately implemented and verified protocol runtime.
"""
site = urlparse(SITE_URL)
if (
site.scheme != "https"
or not site.hostname
or site.username is not None
or site.password is not None
or site.netloc != site.hostname
or site.path not in {"", "/"}
or site.query
or site.fragment
):
raise ValueError("Poppy discovery requires SITE_URL to be an HTTPS domain root")
if not SITE_TITLE.strip():
raise ValueError("Poppy discovery requires a non-empty SITE_TITLE")
payload = {
"protocol_version": "0.1",
"organization": {"name": SITE_TITLE, "domain": site.hostname},
"web": {},
}
return json.dumps(payload, indent=2, ensure_ascii=False) + "\n"
def validate_poppy_json(payload: object) -> None:
"""Local supported-profile check, not an official full-protocol validator."""
if payload != json.loads(build_poppy_json()):
raise RuntimeError("poppy.json must match the configured draft 0.1 ordinary-web profile")
def build_ai_catalog_json() -> str:
payload = {
"specVersion": "1.0",
@@ -526,11 +564,13 @@ def validate_outputs() -> None:
".well-known/ai-catalog.json",
".well-known/security.txt",
".well-known/agent-card.json",
".well-known/poppy.json",
):
path = PUBLIC_ROOT / filename
if not path.exists() or path.stat().st_size == 0:
raise RuntimeError(f"{filename} was not created")
ai_catalog = json.loads(read_text(PUBLIC_ROOT / ".well-known" / "ai-catalog.json"))
validate_poppy_json(json.loads(read_text(PUBLIC_ROOT / ".well-known" / "poppy.json")))
if ai_catalog.get("specVersion") != "1.0" or not ai_catalog.get("entries"):
raise RuntimeError("ai-catalog.json is missing its supported specVersion or entries")
for entry in ai_catalog["entries"]:
@@ -551,15 +591,20 @@ def validate_outputs() -> None:
def main() -> None:
poppy = build_poppy_json() # Validate configuration before writing any output.
entries = collect_sitemap_entries()
# Materialize helpers before collecting the final sitemap on a fresh build.
write_text(PUBLIC_ROOT / "llms.txt", build_llms_txt(entries))
write_text(PUBLIC_ROOT / "skills.md", build_skills_md())
entries = collect_sitemap_entries()
write_text(PUBLIC_ROOT / "robots.txt", build_robots())
write_text(PUBLIC_ROOT / "sitemap.xml", build_sitemap(entries))
write_text(PUBLIC_ROOT / "llms.txt", build_llms_txt(entries))
write_text(PUBLIC_ROOT / "agents.md", build_agents_md(entries))
write_text(PUBLIC_ROOT / "skills.md", build_skills_md())
write_text(PUBLIC_ROOT / ".well-known" / "ai-catalog.json", build_ai_catalog_json())
write_text(PUBLIC_ROOT / ".well-known" / "security.txt", build_security_txt())
write_text(PUBLIC_ROOT / ".well-known" / "agent-card.json", build_agent_card_json())
write_text(PUBLIC_ROOT / ".well-known" / "poppy.json", poppy)
validate_outputs()
print(f"Wrote discovery files in {PUBLIC_ROOT} for {len(entries)} sitemap URLs.")