hermes-agent/website/docs/user-guide/features
kshitijk4poor 00ec0b617c feat(tts): add register_tts_provider() plugin hook (closes #30398)
Adds a `TTSProvider(ABC)` + `register_tts_provider()` extension point
to the plugin context API, **alongside** the existing config-driven
`tts.providers.<name>: type: command` registry from PR #17843. This is
additive — the command-provider surface stays as the primary way to
add a TTS backend.

The hook covers cases the shell-template grammar can't reasonably
express:

- Native Python SDKs without a CLI (Cartesia, Fish Audio, etc.)
- Streaming synthesis (chunked Opus → voice-bubble delivery)
- Voice metadata API for the `hermes tools` picker
- OAuth-refreshing auth flows

None of the 10 inline built-in providers (`edge`, `openai`,
`elevenlabs`, `minimax`, `gemini`, `mistral`, `xai`, `piper`,
`kittentts`, `neutts`) are migrated to plugins. They stay inline. The
hook is for *new* engines that aren't built-in.

## Resolution order

The dispatcher's resolution order is the load-bearing invariant:

1. `tts.provider` is a built-in name → built-in dispatch. **Always wins.**
2. `tts.provider` matches `tts.providers.<name>` with `command:` set
   → command-provider dispatch (PR #17843).
3. `tts.provider` matches a plugin-registered `TTSProvider`
   → plugin dispatch (new).
4. No match → falls through to Edge TTS default (legacy behavior).

Built-ins-always-win is enforced at THREE layers:
- Registry: `register_provider()` rejects shadowing names with a warning.
- Dispatcher: `_dispatch_to_plugin_provider()` short-circuits built-in
  names defensively before consulting the registry.
- Picker: `_plugin_tts_providers()` filters built-in shadows out of
  the `hermes tools` row list defensively.

Command-providers-win-over-plugins is enforced at TWO layers:
- The caller in `text_to_speech_tool` checks
  `_resolve_command_provider_config` first.
- `_dispatch_to_plugin_provider` re-checks for a same-name command
  config defensively so a refactor of the caller can't silently break
  the invariant.

## New files

- `agent/tts_provider.py` — `TTSProvider(ABC)` with `synthesize()` (required),
  `list_voices()`, `list_models()`, `get_setup_schema()`, `stream()`,
  `voice_compatible` (all optional with sane defaults). Mirrors
  `agent/image_gen_provider.py` shape.
- `agent/tts_registry.py` — `register_provider`/`get_provider`/`list_providers`
  with `_BUILTIN_NAMES` reject-shadowing invariant. Mirrors
  `agent/image_gen_registry.py` shape.
- `plugins/tts/...` directory ready for community plugins (none shipped).

## Modified files

- `hermes_cli/plugins.py` — `register_tts_provider()` method on
  `PluginContext`. Matches the gating shape of
  `register_image_gen_provider()` / `register_browser_provider()`.
- `tools/tts_tool.py` — `_dispatch_to_plugin_provider()` +
  `_plugin_provider_is_voice_compatible()` + walrus-elif wiring into
  the main dispatcher. Built-in elif chain untouched.
- `hermes_cli/tools_config.py` — `_plugin_tts_providers()` injects
  plugin rows into the Text-to-Speech picker category alongside the
  10 hardcoded built-in rows.

## Tests

- `tests/agent/test_tts_registry.py` — 47 tests covering registration,
  lookup, ABC contract, helpers, AND a `TestBuiltinSync` regression
  test that fails if `agent.tts_registry._BUILTIN_NAMES` drifts from
  `tools.tts_tool.BUILTIN_TTS_PROVIDERS` (kept duplicated due to
  circular import constraints).
- `tests/tools/test_tts_plugin_dispatch.py` — 35 tests covering
  built-in-always-wins, command-wins-over-plugin, plugin dispatch,
  exception passthrough, voice_compatible helper.
- `tests/hermes_cli/test_tts_picker.py` — 10 tests covering the
  picker surface, builtin shadowing defense, integration with
  `_visible_providers`.
- `tests/hermes_cli/test_plugins_tts_registration.py` — 3 end-to-end
  tests via `PluginManager.discover_and_load()`.
- `tests/plugins/tts/check_parity_vs_main.py` — 9-scenario subprocess
  parity harness vs `origin/main`. The only intentional diff is
  `fallback_edge → plugin` for the `plugin-installed` scenario.

## Verification

- 95/95 new tests pass.
- 170/170 pre-existing TTS tests (test_tts_command_providers,
  test_tts_max_text_length, test_tts_speed, etc.) pass unchanged.
- Parity harness against `origin/main`: 8 OK + 1 expected DIFF.
- E2E smoke: a registered plugin's `synthesize()` is called via
  `text_to_speech_tool` with the standard JSON envelope returned.
- Ruff clean on all touched files.

## Docs

- `website/docs/user-guide/features/tts.md` — new "Python plugin
  providers" section with a decision table (command-provider vs
  plugin), minimal plugin example, and the optional-hook reference.
- `website/docs/user-guide/features/plugins.md` — TTS row updated to
  mention both surfaces (command-provider primary, plugin for
  SDK/streaming).

Closes #30398
2026-05-24 18:04:54 -07:00
..
_category_.json
acp.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
api-server.md docs: surface Nous Portal on pages where it solves a real problem the page describes (#30874) 2026-05-23 02:47:53 -07:00
batch-processing.md docs: surface Nous Portal on pages where it solves a real problem the page describes (#30874) 2026-05-23 02:47:53 -07:00
browser.md docs: surface 'hermes setup --portal' and 'hermes portal' across user-facing pages (#30869) 2026-05-23 02:42:31 -07:00
built-in-plugins.md fix(plugins): remove unreachable hermes tools → Langfuse path 2026-05-16 17:15:19 -07:00
code-execution.md docs(execute_code): document project/strict execution modes (#12073) 2026-04-18 01:53:09 -07:00
codex-app-server-runtime.md docs(codex_app_server): document multi-root Kanban writable_roots (#27941) 2026-05-18 21:03:25 -07:00
computer-use.md feat(computer-use): refresh cua-driver on hermes update + add install --upgrade (#24063) 2026-05-11 17:10:58 -07:00
context-files.md
context-references.md
credential-pools.md docs(anthropic): correct OAuth scope to Max plan + extra usage credits only (#17404) 2026-04-29 04:11:14 -07:00
cron.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
curator.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
delegation.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
deliverable-mode.md feat(gateway): deliverable mode — ship artifacts as native uploads from any agent surface (#27813) 2026-05-18 02:14:43 -07:00
extending-the-dashboard.md feat(plugins): run any LLM call from inside a plugin via ctx.llm (#23194) 2026-05-10 07:09:28 -07:00
fallback-providers.md docs: surface Nous Portal on pages where it solves a real problem the page describes (#30874) 2026-05-23 02:47:53 -07:00
goals.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
honcho.md docs: deep audit — fix stale config keys, missing commands, and registry drift (#22784) 2026-05-09 13:19:51 -07:00
hooks.md test+docs: cover transform_llm_output hook + release author map 2026-05-07 05:46:05 -07:00
image-generation.md docs: surface 'hermes setup --portal' and 'hermes portal' across user-facing pages (#30869) 2026-05-23 02:42:31 -07:00
kanban-tutorial.md docs: align kanban readiness docs and smoke tests 2026-05-18 21:07:03 -07:00
kanban-worker-lanes.md feat(kanban): stranded_in_ready diagnostic for unclaimed tasks (#23578) 2026-05-10 21:58:44 -07:00
kanban.md feat(kanban): warn users that scratch workspaces are deleted on completion (#30949) 2026-05-23 11:27:00 -07:00
lsp.md docs(lsp): replace "git worktree" with "git repository" in LSP docs 2026-05-13 23:05:20 -07:00
mcp.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
memory-providers.md docs: deep audit — fix stale config keys, missing commands, and registry drift (#22784) 2026-05-09 13:19:51 -07:00
memory.md docs(session_search): update all docs for the single-shape rewrite (#27840) 2026-05-18 00:36:17 -07:00
overview.md feat: auto-launch Chromium-family browser for CDP 2026-05-19 22:34:05 -07:00
personality.md
plugins.md feat(tts): add register_tts_provider() plugin hook (closes #30398) 2026-05-24 18:04:54 -07:00
provider-routing.md
skills.md docs(skills): clarify external dir mutations 2026-05-20 12:41:38 -07:00
skins.md fix(tui): honor skin highlight colors (#20895) 2026-05-06 14:01:56 -07:00
spotify.md docs(spotify): document Home Assistant speaker routing 2026-05-16 20:32:43 -07:00
subscription-proxy.md feat(proxy): local OpenAI-compatible proxy for OAuth providers (#25969) 2026-05-14 15:40:48 -07:00
tool-gateway.md docs: surface 'hermes setup --portal' and 'hermes portal' across user-facing pages (#30869) 2026-05-23 02:42:31 -07:00
tools.md docs(tools): add video_generate / video_gen toolset to user-facing tool docs (#27050) 2026-05-16 11:53:13 -07:00
tts.md feat(tts): add register_tts_provider() plugin hook (closes #30398) 2026-05-24 18:04:54 -07:00
vision.md docs: comprehensive 2-week sweep of feature/PR coverage gaps (#28497) 2026-05-18 23:55:25 -07:00
voice-mode.md docs: surface Nous Portal on pages where it solves a real problem the page describes (#30874) 2026-05-23 02:47:53 -07:00
web-dashboard.md docs(dashboard): clarify chat tab tui flag 2026-05-16 20:32:43 -07:00
web-search.md docs: surface 'hermes setup --portal' and 'hermes portal' across user-facing pages (#30869) 2026-05-23 02:42:31 -07:00
x-search.md fix(x_search): surface degraded results + validate dates 2026-05-21 02:38:45 +05:30