import type { Options as ClaudeAgentOptions } from "@anthropic-ai/claude-agent-sdk";
export type AgentProvider = string;
export type AgentMetadata = {
    [key: string]: unknown;
};
/**
 * Stdio-based MCP server (spawns a subprocess).
 */
export interface McpStdioServerConfig {
    type: "stdio";
    command: string;
    args?: string[];
    env?: Record<string, string>;
}
/**
 * HTTP-based MCP server.
 */
export interface McpHttpServerConfig {
    type: "http";
    url: string;
    headers?: Record<string, string>;
}
/**
 * SSE-based MCP server (Server-Sent Events over HTTP).
 */
export interface McpSseServerConfig {
    type: "sse";
    url: string;
    headers?: Record<string, string>;
}
/**
 * Canonical MCP server configuration.
 * Discriminated union by `type` field.
 * Each provider normalizes this to their expected format.
 */
export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig | McpSseServerConfig;
export type AgentMode = {
    id: string;
    label: string;
    description?: string;
};
export type ProviderStatus = "ready" | "loading" | "error" | "unavailable";
export type AgentModelDefinition = {
    provider: AgentProvider;
    id: string;
    label: string;
    description?: string;
    isDefault?: boolean;
    metadata?: AgentMetadata;
    thinkingOptions?: AgentSelectOption[];
    defaultThinkingOptionId?: string;
};
export type AgentSelectOption = {
    id: string;
    label: string;
    description?: string;
    isDefault?: boolean;
    metadata?: AgentMetadata;
};
export interface ProviderSnapshotEntry {
    provider: AgentProvider;
    status: ProviderStatus;
    error?: string;
    models?: AgentModelDefinition[];
    modes?: AgentMode[];
    fetchedAt?: string;
}
export type AgentFeatureToggle = {
    type: "toggle";
    id: string;
    label: string;
    description?: string;
    tooltip?: string;
    icon?: string;
    value: boolean;
};
export type AgentFeatureSelect = {
    type: "select";
    id: string;
    label: string;
    description?: string;
    tooltip?: string;
    icon?: string;
    value: string | null;
    options: AgentSelectOption[];
};
export type AgentFeature = AgentFeatureToggle | AgentFeatureSelect;
export type AgentCapabilityFlags = {
    supportsStreaming: boolean;
    supportsSessionPersistence: boolean;
    supportsDynamicModes: boolean;
    supportsMcpServers: boolean;
    supportsReasoningStream: boolean;
    supportsToolInvocations: boolean;
};
export type AgentPersistenceHandle = {
    provider: AgentProvider;
    sessionId: string;
    /** Provider specific handle (Codex thread id, Claude resume token, etc). */
    nativeHandle?: string;
    metadata?: AgentMetadata;
};
export type AgentPromptContentBlock = {
    type: "text";
    text: string;
} | {
    type: "image";
    data: string;
    mimeType: string;
};
export type AgentPromptInput = string | AgentPromptContentBlock[];
export type AgentRunOptions = {
    outputSchema?: unknown;
    resumeFrom?: AgentPersistenceHandle;
    maxThinkingTokens?: number;
};
export type AgentUsage = {
    inputTokens?: number;
    cachedInputTokens?: number;
    outputTokens?: number;
    totalCostUsd?: number;
    contextWindowMaxTokens?: number;
    contextWindowUsedTokens?: number;
};
export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"];
export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number];
export type ToolCallDetail = {
    type: "shell";
    command: string;
    cwd?: string;
    output?: string;
    exitCode?: number | null;
} | {
    type: "read";
    filePath: string;
    content?: string;
    offset?: number;
    limit?: number;
} | {
    type: "edit";
    filePath: string;
    oldString?: string;
    newString?: string;
    unifiedDiff?: string;
} | {
    type: "write";
    filePath: string;
    content?: string;
} | {
    type: "search";
    query: string;
    toolName?: "search" | "grep" | "glob" | "web_search";
    content?: string;
    filePaths?: string[];
    webResults?: Array<{
        title: string;
        url: string;
    }>;
    annotations?: string[];
    numFiles?: number;
    numMatches?: number;
    durationMs?: number;
    durationSeconds?: number;
    truncated?: boolean;
    mode?: "content" | "files_with_matches" | "count";
} | {
    type: "fetch";
    url: string;
    prompt?: string;
    result?: string;
    code?: number;
    codeText?: string;
    bytes?: number;
    durationMs?: number;
} | {
    type: "worktree_setup";
    worktreePath: string;
    branchName: string;
    log: string;
    commands: Array<{
        index: number;
        command: string;
        cwd: string;
        status: "running" | "completed" | "failed";
        exitCode: number | null;
        durationMs?: number;
    }>;
    truncated?: boolean;
} | {
    type: "sub_agent";
    subAgentType?: string;
    description?: string;
    log: string;
    actions: Array<{
        index: number;
        toolName: string;
        summary?: string;
    }>;
} | {
    type: "plain_text";
    label?: string;
    text?: string;
    icon?: ToolCallIconName;
} | {
    type: "plan";
    text: string;
} | {
    type: "unknown";
    input: unknown | null;
    output: unknown | null;
};
type ToolCallBase = {
    type: "tool_call";
    callId: string;
    name: string;
    detail: ToolCallDetail;
    metadata?: Record<string, unknown>;
};
type ToolCallRunningTimelineItem = ToolCallBase & {
    status: "running";
    error: null;
};
type ToolCallCompletedTimelineItem = ToolCallBase & {
    status: "completed";
    error: null;
};
type ToolCallFailedTimelineItem = ToolCallBase & {
    status: "failed";
    error: unknown;
};
type ToolCallCanceledTimelineItem = ToolCallBase & {
    status: "canceled";
    error: null;
};
export type ToolCallTimelineItem = ToolCallRunningTimelineItem | ToolCallCompletedTimelineItem | ToolCallFailedTimelineItem | ToolCallCanceledTimelineItem;
export type CompactionTimelineItem = {
    type: "compaction";
    status: "loading" | "completed";
    trigger?: "auto" | "manual";
    preTokens?: number;
};
export type AgentTimelineItem = {
    type: "user_message";
    text: string;
    messageId?: string;
} | {
    type: "assistant_message";
    text: string;
} | {
    type: "reasoning";
    text: string;
} | ToolCallTimelineItem | {
    type: "todo";
    items: {
        text: string;
        completed: boolean;
    }[];
} | {
    type: "error";
    message: string;
} | CompactionTimelineItem;
export type AgentStreamEvent = {
    type: "thread_started";
    sessionId: string;
    provider: AgentProvider;
} | {
    type: "turn_started";
    provider: AgentProvider;
    turnId?: string;
} | {
    type: "turn_completed";
    provider: AgentProvider;
    usage?: AgentUsage;
    turnId?: string;
} | {
    type: "usage_updated";
    provider: AgentProvider;
    usage: AgentUsage;
    turnId?: string;
} | {
    type: "turn_failed";
    provider: AgentProvider;
    error: string;
    code?: string;
    diagnostic?: string;
    turnId?: string;
} | {
    type: "turn_canceled";
    provider: AgentProvider;
    reason: string;
    turnId?: string;
} | {
    type: "timeline";
    item: AgentTimelineItem;
    provider: AgentProvider;
    turnId?: string;
} | {
    type: "permission_requested";
    provider: AgentProvider;
    request: AgentPermissionRequest;
    turnId?: string;
} | {
    type: "permission_resolved";
    provider: AgentProvider;
    requestId: string;
    resolution: AgentPermissionResponse;
    turnId?: string;
} | {
    type: "attention_required";
    provider: AgentProvider;
    reason: "finished" | "error" | "permission";
    timestamp: string;
};
export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other";
export type AgentPermissionUpdate = AgentMetadata;
export type AgentPermissionAction = {
    id: string;
    label: string;
    behavior: "allow" | "deny";
    variant?: "primary" | "secondary" | "danger";
    intent?: "implement" | "implement_resume" | "dismiss";
};
export type AgentPermissionRequest = {
    id: string;
    provider: AgentProvider;
    name: string;
    kind: AgentPermissionRequestKind;
    title?: string;
    description?: string;
    input?: AgentMetadata;
    detail?: ToolCallDetail;
    suggestions?: AgentPermissionUpdate[];
    actions?: AgentPermissionAction[];
    metadata?: AgentMetadata;
};
export type AgentPermissionResponse = {
    behavior: "allow";
    selectedActionId?: string;
    updatedInput?: AgentMetadata;
    updatedPermissions?: AgentPermissionUpdate[];
} | {
    behavior: "deny";
    selectedActionId?: string;
    message?: string;
    interrupt?: boolean;
};
export type AgentRunResult = {
    sessionId: string;
    finalText: string;
    usage?: AgentUsage;
    timeline: AgentTimelineItem[];
    canceled?: boolean;
};
export type AgentRuntimeInfo = {
    provider: AgentProvider;
    sessionId: string | null;
    model?: string | null;
    thinkingOptionId?: string | null;
    modeId?: string | null;
    extra?: AgentMetadata;
};
/**
 * Represents a slash command available in an agent session.
 * Commands are executed by sending them as prompts with / prefix.
 */
