// AUTO-GENERATED by scripts/generate-command-builders.mjs — DO NOT EDIT.
// Source of truth: shared/src/protocol.ts (PluginCommand union).
//
// TypeScript already has the typed discriminated union; this file provides
// matching factory helpers so callers in all three languages share the same
// API shape (`AgentCommand.respond(value)` / `agentCommand.respond(value)`).

import type {
  ResponseCommand,
  SelectOptionCommand,
  NavigateOptionCommand,
  SendPromptCommand,
  SwitchModeCommand,
  InterruptCommand,
  EscapeCommand,
  VoiceCommand,
  QueryUsageCommand,
  QuerySessionTimelineCommand,
  DiagCommand,
  UtilityCommand,
  SwitchAgentCommand,
  FocusSessionCommand,
  ClearSessionFocusCommand,
  SessionCommand,
  ClientRegisterCommand,
  ApmeVibeFeedbackCommand,
  ApmeRecommendCommand,
  PermissionDecisionCommand,
  Esp32OtaAckCommand,
  Esp32OtaErrorCommand,
} from "./protocol.js";

export const agentCommand = {
  respond(value: string): ResponseCommand {
    return { type: "respond", value };
  },
  selectOption(index: number, sessionId?: string): SelectOptionCommand {
    return { type: "select_option", index, sessionId };
  },
  navigateOption(direction: 'up' | 'down'): NavigateOptionCommand {
    return { type: "navigate_option", direction };
  },
  sendPrompt(text: string): SendPromptCommand {
    return { type: "send_prompt", text };
  },
  switchMode(mode?: 'plan' | 'acceptEdits' | 'default'): SwitchModeCommand {
    return { type: "switch_mode", mode };
  },
  interrupt(): InterruptCommand {
    return { type: "interrupt" };
  },
  escape(): EscapeCommand {
    return { type: "escape" };
  },
  voice(action: 'start' | 'stop' | 'cancel'): VoiceCommand {
    return { type: "voice", action };
  },
  queryUsage(): QueryUsageCommand {
    return { type: "query_usage" };
  },
  querySessionTimeline(sessionId: string): QuerySessionTimelineCommand {
    return { type: "query_session_timeline", sessionId };
  },
  diag(action: 'dump' | 'analyze'): DiagCommand {
    return { type: "diag", action };
  },
  utility(action: 'adjust_volume' | 'toggle_mute' | 'adjust_brightness' | 'media_play_pause' | 'media_next' | 'media_prev', value?: number): UtilityCommand {
    return { type: "utility", action, value };
  },
  switchAgent(agent: 'openclaw' | 'claude-code'): SwitchAgentCommand {
    return { type: "switch_agent", agent };
  },
  focusSession(sessionId: string): FocusSessionCommand {
    return { type: "focus_session", sessionId };
  },
  clearSessionFocus(): ClearSessionFocusCommand {
    return { type: "clear_session_focus" };
  },
  sessionCommand(sessionId: string, command: { type: string; [key: string]: unknown; }): SessionCommand {
    return { type: "session_command", sessionId, command };
  },
  clientRegister(clientType: string, clientLabel?: string, devices?: Array<{ id: string; name: string; family?: string; columns?: number; rows?: number; }>): ClientRegisterCommand {
    return { type: "client_register", clientType, clientLabel, devices };
  },
  apmeVibe(runId: string, verdict: 'approve' | 'reject' | 'neutral', note?: string): ApmeVibeFeedbackCommand {
    return { type: "apme_vibe", runId, verdict, note };
  },
  apmeRecommend(taskKind?: string, budgetUsd?: number, latencyBudgetMs?: number, preferLocal?: boolean): ApmeRecommendCommand {
    return { type: "apme_recommend", taskKind, budgetUsd, latencyBudgetMs, preferLocal };
  },
  permissionDecision(requestId: string, decision: 'allow' | 'deny'): PermissionDecisionCommand {
    return { type: "permission_decision", requestId, decision };
  },
  esp32OtaAck(otaId: string, stage: 'begin' | 'chunk' | 'end' | 'abort', seq?: number, offset?: number, written?: number): Esp32OtaAckCommand {
    return { type: "esp32_ota_ack", otaId, stage, seq, offset, written };
  },
  esp32OtaError(error: string, otaId?: string, stage?: string): Esp32OtaErrorCommand {
    return { type: "esp32_ota_error", error, otaId, stage };
  },
} as const;
