fix(ai): hide the /ask slash command from the composer list when AI is off (LC-686) #655
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/LC-686-ai-menu-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sibling gap to the menu-item fix in this PR: the per-message AI actions now hide when the AI flag is off, but the /ask slash command still appeared in the composer's slash autocomplete, /help, and the argument-hint bar. The route (assistant::handle_ask) already refuses with 403 when AI is unavailable, so this closes the UI half so /ask is not advertised when it cannot run - consistent with Catch me up and the AI menu items.
llm_onlyflag, set onask. visible_commands / exact_command drop llm_only builtins unless AI is available for the viewer's room.Dispatch is unchanged: typing /ask still routes to handle_ask, which enforces the real flag + role + room-assistant-enabled gate server-side. routes_slash integration tests pass (none asserted /ask in the list).
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01PBAyCesyqJkZ5JgixXf9Lf
Sibling gap to the menu-item fix in this PR: the per-message AI actions now hide when the AI flag is off, but the /ask slash command still appeared in the composer's slash autocomplete, /help, and the argument-hint bar. The route (assistant::handle_ask) already refuses with 403 when AI is unavailable, so this closes the UI half so /ask is not advertised when it cannot run - consistent with Catch me up and the AI menu items. - commands::BuiltinCommand gains an `llm_only` flag, set on `ask`. visible_commands / exact_command drop llm_only builtins unless AI is available for the viewer's room. - New slash::ai_slash_available(state, user, room_id) mirrors the menu items' [data-lc-llm] gate exactly: runtime flag on, an LLM configured, and the viewer privileged in this room (a privilege-lookup error degrades to hidden). - The autocomplete query carries room_id (the composer passes {{ room.id }} on both the list and hint requests); absent room_id (older clients) hides the AI command, the safe default. The /help dispatch path computes availability from its room too. Dispatch is unchanged: typing /ask still routes to handle_ask, which enforces the real flag + role + room-assistant-enabled gate server-side. routes_slash integration tests pass (none asserted /ask in the list). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PBAyCesyqJkZ5JgixXf9Lf