feat(plugins): seam slash-commands contribuées par plugin via callback — #165 (QA verte)

Permet à un plugin de contribuer des commandes slash adossées à une callback,
transitant par le registry/contrat unifié (#162) :

- sdk/IdeaSDK: manifeste contributes.slashCommands (déclaratif) — pointer bumpé.
- domain: source Plugin étendue + effet PluginCallback (la commande ne
  s'exécute pas directement : elle renvoie une référence à la callback du plugin).
- application: registration des commandes plugin dans le registry + exécution
  renvoyant l'effet PluginCallback ; métadonnées UI suffisantes pour l'autocomplete.
- backend + app-tauri: DTO + commandes Tauri listant/invoquant les commandes plugin.
- frontend (contrat): types adapters/domain/ports/mock pour pluginCallback et
  l'invocation avec arguments.

L'exécution effective de la callback côté runtime UI est livrée par #166.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 15:46:52 +02:00
parent ff7696b724
commit fbaca9d5cc
17 changed files with 514 additions and 34 deletions

View File

@ -1698,12 +1698,23 @@ export interface SlashCommand {
availability: SlashCommandAvailability;
source: SlashCommandSource;
native?: NativeSlashCommand;
plugin?: {
pluginId: string;
commandId: string;
};
}
export type SlashCommandEffect =
| { kind: "help"; commands: SlashCommand[] }
| { kind: "cleanConversation"; sessionId: string; clearedChunks: number }
| { kind: "profileSwitch"; sessionId: string };
| { kind: "profileSwitch"; sessionId: string }
| {
kind: "pluginCallback";
pluginId: string;
commandId: string;
sessionId?: string;
arguments: unknown[];
};
export interface ExecuteSlashCommandResult {
command: SlashCommand;
@ -1844,6 +1855,7 @@ export interface PluginUninstallResult {
export interface PluginContributionDto {
menus: PluginTopLevelMenuContribution[];
menuItems: PluginMenuItemContribution[];
slashCommands?: PluginSlashCommandContribution[];
layouts: PluginLayoutContribution[];
mcpServers: PluginMcpServerSummary[];
}
@ -2125,6 +2137,15 @@ export interface PluginMenuItemContribution {
when?: string;
}
/** Manifest declaration of a plugin-backed slash command. */
export interface PluginSlashCommandContribution {
name: string;
shortDescription: string;
command: string;
requiresConfirmation?: boolean;
when?: string;
}
/** A menu item resolved for rendering — enablement already evaluated (carnet §7.2). */
export interface ResolvedPluginMenuItem {
id: string;