allozaur/feat/chat slash commands (#26716)

* base : slash-command/misc foundation - model icon and focus-selector constants

* feat : slash-command picker and command parsing helpers

* refactor : wire command and @-mention pickers into the chat form

* ui : improve model selector keyboard navigation and load/dismiss

* feat: Unify markdown/raw-text rendering under one setting with migration

* fix: Misc fixes - tool-call subtitle, assistant wrap, progress guards

* feat: Clamp and style numeric settings inputs from registry bounds
This commit is contained in:
Aleksander Grygier
2026-08-07 20:20:01 +02:00
committed by GitHub
parent f8e30266d2
commit 6de1b63473
41 changed files with 1425 additions and 506 deletions
@@ -0,0 +1,44 @@
import { SET_WORKING_DIRECTORY_LABEL } from '$lib/constants/working-directory';
import { ChatFormCommandAction } from '$lib/enums';
import type { ChatFormCommand } from '$lib/types';
interface ChatCommandsOptions {
/** Gates `/model`. */
showModelSelector: boolean;
/** Gates `/prompt`. */
hasPrompts: () => boolean;
/** Gates `/cwd`. */
hasBuiltinTools: () => boolean;
}
/**
* The slash commands surfaced by the `/` command picker, in display order.
*
* Availability is supplied as predicates rather than store imports: this
* module is re-exported through the `$lib/constants` barrel, and importing
* stores at module load would create a circular dependency (the stores
* themselves import from `$lib/constants`).
*/
export function getChatCommands(options: ChatCommandsOptions): ChatFormCommand[] {
return [
{
name: 'prompt',
description: 'Insert an MCP prompt',
action: ChatFormCommandAction.PROMPT,
disabled: !options.hasPrompts()
},
{
name: 'cwd',
description: SET_WORKING_DIRECTORY_LABEL,
keywords: ['current working directory'],
action: ChatFormCommandAction.CWD,
disabled: !options.hasBuiltinTools()
},
{
name: 'model',
description: 'Select model',
action: ChatFormCommandAction.MODEL,
disabled: !options.showModelSelector
}
];
}