feat(model-server): source Hugging Face (-hf) + options structurées llama.cpp + migration store V2

Backend du support natif d'une source modèle Hugging Face en alternative au
chemin .gguf local pour le serveur llama.cpp intégré, et refonte des options.

- domaine : ModelSource {LocalPath|HuggingFace} + HfModelRef,
  LlamaCppOptions {host,gpu_layers,context_size,jinja}, invariant auto_start
  exigeant une source, validate_free_args (rejet des flags réservés).
- infra : build_argv partagé avec build_spawn_spec, émission -hf vs --model,
  ordre argv figé ; migration model-servers.json V1 -> V2.
- app-tauri : DTO V2 (modelSource, compat modelPath, conflit = INVALID),
  commande preview_model_server_command.

QA : cargo test ciblés verts (domain 7, application 8, infra model_server 4,
app-tauri dto 5). Échecs des suites complètes infra/app-tauri environnementaux
(sandbox bind/socket), hors périmètre.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 14:31:54 +02:00
parent bc96285fa5
commit 38aecf2cac
11 changed files with 820 additions and 102 deletions

View File

@ -1014,6 +1014,15 @@ pub trait ManagedProcess: Send + Sync {
/// Builds the argv-structured spawn spec for a local model server.
pub trait ModelServerRuntime: Send + Sync {
/// Builds the pure argv contract for previewing or spawning a local server.
///
/// # Errors
/// [`ModelServerError`] if the config cannot be launched.
fn build_argv(
&self,
config: &LocalModelServerConfig,
) -> Result<ModelServerArgv, ModelServerError>;
/// Builds a spawn spec from a validated local-server config.
///
/// # Errors
@ -1024,6 +1033,15 @@ pub trait ModelServerRuntime: Send + Sync {
) -> Result<SpawnSpec, ModelServerError>;
}
/// Pure argv contract for a local model server invocation.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ModelServerArgv {
/// Executable command.
pub command: String,
/// Arguments without shell parsing.
pub args: Vec<String>,
}
/// Persists local model-server configuration in the global IdeA store.
#[async_trait]
pub trait ModelServerRegistry: Send + Sync {