/** * Extended type definitions for OpenCode client APIs that are not (yet) in @opencode-ai/sdk types. * These describe the actual runtime shape observed in OpenCode 1.2.x. */ /** Model identifier as passed through hook input */ export interface ModelRef { providerID?: string; modelID?: string; } /** Toast notification (TUI-only, non-standard) */ export interface ToastOptions { body: { title: string; message: string; variant?: "info" | "success" | "warning" | "error"; duration?: number; }; } /** Extended OpenCode client with optional TUI and MCP methods */ export interface ExtendedClient { session: { create: (opts: { body: Record; query?: { directory?: string; }; }) => Promise<{ data?: { id?: string; }; }>; prompt: (opts: { path: { id: string; }; body: { parts: Array<{ type: string; text: string; }>; agent?: string; }; query?: { directory?: string; }; }) => Promise; messages: (opts: { path: { id: string; }; query?: { directory?: string; }; }) => Promise<{ data?: Array<{ info?: { role?: string; }; parts?: Array<{ type: string; text?: string; }>; }>; }>; delete: (opts: { path: { id: string; }; query?: { directory?: string; }; }) => Promise; listMessages?: (opts: { id: string; }) => Promise<{ messages?: unknown[]; } | unknown[]>; }; tui?: { showToast?: (opts: ToastOptions) => Promise; }; mcp?: { add?: (opts: { body: Record; }) => Promise; }; } /** System transform hook input */ export interface SystemTransformInput { sessionID?: string; model?: ModelRef; agent?: string; }