Esta página foi traduzida por máquina e ainda não foi revisada por uma pessoa. O inglês é a referência; correções são bem-vindas no GitHub. GitHub
Cookwala / SDK e cenários / 090
Read the reference registry: six entries, all verified by DNS TXT
The registry at cookwala.ai lists pointers to things that exist in this repository: a catalog, the example recipe collection, the default safety limits, one humanitarian rule pack and one agent benchmark. Read it from the hub and check names and verification.
Leia primeiro: /docs/REGISTRY/ /docs/FEDERATION/
Passos
Fetch the registry document. Names are namespace/name, the namespace proven once by a DNS TXT record.
getRegistryThe other four entries: examples, safety limits, the WHO/Codex rule pack and the kitchen agent-safety benchmark, each with an exact version.
A file entry carries the sha256 of the file it points at, so a hub can check what it downloaded.
Resultado
You know the shape of a registry entry and that nothing listed is a third-party product. Anyone may run a registry (RFC-0002, RFC-0006). Next: 091 validates a directory entry and checks its conformance pointer.
Linha de comando
curl -s ${COOKWALA_HUB:-http://localhost:7878}/v1/tools/registry | jq '.entries[] | {kind, name, version, method: .verification.method}'
curl -s https://cookwala.ai/v1/registry.json | jq '.entries | length'Saída gravada
Status: ok
[1] getRegistry: {"cookwala": "0.2.0", "generatedAt": "2026-10-04T12:00:00Z", "registry": "https://cookwala.ai", "note": "Pointers only. Everything listed exists in the amado2k5/cookwala repository; nothing here is a third-party product. Anyone may run a registry (RFC-0002, RFC-0006).", "entries": [{"kind": "catalog", "name": "ai.cookwala/reference-catalog", "description": "The reference Cookwala catalog: schemas, vocabularies, example recipes and feeds.", "version": "0.2.0", "status": "active", "url": "https://cookwala.ai/.well-known/cookwala.json", "coreVersion": "0.2.0", "verification": {"method": "dns_txt"…Código
Executar: python scenarios/out/090-read-the-registry-five-entries/python.py
# Scenario 090: Read the reference registry: six entries, all verified by DNS TXT
# The registry at cookwala.ai lists pointers to things that exist in this repository: a catalog, the example recipe collection, the default safety limits, one humanitarian rule pack and one agent benchmark. Read it from the hub and check names and verification.
# Run a hub first: python hub/cookwala_hub.py --recipes examples
import json, os
from cookwala.client import CookwalaClient, CookwalaProblem
def load(path):
with open(path, encoding="utf-8") as f:
return json.load(f)
def pick(obj, path):
for part in path.replace("]", "").replace("[", ".").split("."):
obj = obj[int(part)] if part.isdigit() else (len(obj) if part == "length" else obj.get(part))
return obj
c = CookwalaClient(os.environ.get("COOKWALA_HUB", "http://localhost:7878"))
# Step 1: Fetch the registry document. Names are namespace/name, the namespace proven once by a DNS TXT record.
reg = c.get_registry()
assert pick(reg, "entries.length") == 6, pick(reg, "entries.length")
print("ok", "entries.length", "=", 6)
assert pick(reg, "registry") == "https://cookwala.ai", pick(reg, "registry")
print("ok", "registry", "=", "https://cookwala.ai")
assert pick(reg, "entries[0].kind") == "catalog", pick(reg, "entries[0].kind")
print("ok", "entries[0].kind", "=", "catalog")
assert pick(reg, "entries[0].name") == "ai.cookwala/reference-catalog", pick(reg, "entries[0].name")
print("ok", "entries[0].name", "=", "ai.cookwala/reference-catalog")
assert pick(reg, "entries[0].verification.method") == "dns_txt", pick(reg, "entries[0].verification.method")
print("ok", "entries[0].verification.method", "=", "dns_txt")
# Step 2: The other four entries: examples, safety limits, the WHO/Codex rule pack and the kitchen agent-safety benchmark, each with an exact version.
assert pick(reg, "entries[1].name") == "ai.cookwala/examples", pick(reg, "entries[1].name")
print("ok", "entries[1].name", "=", "ai.cookwala/examples")
assert pick(reg, "entries[2].name") == "ai.cookwala/safety-limits-default", pick(reg, "entries[2].name")
print("ok", "entries[2].name", "=", "ai.cookwala/safety-limits-default")
assert pick(reg, "entries[3].name") == "ai.cookwala/who-codex-basic", pick(reg, "entries[3].name")
print("ok", "entries[3].name", "=", "ai.cookwala/who-codex-basic")
assert pick(reg, "entries[3].status") == "deleted", pick(reg, "entries[3].status")
print("ok", "entries[3].status", "=", "deleted")
assert pick(reg, "entries[3].replacedBy") == "ai.cookwala/basic-nutrition-food-safety", pick(reg, "entries[3].replacedBy")
print("ok", "entries[3].replacedBy", "=", "ai.cookwala/basic-nutrition-food-safety")
assert pick(reg, "entries[5].name") == "ai.cookwala/basic-nutrition-food-safety", pick(reg, "entries[5].name")
print("ok", "entries[5].name", "=", "ai.cookwala/basic-nutrition-food-safety")
assert pick(reg, "entries[4].name") == "ai.cookwala/kitchen-agent-safety", pick(reg, "entries[4].name")
print("ok", "entries[4].name", "=", "ai.cookwala/kitchen-agent-safety")
assert pick(reg, "entries[4].kind") == "benchmark", pick(reg, "entries[4].kind")
print("ok", "entries[4].kind", "=", "benchmark")
assert pick(reg, "entries[3].version") == "0.1.0", pick(reg, "entries[3].version")
print("ok", "entries[3].version", "=", "0.1.0")
# Step 3: A file entry carries the sha256 of the file it points at, so a hub can check what it downloaded.
assert pick(reg, "entries[2].sha256") == "75ab08ca1988e3b7c462cae7a9f8ed0c4705fae80e4fa4ad213f3332bf4cd3c0", pick(reg, "entries[2].sha256")
print("ok", "entries[2].sha256", "=", "75ab08ca1988e3b7c462cae7a9f8ed0c4705fae80e4fa4ad213f3332bf4cd3c0")
assert pick(reg, "entries[2].verification.method") == "dns_txt", pick(reg, "entries[2].verification.method")
print("ok", "entries[2].verification.method", "=", "dns_txt")
print("scenario complete")