export type AgentSlashCommand = {
    name: string;
    description: string;
    argumentHint: string;
};
export type ListPersistedAgentsOptions = {
    limit?: number;
};
export type PersistedAgentDescriptor = {
    provider: AgentProvider;
    sessionId: string;
    cwd: string;
    title: string | null;
    lastActivityAt: Date;
    persistence: AgentPersistenceHandle;
    timeline: AgentTimelineItem[];
};
export type AgentSessionConfig = {
    provider: AgentProvider;
    cwd: string;
    /**
     * Provider-agnostic system/developer instruction string.
     * Mapped by each provider to its native instruction field.
     */
    systemPrompt?: string;
    modeId?: string;
    model?: string;
    thinkingOptionId?: string;
    featureValues?: Record<string, unknown>;
    title?: string | null;
    approvalPolicy?: string;
    sandboxMode?: string;
    networkAccess?: boolean;
    webSearch?: boolean;
    extra?: {
        codex?: AgentMetadata;
        claude?: Partial<ClaudeAgentOptions>;
    };
    mcpServers?: Record<string, McpServerConfig>;
    /**
     * Internal agents are hidden from listings and don't trigger notifications.
     * They are used for ephemeral system tasks like commit/PR generation.
     */
    internal?: boolean;
};
export interface AgentLaunchContext {
    env?: Record<string, string>;
}
/**
 * Returned by respondToPermission when the permission resolution requires
 * a follow-up turn (e.g. Codex plan approval → implementation).
 */
