/** * Tauri adapter for {@link SkillGateway} (L12). * * Commands use snake_case (Tauri convention); payload keys are camelCase * (matching the backend DTO `#[serde(rename_all = "camelCase")]`), consistent * with the other adapters in this directory. The `scope` value (`"global"` / * `"project"`) maps directly onto the backend `SkillScope` serde enum. */ import { invoke } from "@tauri-apps/api/core"; import type { Skill, SkillScope } from "@/domain"; import type { CreateSkillInput, SkillGateway } from "@/ports"; export class TauriSkillGateway implements SkillGateway { listSkills(projectId: string, scope: SkillScope): Promise { return invoke("list_skills", { projectId, scope }); } createSkill(input: CreateSkillInput): Promise { return invoke("create_skill", { request: { projectId: input.projectId, name: input.name, content: input.content, scope: input.scope, }, }); } updateSkill( projectId: string, scope: SkillScope, skillId: string, content: string, ): Promise { return invoke("update_skill", { request: { projectId, scope, skillId, content }, }); } async deleteSkill( projectId: string, scope: SkillScope, skillId: string, ): Promise { await invoke("delete_skill", { projectId, scope, skillId }); } async assignSkill( projectId: string, agentId: string, skillId: string, scope: SkillScope, ): Promise { await invoke("assign_skill_to_agent", { request: { projectId, agentId, skillId, scope }, }); } async unassignSkill( projectId: string, agentId: string, skillId: string, ): Promise { await invoke("unassign_skill_from_agent", { request: { projectId, agentId, skillId }, }); } }