// This file is auto-generated by @hey-api/openapi-ts
import { client } from "./client.gen.js";
import { buildClientParams } from "./client/index.js";
class HeyApiClient {
    client;
    constructor(args) {
        this.client = args?.client ?? client;
    }
}
class HeyApiRegistry {
    defaultKey = "default";
    instances = new Map();
    get(key) {
        const instance = this.instances.get(key ?? this.defaultKey);
        if (!instance) {
            throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`);
        }
        return instance;
    }
    set(value, key) {
        this.instances.set(key ?? this.defaultKey, value);
    }
}
export class Global extends HeyApiClient {
    /**
     * Get health
     *
     * Get health information about the OpenCode server.
     */
    health(options) {
        return (options?.client ?? this.client).get({
            url: "/global/health",
            ...options,
        });
    }
    /**
     * Get global events
     *
     * Subscribe to global events from the OpenCode system using server-sent events.
     */
    event(options) {
        return (options?.client ?? this.client).sse.get({
            url: "/global/event",
            ...options,
        });
    }
    /**
     * Dispose instance
     *
     * Clean up and dispose all OpenCode instances, releasing all resources.
     */
    dispose(options) {
        return (options?.client ?? this.client).post({
            url: "/global/dispose",
            ...options,
        });
    }
}
export class Project extends HeyApiClient {
    /**
     * List all projects
     *
     * Get a list of projects that have been opened with OpenCode.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/project",
            ...options,
            ...params,
        });
    }
    /**
     * Get current project
     *
     * Retrieve the currently active project that OpenCode is working with.
     */
    current(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/project/current",
            ...options,
            ...params,
        });
    }
    /**
     * Update project
     *
     * Update project properties such as name, icon and color.
     */
    update(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "projectID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "name" },
                    { in: "body", key: "icon" },
                ],
            },
        ]);
        return (options?.client ?? this.client).patch({
            url: "/project/{projectID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Pty extends HeyApiClient {
    /**
     * List PTY sessions
     *
     * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/pty",
            ...options,
            ...params,
        });
    }
    /**
     * Create PTY session
     *
     * Create a new pseudo-terminal (PTY) session for running shell commands and processes.
     */
    create(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "command" },
                    { in: "body", key: "args" },
                    { in: "body", key: "cwd" },
                    { in: "body", key: "title" },
                    { in: "body", key: "env" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/pty",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Remove PTY session
     *
     * Remove and terminate a specific pseudo-terminal (PTY) session.
     */
    remove(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "ptyID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).delete({
            url: "/pty/{ptyID}",
            ...options,
            ...params,
        });
    }
    /**
     * Get PTY session
     *
     * Retrieve detailed information about a specific pseudo-terminal (PTY) session.
     */
    get(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "ptyID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/pty/{ptyID}",
            ...options,
            ...params,
        });
    }
    /**
     * Update PTY session
     *
     * Update properties of an existing pseudo-terminal (PTY) session.
     */
    update(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "ptyID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "title" },
                    { in: "body", key: "size" },
                ],
            },
        ]);
        return (options?.client ?? this.client).put({
            url: "/pty/{ptyID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Connect to PTY session
     *
     * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.
     */
    connect(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "ptyID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/pty/{ptyID}/connect",
            ...options,
            ...params,
        });
    }
}
export class Config extends HeyApiClient {
    /**
     * Get configuration
     *
     * Retrieve the current OpenCode configuration settings and preferences.
     */
    get(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/config",
            ...options,
            ...params,
        });
    }
    /**
     * Update configuration
     *
     * Update OpenCode configuration settings and preferences.
     */
    update(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { key: "config", map: "body" },
                ],
            },
        ]);
        return (options?.client ?? this.client).patch({
            url: "/config",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * List config providers
     *
     * Get a list of all configured AI providers and their default models.
     */
    providers(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/config/providers",
            ...options,
            ...params,
        });
    }
}
export class Tool extends HeyApiClient {
    /**
     * List tool IDs
     *
     * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools.
     */
    ids(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/experimental/tool/ids",
            ...options,
            ...params,
        });
    }
    /**
     * List tools
     *
     * Get a list of available tools with their JSON schema parameters for a specific provider and model combination.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "provider" },
                    { in: "query", key: "model" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/experimental/tool",
            ...options,
            ...params,
        });
    }
}
export class Instance extends HeyApiClient {
    /**
     * Dispose instance
     *
     * Clean up and dispose the current OpenCode instance, releasing all resources.
     */
    dispose(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/instance/dispose",
            ...options,
            ...params,
        });
    }
}
export class Path extends HeyApiClient {
    /**
     * Get paths
     *
     * Retrieve the current working directory and related path information for the OpenCode instance.
     */
    get(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/path",
            ...options,
            ...params,
        });
    }
}
export class Worktree extends HeyApiClient {
    /**
     * List worktrees
     *
     * List all sandbox worktrees for the current project.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/experimental/worktree",
            ...options,
            ...params,
        });
    }
    /**
     * Create worktree
     *
     * Create a new git worktree for the current project.
     */
    create(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { key: "worktreeCreateInput", map: "body" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/experimental/worktree",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Vcs extends HeyApiClient {
    /**
     * Get VCS info
     *
     * Retrieve version control system (VCS) information for the current project, such as git branch.
     */
    get(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/vcs",
            ...options,
            ...params,
        });
    }
}
export class Session extends HeyApiClient {
    /**
     * List sessions
     *
     * Get a list of all OpenCode sessions, sorted by most recently updated.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "start" },
                    { in: "query", key: "search" },
                    { in: "query", key: "limit" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session",
            ...options,
            ...params,
        });
    }
    /**
     * Create session
     *
     * Create a new OpenCode session for interacting with AI assistants and managing conversations.
     */
    create(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "parentID" },
                    { in: "body", key: "title" },
                    { in: "body", key: "permission" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Get session status
     *
     * Retrieve the current status of all sessions, including active, idle, and completed states.
     */
    status(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/session/status",
            ...options,
            ...params,
        });
    }
    /**
     * Delete session
     *
     * Delete a session and permanently remove all associated data, including messages and history.
     */
    delete(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).delete({
            url: "/session/{sessionID}",
            ...options,
            ...params,
        });
    }
    /**
     * Get session
     *
     * Retrieve detailed information about a specific OpenCode session.
     */
    get(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}",
            ...options,
            ...params,
        });
    }
    /**
     * Update session
     *
     * Update properties of an existing session, such as title or other metadata.
     */
    update(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "title" },
                    { in: "body", key: "time" },
                ],
            },
        ]);
        return (options?.client ?? this.client).patch({
            url: "/session/{sessionID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Get session children
     *
     * Retrieve all child sessions that were forked from the specified parent session.
     */
    children(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}/children",
            ...options,
            ...params,
        });
    }
    /**
     * Get session todos
     *
     * Retrieve the todo list associated with a specific session, showing tasks and action items.
     */
    todo(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}/todo",
            ...options,
            ...params,
        });
    }
    /**
     * Initialize session
     *
     * Analyze the current application and create an AGENTS.md file with project-specific agent configurations.
     */
    init(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "modelID" },
                    { in: "body", key: "providerID" },
                    { in: "body", key: "messageID" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/init",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Fork session
     *
     * Create a new session by forking an existing session at a specific message point.
     */
    fork(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "messageID" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/fork",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Abort session
     *
     * Abort an active session and stop any ongoing AI processing or command execution.
     */
    abort(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/abort",
            ...options,
            ...params,
        });
    }
    /**
     * Unshare session
     *
     * Remove the shareable link for a session, making it private again.
     */
    unshare(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).delete({
            url: "/session/{sessionID}/share",
            ...options,
            ...params,
        });
    }
    /**
     * Share session
     *
     * Create a shareable link for a session, allowing others to view the conversation.
     */
    share(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/share",
            ...options,
            ...params,
        });
    }
    /**
     * Get session diff
     *
     * Get all file changes (diffs) made during this session.
     */
    diff(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "query", key: "messageID" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}/diff",
            ...options,
            ...params,
        });
    }
    /**
     * Summarize session
     *
     * Generate a concise summary of the session using AI compaction to preserve key information.
     */
    summarize(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "providerID" },
                    { in: "body", key: "modelID" },
                    { in: "body", key: "auto" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/summarize",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Get session messages
     *
     * Retrieve all messages in a session, including user prompts and AI responses.
     */
    messages(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "query", key: "limit" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}/message",
            ...options,
            ...params,
        });
    }
    /**
     * Send message
     *
     * Create and send a new message to a session, streaming the AI response.
     */
    prompt(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "messageID" },
                    { in: "body", key: "model" },
                    { in: "body", key: "agent" },
                    { in: "body", key: "noReply" },
                    { in: "body", key: "tools" },
                    { in: "body", key: "system" },
                    { in: "body", key: "variant" },
                    { in: "body", key: "parts" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/message",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Get message
     *
     * Retrieve a specific message from a session by its message ID.
     */
    message(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "path", key: "messageID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/session/{sessionID}/message/{messageID}",
            ...options,
            ...params,
        });
    }
    /**
     * Send async message
     *
     * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately.
     */
    promptAsync(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "messageID" },
                    { in: "body", key: "model" },
                    { in: "body", key: "agent" },
                    { in: "body", key: "noReply" },
                    { in: "body", key: "tools" },
                    { in: "body", key: "system" },
                    { in: "body", key: "variant" },
                    { in: "body", key: "parts" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/prompt_async",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Send command
     *
     * Send a new command to a session for execution by the AI assistant.
     */
    command(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "messageID" },
                    { in: "body", key: "agent" },
                    { in: "body", key: "model" },
                    { in: "body", key: "arguments" },
                    { in: "body", key: "command" },
                    { in: "body", key: "variant" },
                    { in: "body", key: "parts" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/command",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Run shell command
     *
     * Execute a shell command within the session context and return the AI's response.
     */
    shell(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "agent" },
                    { in: "body", key: "model" },
                    { in: "body", key: "command" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/shell",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Revert message
     *
     * Revert a specific message in a session, undoing its effects and restoring the previous state.
     */
    revert(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "messageID" },
                    { in: "body", key: "partID" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/revert",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Restore reverted messages
     *
     * Restore all previously reverted messages in a session.
     */
    unrevert(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/unrevert",
            ...options,
            ...params,
        });
    }
}
export class Part extends HeyApiClient {
    /**
     * Delete a part from a message
     */
    delete(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "path", key: "messageID" },
                    { in: "path", key: "partID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).delete({
            url: "/session/{sessionID}/message/{messageID}/part/{partID}",
            ...options,
            ...params,
        });
    }
    /**
     * Update a part in a message
     */
    update(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "path", key: "messageID" },
                    { in: "path", key: "partID" },
                    { in: "query", key: "directory" },
                    { key: "part", map: "body" },
                ],
            },
        ]);
        return (options?.client ?? this.client).patch({
            url: "/session/{sessionID}/message/{messageID}/part/{partID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Permission extends HeyApiClient {
    /**
     * Respond to permission
     *
     * Approve or deny a permission request from the AI assistant.
     *
     * @deprecated
     */
    respond(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "sessionID" },
                    { in: "path", key: "permissionID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "response" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/session/{sessionID}/permissions/{permissionID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Respond to permission request
     *
     * Approve or deny a permission request from the AI assistant.
     */
    reply(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "requestID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "reply" },
                    { in: "body", key: "message" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/permission/{requestID}/reply",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * List pending permissions
     *
     * Get all pending permission requests across all sessions.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/permission",
            ...options,
            ...params,
        });
    }
}
export class Question extends HeyApiClient {
    /**
     * List pending questions
     *
     * Get all pending question requests across all sessions.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/question",
            ...options,
            ...params,
        });
    }
    /**
     * Reply to question request
     *
     * Provide answers to a question request from the AI assistant.
     */
    reply(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "requestID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "answers" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/question/{requestID}/reply",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Reject question request
     *
     * Reject a question request from the AI assistant.
     */
    reject(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "requestID" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/question/{requestID}/reject",
            ...options,
            ...params,
        });
    }
}
export class Command extends HeyApiClient {
    /**
     * List commands
     *
     * Get a list of all available commands in the OpenCode system.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/command",
            ...options,
            ...params,
        });
    }
}
export class Oauth extends HeyApiClient {
    /**
     * OAuth authorize
     *
     * Initiate OAuth authorization for a specific AI provider to get an authorization URL.
     */
    authorize(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "providerID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "method" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/provider/{providerID}/oauth/authorize",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * OAuth callback
     *
     * Handle the OAuth callback from a provider after user authorization.
     */
    callback(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "providerID" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "method" },
                    { in: "body", key: "code" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/provider/{providerID}/oauth/callback",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Provider extends HeyApiClient {
    /**
     * List providers
     *
     * Get a list of all available AI providers, including both available and connected ones.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/provider",
            ...options,
            ...params,
        });
    }
    /**
     * Get provider auth methods
     *
     * Retrieve available authentication methods for all AI providers.
     */
    auth(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/provider/auth",
            ...options,
            ...params,
        });
    }
    oauth = new Oauth({ client: this.client });
}
export class Find extends HeyApiClient {
    /**
     * Find text
     *
     * Search for text patterns across files in the project using ripgrep.
     */
    text(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "pattern" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/find",
            ...options,
            ...params,
        });
    }
    /**
     * Find files
     *
     * Search for files or directories by name or pattern in the project directory.
     */
    files(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "query" },
                    { in: "query", key: "dirs" },
                    { in: "query", key: "type" },
                    { in: "query", key: "limit" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/find/file",
            ...options,
            ...params,
        });
    }
    /**
     * Find symbols
     *
     * Search for workspace symbols like functions, classes, and variables using LSP.
     */
    symbols(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "query" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/find/symbol",
            ...options,
            ...params,
        });
    }
}
export class File extends HeyApiClient {
    /**
     * List files
     *
     * List files and directories in a specified path.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "path" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/file",
            ...options,
            ...params,
        });
    }
    /**
     * Read file
     *
     * Read the content of a specified file.
     */
    read(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "query", key: "path" },
                ],
            },
        ]);
        return (options?.client ?? this.client).get({
            url: "/file/content",
            ...options,
            ...params,
        });
    }
    /**
     * Get file status
     *
     * Get the git status of all files in the project.
     */
    status(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/file/status",
            ...options,
            ...params,
        });
    }
}
export class App extends HeyApiClient {
    /**
     * Write log
     *
     * Write a log entry to the server logs with specified level and metadata.
     */
    log(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "service" },
                    { in: "body", key: "level" },
                    { in: "body", key: "message" },
                    { in: "body", key: "extra" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/log",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * List agents
     *
     * Get a list of all available AI agents in the OpenCode system.
     */
    agents(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/agent",
            ...options,
            ...params,
        });
    }
}
export class Auth extends HeyApiClient {
    /**
     * Remove MCP OAuth
     *
     * Remove OAuth credentials for an MCP server
     */
    remove(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).delete({
            url: "/mcp/{name}/auth",
            ...options,
            ...params,
        });
    }
    /**
     * Start MCP OAuth
     *
     * Start OAuth authentication flow for a Model Context Protocol (MCP) server.
     */
    start(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp/{name}/auth",
            ...options,
            ...params,
        });
    }
    /**
     * Complete MCP OAuth
     *
     * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.
     */
    callback(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                    { in: "body", key: "code" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp/{name}/auth/callback",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Authenticate MCP OAuth
     *
     * Start OAuth flow and wait for callback (opens browser)
     */
    authenticate(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp/{name}/auth/authenticate",
            ...options,
            ...params,
        });
    }
    /**
     * Set auth credentials
     *
     * Set authentication credentials
     */
    set(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "providerID" },
                    { in: "query", key: "directory" },
                    { key: "auth", map: "body" },
                ],
            },
        ]);
        return (options?.client ?? this.client).put({
            url: "/auth/{providerID}",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Mcp extends HeyApiClient {
    /**
     * Get MCP status
     *
     * Get the status of all Model Context Protocol (MCP) servers.
     */
    status(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/mcp",
            ...options,
            ...params,
        });
    }
    /**
     * Add MCP server
     *
     * Dynamically add a new Model Context Protocol (MCP) server to the system.
     */
    add(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "name" },
                    { in: "body", key: "config" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Connect an MCP server
     */
    connect(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp/{name}/connect",
            ...options,
            ...params,
        });
    }
    /**
     * Disconnect an MCP server
     */
    disconnect(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "path", key: "name" },
                    { in: "query", key: "directory" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/mcp/{name}/disconnect",
            ...options,
            ...params,
        });
    }
    auth = new Auth({ client: this.client });
}
export class Resource extends HeyApiClient {
    /**
     * Get MCP resources
     *
     * Get all available MCP resources from connected servers. Optionally filter by name.
     */
    list(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/experimental/resource",
            ...options,
            ...params,
        });
    }
}
export class Experimental extends HeyApiClient {
    resource = new Resource({ client: this.client });
}
export class Lsp extends HeyApiClient {
    /**
     * Get LSP status
     *
     * Get LSP server status
     */
    status(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/lsp",
            ...options,
            ...params,
        });
    }
}
export class Formatter extends HeyApiClient {
    /**
     * Get formatter status
     *
     * Get formatter status
     */
    status(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/formatter",
            ...options,
            ...params,
        });
    }
}
export class Control extends HeyApiClient {
    /**
     * Get next TUI request
     *
     * Retrieve the next TUI (Terminal User Interface) request from the queue for processing.
     */
    next(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).get({
            url: "/tui/control/next",
            ...options,
            ...params,
        });
    }
    /**
     * Submit TUI response
     *
     * Submit a response to the TUI request queue to complete a pending request.
     */
    response(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/control/response",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
}
export class Tui extends HeyApiClient {
    /**
     * Append TUI prompt
     *
     * Append prompt to the TUI
     */
    appendPrompt(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "text" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/tui/append-prompt",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Open help dialog
     *
     * Open the help dialog in the TUI to display user assistance information.
     */
    openHelp(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/open-help",
            ...options,
            ...params,
        });
    }
    /**
     * Open sessions dialog
     *
     * Open the session dialog
     */
    openSessions(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/open-sessions",
            ...options,
            ...params,
        });
    }
    /**
     * Open themes dialog
     *
     * Open the theme dialog
     */
    openThemes(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/open-themes",
            ...options,
            ...params,
        });
    }
    /**
     * Open models dialog
     *
     * Open the model dialog
     */
    openModels(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/open-models",
            ...options,
            ...params,
        });
    }
    /**
     * Submit TUI prompt
     *
     * Submit the prompt
     */
    submitPrompt(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/submit-prompt",
            ...options,
            ...params,
        });
    }
    /**
     * Clear TUI prompt
     *
     * Clear the prompt
     */
    clearPrompt(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/clear-prompt",
            ...options,
            ...params,
        });
    }
    /**
     * Execute TUI command
     *
     * Execute a TUI command (e.g. agent_cycle)
     */
    executeCommand(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "command" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/tui/execute-command",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Show TUI toast
     *
     * Show a toast notification in the TUI
     */
    showToast(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "title" },
                    { in: "body", key: "message" },
                    { in: "body", key: "variant" },
                    { in: "body", key: "duration" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/tui/show-toast",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Publish TUI event
     *
     * Publish a TUI event
     */
    publish(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]);
        return (options?.client ?? this.client).post({
            url: "/tui/publish",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    /**
     * Select session
     *
     * Navigate the TUI to display the specified session.
     */
    selectSession(parameters, options) {
        const params = buildClientParams([parameters], [
            {
                args: [
                    { in: "query", key: "directory" },
                    { in: "body", key: "sessionID" },
                ],
            },
        ]);
        return (options?.client ?? this.client).post({
            url: "/tui/select-session",
            ...options,
            ...params,
            headers: {
                "Content-Type": "application/json",
                ...options?.headers,
                ...params.headers,
            },
        });
    }
    control = new Control({ client: this.client });
}
export class Event extends HeyApiClient {
    /**
     * Subscribe to events
     *
     * Get events
     */
    subscribe(parameters, options) {
        const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]);
        return (options?.client ?? this.client).sse.get({
            url: "/event",
            ...options,
            ...params,
        });
    }
}
export class OpencodeClient extends HeyApiClient {
    static __registry = new HeyApiRegistry();
    constructor(args) {
        super(args);
        OpencodeClient.__registry.set(this, args?.key);
    }
    global = new Global({ client: this.client });
    project = new Project({ client: this.client });
    pty = new Pty({ client: this.client });
    config = new Config({ client: this.client });
    tool = new Tool({ client: this.client });
    instance = new Instance({ client: this.client });
    path = new Path({ client: this.client });
    worktree = new Worktree({ client: this.client });
    vcs = new Vcs({ client: this.client });
    session = new Session({ client: this.client });
    part = new Part({ client: this.client });
    permission = new Permission({ client: this.client });
    question = new Question({ client: this.client });
    command = new Command({ client: this.client });
    provider = new Provider({ client: this.client });
    find = new Find({ client: this.client });
    file = new File({ client: this.client });
    app = new App({ client: this.client });
    mcp = new Mcp({ client: this.client });
    experimental = new Experimental({ client: this.client });
    lsp = new Lsp({ client: this.client });
    formatter = new Formatter({ client: this.client });
    tui = new Tui({ client: this.client });
    auth = new Auth({ client: this.client });
    event = new Event({ client: this.client });
}
