import type { createOpencodeClient } from "@opencode-ai/sdk"; export type OpenCodeClient = ReturnType; type SessionRecord = Record; type CreateSessionOptions = { parentID?: string; title: string; directory?: string; }; type GetSessionMessagesOptions = { limit?: number; }; export declare function createSession(client: OpenCodeClient, opts: CreateSessionOptions): Promise; export declare function getSession(client: OpenCodeClient, sessionID: string): Promise; /** * Get the status map for all sessions. * Returns a map of sessionID -> { type: "idle" | "busy" | "retry" } */ export declare function getSessionStatusMap(client: OpenCodeClient): Promise>; export declare function abortSession(client: OpenCodeClient, sessionID: string): Promise; export declare function getSessionMessages(client: OpenCodeClient, sessionID: string, opts?: GetSessionMessagesOptions): Promise; export declare function getSessionMessageCount(client: OpenCodeClient, sessionID: string): Promise; export declare function sendPrompt(client: OpenCodeClient, sessionID: string, body: unknown, noReply?: boolean): Promise; /** * Prompt a session asynchronously — returns 204 immediately. * * Use this for background/background delegation tasks where the caller * should not wait for the assistant's response. Harness must only use this * path when a trusted runtime policy explicitly says the host is durable. */ export declare function sendPromptAsync(client: OpenCodeClient, sessionID: string, body: unknown): Promise; /** * Append a bounded parent-facing notification line to the active OpenCode TUI prompt. * * @param client - OpenCode SDK client with the `tui.appendPrompt` surface. * @param text - Text to append to the foreground prompt input. * @returns The unwrapped SDK response when append succeeds. */ export declare function appendTuiPrompt(client: OpenCodeClient, text: string): Promise; /** * Show a compact delegation toast in the OpenCode TUI when the host exposes it. * * Step 1 (notification redesign): replaces `appendTuiPrompt` for user-visible notifications. * Toast is transient — user sees it, agent's context does NOT receive it. * * SDK v1 API: `client.tui.showToast({ body: { message, variant, duration?, title? } })` * * @param client - OpenCode SDK client with the `tui.showToast` surface. * @param message - Toast message to display. * @param variant - Optional visual style: "info" | "success" | "error" | "warning". * @returns The unwrapped SDK response when the toast succeeds. */ /** * Check if a message carries the `[Hivemind]` prefix that flags it as * an internal runtime error that should be suppressed from TUI toasts. * * When `true`, the caller should route the message to `console.warn` * instead of `client.tui.showToast()`. */ export declare function isHivemindError(message: string): boolean; export declare function showTuiToast(client: OpenCodeClient, message: string, variant?: "info" | "success" | "error" | "warning"): Promise; export declare function getSessionID(session: unknown): string | undefined; export declare function getParentID(session: unknown): string | undefined; export declare function getEventSessionID(event: unknown): string | undefined; export declare function getEventParentID(event: unknown): string | undefined; export declare function walkParentChain(client: OpenCodeClient, sessionID: string): Promise; export {}; //# sourceMappingURL=session-api.d.ts.map