feat: Engine-Adaptervertrag, llama.cpp-Adapter und Attrappe (M2.2)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 17:05:03 +01:00
parent 3e6148419b
commit ada5745c53
14 changed files with 1672 additions and 4 deletions

View File

@ -0,0 +1,36 @@
use std::time::Duration;
use async_trait::async_trait;
use crate::types::EngineInfo;
use crate::types::{
DiscoveredArtifact, Endpoint, Health, InstanceHandle, ProfileSpec, Result, Usage,
};
/// Vertrag zwischen Gateway und Engine (Spezifikation, Abschnitt 4).
///
/// Alle Methoden sind wiederholbar aufrufbar. `stop` ist idempotent: Eine
/// bereits beendete oder unbekannte Instanz ist kein Fehler.
#[async_trait]
pub trait Engine: Send + Sync {
/// Art, Modus und Fähigkeiten der Engine.
fn describe(&self) -> EngineInfo;
/// Sucht Modelle und Quantisierungen. Verändert nichts.
async fn discover(&self) -> Result<Vec<DiscoveredArtifact>>;
/// Startet eine Instanz und kehrt erst zurück, wenn sie bereit ist oder
/// der Start gescheitert ist.
async fn start(&self, profile: &ProfileSpec) -> Result<InstanceHandle>;
/// Beendet die Instanz: zuerst höflich, nach `grace` mit Gewalt.
async fn stop(&self, instance: &InstanceHandle, grace: Duration) -> Result<()>;
async fn health(&self, instance: &InstanceHandle) -> Health;
/// Adresse, unter der die Instanz erreichbar ist.
fn endpoint(&self, instance: &InstanceHandle) -> Endpoint;
/// Misst den echten Ressourcenverbrauch.
async fn measure(&self, instance: &InstanceHandle) -> Usage;
}