Skip to content

feat: add transform_llm_output plugin hook (salvage of #20813)#21235

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5c674f1a
May 7, 2026
Merged

feat: add transform_llm_output plugin hook (salvage of #20813)#21235
teknium1 merged 2 commits into
mainfrom
hermes/hermes-5c674f1a

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

@teknium1 teknium1 commented May 7, 2026

Salvages @JezzaHehn's #20813 onto current main, plus tests, docs, and an AUTHOR_MAP entry.

Summary

Plugins can now transform the assistant's final response text once per turn, before it's delivered. Fail-open, first-non-empty-string wins — same contract as transform_tool_result.

Changes

  • hermes_cli/plugins.py, run_agent.py — contributor's commit (cherry-picked with authorship preserved)
  • tests/test_transform_llm_output_hook.py — new: dispatch-semantics tests (kwargs contract, first-non-empty wins, empty/None pass-through, raising plugin fail-open, no-plugins no-op)
  • tests/hermes_cli/test_plugins.py — add transform_llm_output to the VALID_HOOKS assertion
  • website/docs/user-guide/features/hooks.md — summary-table row + full hook section (mirrors transform_tool_result / transform_terminal_output)
  • scripts/release.py — map barnacleboy.jezzahehn@agentmail.toJezzaHehn (existing entry only covered the gmail address)

Validation

77 passed targeted (tests/test_transform_llm_output_hook.py, tests/hermes_cli/test_plugins.py, tests/test_transform_tool_result_hook.py).

Closes #20813. Credit to @JezzaHehn.

JezzaHehn and others added 2 commits May 7, 2026 05:40
Enables plugins to transform LLM output text after generation,
useful for vocabulary/personality transformation without burning
inference tokens.

Follows same pattern as transform_tool_result and transform_terminal_output:
- First non-empty string result wins
- Fail-open: exceptions logged as warnings, agent continues
- Signature: (response_text, session_id, model, platform)
- tests/test_transform_llm_output_hook.py: dispatch semantics
  (kwargs contract, first-non-empty-string-wins, empty-string
  pass-through, raising-plugin fail-open, no-plugins = no-op)
- tests/hermes_cli/test_plugins.py: assert the new hook name is in
  VALID_HOOKS alongside the other transform_* hooks
- website/docs/user-guide/features/hooks.md: summary-table entry +
  full section mirroring transform_tool_result / transform_terminal_output
- scripts/release.py: map barnacleboy.jezzahehn@agentmail.to -> JezzaHehn
  (existing entry only covers the gmail address)
@teknium1 teknium1 merged commit 47bf5d7 into main May 7, 2026
7 of 11 checks passed
@teknium1 teknium1 deleted the hermes/hermes-5c674f1a branch May 7, 2026 12:46
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🔎 Lint report: hermes/hermes-5c674f1a vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7505 on HEAD, 7505 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 3943 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants