The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(commands): put desktop slash metadata on the CommandDef
Brooklyn Nicholson595ee9228957
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-composer-trigger.test.ts b/apps/desktop/src/app/chat/composer/hooks/use-composer-trigger.test.tsindex 44c010cb4f1..fd8599d7460 100644--- a/apps/desktop/src/app/chat/composer/hooks/use-composer-trigger.test.ts+++ b/apps/desktop/src/app/chat/composer/hooks/use-composer-trigger.test.ts@@ -1,12 +1,27 @@import type { Unstable_TriggerAdapter, Unstable_TriggerItem } from '@assistant-ui/core'import { act, renderHook } from '@testing-library/react'import { createRef } from 'react'-import { describe, expect, it, vi } from 'vitest'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'++import { rememberDesktopCommandsCatalog } from '@/lib/desktop-slash-commands'import { composerPlainText, renderComposerContents, RICH_INPUT_SLOT } from '../rich-editor'import { useComposerTrigger } from './use-composer-trigger'+beforeEach(() => {+ rememberDesktopCommandsCatalog({+ commands: {+ '/goal': { argument_mode: 'mixed', desktop: null },+ '/personality': { argument_mode: 'options', desktop: null }+ }+ })+})++afterEach(() => {+ rememberDesktopCommandsCatalog(undefined)+})+/** A live contentEditable seeded with `text`, caret parked at the end. */function mountEditor(text: string) {const editor = document.createElement('div')diff --git a/apps/desktop/src/app/chat/composer/rich-editor.test.ts b/apps/desktop/src/app/chat/composer/rich-editor.test.tsindex d3bfd60eedb..f618b1f9e1c 100644--- a/apps/desktop/src/app/chat/composer/rich-editor.test.ts+++ b/apps/desktop/src/app/chat/composer/rich-editor.test.ts@@ -1,4 +1,6 @@-import { describe, expect, it } from 'vitest'+import { afterEach, beforeEach, describe, expect, it } from 'vitest'++import { rememberDesktopCommandsCatalog } from '@/lib/desktop-slash-commands'import { insertInlineRefsIntoEditor } from './inline-refs'import {@@ -13,6 +15,16 @@ import {} from './rich-editor'import { placeCaretAtEnd } from './test-utils'+beforeEach(() => {+ rememberDesktopCommandsCatalog({+ commands: { '/goal': { argument_mode: 'mixed', desktop: null } }+ })+})++afterEach(() => {+ rememberDesktopCommandsCatalog(undefined)+})+describe('renderComposerContents', () => {it('renders refs and raw text without interpreting user text as HTML', () => {const editor = document.createElement('div')diff --git a/apps/desktop/src/app/chat/composer/slash-refs.test.ts b/apps/desktop/src/app/chat/composer/slash-refs.test.tsindex 2b50d750875..68a78504235 100644--- a/apps/desktop/src/app/chat/composer/slash-refs.test.ts+++ b/apps/desktop/src/app/chat/composer/slash-refs.test.ts@@ -1,4 +1,6 @@-import { describe, expect, it } from 'vitest'+import { afterEach, beforeEach, describe, expect, it } from 'vitest'++import { rememberDesktopCommandsCatalog } from '@/lib/desktop-slash-commands'import { slashCommandMatches } from './slash-refs'@@ -6,6 +8,16 @@ const commands = (text: string, options?: Parameters<typeof slashCommandMatches>slashCommandMatches(text, options).map(match => `${match.kind}:${match.command}`)describe('slashCommandMatches', () => {+ beforeEach(() => {+ rememberDesktopCommandsCatalog({+ commands: { '/goal': { argument_mode: 'mixed', desktop: null } }+ })+ })++ afterEach(() => {+ rememberDesktopCommandsCatalog(undefined)+ })+it('recognizes a leading command and a skill named mid-prose', () => {expect(commands('/some-skill clean this with /other-skill please')).toEqual(['skill:/some-skill',diff --git a/apps/desktop/src/lib/desktop-slash-commands.test.ts b/apps/desktop/src/lib/desktop-slash-commands.test.tsindex 6ba07a57213..3001b103aad 100644--- a/apps/desktop/src/lib/desktop-slash-commands.test.ts+++ b/apps/desktop/src/lib/desktop-slash-commands.test.ts@@ -3,8 +3,8 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'import {type CommandCatalogMeta,type CommandsCatalogLike,- type DesktopSlashArgumentMode,desktopSkinSlashCompletions,+ type DesktopSlashArgumentMode,desktopSlashCommandArgumentMode,desktopSlashDescription,desktopSlashUnavailableMessage,diff --git a/apps/desktop/src/lib/desktop-slash-commands.ts b/apps/desktop/src/lib/desktop-slash-commands.tsindex 4d81231df88..bfdbaa59339 100644--- a/apps/desktop/src/lib/desktop-slash-commands.ts+++ b/apps/desktop/src/lib/desktop-slash-commands.ts@@ -347,6 +347,7 @@ function liveCatalog(): CommandsCatalogLike | undefined {function catalogMeta(command: string): CommandCatalogMeta | undefined {const commands = liveCatalog()?.commands+if (!commands) {return undefined}@@ -359,6 +360,7 @@ function catalogMeta(command: string): CommandCatalogMeta | undefined {function catalogCanonical(normalized: string): string | undefined {const canon = liveCatalog()?.canon+if (!canon) {return undefined}@@ -390,6 +392,7 @@ function asArgumentMode(value: string | null | undefined): DesktopSlashArgumentMfunction specFromCatalog(command: string): DesktopCommandSpec | null {const entry = catalogMeta(command)+if (!entry) {return null}diff --git a/hermes_cli/commands.py b/hermes_cli/commands.pyindex 68435460a77..0a5b7677c5b 100644--- a/hermes_cli/commands.py+++ b/hermes_cli/commands.py@@ -17,7 +17,7 @@ import shutilimport subprocessimport timefrom collections.abc import Callable, Mapping-from dataclasses import dataclass, field, replace+from dataclasses import dataclass, fieldfrom typing import Any, Dict, Optional, Tuplefrom utils import is_truthy_value@@ -154,11 +154,11 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("topic", "Enable or inspect Telegram DM topic sessions", "Session",gateway_only=True, args_hint="[off|help|session-id]"),CommandDef("clear", "Clear screen and start a new session", "Session",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("redraw", "Force a full UI repaint (recovers from terminal drift)", "Session",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("history", "Show conversation history", "Session",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("save", "Export the current conversation (bare /save shows usage)", "Session",args_hint="<json|md|html> [filename] [redact]"),CommandDef("retry", "Retry the last message (resend to agent)", "Session"),@@ -169,7 +169,7 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("title", "Set a title for the current session", "Session",args_hint="[name]"),CommandDef("handoff", "Hand off this session to a messaging platform (Telegram, Discord, etc.)", "Session",- args_hint="<platform>", cli_only=True),+ args_hint="<platform>", cli_only=True, argument_mode="options"),CommandDef("branch", "Branch the current session (explore a different path)", "Session",aliases=("fork",), args_hint="[name]"),CommandDef("worktree", "Show, list, create, or prune isolated git worktrees", "Session",@@ -180,7 +180,8 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("rollback", "List or restore filesystem checkpoints (restores keep your hand-edits; --all overrides)", "Session",args_hint="[number] [--all]"),CommandDef("snapshot", "Create or restore state snapshots of Hermes config/state", "Session",- cli_only=True, aliases=("snap",), args_hint="[create|restore <id>|prune]"),+ cli_only=True, aliases=("snap",), args_hint="[create|restore <id>|prune]",+ desktop="terminal"),CommandDef("export", "Export a profile (config, skills, theme) to a shareable archive", "Configuration",cli_only=True, args_hint="[profile] [-o output.tar.gz]"),CommandDef("import", "Import a shared profile archive as a new profile", "Configuration",@@ -191,9 +192,11 @@ COMMAND_REGISTRY: list[CommandDef] = [gateway_only=True, args_hint="[reason | off]",busy_policy="dispatch"),CommandDef("approve", "Approve a pending dangerous command", "Session",- gateway_only=True, args_hint="[session|always]", busy_policy="dispatch"),+ gateway_only=True, args_hint="[session|always]", busy_policy="dispatch",+ desktop="messaging"),CommandDef("deny", "Deny a pending dangerous command (optionally with a reason)", "Session",- gateway_only=True, args_hint="[all] [reason]", busy_policy="dispatch"),+ gateway_only=True, args_hint="[all] [reason]", busy_policy="dispatch",+ desktop="messaging"),CommandDef("background", "Run a prompt in the background", "Session",aliases=("bg", "btw"), args_hint="<prompt>", busy_policy="dispatch"),CommandDef("agents", "Show active agents and running tasks", "Session",@@ -209,7 +212,7 @@ COMMAND_REGISTRY: list[CommandDef] = [args_hint="<prompt>", busy_policy="dispatch", busy_handler="steer"),CommandDef("goal", "Set a standing goal Hermes works on across turns until achieved", "Session",args_hint="[text | draft <text> | show | gate add <cmd> | pause | resume | clear | status | wait <pid> | unwait]",- busy_policy="dispatch", busy_handler="goal"),+ argument_mode="mixed", busy_policy="dispatch", busy_handler="goal"),CommandDef("heartbeat", "Set a recurring prompt that re-enters this session when idle", "Session",aliases=("hb",), args_hint="[every <interval> <prompt> | status | pause | resume | clear]",subcommands=("status", "pause", "resume", "clear"),@@ -221,7 +224,7 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("loop", "Re-run a prompt on a recurring interval in this session", "Session",aliases=("proactive",),args_hint="[interval] <prompt> [--times N] [--until <condition>] | status | pause | resume | stop",- busy_policy="dispatch", busy_handler="loop"),+ argument_mode="mixed", busy_policy="dispatch", busy_handler="loop"),CommandDef("moa", "Run one prompt through the default Mixture of Agents preset, then restore your model", "Session",args_hint="<prompt>", busy_policy="reject", busy_handler="moa"),CommandDef("subgoal", "Add or manage extra criteria on the active goal", "Session",@@ -239,28 +242,28 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("profile", "Show active profile name and home directory", "Info",busy_policy="dispatch", execute="profile"),CommandDef("sethome", "Set this chat as the home channel", "Session",- gateway_only=True, aliases=("set-home",)),+ gateway_only=True, aliases=("set-home",), desktop="terminal"),CommandDef("resume", "Resume a previously-named session", "Session",- args_hint="[name]"),+ args_hint="[name]", argument_mode="mixed"),# ConfigurationCommandDef("sessions", "Browse and resume previous sessions", "Session"),# ConfigurationCommandDef("config", "Show current configuration", "Configuration",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("model", "Switch model (session-scoped; --global to persist)", "Configuration",args_hint="[model] [--provider name] [--global|--session] [--refresh]",- busy_policy="reject", busy_handler="model"),+ busy_policy="reject", busy_handler="model", desktop="hidden"),CommandDef("codex-runtime", "Toggle codex app-server runtime for OpenAI/Codex models","Configuration", aliases=("codex_runtime",),args_hint="[auto|codex_app_server]",busy_policy="reject", busy_handler="codex-runtime"),CommandDef("personality", "Set a predefined personality", "Configuration",- args_hint="[name]"),+ args_hint="[name]", argument_mode="options"),CommandDef("statusbar", "Toggle the context/model status bar", "Configuration",- cli_only=True, aliases=("sb",)),+ cli_only=True, aliases=("sb",), desktop="terminal"),CommandDef("battery", "Toggle a color-coded battery indicator in the status bar","Configuration", cli_only=True, args_hint="[on|off|status]",subcommands=("on", "off", "status")),@@ -273,13 +276,14 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("verbose", "Cycle tool progress display: off -> new -> all -> verbose","Configuration", cli_only=True,gateway_config_gate="display.tool_progress_command",- busy_policy="dispatch"),+ busy_policy="dispatch", desktop="terminal"),CommandDef("focus", "Toggle focus view — show only your prompt and the final response","Configuration", cli_only=True, args_hint="[on|off|status]",subcommands=("on", "off", "status")),CommandDef("footer", "Toggle gateway runtime-metadata footer on final replies","Configuration", args_hint="[on|off|status]",- subcommands=("on", "off", "status"), busy_policy="dispatch"),+ subcommands=("on", "off", "status"), busy_policy="dispatch",+ desktop="terminal"),CommandDef("yolo", "Toggle YOLO mode (skip all dangerous command approvals)","Configuration", busy_policy="dispatch"),CommandDef("approvals", "Show or set the persistent dangerous-command approval mode",@@ -287,34 +291,40 @@ COMMAND_REGISTRY: list[CommandDef] = [subcommands=("manual", "smart", "off")),CommandDef("reasoning", "Manage reasoning effort and display", "Configuration",args_hint="[level|show|hide|full|clamp] [--global]",- subcommands=("none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra", "show", "hide", "on", "off", "full", "clamp", "--global")),+ subcommands=("none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra", "show", "hide", "on", "off", "full", "clamp", "--global"),+ desktop="advanced"),CommandDef("fast", "Toggle fast mode — OpenAI Priority Processing / Anthropic Fast Mode (Normal/Fast)", "Configuration",args_hint="[normal|fast|status] [--global]",- subcommands=("normal", "fast", "status", "on", "off", "--global")),+ subcommands=("normal", "fast", "status", "on", "off", "--global"),+ desktop="advanced"),CommandDef("skin", "Show or change the display skin/theme", "Configuration",- cli_only=True, args_hint="[name]"),+ cli_only=True, args_hint="[name]", argument_mode="options"),CommandDef("indicator", "Pick the TUI busy-indicator style", "Configuration",cli_only=True, args_hint=f"[{'|'.join(INDICATOR_STYLES)}]",- subcommands=INDICATOR_STYLES),+ subcommands=INDICATOR_STYLES, desktop="terminal"),CommandDef("voice", "Toggle voice mode", "Configuration",- args_hint="[on|off|tts|status]", subcommands=("on", "off", "tts", "status")),+ args_hint="[on|off|tts|status]", subcommands=("on", "off", "tts", "status"),+ desktop="composer-voice"),CommandDef("wake", "Toggle the 'Hey Hermes' wake word listener", "Configuration",cli_only=True, args_hint="[on|off|status]",subcommands=("on", "off", "status")),CommandDef("busy", "Control what Enter does while Hermes is working", "Configuration",cli_only=True, args_hint="[queue|steer|interrupt|status]",- subcommands=("queue", "steer", "interrupt", "status")),+ subcommands=("queue", "steer", "interrupt", "status"),+ desktop="terminal"),# Tools & SkillsCommandDef("tools", "Manage tools: /tools [list|disable|enable] [name...]", "Tools & Skills",- args_hint="[list|disable|enable] [name...]", cli_only=True),+ args_hint="[list|disable|enable] [name...]", cli_only=True,+ argument_mode="options"),CommandDef("toolsets", "List available toolsets", "Tools & Skills",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("skills", "Search, install, inspect, or manage skills","Tools & Skills", cli_only=True,gateway_config_gate="skills.write_approval",subcommands=("search", "browse", "inspect", "install", "audit",- "pending", "approve", "reject", "diff", "approval")),+ "pending", "approve", "reject", "diff", "approval"),+ desktop="settings"),CommandDef("memory", "Review pending memory writes / toggle the approval gate","Tools & Skills",args_hint="[pending|approve|reject|approval] [id|on|off]",@@ -331,7 +341,8 @@ COMMAND_REGISTRY: list[CommandDef] = ["Tools & Skills", args_hint="[notes]"),CommandDef("cron", "Manage scheduled tasks", "Tools & Skills",cli_only=True, args_hint="[subcommand]",- subcommands=("list", "add", "create", "edit", "pause", "resume", "run", "remove")),+ subcommands=("list", "add", "create", "edit", "pause", "resume", "run", "remove"),+ desktop="terminal"),CommandDef("suggestions", "Review suggested automations (accept/dismiss)","Tools & Skills", aliases=("suggest",), args_hint="[accept|dismiss N | catalog]",subcommands=("accept", "dismiss", "catalog", "clear")),@@ -339,7 +350,8 @@ COMMAND_REGISTRY: list[CommandDef] = ["Tools & Skills", aliases=("bp",), args_hint="[name] [slot=value ...]"),CommandDef("curator", "Background skill maintenance (status, run, pin, archive, list-archived)","Tools & Skills", args_hint="[subcommand]",- subcommands=("status", "run", "pause", "resume", "pin", "unpin", "restore", "list-archived")),+ subcommands=("status", "run", "pause", "resume", "pin", "unpin", "restore", "list-archived"),+ desktop="advanced"),CommandDef("kanban", "Multi-profile collaboration board (tasks, links, comments)","Tools & Skills", args_hint="[subcommand]",subcommands=("init", "boards", "create", "list", "ls", "show", "assign",@@ -348,18 +360,18 @@ COMMAND_REGISTRY: list[CommandDef] = ["archive", "tail", "dispatch", "stats", "notify-subscribe","notify-list", "notify-unsubscribe", "log", "runs","heartbeat", "assignees", "context", "specify", "gc"),- busy_policy="dispatch"),+ busy_policy="dispatch", desktop="advanced"),CommandDef("reload", "Reload .env variables into the running session", "Tools & Skills",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("reload-mcp", "Reload MCP servers from config", "Tools & Skills",- aliases=("reload_mcp",)),+ aliases=("reload_mcp",), desktop="advanced"),CommandDef("reload-skills", "Re-scan ~/.hermes/skills/ for newly installed or removed skills",- "Tools & Skills", aliases=("reload_skills",)),+ "Tools & Skills", aliases=("reload_skills",), desktop="advanced"),CommandDef("browser", "Connect browser tools to your live Chromium-family browser via CDP, or switch to Browser Use mode", "Tools & Skills",cli_only=True, args_hint="[connect|disconnect|status|use]",subcommands=("connect", "disconnect", "status", "use")),CommandDef("plugins", "List installed plugins and their status",- "Tools & Skills", cli_only=True),+ "Tools & Skills", cli_only=True, desktop="terminal"),# InfoCommandDef("commands", "Browse all commands and skills (paginated)", "Info",@@ -370,26 +382,26 @@ COMMAND_REGISTRY: list[CommandDef] = [CommandDef("palette", "Open the fuzzy command palette (also Ctrl+P)", "Info",cli_only=True, busy_policy="dispatch"),CommandDef("restart", "Gracefully restart the gateway after draining active runs", "Session",- gateway_only=True, busy_policy="dispatch"),+ gateway_only=True, busy_policy="dispatch", desktop="terminal"),CommandDef("usage", "Show token usage and rate limits; `reset` redeems a banked Codex limit reset", "Info",args_hint="[reset [--force]]"),CommandDef("subscription", "View your Nous plan and change it in the browser", "Info",cli_only=True, aliases=("upgrade",)),CommandDef("topup", "Show your Nous balance and manage billing on the portal", "Info"),CommandDef("insights", "Show usage insights and analytics", "Info",- args_hint="[days]"),+ args_hint="[days]", desktop="advanced"),CommandDef("platforms", "Show gateway/messaging platform status", "Info",- cli_only=True, aliases=("gateway",)),+ cli_only=True, aliases=("gateway",), desktop="terminal"),CommandDef("platform", "Pause, resume, or list a failing gateway platform", "Info",gateway_only=True, args_hint="<pause|resume|list> [name]"),CommandDef("copy", "Copy the last assistant response to clipboard", "Info",- cli_only=True, args_hint="[number]"),+ cli_only=True, args_hint="[number]", desktop="terminal"),CommandDef("paste", "Attach clipboard image from your clipboard", "Info",- cli_only=True),+ cli_only=True, desktop="terminal"),CommandDef("image", "Attach a local image file for your next prompt", "Info",- cli_only=True, args_hint="<path>"),+ cli_only=True, args_hint="<path>", desktop="terminal"),CommandDef("update", "Update Hermes Agent to the latest version", "Info",- busy_policy="dispatch"),+ busy_policy="dispatch", desktop="terminal"),CommandDef("version", "Show Hermes Agent version", "Info", aliases=("v",),busy_policy="dispatch", execute="version"),CommandDef("debug", "Upload debug report (system info + logs) and get shareable links", "Info",@@ -397,80 +409,23 @@ COMMAND_REGISTRY: list[CommandDef] = [# ExitCommandDef("quit", "Exit the CLI (use --delete to also remove session history)", "Exit",- cli_only=True, aliases=("exit",), args_hint="[--delete]"),+ cli_only=True, aliases=("exit",), args_hint="[--delete]",+ desktop="terminal"),]-# Desktop composer / popover metadata. Lives next to the registry so a new-# CommandDef can declare how desktop should treat it — the TS table is only-# the local-action overlay (pickers, Electron actions, dedicated RPCs).-_DESKTOP_UNAVAILABLE: dict[str, str] = {- "busy": "terminal",- "clear": "terminal",- "config": "terminal",- "copy": "terminal",- "cron": "terminal",- "density": "terminal",- "details": "terminal",- "footer": "terminal",- "gateway": "terminal",- "history": "terminal",- "image": "terminal",- "indicator": "terminal",- "logs": "terminal",- "mouse": "terminal",- "paste": "terminal",- "platforms": "terminal",- "plugins": "terminal",- "quit": "terminal",- "redraw": "terminal",- "reload": "terminal",- "restart": "terminal",- "sethome": "terminal",- "snapshot": "terminal",- "statusbar": "terminal",- "toolsets": "terminal",- "update": "terminal",- "verbose": "terminal",- "approve": "messaging",- "deny": "messaging",- "skills": "settings",- "pets": "settings",- "curator": "advanced",- "fast": "advanced",- "insights": "advanced",- "kanban": "advanced",- "reasoning": "advanced",- "reload-mcp": "advanced",- "reload-skills": "advanced",- "voice": "composer-voice",-}--_DESKTOP_HIDDEN: frozenset[str] = frozenset({"model"})--# Only the cases ``args_hint`` / ``subcommands`` would get wrong.-_ARGUMENT_MODE_OVERRIDES: dict[str, str] = {- "goal": "mixed",- "handoff": "options",- "loop": "mixed",- "personality": "options",- "resume": "mixed",- "skin": "options",- "tools": "options",-}--_TEXT_HINTS = ("<prompt>", "[text", "instructions", "[interval]", "<what", "[focus", "[review")+# Used only to distinguish ``mixed`` (subcommands plus free-text) from+# ``options`` (subcommand list only). A bare ``args_hint`` with no+# subcommands is always ``text`` — do not add tokens here for that path.+_PROSE_HINTS = ("<prompt>", "[text", "instructions", "[interval]", "<what")def infer_argument_mode(cmd: CommandDef) -> str | None:- """Composer mode for a command: explicit, override, or inferred from args."""+ """Composer mode: explicit on the CommandDef, else inferred from its args."""if cmd.argument_mode in {"options", "text", "mixed"}:return cmd.argument_mode- override = _ARGUMENT_MODE_OVERRIDES.get(cmd.name)- if override:- return override- hint = (cmd.args_hint or "").lower()- if cmd.subcommands and hint and any(token in hint for token in _TEXT_HINTS):+ hint = (cmd.args_hint or "").strip()+ if cmd.subcommands and hint and any(token in hint.lower() for token in _PROSE_HINTS):return "mixed"if cmd.subcommands:return "options"@@ -480,26 +435,8 @@ def infer_argument_mode(cmd: CommandDef) -> str | None:def command_desktop_meta(cmd: CommandDef) -> dict[str, str | None]:- """Wire shape for ``commands.catalog`` — argument mode + desktop availability."""- desktop = cmd.desktop- if desktop is None and cmd.name in _DESKTOP_HIDDEN:- desktop = "hidden"- if desktop is None:- desktop = _DESKTOP_UNAVAILABLE.get(cmd.name)- return {"argument_mode": infer_argument_mode(cmd), "desktop": desktop}---def _apply_desktop_fields(cmds: list[CommandDef]) -> list[CommandDef]:- applied: list[CommandDef] = []- for cmd in cmds:- meta = command_desktop_meta(cmd)- if meta["argument_mode"] != cmd.argument_mode or meta["desktop"] != cmd.desktop:- cmd = replace(cmd, argument_mode=meta["argument_mode"], desktop=meta["desktop"])- applied.append(cmd)- return applied---COMMAND_REGISTRY = _apply_desktop_fields(COMMAND_REGISTRY)+ """Wire shape for ``commands.catalog`` — reads the CommandDef, nothing else."""+ return {"argument_mode": infer_argument_mode(cmd), "desktop": cmd.desktop}# ---------------------------------------------------------------------------diff --git a/tests/hermes_cli/test_commands.py b/tests/hermes_cli/test_commands.pyindex fa591b680d8..501a9d200d3 100644--- a/tests/hermes_cli/test_commands.py+++ b/tests/hermes_cli/test_commands.py@@ -74,11 +74,11 @@ class TestCommandRegistry:assert resolve_command(alias).name == cmd.name or alias == cmd.name, \f"Alias '{alias}' of '{cmd.name}' shadows canonical '{target.name}'"- def test_desktop_meta_marks_review_typeable_and_terminal_hidden(self):+ def test_desktop_meta_lives_on_the_command_def(self):review = resolve_command("review")assert review is not None- assert review.argument_mode == "text"- assert review.desktop is None+ assert review.argument_mode is None+ assert infer_argument_mode(review) == "text"assert command_desktop_meta(review) == {"argument_mode": "text", "desktop": None}clear = resolve_command("clear")@@ -89,9 +89,14 @@ class TestCommandRegistry:assert model is not Noneassert model.desktop == "hidden"- def test_argument_mode_infers_text_from_args_hint(self):- cmd = CommandDef("demo", "Demo", "Session", args_hint="<prompt>")- assert infer_argument_mode(cmd) == "text"+ goal = resolve_command("goal")+ assert goal is not None+ assert goal.argument_mode == "mixed"++ def test_argument_mode_infers_text_from_any_args_hint(self):+ assert infer_argument_mode(CommandDef("demo", "Demo", "Session", args_hint="<prompt>")) == "text"+ assert infer_argument_mode(CommandDef("ask", "Ask", "Session", args_hint="<query>")) == "text"+ assert infer_argument_mode(CommandDef("note", "Note", "Session", args_hint="[message]")) == "text"# ---------------------------------------------------------------------------diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex 0334738f869..80d94deee44 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -272,9 +272,9 @@ def _(rid, params: dict) -> dict:for cmd in COMMAND_REGISTRY:meta = command_desktop_meta(cmd)- commands[f"/{cmd.name}"] = meta+ commands[f"/{cmd.name}"] = dict(meta)for alias in cmd.aliases:- commands[f"/{alias}"] = meta+ commands[f"/{alias}"] = dict(meta)if cmd.name in _TUI_HIDDEN or cmd.gateway_only:continue