mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(tui): address Copilot review feedback on mutating command parity
Harden busy mode config reads against invalid display config shapes and align /fast help+usage text with accepted aliases, with regression coverage for non-dict display values.
This commit is contained in:
parent
487da4b72b
commit
a13449a40a
3 changed files with 16 additions and 7 deletions
|
|
@ -729,6 +729,16 @@ def test_config_get_statusbar_survives_non_dict_display(monkeypatch):
|
||||||
assert resp["result"]["value"] == "top"
|
assert resp["result"]["value"] == "top"
|
||||||
|
|
||||||
|
|
||||||
|
def test_config_get_busy_survives_non_dict_display(monkeypatch):
|
||||||
|
monkeypatch.setattr(server, "_load_cfg", lambda: {"display": "broken"})
|
||||||
|
|
||||||
|
resp = server.handle_request(
|
||||||
|
{"id": "1", "method": "config.get", "params": {"key": "busy"}}
|
||||||
|
)
|
||||||
|
|
||||||
|
assert resp["result"]["value"] == "interrupt"
|
||||||
|
|
||||||
|
|
||||||
def test_config_set_statusbar_survives_non_dict_display(tmp_path, monkeypatch):
|
def test_config_set_statusbar_survives_non_dict_display(tmp_path, monkeypatch):
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,11 +252,10 @@ class _SlashWorker:
|
||||||
|
|
||||||
|
|
||||||
def _load_busy_input_mode() -> str:
|
def _load_busy_input_mode() -> str:
|
||||||
raw = (
|
display = _load_cfg().get("display")
|
||||||
str((_load_cfg().get("display") or {}).get("busy_input_mode", "") or "")
|
if not isinstance(display, dict):
|
||||||
.strip()
|
display = {}
|
||||||
.lower()
|
raw = str(display.get("busy_input_mode", "") or "").strip().lower()
|
||||||
)
|
|
||||||
return raw if raw in {"queue", "steer", "interrupt"} else "interrupt"
|
return raw if raw in {"queue", "steer", "interrupt"} else "interrupt"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,14 +307,14 @@ export const sessionCommands: SlashCommand[] = [
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
help: 'toggle fast mode [normal|fast|status]',
|
help: 'toggle fast mode [normal|fast|status|on|off|toggle]',
|
||||||
name: 'fast',
|
name: 'fast',
|
||||||
run: (arg, ctx) => {
|
run: (arg, ctx) => {
|
||||||
const mode = arg.trim().toLowerCase()
|
const mode = arg.trim().toLowerCase()
|
||||||
const valid = new Set(['', 'status', 'normal', 'fast', 'on', 'off', 'toggle'])
|
const valid = new Set(['', 'status', 'normal', 'fast', 'on', 'off', 'toggle'])
|
||||||
|
|
||||||
if (!valid.has(mode)) {
|
if (!valid.has(mode)) {
|
||||||
return ctx.transcript.sys('usage: /fast [normal|fast|status]')
|
return ctx.transcript.sys('usage: /fast [normal|fast|status|on|off|toggle]')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mode || mode === 'status') {
|
if (!mode || mode === 'status') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue