import type { Logger } from "pino";
import type { AgentCapabilityFlags, AgentClient, AgentLaunchContext, AgentMode, AgentModelDefinition, AgentPersistenceHandle, AgentSession, AgentSessionConfig, AgentStreamEvent, AgentUsage, ListModelsOptions, ListModesOptions, ListPersistedAgentsOptions, PersistedAgentDescriptor } from "../agent-sdk-types.js";
import { type ProviderRuntimeSettings } from "../provider-launch-config.js";
type OpenCodeMessageRole = "user" | "assistant";
export declare class OpenCodeServerManager {
    private static instance;
    private static exitHandlerRegistered;
    private server;
    private port;
    private startPromise;
    private readonly logger;
    private readonly runtimeSettings?;
    private readonly runtimeSettingsKey;
    private constructor();
    static getInstance(logger: Logger, runtimeSettings?: ProviderRuntimeSettings): OpenCodeServerManager;
    private static registerExitHandler;
    ensureRunning(): Promise<{
        port: number;
        url: string;
    }>;
    private startServer;
    shutdown(): Promise<void>;
}
export declare class OpenCodeAgentClient implements AgentClient {
    readonly provider: "opencode";
    readonly capabilities: AgentCapabilityFlags;
    private readonly serverManager;
    private readonly logger;
    private readonly runtimeSettings?;
    constructor(logger: Logger, runtimeSettings?: ProviderRuntimeSettings);
    createSession(config: AgentSessionConfig, _launchContext?: AgentLaunchContext): Promise<AgentSession>;
    resumeSession(handle: AgentPersistenceHandle, overrides?: Partial<AgentSessionConfig>, _launchContext?: AgentLaunchContext): Promise<AgentSession>;
    listModels(options?: ListModelsOptions): Promise<AgentModelDefinition[]>;
    listModes(options?: ListModesOptions): Promise<AgentMode[]>;
    listPersistedAgents(_options?: ListPersistedAgentsOptions): Promise<PersistedAgentDescriptor[]>;
    isAvailable(): Promise<boolean>;
    private assertConfig;
}
export type OpenCodeEventTranslationState = {
    sessionId: string;
    messageRoles: Map<string, OpenCodeMessageRole>;
    accumulatedUsage: AgentUsage;
    streamedPartKeys: Set<string>;
    emittedStructuredMessageIds: Set<string>;
    /** Tracks the type of each part by ID, learned from message.part.updated events. */
    partTypes: Map<string, string>;
};
export declare function translateOpenCodeEvent(event: unknown, state: OpenCodeEventTranslationState): AgentStreamEvent[];
export {};
//# sourceMappingURL=opencode-agent.d.ts.map