6C: AgentReady standard conformance lens (Wave 1)
Browse filesFiles changed (15)
- pyproject.toml+1-1
- src/legibl/api/static/app.js+39
- src/legibl/api/static/index.html+9
- src/legibl/api/static/styles.css+12
- src/legibl/contracts/__init__.py+32
- src/legibl/contracts/__pycache__/__init__.cpython-312.pyc
- src/legibl/crawl/__pycache__/fetch.cpython-312.pyc
- src/legibl/crawl/fetch.py+5-3
- src/legibl/score/__pycache__/ar_spec.cpython-312.pycAdded
- src/legibl/score/__pycache__/conformance.cpython-312.pycAdded
- src/legibl/score/ar_spec.jsonAdded+1
- src/legibl/score/ar_spec.pyAdded+62
- src/legibl/score/conformance.pyAdded+313
- src/legibl/service/__pycache__/orchestrate.cpython-312.pyc
- src/legibl/service/orchestrate.py+15
40 unmodified lines4142434445464740 unmodified linespackage-dir = { "" = "src" }[tool.setuptools.package-data]legibl = ["py.typed", "score/scorespec.json", "api/static/*"][tool.setuptools.packages.find]where = ["src"]40 unmodified lines4142434445464740 unmodified linespackage-dir = { "" = "src" }[tool.setuptools.package-data]legibl = ["py.typed", "score/scorespec.json", "score/ar_spec.json", "api/static/*"][tool.setuptools.packages.find]where = ["src"]
124 unmodified lines125126127128129130131124 unmodified lines<div style="color:${color(p.score)};font-weight:800">${p.score}/100</div><div class="ev">${esc(p.render_mode)}</div></div>`).join("");const llms = (result.artifacts || []).find((a) => a.type === "llms_txt");$("llms").textContent = llms ? llms.content : "";$("zip").href = "/api/audits/" + id + "/artifacts.zip";}124 unmodified lines125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170124 unmodified lines<div style="color:${color(p.score)};font-weight:800">${p.score}/100</div><div class="ev">${esc(p.render_mode)}</div></div>`).join("");renderConformance(audit.conformance);const llms = (result.artifacts || []).find((a) => a.type === "llms_txt");$("llms").textContent = llms ? llms.content : "";$("zip").href = "/api/audits/" + id + "/artifacts.zip";}const _SECTION_NAMES = {discoverability: "Discoverability", content: "Content", capabilities: "Capabilities","identity-access": "Identity & Access", commerce: "Commerce",};const _SECTION_ORDER = ["discoverability", "content", "capabilities", "identity-access", "commerce"];const _STATE_CHIP = {met: ["met", "MET"], unmet: ["unmet", "UNMET"],not_applicable: ["na", "N/A"], not_detectable: ["na", "N/D"],};function renderConformance(conf) {const panel = $("conformancePanel");if (!panel) return;if (!conf || !conf.results || !conf.results.length) {panel.classList.add("hide");return;}panel.classList.remove("hide");const s = conf.summary || {};$("confMeta").textContent ="AgentReady v" + conf.spec_version + " \u00b7 " + (s.met || 0) + "/" + (s.applicable || 0) + " applicable met";$("confSub").textContent ="Conformance to the AgentReady standard (agentready.org) \u2014 reported separately from the readiness score.";const bySec = {};conf.results.forEach((r) => { (bySec[r.section] = bySec[r.section] || []).push(r); });$("conformance").innerHTML = _SECTION_ORDER.filter((k) => bySec[k]).map((k) => {const rows = bySec[k].map((r) => {const [cssState, label] = _STATE_CHIP[r.state] || ["na", "?"];const via = (r.state === "met" && r.detected_via) ? ` <span class="ev">\u00b7 ${esc(r.detected_via)}</span>` : "";return `<div class="conf-row"><span class="state ${cssState}">${label}</span><div class="conf-id">${esc(r.stable_id)} <span class="conf-str">${esc(r.strength)}</span></div><div class="conf-name">${esc(r.name)}${via}</div></div>`;}).join("");return `<div class="conf-sec"><div class="conf-sec-h">${esc(_SECTION_NAMES[k] || k)}</div>${rows}</div>`;}).join("");}
66 unmodified lines67686970717266 unmodified lines<div id="pagesList"></div></section><section class="panel"><div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap"><h2 style="margin:0">Generated artifacts</h2>66 unmodified lines67686970717273747576777879808166 unmodified lines<div id="pagesList"></div></section><section class="panel hide" id="conformancePanel"><div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap"><h2 style="margin:0">Standards conformance</h2><span class="mini" id="confMeta"></span></div><p class="muted" id="confSub"></p><div id="conformance"></div></section><section class="panel"><div style="display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap"><h2 style="margin:0">Generated artifacts</h2>
66 unmodified lines67686970717266 unmodified linespre { background: #fafbff; border: 1px solid var(--line); border-radius: 8px;padding: 12px; overflow: auto; font-size: 12px; max-height: 260px; }.footer { margin-top: 20px; color: var(--mut); font-size: 12px; }@media (max-width: 820px) {.scoreboard, .grid2, .form-row { grid-template-columns: 1fr; }h1 { font-size: 30px; }66 unmodified lines67686970717273747576777879808182838466 unmodified linespre { background: #fafbff; border: 1px solid var(--line); border-radius: 8px;padding: 12px; overflow: auto; font-size: 12px; max-height: 260px; }.footer { margin-top: 20px; color: var(--mut); font-size: 12px; }.conf-sec { margin-bottom: 12px; }.conf-sec-h { font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;color: var(--mut); margin: 10px 0 6px; }.conf-row { display: grid; grid-template-columns: 74px 128px 1fr; gap: 10px; align-items: center;border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; margin-bottom: 6px; background: #fff; }.conf-id { font-weight: 800; font-size: 12px; }.conf-str { color: var(--mut); font-weight: 700; font-size: 11px; }.conf-name { font-size: 13px; }.state { font-size: 11px; font-weight: 900; border-radius: 999px; padding: 4px 8px; text-align: center; }.state.met { background: #e8efff; color: var(--good); }.state.unmet { background: #ffe8e4; color: var(--bad); }.state.na { background: #eef1f6; color: var(--mut); }@media (max-width: 820px) {.scoreboard, .grid2, .form-row { grid-template-columns: 1fr; }h1 { font-size: 30px; }
161 unmodified lines16216316416516616713 unmodified lines18118218318418518660 unmodified lines247248249250251252161 unmodified linesscope: CheckScopeclass PageAudit(BaseModel):url: strscore: int13 unmodified linesrecommendations: list[Recommendation] = Field(default_factory=list)pages_crawled: int = 0scorespec_version: str = ""generated_at: datetime = Field(default_factory=utcnow)def all_checks(self) -> list[Check]:60 unmodified lines"Heading", "Link", "Image", "Block", "PageDoc","BotAccess", "RobotsInfo", "SitemapInfo", "CrawlError", "CrawlResult", "SiteDoc","Check", "Recommendation", "PageAudit", "SiteAudit","Artifact", "ArtifactType","CheckSpec", "ScoreSpec","JobEvent", "JobEventType",161 unmodified lines16216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619713 unmodified lines21121221321421521621760 unmodified lines278279280281282283284161 unmodified linesscope: CheckScope# --- AR conformance (Phase 6C: standard lens, reported alongside the score) ---ARStrength = Literal["MUST", "SHOULD", "MAY"]ARState = Literal["met", "unmet", "not_applicable", "not_detectable"]class ARResult(BaseModel):"""One AgentReady-standard requirement evaluated against the crawled site."""stable_id: strsection: strname: strstrength: ARStrengthapplies: boolstate: ARStatedetected_via: str | None = Noneevidence: str | None = Nonereference_url: str | None = Noneclass ConformanceReport(BaseModel):"""Conformance to a pinned version of the AgentReady standard (agentready.org).Reported alongside—never blended into—the Agent-Readiness Score."""spec_version: strspec_date: strresults: list[ARResult] = Field(default_factory=list)summary: dict[str, int] = Field(default_factory=dict)class PageAudit(BaseModel):url: strscore: int13 unmodified linesrecommendations: list[Recommendation] = Field(default_factory=list)pages_crawled: int = 0scorespec_version: str = ""conformance: ConformanceReport | None = Nonegenerated_at: datetime = Field(default_factory=utcnow)def all_checks(self) -> list[Check]:60 unmodified lines"Heading", "Link", "Image", "Block", "PageDoc","BotAccess", "RobotsInfo", "SitemapInfo", "CrawlError", "CrawlResult", "SiteDoc","Check", "Recommendation", "PageAudit", "SiteAudit","ARResult", "ConformanceReport", "ARStrength", "ARState","Artifact", "ArtifactType","CheckSpec", "ScoreSpec","JobEvent", "JobEventType",
9 unmodified lines1011121314151623 unmodified lines40414243444581 unmodified lines1271281291301311321333 unmodified lines13713813914014114214325 unmodified lines1691701711721731749 unmodified linesimport ipaddressimport socketimport timefrom dataclasses import dataclassfrom datetime import UTC, datetimefrom email.utils import parsedate_to_datetimefrom urllib.parse import urljoin, urlparse23 unmodified linesresponse_ms: intredirect_hops: inttruncated: bool = False@propertydef is_html(self) -> bool:81 unmodified linesverify=self.verify,)def fetch(self, url: str) -> FetchResponse:start = time.monotonic()current = urlretried_after = False3 unmodified linesfor hop in range(self.max_redirects + 1):validate_url(current, allow_private=self.allow_private)try:with client.stream("GET", current) as response:if response.is_redirect:location = response.headers.get("location")if not location:25 unmodified linesresponse_ms=elapsed,redirect_hops=hop,truncated=truncated,)except httpx.HTTPError as exc:raise FetchError(f"request failed: {exc}") from exc9 unmodified lines1011121314151623 unmodified lines4041424344454681 unmodified lines1281291301311321331343 unmodified lines13813914014114214314425 unmodified lines1701711721731741751769 unmodified linesimport ipaddressimport socketimport timefrom dataclasses import dataclass, fieldfrom datetime import UTC, datetimefrom email.utils import parsedate_to_datetimefrom urllib.parse import urljoin, urlparse23 unmodified linesresponse_ms: intredirect_hops: inttruncated: bool = Falseheaders: dict[str, str] = field(default_factory=dict)@propertydef is_html(self) -> bool:81 unmodified linesverify=self.verify,)def fetch(self, url: str, *, extra_headers: dict[str, str] | None = None) -> FetchResponse:start = time.monotonic()current = urlretried_after = False3 unmodified linesfor hop in range(self.max_redirects + 1):validate_url(current, allow_private=self.allow_private)try:with client.stream("GET", current, headers=extra_headers) as response:if response.is_redirect:location = response.headers.get("location")if not location:25 unmodified linesresponse_ms=elapsed,redirect_hops=hop,truncated=truncated,headers={k.lower(): v for k, v in response.headers.items()},)except httpx.HTTPError as exc:raise FetchError(f"request failed: {exc}") from exc
1{"$schema":"https://agentready.org/schemas/agentready.v1.json","standard":"AgentReady","version":"1.0.0","date":"2026-04-24","license":"MIT","homepage":"https://agentready.org","repository":"https://github.com/agentready-org/standard","normativeReferences":[{"id":"BCP14","refs":["RFC 2119","RFC 8174"],"url":"https://www.rfc-editor.org/info/bcp14","note":"The keywords MUST, SHOULD, and MAY are interpreted per BCP 14 when they appear in all capitals."}],"conformance":{"summary":"A product conforms when it implements every MUST requirement that applies to its surfaces. It should implement every applicable SHOULD requirement unless it documents a reason not to. It may implement MAY requirements as appropriate.","applicability":{"baseline":"Applies to every agent-addressable product, regardless of surface.","conditional":"Applies only when the product exposes the surface named in the requirement's `applies` field."},"strengths":{"MUST":"Mandatory for products within the requirement's scope.","SHOULD":"Strongly recommended; deviation permitted only with documented rationale.","MAY":"Optional; implementation adds value but is not required for conformance."},"alternatives":{"commerce":"Requirements in the Commerce section are alternative, interoperating approaches. A product that accepts agent payment conforms by implementing at least one applicable Commerce requirement."}},"versioning":{"scheme":"semver","rules":{"MAJOR":"An existing requirement's strength is raised (for example SHOULD to MUST), a requirement is removed, or a stable identifier is reassigned.","MINOR":"A requirement is added, an existing strength is lowered, or a reference is updated to a newer specification.","PATCH":"Clarifications, editorial fixes, and link updates."},"stableIdFormat":"AR-<SECTION>-<NN>","stableIdPolicy":"Stable identifiers are preserved across spec versions and are the canonical way to cite a requirement."},"counts":{"sections":5,"requirements":30},"sections":[{"id":"discoverability","name":"Discoverability","summary":"Help agents find the product and the files they need to read.","requirements":[{"stableId":"AR-DISC-01","slug":"robots-txt","name":"robots.txt with AI policy","summary":"Declare which AI crawlers are allowed. A robots.txt that distinguishes GPTBot, ClaudeBot, Google-Extended, PerplexityBot, and other identified agents from broad training crawlers gives agents a clear signal about intent.","applies":"baseline","strength":"MUST","emerging":false,"reference":"RFC 9309","referenceUrl":"https://www.rfc-editor.org/rfc/rfc9309.html","anchor":"https://agentready.org/#robots-txt"},{"stableId":"AR-DISC-02","slug":"sitemap","name":"Sitemap","summary":"A /sitemap.xml lets agents list the site's main URLs without crawling every page.","applies":"baseline","strength":"SHOULD","emerging":false,"reference":"sitemaps.org","referenceUrl":"https://www.sitemaps.org/protocol.html","anchor":"https://agentready.org/#sitemap"},{"stableId":"AR-DISC-03","slug":"llms-txt","name":"llms.txt","summary":"A markdown index at the site root that summarizes the product and links to the documents agents should read first.","applies":"baseline","strength":"SHOULD","emerging":false,"reference":"llmstxt.org","referenceUrl":"https://llmstxt.org","anchor":"https://agentready.org/#llms-txt"},{"stableId":"AR-DISC-04","slug":"llms-full-txt","name":"llms-full.txt","summary":"A single-file, ingestible version of the product documentation that fits into an agent context window in one request.","applies":"baseline","strength":"MAY","emerging":false,"reference":"llmstxt.org","referenceUrl":"https://llmstxt.org","anchor":"https://agentready.org/#llms-full-txt"},{"stableId":"AR-DISC-05","slug":"http-link-header","name":"HTTP Link response header","summary":"Link headers with rel=sitemap, describedby, api-catalog, or alternate surface related resources to agents without parsing HTML.","applies":"baseline","strength":"MAY","emerging":false,"reference":"RFC 8288","referenceUrl":"https://www.rfc-editor.org/rfc/rfc8288.html","anchor":"https://agentready.org/#http-link-header"},{"stableId":"AR-DISC-06","slug":"nlweb-schema-feeds","name":"NLWeb schema feeds","summary":"A schemamap directive in robots.txt pointing to a structured feed that describes site content in schema.org vocabulary for natural-language retrieval.","applies":"Products that offer search or natural-language retrieval","strength":"MAY","emerging":true,"reference":"nlweb.ai","referenceUrl":"https://nlweb.ai/docs/specification","anchor":"https://agentready.org/#nlweb-schema-feeds"}]},{"id":"content","name":"Content for agents","summary":"Expose content in a form models can parse without running JavaScript.","requirements":[{"stableId":"AR-CONT-01","slug":"json-ld","name":"JSON-LD structured data","summary":"Embed schema.org types such as Product, Organization, Offer, SoftwareApplication, and FAQPage as JSON-LD so models can read entity and product facts directly.","applies":"baseline","strength":"SHOULD","emerging":false,"reference":"schema.org","referenceUrl":"https://schema.org/docs/gs.html","anchor":"https://agentready.org/#json-ld"},{"stableId":"AR-CONT-02","slug":"markdown-negotiation","name":"Markdown content negotiation","summary":"Respond to Accept: text/markdown with a markdown representation of the page, giving agents a cleaner and more token-efficient view of the same content.","applies":"baseline","strength":"MAY","emerging":true,"reference":null,"referenceUrl":null,"anchor":"https://agentready.org/#markdown-negotiation"},{"stableId":"AR-CONT-03","slug":"index-md","name":"/index.md fallback","summary":"A markdown version of the homepage served at /index.md, so the primary product page is directly fetchable as plain text.","applies":"baseline","strength":"MAY","emerging":true,"reference":null,"referenceUrl":null,"anchor":"https://agentready.org/#index-md"},{"stableId":"AR-CONT-04","slug":"speakable","name":"Speakable content markup","summary":"Mark portions of a page as suitable to be read aloud by voice agents using schema.org/SpeakableSpecification.","applies":"Products with content meant to be consumed by voice agents","strength":"MAY","emerging":false,"reference":"schema.org","referenceUrl":"https://schema.org/SpeakableSpecification","anchor":"https://agentready.org/#speakable"}]},{"id":"capabilities","name":"Capabilities","summary":"Declare what the product can do for agents and how to call it.","requirements":[{"stableId":"AR-CAPA-01","slug":"mcp","name":"Model Context Protocol (MCP)","summary":"An open JSON-RPC protocol for exposing tools, resources, and prompts to agents over Streamable HTTP or stdio.","applies":"Products that expose tools or resources to agents","strength":"MUST","emerging":false,"reference":"modelcontextprotocol.io","referenceUrl":"https://modelcontextprotocol.io","anchor":"https://agentready.org/#mcp"},{"stableId":"AR-CAPA-04","slug":"a2a-agent-card","name":"A2A Agent Card","summary":"A /.well-known/agent-card.json descriptor used for agent-to-agent discovery under the A2A protocol. The Agent Card declares identity, service endpoints, supported interfaces, skills, and security schemes.","applies":"Products that expose an agent-to-agent surface","strength":"MUST","emerging":false,"reference":"A2A v1.0","referenceUrl":"https://a2a-protocol.org/latest/specification","anchor":"https://agentready.org/#a2a-agent-card"},{"stableId":"AR-CAPA-08","slug":"openapi","name":"OpenAPI","summary":"A machine-readable description of HTTP APIs. Function-calling agents use OpenAPI to understand paths, parameters, schemas, and errors.","applies":"Products that expose an HTTP API","strength":"MUST","emerging":false,"reference":"OpenAPI 3.1","referenceUrl":"https://spec.openapis.org/oas/latest.html","anchor":"https://agentready.org/#openapi"},{"stableId":"AR-CAPA-02","slug":"mcp-server-card","name":"MCP Server Card","summary":"A /.well-known/mcp/server-card.json document describing a server's name, version, transport, capabilities, authentication, and tool surface for pre-connection discovery.","applies":"Products that expose an MCP server over HTTP","strength":"SHOULD","emerging":true,"reference":"SEP-2127","referenceUrl":"https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2127","anchor":"https://agentready.org/#mcp-server-card"},{"stableId":"AR-CAPA-03","slug":"mcp-apps","name":"MCP Apps","summary":"The MCP extension for ui:// resources (io.modelcontextprotocol/ui), letting servers return renderable HTML that hosts can embed in sandboxed iframes for confirmation, payment, or generative-UI handoffs.","applies":"MCP servers that return renderable UI","strength":"MAY","emerging":false,"reference":"modelcontextprotocol/ext-apps","referenceUrl":"https://github.com/modelcontextprotocol/ext-apps","anchor":"https://agentready.org/#mcp-apps"},{"stableId":"AR-CAPA-05","slug":"webmcp","name":"WebMCP","summary":"A browser API (navigator.modelContext) and HTML-native tool metadata that let pages expose actions as MCP-style tools to in-page agents.","applies":"Products whose pages expose in-page actions to agents","strength":"MAY","emerging":true,"reference":"W3C WICG","referenceUrl":"https://webmachinelearning.github.io/webmcp/","anchor":"https://agentready.org/#webmcp"},{"stableId":"AR-CAPA-06","slug":"nlweb-ask","name":"NLWeb /ask endpoint","summary":"A natural-language query endpoint that returns structured schema.org responses, designed to make any site conversational. NLWeb instances also act as MCP servers.","applies":"Products that offer natural-language retrieval","strength":"MAY","emerging":true,"reference":"nlweb.ai","referenceUrl":"https://nlweb.ai/docs/specification","anchor":"https://agentready.org/#nlweb-ask"},{"stableId":"AR-CAPA-07","slug":"agent-skills","name":"Agent Skills","summary":"SKILL.md files packaging discrete, portable agent capabilities as YAML frontmatter plus markdown instructions, with optional scripts, references, and assets.","applies":"Products that ship agent-invokable skills","strength":"MAY","emerging":false,"reference":"agentskills.io","referenceUrl":"https://agentskills.io/specification","anchor":"https://agentready.org/#agent-skills"},{"stableId":"AR-CAPA-09","slug":"ai-plugin-json","name":"ai-plugin.json","summary":"A /.well-known/ai-plugin.json manifest originally introduced for ChatGPT plugins and still used as a lightweight capability descriptor.","applies":"Products that expose a plugin-style capability","strength":"MAY","emerging":true,"reference":null,"referenceUrl":null,"anchor":"https://agentready.org/#ai-plugin-json"}]},{"id":"identity-access","name":"Identity & Access","summary":"Prove who the agent is and give it scoped, revocable access.","requirements":[{"stableId":"AR-IDEN-02","slug":"oauth","name":"OAuth 2.0","summary":"The foundation for delegated, scoped access. Publish authorization and token endpoints agents can discover.","applies":"Products with user-owned resources or delegated access","strength":"MUST","emerging":false,"reference":"RFC 6749","referenceUrl":"https://www.rfc-editor.org/rfc/rfc6749.html","anchor":"https://agentready.org/#oauth"},{"stableId":"AR-IDEN-03","slug":"oauth-as-metadata","name":"OAuth Authorization Server Metadata","summary":"A /.well-known/oauth-authorization-server or /.well-known/openid-configuration document exposing issuer, endpoints, and supported scopes.","applies":"Products that run an OAuth authorization server","strength":"MUST","emerging":false,"reference":"RFC 8414","referenceUrl":"https://www.rfc-editor.org/rfc/rfc8414.html","anchor":"https://agentready.org/#oauth-as-metadata"},{"stableId":"AR-IDEN-05","slug":"pkce","name":"PKCE","summary":"Proof Key for Code Exchange with S256. The secure pattern for native and agent OAuth flows that cannot hold a client secret.","applies":"Products that accept public or agent OAuth clients","strength":"MUST","emerging":false,"reference":"RFC 7636","referenceUrl":"https://www.rfc-editor.org/rfc/rfc7636.html","anchor":"https://agentready.org/#pkce"},{"stableId":"AR-IDEN-01","slug":"web-bot-auth","name":"Web Bot Auth","summary":"HTTP message signatures over agent requests, with a /.well-known/http-message-signatures-directory publishing the public keys an agent operator signs with. Servers verify signatures to distinguish identified agents from unattributed traffic.","applies":"baseline","strength":"SHOULD","emerging":true,"reference":"draft-meunier-web-bot-auth / RFC 9421","referenceUrl":"https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture","anchor":"https://agentready.org/#web-bot-auth"},{"stableId":"AR-IDEN-04","slug":"oauth-protected-resource","name":"OAuth Protected Resource","summary":"A /.well-known/oauth-protected-resource document declaring which authorization servers a resource trusts, plus supported scopes and bearer methods.","applies":"Products that expose OAuth-protected resources","strength":"SHOULD","emerging":false,"reference":"RFC 9728","referenceUrl":"https://www.rfc-editor.org/rfc/rfc9728.html","anchor":"https://agentready.org/#oauth-protected-resource"},{"stableId":"AR-IDEN-06","slug":"api-catalog","name":"API Catalog","summary":"A /.well-known/api-catalog linkset describing a site's public APIs and pointing agents to OpenAPI, AsyncAPI, or other descriptors.","applies":"Products that expose one or more public APIs","strength":"MAY","emerging":false,"reference":"RFC 9727","referenceUrl":"https://www.rfc-editor.org/rfc/rfc9727.html","anchor":"https://agentready.org/#api-catalog"}]},{"id":"commerce","name":"Commerce","summary":"Let agents pay, initiate checkouts, and complete purchases on behalf of their users. The requirements in this section are alternative, interoperating approaches; a conformant commerce product implements at least one.","requirements":[{"stableId":"AR-COMM-01","slug":"x402","name":"x402","summary":"An HTTP-native payment protocol built on the 402 Payment Required status code for inline stablecoin settlement of API calls.","applies":"Products that charge for API calls or resources","strength":"MAY","emerging":false,"reference":"x402.org","referenceUrl":"https://www.x402.org","anchor":"https://agentready.org/#x402"},{"stableId":"AR-COMM-02","slug":"acp","name":"Agentic Commerce Protocol (ACP)","summary":"OpenAPI-backed checkout sessions that let agents drive standard e-commerce flows end to end. Maintained by OpenAI and Stripe, used by ChatGPT Instant Checkout.","applies":"Products that accept agent-driven checkout","strength":"MAY","emerging":true,"reference":"agentic-commerce-protocol","referenceUrl":"https://github.com/agentic-commerce-protocol/agentic-commerce-protocol","anchor":"https://agentready.org/#acp"},{"stableId":"AR-COMM-03","slug":"acp-delegate-payment","name":"ACP Delegate Payment","summary":"A companion flow for shared payment tokens, letting an agent pay on a user's behalf with a short-lived, cart-scoped token.","applies":"Payment providers that issue delegated tokens to agents","strength":"MAY","emerging":true,"reference":"agentic-commerce-protocol","referenceUrl":"https://github.com/agentic-commerce-protocol/agentic-commerce-protocol","anchor":"https://agentready.org/#acp-delegate-payment"},{"stableId":"AR-COMM-04","slug":"ucp","name":"Universal Commerce Protocol (UCP)","summary":"A /.well-known/ucp profile declaring services, capabilities, and payment handlers, plus an agent profile URL for two-sided capability negotiation. Co-developed by Shopify and Google.","applies":"Products that expose agent-driven commerce","strength":"MAY","emerging":true,"reference":"ucp.dev","referenceUrl":"https://ucp.dev","anchor":"https://agentready.org/#ucp"},{"stableId":"AR-COMM-05","slug":"mpp","name":"Machine Payments Protocol (MPP)","summary":"An HTTP 402 + Payment authentication scheme with an OpenAPI x-payment-info extension for per-call API monetization. Submitted to the IETF as draft-httpauth-payment.","applies":"Products that monetize APIs at the call level","strength":"MAY","emerging":true,"reference":"mpp.dev","referenceUrl":"https://mpp.dev","anchor":"https://agentready.org/#mpp"}]}]}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162"""Loader for the pinned AgentReady standard (agentready.org spec.json).
The spec is vendored at ``score/ar_spec.json`` and pinned by version so upstreamdrift never silently changes conformance results. See ``docs/6c-ar-conformance-spec.md``."""from __future__ import annotations
import jsonfrom dataclasses import dataclassfrom functools import lru_cachefrom importlib import resources
@dataclass(frozen=True)class ARRequirement: stable_id: str section: str section_name: str name: str strength: str # MUST | SHOULD | MAY applies: str | None # applicability condition; None/empty => baseline emerging: bool reference_url: str | None
@property def is_baseline(self) -> bool: return not self.applies
@dataclass(frozen=True)class ARSpec: version: str date: str homepage: str requirements: tuple[ARRequirement, ...]
@lru_cache(maxsize=1)def load_ar_spec() -> ARSpec: raw = resources.files("legibl.score").joinpath("ar_spec.json").read_text("utf-8") data = json.loads(raw) reqs: list[ARRequirement] = [] for section in data["sections"]: for r in section.get("requirements", []): reqs.append( ARRequirement( stable_id=r["stableId"], section=section["id"], section_name=section["name"], name=r["name"], strength=r["strength"], applies=r.get("applies") or None, emerging=bool(r.get("emerging")), reference_url=r.get("referenceUrl"), ) ) return ARSpec( version=str(data["version"]), date=str(data.get("date", "")), homepage=str(data.get("homepage", "")), requirements=tuple(reqs), )123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313"""Phase 6C — AgentReady standard conformance lens.
Maps Legibl's crawl signals to the pinned AgentReady standard (agentready.org)stable ``AR-*`` IDs and runs deterministic, SSRF-safe well-known probes for theprotocol surfaces the crawler does not otherwise inspect.
Conformance is reported *alongside*, never blended into, the Agent-Readiness Score.All probes go through the existing SSRF-safe ``Fetcher``. No JS, no auth flows.Wave 1 (see ``docs/6c-ar-conformance-spec.md``): baseline + discoverablecapability/identity/commerce surfaces; the rest report ``not_applicable`` /``not_detectable`` honestly."""from __future__ import annotations
import jsonfrom concurrent.futures import ThreadPoolExecutorfrom dataclasses import dataclass, fieldfrom typing import Anyfrom urllib.parse import urljoin
from ..contracts import ARResult, ConformanceReport, CrawlResultfrom ..crawl.fetch import Fetcher, FetchError, FetchResponsefrom .ar_spec import load_ar_spec
_PROBE_TIMEOUT = 4.0_MARKDOWN_ACCEPT = {"Accept": "text/markdown, text/x-markdown;q=0.9, */*;q=0.1"}
@dataclassclass _Signals: ai_policy: bool = False ai_policy_evidence: str | None = None sitemap: bool = False llms_txt: bool = False llms_full: bool = False link_header: str | None = None md_negotiation: bool = False index_md: bool = False json_ld: bool = False speakable: bool = False agent_card: bool = False mcp_card: bool = False ai_plugin: bool = False webbotauth: bool = False oauth_as: dict[str, Any] | None = None oauth_pr: bool = False api_catalog: bool = False ucp: bool = False openapi: bool = False probe_paths: dict[str, str] = field(default_factory=dict)
@property def pkce(self) -> bool: methods = (self.oauth_as or {}).get("code_challenge_methods_supported") or [] return "S256" in methods
def _get( fetcher: Fetcher, url: str, extra_headers: dict[str, str] | None = None) -> FetchResponse | None: try: resp = fetcher.fetch(url, extra_headers=extra_headers) except FetchError: return None return resp
def _first_ok(fetcher: Fetcher, origin: str, paths: list[str]) -> tuple[str, FetchResponse] | None: for path in paths: resp = _get(fetcher, urljoin(origin, path)) if resp is not None and resp.status == 200: return path, resp return None
def _json_ok(hit: tuple[str, FetchResponse] | None) -> tuple[str, dict[str, Any]] | None: if hit is None: return None path, resp = hit try: parsed = json.loads(resp.text) except (ValueError, TypeError): return None return (path, parsed) if isinstance(parsed, dict) else None
def _gather_signals(crawl: CrawlResult, fetcher: Fetcher) -> _Signals: origin = crawl.origin.rstrip("/") or crawl.start_url home = origin + "/" sig = _Signals()
# --- reuse signals already computed during crawl (no re-fetch) --- matched = [b for b in crawl.robots.bots if b.matched_rule] sig.ai_policy = crawl.robots.fetched and bool(matched) if matched: sig.ai_policy_evidence = f"{len(matched)} AI-bot rule(s) in robots.txt" sig.sitemap = crawl.sitemap.found sig.llms_txt = crawl.llms_txt_present sig.json_ld = any(p.json_ld for p in crawl.pages) blob = "".join(r for p in crawl.pages for r in p.json_ld_raw).lower() sig.speakable = "speakable" in blob
# --- deterministic well-known probes (parallel, bounded) --- probes: dict[str, Any] = {} with ThreadPoolExecutor(max_workers=8) as pool: fut: dict[str, Any] = { "home": pool.submit(_get, fetcher, home), "home_md": pool.submit(_get, fetcher, home, _MARKDOWN_ACCEPT), "llms_full": pool.submit(_get, fetcher, urljoin(origin, "/llms-full.txt")), "index_md": pool.submit(_get, fetcher, urljoin(origin, "/index.md")), "agent_card": pool.submit( _first_ok, fetcher, origin, ["/.well-known/agent-card.json", "/.well-known/agent.json"], ), "mcp_card": pool.submit( _first_ok, fetcher, origin, ["/.well-known/mcp/server-card.json"] ), "ai_plugin": pool.submit( _first_ok, fetcher, origin, ["/.well-known/ai-plugin.json"] ), "webbotauth": pool.submit( _first_ok, fetcher, origin, ["/.well-known/http-message-signatures-directory"] ), "oauth_as": pool.submit( _first_ok, fetcher, origin, ["/.well-known/oauth-authorization-server", "/.well-known/openid-configuration"], ), "oauth_pr": pool.submit( _first_ok, fetcher, origin, ["/.well-known/oauth-protected-resource"] ), "api_catalog": pool.submit(_first_ok, fetcher, origin, ["/.well-known/api-catalog"]), "ucp": pool.submit(_first_ok, fetcher, origin, ["/.well-known/ucp"]), "openapi": pool.submit(_first_ok, fetcher, origin, ["/openapi.json", "/openapi.yaml"]), } probes = {k: f.result() for k, f in fut.items()}
paths: dict[str, str] = {}
def _ok(key: str) -> bool: hit = probes.get(key) if isinstance(hit, tuple): paths[key] = hit[0] return True return False
home_resp: FetchResponse | None = probes.get("home") if home_resp is not None: sig.link_header = home_resp.headers.get("link") home_md: FetchResponse | None = probes.get("home_md") if home_md is not None and home_md.status == 200 and "markdown" in home_md.content_type.lower(): sig.md_negotiation = True
llms_full = probes.get("llms_full") sig.llms_full = bool(llms_full is not None and llms_full.status == 200) if sig.llms_full: paths["llms_full"] = "/llms-full.txt" idx = probes.get("index_md") sig.index_md = bool( idx is not None and idx.status == 200 and not idx.is_html and idx.text.strip() ) if sig.index_md: paths["index_md"] = "/index.md"
sig.agent_card = _ok("agent_card") sig.mcp_card = _ok("mcp_card") sig.ai_plugin = _ok("ai_plugin") sig.webbotauth = _ok("webbotauth") sig.oauth_pr = _ok("oauth_pr") sig.api_catalog = _ok("api_catalog") sig.ucp = _ok("ucp") sig.openapi = _ok("openapi")
oauth_json = _json_ok(probes.get("oauth_as")) if oauth_json is not None: paths["oauth_as"] = oauth_json[0] sig.oauth_as = oauth_json[1]
sig.probe_paths = paths return sig
# --- evaluation helpers -------------------------------------------------------
_Eval = tuple[bool, str, str | None, str | None] # applies, state, detected_via, evidence
def _met(via: str, evidence: str | None = None) -> _Eval: return (True, "met", via, evidence)
def _unmet(via: str) -> _Eval: return (True, "unmet", via, None)
_NA: _Eval = (False, "not_applicable", None, None)_UND: _Eval = (False, "not_detectable", None, None)
# Conditional requirements whose triggering surface a crawl cannot detect in Wave 1._DEFERRED_NA = frozenset( { "AR-DISC-06", "AR-CAPA-03", "AR-CAPA-05", "AR-CAPA-06", "AR-CAPA-07", "AR-COMM-01", "AR-COMM-02", "AR-COMM-03", "AR-COMM-05", })
def _req(present: bool, via: str, evidence: str | None = None) -> _Eval: """Baseline requirement: met if present, else unmet (always applies).""" return _met(via, evidence) if present else _unmet(via)
def _cond(present: bool, via: str) -> _Eval: """Conditional requirement: met if the surface is present, else not-applicable.""" return _met(via) if present else _NA
def _evaluate(stable_id: str, sig: _Signals) -> _Eval: if stable_id in _DEFERRED_NA: return _NA p = sig.probe_paths match stable_id: # Discoverability (baseline) case "AR-DISC-01": return _req(sig.ai_policy, "robots.txt", sig.ai_policy_evidence) case "AR-DISC-02": return _req(sig.sitemap, "sitemap") case "AR-DISC-03": return _req(sig.llms_txt, "/llms.txt") case "AR-DISC-04": return _req(sig.llms_full, "/llms-full.txt") case "AR-DISC-05": return _req(bool(sig.link_header), "Link header", sig.link_header) # Content (baseline; CONT-04 conditional on a voice surface) case "AR-CONT-01": return _req(sig.json_ld, "json-ld") case "AR-CONT-02": return _req(sig.md_negotiation, "Accept: text/markdown") case "AR-CONT-03": return _req(sig.index_md, "/index.md") case "AR-CONT-04": return _cond(sig.speakable, "json-ld speakable") # Capabilities (conditional; detect via discovery documents) case "AR-CAPA-01": return _met(p.get("mcp_card", "MCP server card")) if sig.mcp_card else _UND case "AR-CAPA-02": return _cond(sig.mcp_card, p.get("mcp_card", "MCP server card")) case "AR-CAPA-04": return _cond(sig.agent_card, p.get("agent_card", "A2A agent card")) case "AR-CAPA-08": return _cond(sig.openapi, p.get("openapi", "OpenAPI")) case "AR-CAPA-09": return _cond(sig.ai_plugin, p.get("ai_plugin", "ai-plugin.json")) # Identity & Access case "AR-IDEN-01": return _req(sig.webbotauth, p.get("webbotauth", "web-bot-auth directory")) case "AR-IDEN-02": return _cond(bool(sig.oauth_as), p.get("oauth_as", "OAuth metadata")) case "AR-IDEN-03": return _cond(bool(sig.oauth_as), p.get("oauth_as", "OAuth AS metadata")) case "AR-IDEN-04": return _cond(sig.oauth_pr, p.get("oauth_pr", "oauth-protected-resource")) case "AR-IDEN-05": if not sig.oauth_as: return _NA return _req(sig.pkce, "PKCE S256", "code_challenge_methods_supported") case "AR-IDEN-06": return _cond(sig.api_catalog, p.get("api_catalog", "api-catalog")) # Commerce (conditional/MAY) case "AR-COMM-04": return _cond(sig.ucp, p.get("ucp", "/.well-known/ucp")) case _: return _UND
def _summarize(results: list[ARResult]) -> dict[str, int]: summary: dict[str, int] = {} for strength in ("MUST", "SHOULD", "MAY"): applicable = [r for r in results if r.strength == strength and r.applies] summary[f"{strength.lower()}_applicable"] = len(applicable) summary[f"{strength.lower()}_met"] = sum(1 for r in applicable if r.state == "met") summary["applicable"] = sum(1 for r in results if r.applies) summary["met"] = sum(1 for r in results if r.state == "met") summary["not_applicable"] = sum(1 for r in results if r.state == "not_applicable") summary["not_detectable"] = sum(1 for r in results if r.state == "not_detectable") return summary
def build_conformance(crawl: CrawlResult, fetcher: Fetcher) -> ConformanceReport: """Evaluate the crawled site against the pinned AgentReady standard.""" spec = load_ar_spec() sig = _gather_signals(crawl, fetcher.with_timeout(_PROBE_TIMEOUT)) results: list[ARResult] = [] for req in spec.requirements: applies, state, via, evidence = _evaluate(req.stable_id, sig) results.append( ARResult( stable_id=req.stable_id, section=req.section, name=req.name, strength=req.strength, # type: ignore[arg-type] applies=applies, state=state, # type: ignore[arg-type] detected_via=via, evidence=evidence, reference_url=req.reference_url, ) ) return ConformanceReport( spec_version=spec.version, spec_date=spec.date, results=results, summary=_summarize(results), )7 unmodified lines891011121335 unmodified lines4950515253548 unmodified lines63646566676811 unmodified lines8081828384857 unmodified linesfrom ..contracts import Artifact, CrawlResult, JobEvent, SiteAuditfrom ..crawl import Fetcher, crawl_sitefrom ..score import score_siteEventSink = Callable[[JobEvent], None]35 unmodified linesaudit = score_site(crawl)sink(JobEvent(type="page_scored", data={"pages": len(audit.pages), "score": audit.score}))artifacts = generate_artifacts(crawl)sink(JobEvent(type="artifacts_generated", data={"count": len(artifacts)}))sink(JobEvent(type="completed", data={"score": audit.score, "label": audit.score_label}))8 unmodified linesreturn countsdef run_summary(run: AuditRun) -> dict:audit = run.auditerrors = run.crawl.errors11 unmodified lines"robots_blocked_bots": [b.bot for b in run.crawl.robots.bots if not b.allowed],"llms_txt_present": run.crawl.llms_txt_present,"sitemap_found": run.crawl.sitemap.found,"crawl_errors_total": len(errors),"first_error": errors[0].error if errors else "",}7 unmodified lines89101112131435 unmodified lines5051525354555657585960618 unmodified lines7071727374757677787980818211 unmodified lines9495969798991007 unmodified linesfrom ..contracts import Artifact, CrawlResult, JobEvent, SiteAuditfrom ..crawl import Fetcher, crawl_sitefrom ..score import score_sitefrom ..score.conformance import build_conformanceEventSink = Callable[[JobEvent], None]35 unmodified linesaudit = score_site(crawl)sink(JobEvent(type="page_scored", data={"pages": len(audit.pages), "score": audit.score}))probe_fetcher = fetcher or Fetcher(allow_private=allow_private)try:audit.conformance = build_conformance(crawl, probe_fetcher)except Exception as exc: # conformance is a lens; never let it break an auditsink(JobEvent(type="error", message=f"conformance probe failed: {exc}"))artifacts = generate_artifacts(crawl)sink(JobEvent(type="artifacts_generated", data={"count": len(artifacts)}))sink(JobEvent(type="completed", data={"score": audit.score, "label": audit.score_label}))8 unmodified linesreturn countsdef _conformance_summary(audit: SiteAudit) -> dict | None:c = audit.conformanceif c is None:return Nonereturn {"spec_version": c.spec_version, "spec_date": c.spec_date, **c.summary}def run_summary(run: AuditRun) -> dict:audit = run.auditerrors = run.crawl.errors11 unmodified lines"robots_blocked_bots": [b.bot for b in run.crawl.robots.bots if not b.allowed],"llms_txt_present": run.crawl.llms_txt_present,"sitemap_found": run.crawl.sitemap.found,"conformance": _conformance_summary(audit),"crawl_errors_total": len(errors),"first_error": errors[0].error if errors else "",}
pyproject.toml+1-1
src/legibl/api/static/app.js+39
src/legibl/api/static/index.html+9
src/legibl/api/static/styles.css+12
src/legibl/contracts/__init__.py+32
src/legibl/contracts/__pycache__/__init__.cpython-312.pyc
src/legibl/crawl/__pycache__/fetch.cpython-312.pyc
src/legibl/crawl/fetch.py+5-3
src/legibl/score/__pycache__/ar_spec.cpython-312.pycAdded
src/legibl/score/__pycache__/conformance.cpython-312.pycAdded
src/legibl/score/ar_spec.jsonAdded+1
src/legibl/score/ar_spec.pyAdded+62
src/legibl/score/conformance.pyAdded+313
src/legibl/service/__pycache__/orchestrate.cpython-312.pyc
src/legibl/service/orchestrate.py+15