The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): recognize every registry built-in offline so /context groups as a Command
teknium1969913bb96ff
diff --git a/apps/desktop/src/lib/desktop-slash-commands.test.ts b/apps/desktop/src/lib/desktop-slash-commands.test.tsindex 43726561eb1..a4f040ea38d 100644--- a/apps/desktop/src/lib/desktop-slash-commands.test.ts+++ b/apps/desktop/src/lib/desktop-slash-commands.test.ts@@ -10,6 +10,7 @@ import {desktopSlashUnavailableMessage,filterDesktopCommandsCatalog,isDesktopSlashCommand,+ isDesktopSlashExtensionCommand,isDesktopSlashSuggestion,isModelPickerCommand,isPickerCommand,@@ -479,7 +480,7 @@ describe('registry-derived block-list (contract with hermes_cli/commands.py)', (it('marks every registry row with a reason unavailable offline, without a hand-typed copy', () => {for (const [name, reason] of Object.entries(desktopSlashRegistry)) {- if (reason === 'hidden') {+ if (reason === null || reason === 'hidden') {continue}@@ -494,6 +495,23 @@ describe('registry-derived block-list (contract with hermes_cli/commands.py)', (}})+ it('recognizes offered built-ins and their aliases offline as Commands, never as skills (#116159)', () => {+ // Cold catalog: nothing remembered, nothing cached. /context has no+ // desktop disposition and no hand-typed TS row, so only the dump can+ // vouch for it — and it must, or the popover files it under Skills and+ // Enter takes the extension path.+ for (const name of ['/context', '/ctx', '/usage']) {+ expect(desktopSlashRegistry[name as keyof typeof desktopSlashRegistry]).toBeNull()+ expect(isDesktopSlashExtensionCommand(name)).toBe(false)+ expect(slashCompletionGroup(name)).toBe('Commands')+ expect(isDesktopSlashCommand(name)).toBe(true)+ expect(resolveDesktopCommand(name)?.surface.kind).toBe('exec')+ }++ // Control: an unknown skill command still groups as a skill offline.+ expect(slashCompletionGroup('/gif-search')).toBe('Skills')+ })+it('keeps the TS-only list disjoint from the registry dump', () => {for (const names of Object.values(TS_ONLY_NO_DESKTOP_SURFACE)) {for (const name of names) {diff --git a/apps/desktop/src/lib/desktop-slash-commands.ts b/apps/desktop/src/lib/desktop-slash-commands.tsindex b3e3668c43b..19265bdd979 100644--- a/apps/desktop/src/lib/desktop-slash-commands.ts+++ b/apps/desktop/src/lib/desktop-slash-commands.ts@@ -298,7 +298,7 @@ const DESKTOP_COMMAND_SPECS: readonly DesktopCommandSpec[] = [* the JSON drifts from either side, so the Python registry stays the single* place a command's desktop disposition is authored.*/-const REGISTRY_DESKTOP_SURFACE: Readonly<Record<string, string>> = desktopSlashRegistry+const REGISTRY_DESKTOP_SURFACE: Readonly<Record<string, string | null>> = desktopSlashRegistry/*** Commands the Python registry has never heard of, so they cannot ride the@@ -318,20 +318,35 @@ export const TS_ONLY_NO_DESKTOP_SURFACE: Record<DesktopUnavailableReason, readonconst LOCAL_SPEC_NAMES = new Set(DESKTOP_COMMAND_SPECS.flatMap(spec => [spec.name, ...(spec.aliases ?? [])]))-/** Registry rows with a real unavailability reason. `hidden` (e.g. `/model`) is- * a popover flag on an executable command and is read from the live catalog- * by `specFromCatalog`; a local spec always wins over the dump. */-function registryUnavailableSpecs(): DesktopCommandSpec[] {+/** Registry rows the local table doesn't already curate. A row with a real+ * unavailability reason blocks the command; a `null` row is an OFFERED+ * built-in (`/context`, `/usage`, …) and becomes a plain `exec` spec, so the+ * desktop recognizes every registry command offline — otherwise, before the+ * first `commands.catalog` round-trip (or against an older gateway whose+ * `complete.slash` rows carry no `kind`), `/context` read as a skill: Skills+ * group in the popover, skill chip on paste, extension dispatch (#116159).+ * `hidden` (e.g. `/model`) is a popover flag on an executable command and is+ * read from the live catalog by `specFromCatalog`; a local spec always wins+ * over the dump. */+function registryDerivedSpecs(): DesktopCommandSpec[] {return Object.entries(REGISTRY_DESKTOP_SURFACE).flatMap(([name, value]) => {+ if (LOCAL_SPEC_NAMES.has(name)) {+ return []+ }++ if (value === null) {+ return [{ name, surface: exec() }]+ }+const reason = asUnavailableReason(value)- return reason && !LOCAL_SPEC_NAMES.has(name) ? [{ name, surface: unavailable(reason) }] : []+ return reason ? [{ name, surface: unavailable(reason) }] : []})}const ALL_SPECS: readonly DesktopCommandSpec[] = [...DESKTOP_COMMAND_SPECS,- ...registryUnavailableSpecs(),+ ...registryDerivedSpecs(),...(Object.entries(TS_ONLY_NO_DESKTOP_SURFACE) as [DesktopUnavailableReason, readonly string[]][]).flatMap(([reason, names]) => names.map(name => ({ name, surface: unavailable(reason) })))@@ -339,6 +354,15 @@ const ALL_SPECS: readonly DesktopCommandSpec[] = [const SPEC_BY_NAME = new Map<string, DesktopCommandSpec>(ALL_SPECS.map(spec => [spec.name, spec]))+/** Names whose only local spec is the dump's offline `exec` placeholder. The+ * live catalog knows more about these (argument mode, `hidden`), so it wins+ * once it has answered; the placeholder only covers the cold gap. */+const REGISTRY_OFFERED_NAMES = new Set(+ Object.entries(REGISTRY_DESKTOP_SURFACE).flatMap(([name, value]) =>+ value === null && !LOCAL_SPEC_NAMES.has(name) ? [name] : []+ )+)+const ALIAS_TO_CANONICAL = new Map<string, string>(ALL_SPECS.flatMap(spec => (spec.aliases ?? []).map(alias => [alias, spec.name] as const)))@@ -464,7 +488,14 @@ export function canonicalDesktopSlashCommand(command: string): string {/** Resolve a command (or alias) to its desktop spec, or null for unknown/extension commands. */export function resolveDesktopCommand(command: string): DesktopCommandSpec | null {- return SPEC_BY_NAME.get(canonicalDesktopSlashCommand(command)) ?? specFromCatalog(command)+ const canonical = canonicalDesktopSlashCommand(command)+ const local = SPEC_BY_NAME.get(canonical)++ if (local && REGISTRY_OFFERED_NAMES.has(canonical)) {+ return specFromCatalog(command) ?? local+ }++ return local ?? specFromCatalog(command)}function isKnownHermesSlashCommand(command: string): boolean {diff --git a/apps/desktop/src/lib/desktop-slash-registry.json b/apps/desktop/src/lib/desktop-slash-registry.jsonindex 91917627df7..796af8cabfe 100644--- a/apps/desktop/src/lib/desktop-slash-registry.json+++ b/apps/desktop/src/lib/desktop-slash-registry.json@@ -1,43 +1,129 @@{+ "/agents": null,+ "/approvals": null,"/approve": "messaging",+ "/battery": null,+ "/bg": null,+ "/blueprint": null,+ "/bp": null,+ "/branch": null,+ "/browser": null,+ "/btw": null,+ "/bundles": null,"/busy": "terminal","/clear": "terminal",+ "/codex-runtime": null,+ "/codex_runtime": null,+ "/commands": null,+ "/compact": null,+ "/compose": null,+ "/compress": null,"/config": "terminal",+ "/context": null,"/copy": "terminal","/cron": "terminal",+ "/ctx": null,"/curator": "advanced",+ "/debug": null,"/deny": "messaging",+ "/diff": null,+ "/egress": null,"/exit": "terminal",+ "/export": null,"/fast": "advanced",+ "/focus": null,"/footer": "terminal",+ "/fork": null,"/gateway": "terminal",+ "/generate-pet": null,+ "/goal": null,+ "/handoff": null,+ "/hatch": null,+ "/hb": null,+ "/heartbeat": null,+ "/help": null,"/history": "terminal","/image": "terminal",+ "/import": null,"/indicator": "terminal",+ "/init": null,"/insights": "advanced",+ "/journey": null,"/kanban": "advanced",+ "/learn": null,+ "/learning": null,"/login": "settings",+ "/loop": null,+ "/memory": null,+ "/memory-graph": null,+ "/moa": null,"/model": "hidden",+ "/new": null,+ "/palette": null,"/paste": "terminal",+ "/pause": null,+ "/personality": null,+ "/pet": null,+ "/plan": null,+ "/platform": null,"/platforms": "terminal","/plugins": "terminal",+ "/proactive": null,+ "/profile": null,+ "/prompt": null,+ "/q": null,+ "/queue": null,"/quit": "terminal",+ "/reasoning": null,"/redraw": "terminal",+ "/refine": null,"/reload": "terminal","/reload-mcp": "advanced","/reload-skills": "advanced","/reload_mcp": "advanced","/reload_skills": "advanced",+ "/reset": null,"/restart": "terminal",+ "/resume": null,+ "/retry": null,+ "/review": null,+ "/rollback": null,+ "/save": null,"/sb": "terminal",+ "/sessions": null,"/set-home": "terminal","/sethome": "terminal","/skills": "settings",+ "/skin": null,"/snap": "terminal","/snapshot": "terminal",+ "/start": null,+ "/status": null,"/statusbar": "terminal",+ "/steer": null,+ "/stop": null,+ "/subgoal": null,+ "/subscription": null,+ "/suggest": null,+ "/suggestions": null,+ "/tasks": null,+ "/timestamps": null,+ "/title": null,+ "/tools": null,"/toolsets": "terminal",+ "/topic": null,+ "/topup": null,+ "/ts": null,+ "/undo": null,"/update": "terminal",+ "/upgrade": null,+ "/usage": null,+ "/v": null,"/verbose": "terminal",- "/voice": "composer-voice"+ "/version": null,+ "/voice": "composer-voice",+ "/wake": null,+ "/whoami": null,+ "/worktree": null,+ "/yolo": null}diff --git a/hermes_cli/commands.py b/hermes_cli/commands.pyindex 47fd759bb8b..77e308947fa 100644--- a/hermes_cli/commands.py+++ b/hermes_cli/commands.py@@ -326,8 +326,12 @@ def command_desktop_meta(cmd: CommandDef) -> dict[str, str | None]:return {"argument_mode": infer_argument_mode(cmd), "desktop": cmd.desktop}-def desktop_surface_registry() -> dict[str, str]:- """``/name`` (and every alias) -> ``desktop`` disposition, for each command that has one.+def desktop_surface_registry() -> dict[str, str | None]:+ """``/name`` (and every alias) -> ``desktop`` disposition for EVERY registry command.++ Offered built-ins (no ``desktop=`` value) map to ``None``: the desktop needs their names+ too, or offline it cannot tell ``/context`` from a skill command and files it under+ Skills / routes it down the extension path until the live catalog warms up.The desktop app reads this live from ``commands.catalog``; the copy committed at``apps/desktop/src/lib/desktop-slash-registry.json`` (``scripts/dump_desktop_slash_registry.py``)@@ -335,9 +339,8 @@ def desktop_surface_registry() -> dict[str, str]:command's desktop disposition is authored. A test on each side fails when the two drift."""return {- f"/{key}": cmd.desktop+ f"/{key}": cmd.desktop or Nonefor cmd in COMMAND_REGISTRY- if cmd.desktopfor key in (cmd.name, *cmd.aliases)}diff --git a/tests/hermes_cli/test_desktop_slash_registry.py b/tests/hermes_cli/test_desktop_slash_registry.pyindex 70dbb81ee64..ef34fac950e 100644--- a/tests/hermes_cli/test_desktop_slash_registry.py+++ b/tests/hermes_cli/test_desktop_slash_registry.py@@ -26,11 +26,20 @@ def test_desktop_surface_registry_covers_every_alias_with_its_canonical_value():registry = desktop_surface_registry()for cmd in COMMAND_REGISTRY:for key in (cmd.name, *cmd.aliases):- assert registry.get(f"/{key}") == cmd.desktop, key+ assert registry.get(f"/{key}") == (cmd.desktop or None), key+ assert f"/{key}" in registry, keyfor key in registry:assert resolve_command(key) is not None, key+def test_offered_built_ins_are_present_as_null_rows():+ # #116159: /context (alias /ctx) has no desktop disposition — offline the desktop+ # still needs its name to keep it out of the Skills group and on the built-in path.+ registry = desktop_surface_registry()+ assert "/context" in registry and registry["/context"] is None+ assert "/ctx" in registry and registry["/ctx"] is None++def test_dump_script_check_mode_is_green_on_the_committed_json_and_red_on_drift(tmp_path):"""``--check`` is the shell-usable twin of the equality test: 0 on the committed file, 1 on a stale copy."""proc = subprocess.run(