Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions dist/well-known.js
Original file line number Diff line number Diff line change
Expand Up @@ -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):
// <link rel="ai-catalog"> 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,
Expand Down
Loading