feat(reasoning): full /reasoning CLI parity — show|hide + effort levels via config.yaml (#812)

Closes #461

Adds full /reasoning CLI parity to the WebUI slash command system:

- /reasoning show|on → window._showThinking = true; writes display.show_reasoning to config.yaml (same key as CLI); mirrors to settings.json for boot.js
- /reasoning hide|off → same in reverse; re-renders immediately
- /reasoning none|minimal|low|medium|high|xhigh → POST /api/reasoning → writes agent.reasoning_effort to config.yaml; takes effect next turn (matching CLI semantics)
- /reasoning (no args) → GET /api/reasoning → live status toast from config.yaml
- Autocomplete shows all 8 options: show|hide|none|minimal|low|medium|high|xhigh
- Profile-isolated: _get_config_path() is thread-local so per-profile settings never bleed across
- Boot hydration: window._showThinking initialised from settings.json show_thinking on page load
- Inspect.signature guard in streaming.py so older hermes-agent builds don't TypeError

28 new tests, 1708/1708 total passing. Full browser QA on port 8789 with isolated state. CLI/config.yaml sync verified with hermes_constants.parse_reasoning_effort().
This commit is contained in:
nesquena-hermes
2026-04-21 15:26:52 -07:00
committed by GitHub
parent f6e1612c7e
commit 811424a87b
12 changed files with 628 additions and 10 deletions

View File

@@ -18,13 +18,19 @@ BOOT_JS = (REPO_ROOT / "static" / "boot.js").read_text(encoding="utf-8")
STYLE_CSS = (REPO_ROOT / "static" / "style.css").read_text(encoding="utf-8")
def test_subarg_registry_exists_without_promoting_reasoning_to_builtin():
def test_subarg_registry_exists_and_reasoning_is_promoted_to_builtin():
# SLASH_SUBARG_SOURCES still exists for model and personality
assert "const SLASH_SUBARG_SOURCES=" in COMMANDS_JS
assert "reasoning:{desc:'Set reasoning effort', subArgs:['low','medium','high']}" in COMMANDS_JS
assert "{name:'reasoning'" not in COMMANDS_JS, \
"/reasoning suggestions must not register as a local built-in command"
assert "source:'subarg-command'" in COMMANDS_JS, \
"top-level autocomplete should still surface subarg-only commands like /reasoning"
# /reasoning is now a proper builtin command with a fn: handler (cmdReasoning)
# so it is in the COMMANDS array, not SLASH_SUBARG_SOURCES
assert "{name:'reasoning'" in COMMANDS_JS, \
"/reasoning must be registered as a local built-in command with fn: handler"
assert "fn:cmdReasoning" in COMMANDS_JS, \
"/reasoning entry must reference cmdReasoning function"
assert "function cmdReasoning" in COMMANDS_JS, \
"cmdReasoning function must be defined"
# source:'subarg-command' is still used for model/personality in SLASH_SUBARG_SOURCES
assert "source:'subarg-command'" in COMMANDS_JS
def test_model_and_personality_subargs_load_from_existing_apis():