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.")
@@ -10,6 +10,7 @@ Using this skill, reference the current README.md process document, existing pub
- `public/agents.md`
- `public/skills.md`
- `public/.well-known/ai-catalog.json`
- `public/.well-known/poppy.json` (draft 0.1 ordinary-web profile)
---
@@ -48,7 +49,7 @@ Use:
python skills-scripts/build_discovery_files.py
```
The script materializes all five files deterministically. Patch the script when the policy or output shape changes; do not repeatedly hand-author these files.
The script materializes the root and well-known discovery files deterministically. Read `docs/poppy.md` for the Poppy contract; this builder supports ordinary website access only. Patch the script when the policy or output shape changes; do not repeatedly hand-author these files.
## Phases
@@ -128,7 +129,11 @@ This is a public inventory, not internal secrets or implementation logs.
Apply `ai-catalog-materialization-skill.md` to create `public/.well-known/ai-catalog.json`.
### Phase 8: Validation
### Phase 8: Poppy Discovery
Generate `.well-known/poppy.json` through the same script. Use `SITE_TITLE` for the organization display name and derive its domain from `SITE_URL`. Keep `protocol_version` at `0.1` and `web` empty for ordinary browsing. Do not add auth, APIs, company agents, browser sessions, or extensions without a tested runtime and an updated generator contract. Link the manifest from generated agent guidance and discovery metadata.
### Phase 9: Validation
Validate:
@@ -139,6 +144,9 @@ Validate:
- `robots.txt` references the sitemap
- `llms.txt`, `agents.md`, and `skills.md` exist and are non-empty
- `.well-known/ai-catalog.json` parses and advertises only real public resources
- `.well-known/poppy.json` parses and matches the configured ordinary-web profile
- copy/publish preserves the generated Poppy manifest against stale Hugo output
- after authorized deployment, the well-known HTTPS URL returns the expected JSON and identity
- no credentials or private paths are present
## Anti-Patterns
+4 -2
View File
@@ -7,7 +7,7 @@ Run after:
4. python skills-scripts/build_discovery_files.py
This script copies files from hugo-html-builder/public into public while
preserving repo-level discovery files generated outside Hugo.
preserving repo-level discovery files and the Poppy manifest generated outside Hugo.
"""
from __future__ import annotations
@@ -31,6 +31,8 @@ PRESERVE_AT_PUBLIC_ROOT = {
def should_preserve(relative_path: Path) -> bool:
if relative_path.as_posix() == ".well-known/poppy.json":
return True
return len(relative_path.parts) == 1 and relative_path.name in PRESERVE_AT_PUBLIC_ROOT
@@ -61,7 +63,7 @@ def main() -> None:
copied, skipped = copy_hugo_output()
print(f"Copied {copied} Hugo output files into {PUBLIC_ROOT}")
if skipped:
print("Preserved root discovery files:")
print("Preserved discovery files:")
for path in skipped:
print(f"- {path}")
@@ -64,6 +64,7 @@ Remove old generated and copied-site artifacts, after confirming paths resolve i
- `/public/agents.md`;
- `/public/skills.md`;
- `/public/ai-index.json`;
- stale `/public/.well-known/poppy.json`; regenerate it for the new domain;
- `/public/data/`;
- old public section directories from the copied site;
- `/public/healthz/`;
@@ -199,6 +200,7 @@ Recommended `.well-known` files:
- `/public/.well-known/security.txt`;
- `/public/.well-known/agent-card.json`;
- `/public/.well-known/poppy.json` (draft 0.1 ordinary-web discovery; see `docs/poppy.md`);
- optionally `/public/.well-known/agent-skills.json`.
Update `skills-scripts/sync_content_to_hugo.py`:
@@ -329,6 +331,7 @@ rg -n "old-domain|old-brand|old-logo|old analytics ID|mojibake-patterns" .
Check:
- Poppy organization name/domain match the new SITE_TITLE/SITE_URL and advertise only ordinary website access;
- no old domain in generated HTML/JSON/discovery files;
- no old logo references;
- no old analytics ID;