fix(commands): exact cross-authority parity for announced slash commands

This commit is contained in:
webtecnica authored and n committed 2026-09-20 11:59:09 +00:00
1 parent a85c1d1f62
commit ff06f6d032
2 files changed
+16 -9

No files matched your search

+5 -8
View File
@@ -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();
+11 -1
View File
@@ -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;