diff --git a/dist/well-known.js b/dist/well-known.js index 86de465..224e38e 100644 --- a/dist/well-known.js +++ b/dist/well-known.js @@ -276,6 +276,55 @@ return Promise.all([ return data; }); }), + // Agentic Resource Discovery (ARD) - checked by Lighthouse's agentic-browsing category. + // Resolution follows Lighthouse's ARD gatherer (core/gather/gatherers/agentic/ard.js): + // in the document wins, otherwise /.well-known/ai-catalog.json. + // Keyed by the well-known path either way; `catalog_url` is added only when the + // link points somewhere other than the default location. + (() => { + const wellKnownUrl = '/.well-known/ai-catalog.json'; + let catalogUrl = null; + try { + const link = document.querySelector('link[rel~="ai-catalog" i]'); + if (link && link.href) { + const target = new URL(link.href, location.href); + if (target.origin !== location.origin || target.pathname !== wellKnownUrl) { + catalogUrl = target.href; + } + } + } catch (e) { + // No usable link, fall back to the well-known path. + } + return parseResponse(catalogUrl || wellKnownUrl, r => { + return r.text().then(text => { + let result = { + spec_version: null, + has_host: false, + entries_count: 0, + entry_types: [] + }; + try { + const data = JSON.parse(text); + result.spec_version = typeof data.specVersion === 'string' ? data.specVersion : null; + result.has_host = !!(data.host && typeof data.host === 'object'); + if (Array.isArray(data.entries)) { + result.entries_count = data.entries.length; + result.entry_types = [...new Set(data.entries + .map(e => e && typeof e.type === 'string' ? e.type : null) + .filter(Boolean))].slice(0, 20); + } + } catch (e) { + // Failed to parse JSON, result will contain default values. + } + return result; + }); + }).then(([, resultObj]) => { + if (catalogUrl) { + resultObj.catalog_url = catalogUrl; + } + return [wellKnownUrl, resultObj]; + }); + })(), parseResponseWithRedirects('/.well-known/security.txt', r => { let data = { status: r.status,