feat(cli): add on_session_finalize and on_session_reset plugin hooks

Plugins can now subscribe to session boundary events via
ctx.register_hook('on_session_finalize', ...) and
ctx.register_hook('on_session_reset', ...).

on_session_finalize — fires during CLI exit (/quit, Ctrl-C) and
before /new or /reset, giving plugins a chance to flush or clean up.

on_session_reset — fires after a new session is created via
/new or /reset, so plugins can initialize per-session state.

Closes #5592
This commit is contained in:
Felipe de Leon
2026-04-08 03:47:40 +04:00
committed by Teknium
parent c8a5e36be8
commit bdc72ec355
3 changed files with 94 additions and 0 deletions

View File

@@ -61,6 +61,8 @@ VALID_HOOKS: Set[str] = {
"post_api_request",
"on_session_start",
"on_session_end",
"on_session_finalize",
"on_session_reset",
}
ENTRY_POINTS_GROUP = "hermes_agent.plugins"