fix(tui): add /queue command support across tui and routing

This commit is contained in:
William Valentin
2026-02-16 12:19:21 -08:00
parent d9f7807ab2
commit fd7ad7bfb0
6 changed files with 382 additions and 0 deletions
+22
View File
@@ -12,6 +12,7 @@ export type Command =
| { type: 'login'; provider?: string }
| { type: 'transfer'; target: string }
| { type: 'pair'; action?: 'generate' | 'list' | 'revoke'; args?: string }
| { type: 'queue'; action?: 'show' | 'set' | 'reset'; args?: string }
| { type: 'message'; content: string };
export function parseCommand(input: string): Command | null {
@@ -113,6 +114,22 @@ export function parseCommand(input: string): Command | null {
return { type: 'pair', action: 'revoke', args };
}
// Queue
if (trimmed === '/queue' || trimmed === '/queue show') {
return { type: 'queue', action: 'show' };
}
if (trimmed === '/queue reset') {
return { type: 'queue', action: 'reset' };
}
if (trimmed.startsWith('/queue set ')) {
const args = trimmed.slice('/queue set '.length).trim();
return { type: 'queue', action: 'set', args };
}
if (trimmed.startsWith('/queue ')) {
const args = trimmed.slice('/queue '.length).trim();
return { type: 'queue', action: 'set', args };
}
// Regular message
return { type: 'message', content: trimmed };
}
@@ -128,6 +145,9 @@ Commands:
/pair List pending pairing codes and approved senders
/pair generate [label] Generate a new DM pairing code
/pair revoke <ch> <id> Revoke an approved sender
/queue Show queue policy for this session
/queue set <k> <v> Set queue override (mode/cap/overflow/debounce_ms/summarize_overflow)
/queue reset Clear queue overrides for this session
/reset, /clear, /new Clear conversation history
/compact Compact conversation history
/usage Show token usage and estimated cost
@@ -159,6 +179,7 @@ export const SLASH_COMMANDS = [
'/fs',
'/login',
'/pair',
'/queue',
'/transfer',
'/quit',
'/exit',
@@ -180,6 +201,7 @@ export const COMMAND_TOOLTIPS: Record<string, string> = {
'/fs': 'Switch to fullscreen mode',
'/login': 'Authenticate with GitHub/OpenAI/Anthropic (OAuth/token or API key) or Z.AI (API key store)',
'/pair': 'Generate/list/revoke DM pairing codes',
'/queue': 'Show or update per-session queue policy',
'/transfer': 'Transfer session to another frontend',
'/quit': 'Exit TUI',
'/exit': 'Exit TUI',