import type { PermissionResult } from "../agents/adapters/claude-code/types.js";
import { ToolPermissionPolicy } from "../agents/permissions/ToolPermissionPolicy.js";
import { EventEmitter } from "events";
import type { DefaultPermissions } from "shared/types/index.js";
import type { StreamEvent } from "shared/types/index.js";
export type { StreamEvent };
interface PendingRequest {
    toolName: string;
    input: Record<string, unknown>;
    suggestions?: unknown[];
    eventType: "permission_request" | "user_question" | "plan_review";
    eventData: Record<string, unknown>;
    resolve: (result: PermissionResult) => void;
}
interface ActiveSession {
    abortController: AbortController;
    emitter: EventEmitter;
}
export declare function getActiveSession(chatId: string): ActiveSession | undefined;
export declare function hasPendingRequest(chatId: string): boolean;
export declare function getPendingRequest(chatId: string): Omit<PendingRequest, "resolve"> | null;
export declare function respondToPermission(chatId: string, allow: boolean, updatedInput?: Record<string, unknown>, updatedPermissions?: unknown[]): {
    ok: boolean;
    toolName?: string;
};
export declare function stopSession(chatId: string): boolean;
/**
 * Build the canUseTool permission handler for the Claude SDK.
 * Uses a getter function for the tracking ID since it may change mid-session (new chat flow).
 */
export declare function buildCanUseTool(emitter: EventEmitter, toolPermissionPolicy: ToolPermissionPolicy, getTrackingId: () => string, hookAskOverride?: {
    reason: string;
}): (toolName: string, input: Record<string, unknown>, { signal, suggestions }: {
    signal: AbortSignal;
    suggestions?: unknown[];
}) => Promise<PermissionResult>;
interface SendMessageOptions {
    prompt: string | any;
    imageMetadata?: {
        buffer: Buffer;
        mimeType: string;
    }[];
    activePlugins?: string[];
    /** For existing chats: the chat ID to continue */
    chatId?: string;
    /** For new chats: the working directory (used as cwd for the SDK, also stored with chat) */
    folder?: string;
    /** For new chats: initial permission settings */
    defaultPermissions?: DefaultPermissions;
    /** Maximum number of agent turns before stopping (default: 200) */
    maxTurns?: number;
    /** Agent identity prompt — appended to Claude Code's preset system prompt */
    systemPrompt?: string;
    /** Agent alias — when set, injects Callboard custom tools MCP server into the session */
    agentAlias?: string;
    /** Whether this chat was triggered by an automated system (cron, trigger, heartbeat, etc.) */
    triggered?: boolean;
    /** How this chat was triggered — stored in metadata for icon distinction */
    triggeredBy?: "cron" | "event" | "trigger" | "tool";
}
/**
 * Unified message sending function.
 * Handles both existing chats (provide chatId) and new chats (provide folder).
 * For new chats, creates the chat record when session_id arrives from the SDK
 * and emits a "chat_created" event so the frontend can navigate.
 */
export declare function sendMessage(opts: SendMessageOptions): Promise<EventEmitter>;
//# sourceMappingURL=claude.d.ts.map