mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-22 16:25:58 +00:00
fix(acp,tui): rename /compact to /compress and /density to resolve command collision
- acp_adapter/server.py: rename compact -> compress for context compression command - tui_gateway/server.py: rename /compact -> /density for display density toggle - ui-tui/core.ts: rename compact -> density for display density toggle - Internal config keys (tui_compact) and UI state (ctx.ui.compact) unchanged
This commit is contained in:
parent
cb39be92e4
commit
27a4e92802
3 changed files with 17 additions and 17 deletions
|
|
@ -456,7 +456,7 @@ class HermesACPAgent(acp.Agent):
|
|||
"tools": "List available tools",
|
||||
"context": "Show conversation context info",
|
||||
"reset": "Clear conversation history",
|
||||
"compact": "Compress conversation context",
|
||||
"compress": "Compress conversation context",
|
||||
"steer": "Inject guidance into the currently running agent turn",
|
||||
"queue": "Queue a prompt to run after the current turn finishes",
|
||||
"version": "Show Hermes version",
|
||||
|
|
@ -485,7 +485,7 @@ class HermesACPAgent(acp.Agent):
|
|||
"description": "Clear conversation history",
|
||||
},
|
||||
{
|
||||
"name": "compact",
|
||||
"name": "compress",
|
||||
"description": "Compress conversation context",
|
||||
},
|
||||
{
|
||||
|
|
@ -1756,7 +1756,7 @@ class HermesACPAgent(acp.Agent):
|
|||
"tools": self._cmd_tools,
|
||||
"context": self._cmd_context,
|
||||
"reset": self._cmd_reset,
|
||||
"compact": self._cmd_compact,
|
||||
"compress": self._cmd_compress,
|
||||
"steer": self._cmd_steer,
|
||||
"queue": self._cmd_queue,
|
||||
"version": self._cmd_version,
|
||||
|
|
@ -1898,7 +1898,7 @@ class HermesACPAgent(acp.Agent):
|
|||
lines.append(
|
||||
f"Compression: due now (threshold ~{threshold_tokens:,}"
|
||||
+ (f", {threshold_pct:.0f}%" if threshold_pct else "")
|
||||
+ "). Run /compact."
|
||||
+ "). Run /compress."
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
|
|
@ -1913,7 +1913,7 @@ class HermesACPAgent(acp.Agent):
|
|||
if getattr(agent, "compression_enabled", True) is False:
|
||||
lines.append("Compression is disabled for this agent.")
|
||||
else:
|
||||
lines.append("Tip: run /compact to compress manually before the threshold.")
|
||||
lines.append("Tip: run /compress to compress manually before the threshold.")
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
|
|
@ -1933,7 +1933,7 @@ class HermesACPAgent(acp.Agent):
|
|||
return "Conversation history cleared. Agent session state reset failed; see logs."
|
||||
return "Conversation history cleared."
|
||||
|
||||
def _cmd_compact(self, args: str, state: SessionState) -> str:
|
||||
def _cmd_compress(self, args: str, state: SessionState) -> str:
|
||||
if not state.history:
|
||||
return "Nothing to compress — conversation is empty."
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -11946,7 +11946,7 @@ def _(rid, params: dict) -> dict:
|
|||
)
|
||||
return _ok(rid, {"key": key, "value": nv})
|
||||
|
||||
if key == "compact":
|
||||
if key == "density":
|
||||
raw = str(value or "").strip().lower()
|
||||
cfg0 = _load_cfg()
|
||||
d0 = cfg0.get("display") if isinstance(cfg0.get("display"), dict) else {}
|
||||
|
|
@ -11958,7 +11958,7 @@ def _(rid, params: dict) -> dict:
|
|||
elif raw == "off":
|
||||
nv_b = False
|
||||
else:
|
||||
return _err(rid, 4002, f"unknown compact value: {value}")
|
||||
return _err(rid, 4002, f"unknown density value: {value}")
|
||||
_write_config_key("display.tui_compact", nv_b)
|
||||
return _ok(rid, {"key": key, "value": "on" if nv_b else "off"})
|
||||
|
||||
|
|
@ -12828,7 +12828,7 @@ def _(rid, params: dict) -> dict:
|
|||
)
|
||||
nv = "full" if dm == "expanded" else "collapsed"
|
||||
return _ok(rid, {"value": nv})
|
||||
if key == "compact":
|
||||
if key == "density":
|
||||
on = bool((_load_cfg().get("display") or {}).get("tui_compact", False))
|
||||
return _ok(rid, {"value": "on" if on else "off"})
|
||||
if key == "theme":
|
||||
|
|
@ -13273,7 +13273,7 @@ _TUI_HIDDEN: frozenset[str] = frozenset(
|
|||
)
|
||||
|
||||
_TUI_EXTRA: list[tuple[str, str, str]] = [
|
||||
("/compact", "Toggle compact display mode", "TUI"),
|
||||
("/density", "Toggle compact display mode", "TUI"),
|
||||
("/logs", "Show recent gateway log lines", "TUI"),
|
||||
(
|
||||
"/mouse",
|
||||
|
|
@ -14498,8 +14498,8 @@ def _(rid, params: dict) -> dict:
|
|||
text_lower = text.lower()
|
||||
extras = [
|
||||
{
|
||||
"text": "/compact",
|
||||
"display": "/compact",
|
||||
"text": "/density",
|
||||
"display": "/density",
|
||||
"meta": "Toggle compact display mode",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -278,19 +278,19 @@ export const coreCommands: SlashCommand[] = [
|
|||
},
|
||||
|
||||
{
|
||||
help: 'toggle compact transcript',
|
||||
name: 'compact',
|
||||
help: 'toggle compact display',
|
||||
name: 'density',
|
||||
run: (arg, ctx) => {
|
||||
const next = flagFromArg(arg, ctx.ui.compact)
|
||||
|
||||
if (next === null) {
|
||||
return ctx.transcript.sys('usage: /compact [on|off|toggle]')
|
||||
return ctx.transcript.sys('usage: /density [on|off|toggle]')
|
||||
}
|
||||
|
||||
patchUiState({ compact: next })
|
||||
ctx.gateway.rpc<ConfigSetResponse>('config.set', { key: 'compact', value: next ? 'on' : 'off' }).catch(() => {})
|
||||
ctx.gateway.rpc<ConfigSetResponse>('config.set', { key: 'density', value: next ? 'on' : 'off' }).catch(() => {})
|
||||
|
||||
queueMicrotask(() => ctx.transcript.sys(`compact ${next ? 'on' : 'off'}`))
|
||||
queueMicrotask(() => ctx.transcript.sys(`density ${next ? 'on' : 'off'}`))
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue