fix(confirmations): guarded-action handling across webchat and tui
This commit is contained in:
@@ -24,6 +24,9 @@ const SLASH_COMMANDS = [
|
||||
{ name: '/usage', desc: 'Show token usage' },
|
||||
{ name: '/status', desc: 'Show system health' },
|
||||
{ name: '/model', desc: 'Show current model' },
|
||||
{ name: '/approvals', desc: 'List pending guarded actions' },
|
||||
{ name: '/approve', desc: 'Approve latest or by id' },
|
||||
{ name: '/deny', desc: 'Deny latest or by id' },
|
||||
];
|
||||
|
||||
// ── Helpers ─────────────────────────────────────────────────
|
||||
@@ -402,6 +405,9 @@ function parseSlashCommand(text) {
|
||||
case '/usage': return { type: 'usage' };
|
||||
case '/status': return { type: 'status' };
|
||||
case '/model': return { type: 'model', args };
|
||||
case '/approvals': return { type: 'approvals' };
|
||||
case '/approve': return { type: 'approve', args };
|
||||
case '/deny': return { type: 'deny', args };
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -439,6 +445,9 @@ async function handleSlashCommand(cmd, client) {
|
||||
'| `/usage` | Show token usage stats |',
|
||||
'| `/status` | Show system health |',
|
||||
'| `/model [tier|provider]` | Show or set model tier/provider |',
|
||||
'| `/approvals` | List pending guarded actions |',
|
||||
'| `/approve [id]` | Approve latest pending or specific id |',
|
||||
'| `/deny [id] [reason]` | Deny latest pending or specific id |',
|
||||
'',
|
||||
'Type `/` to see autocomplete suggestions.',
|
||||
];
|
||||
@@ -497,6 +506,36 @@ async function handleSlashCommand(cmd, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
case 'approvals': {
|
||||
try {
|
||||
const result = await executeAgentSlashCommand(client, 'approvals');
|
||||
showSystemMessage(result || 'No pending approvals.');
|
||||
} catch (err) {
|
||||
showSystemMessage(`Failed to list approvals: ${err.message}`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case 'approve': {
|
||||
try {
|
||||
const result = await executeAgentSlashCommand(client, 'approve', cmd.args ?? '');
|
||||
showSystemMessage(result || 'Approved.');
|
||||
} catch (err) {
|
||||
showSystemMessage(`Failed to approve: ${err.message}`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case 'deny': {
|
||||
try {
|
||||
const result = await executeAgentSlashCommand(client, 'deny', cmd.args ?? '');
|
||||
showSystemMessage(result || 'Denied.');
|
||||
} catch (err) {
|
||||
showSystemMessage(`Failed to deny: ${err.message}`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user