"""Generate an HTML proof page from a real routed call to the live HF Space.""" from __future__ import annotations import datetime import html import httpx BASE = "https://build-small-hackathon-hearthnet.hf.space" def call(cap: str, inp: dict) -> dict: r = httpx.post( f"{BASE}/bus/v1/call", json={"capability": cap, "version": "1.0", "input": inp}, timeout=90, follow_redirects=True, ) return r.json() def main() -> None: man = httpx.get(f"{BASE}/manifest", timeout=60, follow_redirects=True).json() chat = call("llm.chat", {"messages": [{"role": "user", "content": "In one sentence, how do I store water safely?"}]}) rag = call("rag.list_corpora", {}) node = man.get("node_id", "?") caps = [c.get("name") if isinstance(c, dict) else c for c in man.get("capabilities", [])] ans = chat["output"]["message"]["content"] model = chat["meta"]["model"] ms = chat["meta"]["ms"] corp = rag["output"]["corpora"] ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") doc = f"""

HearthNet - Local node connected to live HF Space

{ts} · HTTPS over the capability bus
[1] Peered with build-small-hackathon-hearthnet.hf.space
Remote node_id: {html.escape(node)}
Remote capabilities routable: {len(caps)}
[2] Routed llm.chat to Space model {html.escape(model)} ({ms} ms)

Q: In one sentence, how do I store water safely?
A: {html.escape(ans)}
[3] Routed rag.list_corpora to shared corpora: {html.escape(", ".join(corp))}
Caps: {html.escape(", ".join(caps))}
""" with open("docs/screenshots/_proof.html", "w", encoding="utf-8") as fh: fh.write(doc) print(f"wrote proof html; caps={len(caps)} model={model}") if __name__ == "__main__": main()