feat(site): search every AgenTrust site from the top bar - #77
Merged
Merged
Conversation
Each docs site could only be searched on its own host, and agentrust-io.com had no search at all. /search/ now fetches the seven MkDocs search indexes (all served with Access-Control-Allow-Origin: *) and the hub pages from sitemap.xml when it opens, and matches in the browser with no build step and no third-party service. supernav.js adds a Search item on every site, filtered to the current docs site, and "/" opens it on hub pages. supernav.js changed, so CSS_VERSION moves to 22. The availability check's version probe now reads each docs home page with a throwaway query, because the CDN served trace.agentrust-io.com from a pre-deploy cache. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013aK3gVWzNdcM3hZ2o2awK2
Under All, the larger indexes filled the first 50 results on common words: ?q=attestation showed no WCM result at all. After scoring and the per-page cap, results now take each site's best remaining hit in turn, strongest site first in every round. A single-site filter keeps plain score order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013aK3gVWzNdcM3hZ2o2awK2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Until now each AgenTrust docs site could only be searched from its own search box, on its own host, and agentrust-io.com could not be searched at all. A reader looking for "key release" had to guess which of eight sites held it.
Imran chose a live fetch with no build step, and a Search entry in the shared top bar on every site.
How it works
search/index.htmlfetches each MkDocs site'ssearch/search_index.jsonwhen the page opens. All seven sendAccess-Control-Allow-Origin: *. Measured 2026-09-14: wcm 48 KB, manifest 728 KB, cmcp 547 KB, ca2a 267 KB, trace 574 KB, tests 88 KB, governance 43 KB, 2,349,646 bytes in all. Fetched in parallel from this machine, the seven arrived in 496 ms wall clock.sitemap.xmland fetches its 11 canonical pages (203,573 bytes), taking the title, description, main text and eachsection[id]heading.search/search.jsmatches in the browser. Every query word must appear. A word in a title or page title scores 10, each of up to three in the text scores 1, the whole query as a phrase adds 15 in a title or 5 in the text, and a page beats its own sections by 3. One page contributes at most two results, and the list stops at 50.?q=and?site=. Arrow keys move between results, and a source that fails to load is named in the status line while the rest are still searched.textContent, text nodes and<mark>elements built by the script. Indexes are cached in sessionStorage for the visit when they fit.noindex, follow, so it stays out of the sitemap. Without JavaScript it links each site's own search.Top bar.
supernav.jsadds Search after Governance on every site. From a docs site the link carries?site=for that site, including tests. On agentrust-io.com pages/opens search; the MkDocs sites keep their own/andsshortcuts.Version. supernav.js changed, so
CSS_VERSIONmoves from 21 to 22 and every hub page now loads?v=22. The seven docs repos need the same bump in mkdocs.yml, in follow-up PRs; until they deploy, the availability check reports them lagging.Availability check. The docs-host version probe now requests each home page with a throwaway
?availability=<time>query. On 2026-09-14https://trace.agentrust-io.com/returned HTML last modified at 21:01 (Age 426) with unversioned design-system.css and supernav.js, while?v=<timestamp>returnedv=21for both, so the check reported trace as lagging when it was not. The plain 200 probes still use the bare URLs.Limits
Checked
node search/search.test.js, now in the House style workflow: HTML and entity stripping, tokenizing, the all-terms rule, ranking order, the per-page cap, a weaker site appearing in the first round under All while a single-site filter keeps score order, URLs per host, and a title carrying<img src=x onerror=alert(1)>rendered as text through a DOM stub that throws if innerHTML is written.?q=attestationsearched 2,314 entries from 8 of 8 sites: first 50 results, Manifest 7, TRACE 7, cMCP 7, cA2A 7, Tests 7, WCM 7, hub 6, Governance 2, with one from each source in the first 8.?q=attestation&site=wcmgave 18, all WCM.?q=key+releasegave 44 across all eight sources with WCM first. A nonsense query shows the no-results message. A query with<script>produced no markup.check-availability.pylive: 43/43 HTTP probes pass, and 0/7 docs hosts at v=22, each reported at v=21. That shows the cache-busted probe now reads the deployed ?v=21 pages.Generated with Claude Code
https://claude.ai/code/session_013aK3gVWzNdcM3hZ2o2awK2