feat(model-server): wizard V2 config modèles locaux — source, options structurées & preview

Refonte UX du wizard de configuration des modèles locaux du serveur
llama.cpp intégré, alignée sur la source Hugging Face et les options backend.

- choix de source sans jargon (chemin local .gguf vs dépôt Hugging Face) ;
- champs structurés -ngl (gpu_layers), -c (context_size), --jinja, --host ;
- zone d'arguments libres avec alerte sur les flags réservés ;
- preview de la commande via le backend (previewModelServerCommand, debounced) ;
- gateway/ports et mock adaptés au contrat V2.

QA : Vitest 22 verts, tsc/build OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 14:32:04 +02:00
parent 38aecf2cac
commit efa081b074
10 changed files with 794 additions and 143 deletions

View File

@ -26,6 +26,7 @@ import type {
LayoutOperation,
LayoutTree,
LocalModelServerConfig,
ModelServerCommandPreview,
Memory,
MemoryIndexEntry,
MemoryLink,
@ -649,8 +650,9 @@ export interface CloneOpenCodeProfileFromSeedInput {
/**
* Local model servers (F35). CRUD over the global registry of declared
* `llama.cpp` servers an OpenCode profile can bind to via
* `OpenCodeConfig.localModelServerId`. Mirrors the three backend commands
* (`list_model_servers`, `save_model_server`, `delete_model_server`).
* `OpenCodeConfig.localModelServerId`. Mirrors the backend commands
* (`list_model_servers`, `save_model_server`, `delete_model_server`,
* `preview_model_server_command`).
*/
export interface ModelServerGateway {
/** Lists the declared local model servers. */
@ -665,6 +667,15 @@ export interface ModelServerGateway {
* `model_server_in_use` when a profile still references it.
*/
deleteModelServer(serverId: string): Promise<void>;
/**
* Builds the `llama-server` command line the backend would launch for the
* draft config, without persisting it. The backend is the sole authority on
* the argv (never reconstruct it client-side). Rejects when the config is
* invalid (e.g. `modelSource` missing).
*/
previewModelServerCommand(
config: LocalModelServerConfig,
): Promise<ModelServerCommandPreview>;
}
/** Input for {@link EmbedderGateway.saveEmbedderProfile}. */