/** * Tauri adapter for {@link WorkStateGateway}. * * This is the only frontend place that knows the `get_project_work_state` * command name; features consume the gateway port through DI. */ import { invoke } from "@tauri-apps/api/core"; import type { ProjectWorkState } from "@/domain"; import type { WorkStateGateway } from "@/ports"; import { normalizeProjectWorkState } from "./workStateNormalization"; export class TauriWorkStateGateway implements WorkStateGateway { async getProjectWorkState(projectId: string): Promise { const state = await invoke("get_project_work_state", { projectId }); return normalizeProjectWorkState(state); } async cancelBackgroundTask(taskId: string): Promise { await invoke("cancel_background_task", { taskId }); } async retryBackgroundTask(taskId: string): Promise { await invoke("retry_background_task", { taskId }); } }