mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
feat(cli,gateway): /new accepts optional session name argument
Allow users to start a fresh session and immediately set its title by
passing a name to /new (or /reset):
/new Refactor auth module
Changes:
- hermes_cli/commands.py: add args_hint='[name]' to /new command
- cli.py: parse title argument in process_command(), pass to new_session()
- cli.py: new_session() accepts title=None, sets title via SessionDB
- gateway/run.py: _handle_reset_command() parses title, sets on new entry
- gateway/session.py: reset_session() accepts optional display_name
- tests: add test_new_session_with_title, test_reset_command_with_title,
test_new_command_in_help_output
All 36 affected tests pass.
This commit is contained in:
parent
055fde40e0
commit
f720751d79
6 changed files with 138 additions and 9 deletions
|
|
@ -6896,6 +6896,17 @@ class GatewayRunner:
|
|||
new_entry = self.session_store.get_or_create_session(source, force_new=True)
|
||||
header = "✨ New session started!"
|
||||
|
||||
# Set session title if provided with /new <title>
|
||||
_title_arg = event.get_command_args().strip()
|
||||
if _title_arg and self._session_db and new_entry:
|
||||
try:
|
||||
from hermes_state import SessionDB
|
||||
sanitized = SessionDB.sanitize_title(_title_arg)
|
||||
if sanitized:
|
||||
self._session_db.set_session_title(new_entry.session_id, sanitized)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fire plugin on_session_reset hook (new session guaranteed to exist)
|
||||
try:
|
||||
from hermes_cli.plugins import invoke_hook as _invoke_hook
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue