// This file is auto-generated by @hey-api/openapi-ts import type { Options as ClientOptions, TDataShape, Client } from "./client/index.js" import type { EventSubscribeData, EventSubscribeResponses, AppGetData, AppGetResponses, AppInitData, AppInitResponses, ConfigGetData, ConfigGetResponses, SessionListData, SessionListResponses, SessionCreateData, SessionCreateResponses, SessionCreateErrors, SessionDeleteData, SessionDeleteResponses, SessionGetData, SessionGetResponses, SessionUpdateData, SessionUpdateResponses, SessionChildrenData, SessionChildrenResponses, SessionInitData, SessionInitResponses, SessionAbortData, SessionAbortResponses, SessionUnshareData, SessionUnshareResponses, SessionShareData, SessionShareResponses, SessionSummarizeData, SessionSummarizeResponses, SessionMessagesData, SessionMessagesResponses, SessionChatData, SessionChatResponses, SessionMessageData, SessionMessageResponses, SessionCommandData, SessionCommandResponses, SessionShellData, SessionShellResponses, SessionRevertData, SessionRevertResponses, SessionUnrevertData, SessionUnrevertResponses, PostSessionByIdPermissionsByPermissionIdData, PostSessionByIdPermissionsByPermissionIdResponses, CommandListData, CommandListResponses, ConfigProvidersData, ConfigProvidersResponses, FindTextData, FindTextResponses, FindFilesData, FindFilesResponses, FindSymbolsData, FindSymbolsResponses, FileReadData, FileReadResponses, FileStatusData, FileStatusResponses, AppLogData, AppLogResponses, AppAgentsData, AppAgentsResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiOpenHelpData, TuiOpenHelpResponses, TuiOpenSessionsData, TuiOpenSessionsResponses, TuiOpenThemesData, TuiOpenThemesResponses, TuiOpenModelsData, TuiOpenModelsResponses, TuiSubmitPromptData, TuiSubmitPromptResponses, TuiClearPromptData, TuiClearPromptResponses, TuiExecuteCommandData, TuiExecuteCommandResponses, TuiShowToastData, TuiShowToastResponses, AuthSetData, AuthSetResponses, AuthSetErrors, } from "./types.gen.js" import { client as _heyApiClient } from "./client.gen.js" export type Options = ClientOptions< TData, ThrowOnError > & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a * custom client. */ client?: Client /** * You can pass arbitrary values through the `meta` object. This can be * used to access values that aren't defined as part of the SDK function. */ meta?: Record } class _HeyApiClient { protected _client: Client = _heyApiClient constructor(args?: { client?: Client }) { if (args?.client) { this._client = args.client } } } class Event extends _HeyApiClient { /** * Get events */ public subscribe(options?: Options) { return (options?.client ?? this._client).get({ url: "/event", ...options, }) } } class App extends _HeyApiClient { /** * Get app info */ public get(options?: Options) { return (options?.client ?? this._client).get({ url: "/app", ...options, }) } /** * Initialize the app */ public init(options?: Options) { return (options?.client ?? this._client).post({ url: "/app/init", ...options, }) } /** * Write a log entry to the server logs */ public log(options?: Options) { return (options?.client ?? this._client).post({ url: "/log", ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, }) } /** * List all agents */ public agents(options?: Options) { return (options?.client ?? this._client).get({ url: "/agent", ...options, }) } } class Config extends _HeyApiClient { /** * Get config info */ public get(options?: Options) { return (options?.client ?? this._client).get({ url: "/config", ...options, }) } /** * List all providers */ public providers(options?: Options) { return (options?.client ?? this._client).get({ url: "/config/providers", ...options, }) } } class Session extends _HeyApiClient { /** * List all sessions */ public list(options?: Options) { return (options?.client ?? this._client).get({ url: "/session", ...options, }) } /** * Create a new session */ public create(options?: Options) { return (options?.client ?? this._client).post({ url: "/session", ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, }) } /** * Delete a session and all its data */ public delete(options: Options) { return (options.client ?? this._client).delete({ url: "/session/{id}", ...options, }) } /** * Get session */ public get(options: Options) { return (options.client ?? this._client).get({ url: "/session/{id}", ...options, }) } /** * Update session properties */ public update(options: Options) { return (options.client ?? this._client).patch({ url: "/session/{id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Get a session's children */ public children(options: Options) { return (options.client ?? this._client).get({ url: "/session/{id}/children", ...options, }) } /** * Analyze the app and create an AGENTS.md file */ public init(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/init", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Abort a session */ public abort(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/abort", ...options, }) } /** * Unshare the session */ public unshare(options: Options) { return (options.client ?? this._client).delete({ url: "/session/{id}/share", ...options, }) } /** * Share a session */ public share(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/share", ...options, }) } /** * Summarize the session */ public summarize(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/summarize", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * List messages for a session */ public messages(options: Options) { return (options.client ?? this._client).get({ url: "/session/{id}/message", ...options, }) } /** * Create and send a new message to a session */ public chat(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/message", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Get a message from a session */ public message(options: Options) { return (options.client ?? this._client).get({ url: "/session/{id}/message/{messageID}", ...options, }) } /** * Send a new command to a session */ public command(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/command", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Run a shell command */ public shell(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/shell", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Revert a message */ public revert(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/revert", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } /** * Restore all reverted messages */ public unrevert(options: Options) { return (options.client ?? this._client).post({ url: "/session/{id}/unrevert", ...options, }) } } class Command extends _HeyApiClient { /** * List all commands */ public list(options?: Options) { return (options?.client ?? this._client).get({ url: "/command", ...options, }) } } class Find extends _HeyApiClient { /** * Find text in files */ public text(options: Options) { return (options.client ?? this._client).get({ url: "/find", ...options, }) } /** * Find files */ public files(options: Options) { return (options.client ?? this._client).get({ url: "/find/file", ...options, }) } /** * Find workspace symbols */ public symbols(options: Options) { return (options.client ?? this._client).get({ url: "/find/symbol", ...options, }) } } class File extends _HeyApiClient { /** * Read a file */ public read(options: Options) { return (options.client ?? this._client).get({ url: "/file", ...options, }) } /** * Get file status */ public status(options?: Options) { return (options?.client ?? this._client).get({ url: "/file/status", ...options, }) } } class Tui extends _HeyApiClient { /** * Append prompt to the TUI */ public appendPrompt(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/append-prompt", ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, }) } /** * Open the help dialog */ public openHelp(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/open-help", ...options, }) } /** * Open the session dialog */ public openSessions(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/open-sessions", ...options, }) } /** * Open the theme dialog */ public openThemes(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/open-themes", ...options, }) } /** * Open the model dialog */ public openModels(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/open-models", ...options, }) } /** * Submit the prompt */ public submitPrompt(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/submit-prompt", ...options, }) } /** * Clear the prompt */ public clearPrompt(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/clear-prompt", ...options, }) } /** * Execute a TUI command (e.g. agent_cycle) */ public executeCommand(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/execute-command", ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, }) } /** * Show a toast notification in the TUI */ public showToast(options?: Options) { return (options?.client ?? this._client).post({ url: "/tui/show-toast", ...options, headers: { "Content-Type": "application/json", ...options?.headers, }, }) } } class Auth extends _HeyApiClient { /** * Set authentication credentials */ public set(options: Options) { return (options.client ?? this._client).put({ url: "/auth/{id}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } } export class OpencodeClient extends _HeyApiClient { /** * Respond to a permission request */ public postSessionByIdPermissionsByPermissionId( options: Options, ) { return (options.client ?? this._client).post< PostSessionByIdPermissionsByPermissionIdResponses, unknown, ThrowOnError >({ url: "/session/{id}/permissions/{permissionID}", ...options, headers: { "Content-Type": "application/json", ...options.headers, }, }) } event = new Event({ client: this._client }) app = new App({ client: this._client }) config = new Config({ client: this._client }) session = new Session({ client: this._client }) command = new Command({ client: this._client }) find = new Find({ client: this._client }) file = new File({ client: this._client }) tui = new Tui({ client: this._client }) auth = new Auth({ client: this._client }) }