hermes-agent-features/tests/hermes_cli
0xbyt4 04c489b587 feat(tui): match CLI's voice slash + VAD-continuous recording model
The TUI had drifted from the CLI's voice model in two ways:

- /voice on was lighting up the microphone immediately and Ctrl+B was
  interpreted as a mode toggle.  The CLI separates the two: /voice on
  just flips the umbrella bit, recording only starts once the user
  presses Ctrl+B, which also sets _voice_continuous so the VAD loop
  auto-restarts until the user presses Ctrl+B again or three silent
  cycles pass.
- /voice tts was missing entirely, so users couldn't turn agent reply
  speech on/off from inside the TUI.

This commit brings the TUI to parity.

Python

- hermes_cli/voice.py: continuous-mode API (start_continuous,
  stop_continuous, is_continuous_active) layered on the existing PTT
  wrappers. The silence callback transcribes, fires on_transcript,
  tracks consecutive no-speech cycles, and auto-restarts — mirroring
  cli.py:_voice_stop_and_transcribe + _restart_recording.
- tui_gateway/server.py:
  - voice.toggle now supports on / off / tts / status.  The umbrella
    bit lives in HERMES_VOICE + display.voice_enabled; tts lives in
    HERMES_VOICE_TTS + display.voice_tts.  /voice off also tears down
    any active continuous loop so a toggle-off really releases the
    microphone.
  - voice.record start/stop now drives start_continuous/stop_continuous.
    start is refused with a clear error when the mode is off, matching
    cli.py:handle_voice_record's early return on `not _voice_mode`.
  - New voice.transcript / voice.status events emit through
    _voice_emit (remembers the sid that last enabled the mode so
    events land in the right session).

TypeScript

- gatewayTypes.ts: voice.status + voice.transcript event
  discriminants; VoiceToggleResponse gains tts; VoiceRecordResponse
  gains status for the new "started/stopped" responses.
- interfaces.ts: GatewayEventHandlerContext gains composer.setInput +
  submission.submitRef + voice.{setRecording, setProcessing,
  setVoiceEnabled}; InputHandlerContext.voice gains enabled +
  setVoiceEnabled for the mode-aware Ctrl+B handler.
- createGatewayEventHandler.ts: voice.status drives REC/STT badges;
  voice.transcript auto-submits when the composer is empty (CLI
  _pending_input.put parity) and appends when a draft is in flight.
  no_speech_limit flips voice off + sys line.
- useInputHandlers.ts: Ctrl+B now calls voice.record (start/stop),
  not voice.toggle, and nudges the user with a sys line when the
  mode is off instead of silently flipping it on.
- useMainApp.ts: wires the new event-handler context fields.
- slash/commands/session.ts: /voice handles on / off / tts / status
  with CLI-matching output ("voice: mode on · tts off").

Backward compat preserved for voice.record (was always PTT shape;
gateway still honours start/stop with mode-gating added).
2026-04-23 16:18:15 -07:00
..
__init__.py
test_ai_gateway_models.py
test_anthropic_oauth_flow.py
test_anthropic_provider_persistence.py
test_api_key_providers.py
test_arcee_provider.py
test_argparse_flag_propagation.py
test_at_context_completion_filter.py
test_atomic_json_write.py
test_atomic_yaml_write.py
test_auth_codex_provider.py
test_auth_commands.py
test_auth_nous_provider.py
test_auth_provider_gate.py
test_auth_qwen_provider.py
test_aux_config.py
test_backup.py
test_banner_git_state.py
test_banner_skills.py
test_banner.py
test_chat_skills_flag.py
test_claw.py
test_clear_stale_base_url.py
test_cmd_update.py
test_coalesce_session_args.py
test_codex_cli_model_picker.py
test_codex_models.py
test_commands.py
test_completion.py
test_config_drift.py
test_config_env_expansion.py
test_config_env_refs.py
test_config_validation.py
test_config.py
test_container_aware_cli.py
test_copilot_auth.py
test_cron.py
test_custom_provider_model_switch.py
test_debug.py
test_deprecated_cwd_warning.py
test_detect_api_mode_for_url.py
test_determine_api_mode_hostname.py
test_dingtalk_auth.py
test_doctor_command_install.py
test_doctor.py
test_env_loader.py
test_env_sanitize_on_load.py
test_gateway_linger.py
test_gateway_runtime_health.py
test_gateway_service.py
test_gateway_wsl.py
test_gateway.py
test_gemini_provider.py
test_hooks_cli.py
test_ignore_user_config_flags.py
test_image_gen_picker.py
test_launcher.py
test_logs.py
test_managed_installs.py
test_mcp_config.py
test_mcp_tools_config.py
test_memory_reset.py
test_model_normalize.py
test_model_picker_viewport.py
test_model_provider_persistence.py
test_model_switch_copilot_api_mode.py
test_model_switch_custom_providers.py
test_model_switch_opencode_anthropic.py
test_model_switch_variant_tags.py
test_model_validation.py
test_models_dev_preferred_merge.py
test_models.py
test_non_ascii_credential.py
test_nous_hermes_non_agentic.py
test_nous_subscription.py
test_ollama_cloud_auth.py
test_ollama_cloud_provider.py
test_opencode_go_in_model_list.py
test_opencode_go_validation_fallback.py
test_overlay_slug_resolution.py
test_path_completion.py
test_placeholder_usage.py
test_plugin_cli_registration.py
test_plugin_scanner_recursion.py
test_plugins_cmd.py
test_plugins.py
test_profile_export_credentials.py
test_profiles.py
test_provider_config_validation.py
test_reasoning_effort_menu.py
test_runtime_provider_resolution.py
test_session_browse.py
test_sessions_delete.py
test_set_config_value.py
test_setup_agent_settings.py
test_setup_hermes_script.py
test_setup_matrix_e2ee.py
test_setup_model_provider.py
test_setup_noninteractive.py
test_setup_openclaw_migration.py
test_setup_prompt_menus.py
test_setup.py
test_skills_config.py
test_skills_hub.py
test_skills_install_flags.py
test_skills_skip_confirm.py
test_skills_subparser.py
test_skin_engine.py
test_status_model_provider.py
test_status.py
test_subparser_routing_fallback.py
test_subprocess_timeouts.py
test_terminal_menu_fallbacks.py
test_timeouts.py
test_tips.py
test_tool_token_estimation.py
test_tools_config.py
test_tools_disable_enable.py
test_tui_npm_install.py
test_tui_resume_flow.py
test_update_autostash.py
test_update_check.py
test_update_config_clears_custom_fields.py
test_update_gateway_restart.py
test_update_hangup_protection.py
test_user_providers_model_switch.py
test_voice_wrapper.py
test_web_server_host_header.py
test_web_server.py
test_webhook_cli.py
test_xiaomi_provider.py