/** * Tauri adapter for {@link InputGateway} (ARCHITECTURE ยง20.3). * * `interrupt` โ†’ `interrupt_agent` (preempt). `delegationDelivered` โ†’ * `delegation_delivered` (the native write-portal's ack that a delegation's * text was effectively written into the PTY). The former `submit` โ†’ * `submit_agent_input` path is gone: the agent cell is a native terminal, so * human keystrokes reach the PTY directly (no mediated-input strip). * * 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. */ import { invoke } from "@tauri-apps/api/core"; import type { InputGateway } from "@/ports"; export class TauriInputGateway implements InputGateway { async interrupt(projectId: string, agentId: string): Promise { await invoke("interrupt_agent", { request: { projectId, agentId }, }); } async delegationDelivered( projectId: string, agentId: string, ticket: string, ): Promise { await invoke("delegation_delivered", { request: { projectId, agentId, ticket }, }); } async setFrontAttached(agentId: string, attached: boolean): Promise { await invoke("set_front_attached", { request: { agentId, attached }, }); } async cancelResume(agentId: string): Promise { // `cancel_resume` takes a bare `agent_id` (camelCase `agentId`), not a // `request` envelope, and returns whether a pending resume was disarmed. return invoke("cancel_resume", { agentId }); } }