hermes-agent/website/docusaurus.config.ts
Teknium 2106f63723
fix(docs): disable fuzzy matching in docs search (exact word or prefix only) (#65103)
The docs search theme (@easyops-cn/docusaurus-search-local) defaults
fuzzyMatchingDistance to 1, so every term also matched words one edit
away. Two user-visible failures on the 14.4 MB production index:

- Wrong results: 'keet' returned 'Microsoft Teams Meetings',
  'google_meet', 'Keep the Model Loaded' etc. — 'meet' and 'keep' are
  both one edit from 'keet', and the stemmer indexes 'meetings' as
  'meet'.
- Search appearing to die: fuzzy matching multiplies the generated
  lunr queries (distance matrix x maybe-typing variants x
  leave-one-out terms — up to 210 queries per keystroke on multi-word
  input), and fuzzy REQUIRED terms are the expensive scan kind. A
  typo'd 3-word query stalled the single-threaded search Web Worker
  for 25+ seconds; every later keystroke's search queued behind it,
  so the bar stopped returning results.

Setting fuzzyMatchingDistance: 0 keeps exact-word-or-prefix semantics
(keet -> keet*), which is the behavior users asked for. Validated by
running the plugin's shipped smartQueries/tokenize code against the
downloaded production search-index.json: legitimate queries (cron,
telegram, prefix 'memor') return identical results; worst-case typo
queries drop from 210 queries / 365-532ms per keystroke to 50-105 /
53-188ms; false 'keet' matches gone.
2026-07-15 09:57:46 -07:00

215 lines
6.3 KiB
TypeScript

import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const config: Config = {
title: 'Hermes Agent',
tagline: 'The self-improving AI agent',
favicon: 'img/favicon.ico',
url: 'https://hermes-agent.nousresearch.com',
baseUrl: '/docs/',
organizationName: 'NousResearch',
projectName: 'hermes-agent',
onBrokenLinks: 'warn',
markdown: {
mermaid: true,
hooks: {
onBrokenMarkdownLinks: 'warn',
},
},
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-Hans'],
localeConfigs: {
en: {
label: 'English',
},
'zh-Hans': {
label: '简体中文',
htmlLang: 'zh-Hans',
},
},
},
themes: [
'@docusaurus/theme-mermaid',
[
require.resolve('@easyops-cn/docusaurus-search-local'),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
hashed: true,
language: ['en', 'zh'],
indexBlog: false,
docsRouteBasePath: '/',
// Disabled: appends ?_highlight=... to URLs (before the #anchor),
// which makes copy/pasted doc links ugly. Ctrl+F on the page is fine.
highlightSearchTermsOnTargetPage: false,
// Exclude the auto-generated per-skill catalog pages from search.
// There are hundreds of them and they dominate results for generic
// terms, drowning out the real user-guide / reference docs.
// The two human-written catalog indexes (reference/skills-catalog,
// reference/optional-skills-catalog) remain indexed.
//
// Note: ignoreFiles matches `route` (baseUrl stripped, no leading
// slash). With baseUrl '/docs/', `/docs/user-guide/skills/bundled/x`
// becomes 'user-guide/skills/bundled/x'.
ignoreFiles: [
/^user-guide\/skills\/bundled\//,
/^user-guide\/skills\/optional\//,
],
// Exact-or-prefix matching only (default is edit distance 1).
// With fuzzy distance 1, "keet" matched "meetings"/"keep" (one
// edit away after stemming), and multi-word typo queries against
// our ~14 MB index could stall the single-threaded search worker
// for 25s+, backing up every subsequent keystroke's search until
// the bar appeared dead. Distance 0 keeps "word or its extension"
// semantics (keet -> keet*) and removes the pathological scans.
fuzzyMatchingDistance: 0,
}),
],
],
plugins: [
[
'@docusaurus/plugin-client-redirects',
{
// Static-host redirects for renamed doc pages (GitHub Pages can't
// do server-side redirects). Paths are relative to baseUrl (/docs/).
redirects: [
{
// Renamed in #44470 (Automation Blueprints terminology rebrand)
from: '/guides/automation-templates',
to: '/guides/automation-blueprints',
},
{
// Moved when the Plugins subcategory was created under
// Developer Guide > Extending (docs restructure, July 2026)
from: '/guides/build-a-hermes-plugin',
to: '/developer-guide/plugins',
},
],
},
],
],
presets: [
[
'classic',
{
docs: {
routeBasePath: '/', // Docs at the root of /docs/
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/NousResearch/hermes-agent/edit/main/website/',
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: 'img/hermes-agent-banner.png',
colorMode: {
defaultMode: 'dark',
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
navbar: {
title: 'Hermes Agent',
logo: {
alt: 'Hermes Agent',
src: 'img/logo.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'docs',
position: 'left',
label: 'Docs',
},
{
to: '/skills',
label: 'Skills',
position: 'left',
},
{
href: 'https://hermes-agent.nousresearch.com/',
label: 'Download',
position: 'left',
},
{
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://hermes-agent.nousresearch.com',
label: 'Home',
position: 'right',
},
{
href: 'https://github.com/NousResearch/hermes-agent',
label: 'GitHub',
position: 'right',
},
{
href: 'https://discord.gg/NousResearch',
label: 'Discord',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{ label: 'Getting Started', to: '/getting-started/quickstart' },
{ label: 'User Guide', to: '/user-guide/cli' },
{ label: 'Developer Guide', to: '/developer-guide/architecture' },
{ label: 'Reference', to: '/reference/cli-commands' },
],
},
{
title: 'Community',
items: [
{ label: 'Discord', href: 'https://discord.gg/NousResearch' },
{ label: 'GitHub Issues', href: 'https://github.com/NousResearch/hermes-agent/issues' },
{ label: 'Skills Hub', href: 'https://agentskills.io' },
],
},
{
title: 'More',
items: [
{ label: 'Desktop Download', href: 'https://hermes-agent.nousresearch.com/' },
{ label: 'GitHub', href: 'https://github.com/NousResearch/hermes-agent' },
{ label: 'Nous Research', href: 'https://nousresearch.com' },
],
},
],
copyright: `Built by <a href="https://nousresearch.com">Nous Research</a> · MIT License · ${new Date().getFullYear()}`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['bash', 'yaml', 'json', 'python', 'toml'],
},
mermaid: {
theme: {light: 'neutral', dark: 'dark'},
},
} satisfies Preset.ThemeConfig,
};
export default config;