Unify TUI slash commands and harden tool inventory responses
This commit is contained in:
@@ -3,6 +3,9 @@ export type Command =
|
||||
| { type: 'reset' }
|
||||
| { type: 'help' }
|
||||
| { type: 'status' }
|
||||
| { type: 'tools' }
|
||||
| { type: 'research'; task: string }
|
||||
| { type: 'council'; task: string }
|
||||
| { type: 'fullscreen' }
|
||||
| { type: 'compact' }
|
||||
| { type: 'usage' }
|
||||
@@ -17,6 +20,28 @@ export type Command =
|
||||
| { type: 'elevate'; args?: string }
|
||||
| { type: 'message'; content: string };
|
||||
|
||||
export function isToolInventoryQuery(input: string): boolean {
|
||||
const normalized = input.trim().toLowerCase();
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
const hasToolsWord = /\btools?\b/.test(normalized);
|
||||
const hasInventoryIntent = /\b(check|show|list|what|which|available|new|have)\b/.test(normalized);
|
||||
return (
|
||||
normalized.includes('available tools')
|
||||
|| normalized.includes('what tools')
|
||||
|| normalized.includes('which tools')
|
||||
|| normalized.includes('tool list')
|
||||
|| normalized.includes('list tools')
|
||||
|| normalized.includes('new tools')
|
||||
|| normalized.includes('your tools')
|
||||
|| normalized.includes('what can you do')
|
||||
|| normalized.includes('can you do')
|
||||
|| normalized.includes('capabilities')
|
||||
|| (hasToolsWord && hasInventoryIntent)
|
||||
);
|
||||
}
|
||||
|
||||
export function parseCommand(input: string): Command | null {
|
||||
const trimmed = input.trim();
|
||||
if (!trimmed) {return null;}
|
||||
@@ -41,6 +66,29 @@ export function parseCommand(input: string): Command | null {
|
||||
return { type: 'status' };
|
||||
}
|
||||
|
||||
// Tools
|
||||
if (trimmed === '/tools') {
|
||||
return { type: 'tools' };
|
||||
}
|
||||
|
||||
// Research
|
||||
if (trimmed.startsWith('/research ')) {
|
||||
const task = trimmed.slice('/research '.length).trim();
|
||||
return { type: 'research', task };
|
||||
}
|
||||
if (trimmed === '/research') {
|
||||
return { type: 'research', task: '' };
|
||||
}
|
||||
|
||||
// Council
|
||||
if (trimmed.startsWith('/council ')) {
|
||||
const task = trimmed.slice('/council '.length).trim();
|
||||
return { type: 'council', task };
|
||||
}
|
||||
if (trimmed === '/council') {
|
||||
return { type: 'council', task: '' };
|
||||
}
|
||||
|
||||
// Fullscreen
|
||||
if (trimmed === '/fullscreen' || trimmed === '/fs') {
|
||||
return { type: 'fullscreen' };
|
||||
@@ -157,9 +205,12 @@ export function getHelpText(): string {
|
||||
return `
|
||||
Commands:
|
||||
/help, /? Show this help
|
||||
/tools Show available tools in this session
|
||||
/model [name] Show or switch model tier (local, default, fast, complex)
|
||||
/model <tier> <p/m> Change tier's provider/model (e.g. /model default anthropic/claude-sonnet-4)
|
||||
/backend [provider] Show or switch local backend (ollama, llamacpp)
|
||||
/research <task> Delegate a task to the configured research agent
|
||||
/council <task> Run the councils pipeline for a task
|
||||
/login [provider] Authenticate with GitHub, OpenAI, Anthropic, or Z.AI
|
||||
/pair List pending pairing codes and approved senders
|
||||
/pair generate [label] Generate a new DM pairing code
|
||||
@@ -190,8 +241,11 @@ export type ModelAlias = 'local' | 'default' | 'fast' | 'complex' | 'opus' | 'so
|
||||
// List of all slash commands for autocompletion
|
||||
export const SLASH_COMMANDS = [
|
||||
'/help',
|
||||
'/tools',
|
||||
'/model',
|
||||
'/backend',
|
||||
'/research',
|
||||
'/council',
|
||||
'/reset',
|
||||
'/clear',
|
||||
'/new',
|
||||
@@ -217,8 +271,11 @@ export const SLASH_COMMANDS = [
|
||||
// Command descriptions for tooltips
|
||||
export const COMMAND_TOOLTIPS: Record<string, string> = {
|
||||
'/help': 'Show available commands',
|
||||
'/tools': 'Show authoritative runtime tool list for this session',
|
||||
'/model': 'Show or switch model (local, default, fast, complex)',
|
||||
'/backend': 'Show or switch local backend (ollama, llamacpp)',
|
||||
'/research': 'Delegate a task to the configured research agent',
|
||||
'/council': 'Run the councils pipeline for a task',
|
||||
'/reset': 'Clear conversation history',
|
||||
'/clear': 'Clear conversation history',
|
||||
'/new': 'Start a new conversation',
|
||||
|
||||
Reference in New Issue
Block a user