export interface AgentPermissionResult {
    followUpPrompt?: AgentPromptInput;
}
export interface AgentSession {
    readonly provider: AgentProvider;
    readonly id: string | null;
    readonly capabilities: AgentCapabilityFlags;
    readonly features?: AgentFeature[];
    run(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<AgentRunResult>;
    startTurn(prompt: AgentPromptInput, options?: AgentRunOptions): Promise<{
        turnId: string;
    }>;
    subscribe(callback: (event: AgentStreamEvent) => void): () => void;
    streamHistory(): AsyncGenerator<AgentStreamEvent>;
    getRuntimeInfo(): Promise<AgentRuntimeInfo>;
    getAvailableModes(): Promise<AgentMode[]>;
    getCurrentMode(): Promise<string | null>;
    setMode(modeId: string): Promise<void>;
    getPendingPermissions(): AgentPermissionRequest[];
    respondToPermission(requestId: string, response: AgentPermissionResponse): Promise<AgentPermissionResult | void>;
    describePersistence(): AgentPersistenceHandle | null;
    interrupt(): Promise<void>;
    close(): Promise<void>;
    listCommands?(): Promise<AgentSlashCommand[]>;
    setModel?(modelId: string | null): Promise<void>;
    setThinkingOption?(thinkingOptionId: string | null): Promise<void>;
    setFeature?(featureId: string, value: unknown): Promise<void>;
}
export interface ListModelsOptions {
    cwd?: string;
}
export interface ListModesOptions {
    cwd?: string;
}
export interface AgentClient {
    readonly provider: AgentProvider;
    readonly capabilities: AgentCapabilityFlags;
    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[]>;
    /**
     * Check if this provider is available (CLI binary is installed).
     * Returns true if available, false otherwise.
     */
    isAvailable(): Promise<boolean>;
    getDiagnostic?(): Promise<{
        diagnostic: string;
    }>;
}
export {};
//# sourceMappingURL=agent-sdk-types.d.ts.map