/** * Helpers for OpenCode API response processing. * * OpenCode session status is a discriminated union: * { type: "idle" } * { type: "busy" } * { type: "retry", attempt: number, message: string, next: number } * * Message format from OpenCode: * { info: { role, error, finish, tokens, ... }, parts: [ { type, text, ... } ] } */ export interface SessionStatusInfo { /** Normalized status string: "idle", "busy", "retry", "error", etc. */ status: string; /** For retry status: current retry attempt number. */ retryAttempt?: number; /** For retry status: human-readable reason (e.g. "Too Many Requests"). */ retryMessage?: string; /** For retry status: epoch ms when next retry occurs. */ retryNextAt?: number; } /** * Resolve the session status from OpenCode's `/session/status` response. * Returns a normalized status string. For more detail, use resolveSessionStatusInfo(). */ export declare function resolveSessionStatus(raw: unknown): string; /** * Resolve full session status info including retry details. */ export declare function resolveSessionStatusInfo(raw: unknown): SessionStatusInfo; /** Extract error info from an OpenCode assistant message. */ export interface MessageErrorInfo { name: string; message: string; statusCode?: number; isRetryable?: boolean; retryAfterMs?: number; } /** * Extract error information from an OpenCode message response. * OpenCode wraps messages as { info: { ..., error: { name, data } }, parts: [...] } */ export declare function extractMessageError(response: unknown): MessageErrorInfo | undefined; /** * Format a message response from OpenCode into readable text. * Handles both { parts: [...] } and { info: {...}, parts: [...] } formats. */ export declare function formatMessageResponse(response: unknown): string; //# sourceMappingURL=helpers.d.ts.map