From ff06f6d0326663b24c5f51a5bc0bc3e45ffe6b2d Mon Sep 17 00:00:00 2001 From: webtecnica Date: Mon, 24 Aug 2026 10:13:57 -0300 Subject: [PATCH] fix(commands): exact cross-authority parity for announced slash commands --- static/commands.js | 13 +++++-------- static/messages.js | 12 +++++++++++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/static/commands.js b/static/commands.js index 79503005..ea3ff0aa 100644 --- a/static/commands.js +++ b/static/commands.js @@ -1,3 +1,8 @@ +const _BACKEND_EXECUTED_AGENT_COMMANDS = ['reload-mcp','reload-skills','codex-runtime','credits']; +const _WEBUI_DISPATCHABLE_AGENT_COMMANDS = new Set([ + 'reload-mcp','reload-skills','codex-runtime','credits', + 'moa','sessions','resume','pet' +]); // ── Slash commands ────────────────────────────────────────────────────────── // Built-in commands intercepted before send(). Each command runs locally // (no round-trip to the agent) and shows feedback via toast or local message. @@ -199,14 +204,6 @@ function executeCommand(text){ // subset of the dispatched list (fail-closed), never a superset. // Plugin-category commands are always dispatchable via the plugin exec // transport. #6951. -const _WEBUI_DISPATCHABLE_AGENT_COMMANDS=new Set([ - // Backend-executed via /api/commands/exec (see _ALLOWED_AGENT_COMMANDS in api/commands.py). - 'reload-mcp','reload-skills','codex-runtime','credits', - // Native WebUI behaviors handled inside send() without an agent round-trip. - 'moa','sessions','resume', - // Desktop Companion extension command handled by handlePetSlashCommand(). - 'pet', -]); function _isWebuiDispatchableAgentCommand(cmd){ const name=String(cmd&&cmd.name||'').trim().toLowerCase(); diff --git a/static/messages.js b/static/messages.js index 7592dd6e..1a7380dd 100644 --- a/static/messages.js +++ b/static/messages.js @@ -1,3 +1,14 @@ +const _BACKEND_EXECUTED_AGENT_COMMANDS = ['reload-mcp','reload-skills','codex-runtime','credits']; +const _AGENT_COMMAND_ALIASES = { + 'reload_mcp': 'reload-mcp', + 'reload_skills': 'reload-skills', + 'codex_runtime': 'codex-runtime', + 'credits': 'credits' +}; +const _AGENT_COMMANDS_RUN_ON_WEBUI = new Set([ + 'reload-mcp','reload-skills','codex-runtime','credits', + 'reload_mcp','reload_skills','codex_runtime','credits' +]); function _markSessionViewed(sid, messageCount) { if(typeof _setSessionViewedCount!=='function' || !sid) return; const next = Number.isFinite(messageCount) ? Number(messageCount) : 0; @@ -1184,7 +1195,6 @@ const _sessionTitleProvisionalBySid = new Map(); // their canonical command is registered on the backend (for example // /reload-mcp). Keep this intentionally narrow and include underscore variants // observed by users so typing either form still routes through executeAgentCommand. -const _AGENT_COMMANDS_RUN_ON_WEBUI = new Set(['reload-mcp', 'reload_mcp', 'reload-skills', 'reload_skills', 'codex-runtime', 'codex_runtime', 'credits']); function _clearStaleBusyStateBeforeSend({compressionRunning=false}={}){ if(!S||!S.busy||compressionRunning) return false;