hermes-agent/hermes_cli/subcommands
hans 17030939db feat(plugins): inter-plugin event bus with declared emits/listens
Give plugins a first-class, namespaced pub/sub event bus so plugin↔plugin
interaction is a declared, testable contract instead of ad-hoc imports.
Closes #64164 (sub-issue 03/14 of the plugin-interface expansion epic #64182).
Additive-only: when no plugin calls emit/subscribe, behavior is unchanged.

Interface (on PluginContext):
- `ctx.emit(event, payload=None) -> int` publishes to subscribers and returns
  the count invoked. The namespace is FORCED to the plugin's own registry key
  (`manifest.key or manifest.name`): pass only the bare event name, delivered
  as `<key>:<event>`. Fail-closed — any name containing `:` (a `hermes:`
  reserved-core prefix, a foreign `other:` namespace, or an own-colon'd name)
  is rejected with a ValueError + logged warning naming the plugin.
- `ctx.subscribe(full_event, callback)` registers an ordered listener for a
  fully-qualified `<plugin>:<event>`. Subscribing is unrestricted (any plugin
  may listen to any published event); only emitting is namespace-gated.

Delivery mirrors invoke_hook: registration-order iteration, per-callback
try/except isolation (one raising subscriber never breaks delivery to the
rest), payload passed as `cb(**payload)`. A per-thread depth counter caps
re-entrant emits at 8 — mutually-emitting plugins terminate cleanly with one
logged warning, never an infinite loop or RecursionError.

Discoverability: optional advisory `emits:`/`listens:` manifest fields (no
manifest-v2 dependency; not enforced) are parsed and surfaced by a new
`hermes plugins show <name>` (alias `info`) command. `get_plugin_subscriptions()`
module accessor mirrors `get_plugin_auxiliary_tasks()`.

Tests (tests/hermes_cli/test_plugin_event_bus.py, 22): two-plugin delivery +
listener count; forced namespace (delivered as `b:ping`); spoof rejection
(parametrized `hermes:x` / foreign / own-colon'd / `:x` / `x:` / empty) with
no delivery; name-fallback when key empty; per-callback isolation; recursion
cap termination + warning; manifest emits/listens parsed (present/absent/from
yaml); module accessor; `plugins show` output. `pytest test_plugin_event_bus.py
test_plugin_auxiliary_tasks.py` → 37 passed. I independently re-verified the
namespace rejection and recursion-cap termination outside the test suite.

Note: the reserved-name gate rejects any `:`-containing input rather than a
bare-name denylist — a bare `core_event` is allowed and delivered under the
plugin's own namespace. Say the word if a reserved bare-name list is wanted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013b1XyXitAxV7phGmKWigJX
2026-08-12 18:57:51 -07:00
..
__init__.py
…
_shared.py
…
acp.py
…
approvals.py feat(cli): add `hermes approvals test` — dry-run approval verdict CLI 2026-08-07 08:57:39 -07:00
auth.py feat(auth): make xAI Grok OAuth device-code-only, drop loopback login 2026-07-02 13:17:41 -07:00
backup.py
…
claw.py
…
config.py fix(config): warn-after-write for unrecognized keys instead of refusing 2026-07-20 05:38:59 -07:00
console.py Add safe Hermes console REPL 2026-07-03 20:18:00 +05:30
cron.py feat(cron): per-job durable notepad — KV scratchpad surviving scheduled runs 2026-08-07 08:57:48 -07:00
dashboard.py feat(serve): add secure Desktop SSH bootstrap contract 2026-07-16 14:43:14 +02:00
debug.py fix(security): require explicit consent before uploading debug logs 2026-07-01 00:38:17 -07:00
doctor.py feat(doctor): add opt-in `hermes doctor --live` real-call backend probes 2026-08-07 09:07:48 -07:00
dump.py
…
gateway.py fix(gateway): preserve external supervisor ownership 2026-07-16 05:08:56 -07:00
gui.py
…
hooks.py
…
import_agent.py feat(cli): hermes import-agent — import Claude Code and Codex CLI setups 2026-07-26 17:47:07 -07:00
import_cmd.py
…
insights.py
…
login.py
…
logout.py
…
logs.py
…
mcp.py feat(cli): add --connect-timeout flag to hermes mcp add 2026-07-05 19:10:00 -07:00
memory.py
…
model.py feat(auth): make xAI Grok OAuth device-code-only, drop loopback login 2026-07-02 13:17:41 -07:00
monitoring.py refactor(monitoring): scope telemetry substrate to gateway health/diagnostics export 2026-07-24 18:54:45 +00:00
pairing.py fix(pairing): keep GUI approvals off the code brute-force lockout 2026-07-29 17:51:40 -05:00
pause.py feat(cli): global emergency stop — `hermes pause` / `hermes resume` 2026-08-07 08:58:14 -07:00
plugins.py feat(plugins): inter-plugin event bus with declared emits/listens 2026-08-12 18:57:51 -07:00
profile.py
…
prompt_size.py
…
security.py
…
setup.py Reapply "feat(observability): integrate NeMo Relay runtime and shared metrics" 2026-07-27 21:10:51 -07:00
skills.py refactor(sync): put every Skill Sync verb under `hermes sync`; drop HSP naming 2026-07-29 07:47:06 +10:00
skin.py feat(themes): `hermes skin set` — deterministic one-color tweak, bg untouched 2026-07-21 21:00:43 -05:00
slack.py feat(slack): support long app descriptions in the manifest generator 2026-07-23 12:01:24 -07:00
status.py
…
sync.py refactor(sync): put every Skill Sync verb under `hermes sync`; drop HSP naming 2026-07-29 07:47:06 +10:00
tools.py
…
uninstall.py feat: add uninstall dry-run mode 2026-07-07 05:12:24 -07:00
update.py fix(update): consolidate pre-update backups into one gated mechanism (#65754) 2026-07-16 08:47:25 -07:00
verify.py Port from superagent-ai/grok-cli: verify subsystem (run-recipe detection + environment manifest + hermes verify smoke runner) 2026-08-07 10:11:05 -07:00
version.py
…
webhook.py feat(gateway): add webhook payload filters 2026-07-08 08:10:55 -07:00
whatsapp.py
…