Sprint « Modeles locaux », couche frontend. #35 : - F35.1 badge de statut de lancement du serveur local (ModelServerLaunchBadge + useAgentsModelServer). - F35.2 feature model-servers : CRUD (ModelServersPanel / useModelServers / gateway modelServer) et ModelServerSelect. #36 : - Liste multi-profils OpenCode dans le wizard de premier lancement, gateway de clonage (clone_opencode_profile_from_seed). Tests verts (exécution réelle) : tsc propre, vitest 608/608. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
/**
|
|
* Tauri adapter for {@link ProfileGateway} (L5). Like the sibling adapters this
|
|
* is one of the *only* places that calls `invoke()`; components reach it
|
|
* exclusively through the port.
|
|
*
|
|
* Commands and payload keys are camelCase, matching the backend DTO convention.
|
|
*/
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
import type { AgentProfile, FirstRunState, ProfileAvailability } from "@/domain";
|
|
import type { CloneOpenCodeProfileFromSeedInput, ProfileGateway } from "@/ports";
|
|
|
|
export class TauriProfileGateway implements ProfileGateway {
|
|
firstRunState(): Promise<FirstRunState> {
|
|
return invoke<FirstRunState>("first_run_state");
|
|
}
|
|
|
|
referenceProfiles(): Promise<AgentProfile[]> {
|
|
return invoke<AgentProfile[]>("reference_profiles");
|
|
}
|
|
|
|
detectProfiles(candidates: AgentProfile[]): Promise<ProfileAvailability[]> {
|
|
return invoke<ProfileAvailability[]>("detect_profiles", {
|
|
request: { candidates },
|
|
});
|
|
}
|
|
|
|
listProfiles(): Promise<AgentProfile[]> {
|
|
return invoke<AgentProfile[]>("list_profiles");
|
|
}
|
|
|
|
saveProfile(profile: AgentProfile): Promise<AgentProfile> {
|
|
return invoke<AgentProfile>("save_profile", { request: { profile } });
|
|
}
|
|
|
|
async deleteProfile(profileId: string): Promise<void> {
|
|
await invoke("delete_profile", { profileId });
|
|
}
|
|
|
|
configureProfiles(profiles: AgentProfile[]): Promise<AgentProfile[]> {
|
|
return invoke<AgentProfile[]>("configure_profiles", {
|
|
request: { profiles },
|
|
});
|
|
}
|
|
|
|
cloneOpenCodeProfileFromSeed(
|
|
input: CloneOpenCodeProfileFromSeedInput = {},
|
|
): Promise<AgentProfile> {
|
|
return invoke<AgentProfile>("clone_opencode_profile_from_seed", {
|
|
request: { name: input.name, opencode: input.opencode },
|
|
});
|
|
}
|
|
}
|