import { AiContext } from "../ai/types";
import { EditContextType } from "../client/editContext";
import { FieldDescriptor, ItemDescriptor } from "../pageModel";
import { ExecutionResult } from "./serviceHelper";
export type AiModel = {
    id: string;
    name: string;
};
export type PreconfiguredTodo = {
    id: string;
    title: string;
    instructions?: string;
    agentProfileId?: string;
};
export type AiProfileSitecoreAllowance = {
    itemIdentifier: string;
    operationTypes?: string[];
};
export type AiProfileFilesystemAllowance = {
    path: string;
    operationTypes?: string[];
};
export type AiProfile = {
    enableDocumentUpload?: boolean;
    maxDocumentSizeMB?: number;
    id: string;
    name: string;
    defaultModelId: string;
    models: AiModel[];
    prompts: {
        prompt: string;
        title: string;
    }[];
    /** Editor context mode: "none", "onCreate", or "live" */
    editorContextMode?: "none" | "onCreate" | "live";
    greetingMessage?: string;
    displayTitle?: string;
    description?: string;
    svgIcon?: string;
    hiddenFromOverview?: boolean;
    costLimit?: number | null;
    includeUserBrowseHistory?: number;
    includeUserFavorites?: boolean;
    deterministic?: boolean;
    agentName?: string;
    allowedSwitchProfiles?: {
        id: string;
        name: string;
    }[];
    allowedToolNames?: string[];
    readOnlyToolNames?: string[];
    sitecoreAllowances?: AiProfileSitecoreAllowance[];
    filesystemAllowances?: AiProfileFilesystemAllowance[];
    allowedSkills?: {
        id: string;
        name: string;
    }[];
    /** Skills exposed for load-skills; when empty or omitted, no skills are available for that visibility layer. */
    availableSkills?: {
        id: string;
        name: string;
    }[];
    preloadSkills?: {
        id: string;
        name: string;
    }[];
    preconfiguredTodos?: PreconfiguredTodo[];
};
export declare function getAiProfilesErrorMessage(error: unknown): string;
export declare function loadAiProfiles(item?: ItemDescriptor): Promise<AiProfile[]>;
/**
 * Invalidates cached AI profiles so the next `loadAiProfiles` refetches immediately.
 * Call this when profiles are changed (e.g. via websocket).
 */
export declare function invalidateAiProfilesCache(): void;
export type HelpTopic = {
    id: string;
    title: string;
    description: string;
    prompt: string;
};
export declare function loadHelpTopics(): Promise<HelpTopic[]>;
type Message = {
    content: string;
    name: string;
    role: string;
    id: string;
    tool_calls?: any[];
    tool_call_id?: string;
};
export interface ExecutePromptResponse {
    editOperations: any[];
    content: string;
    messages?: Message[];
    numInputTokens: number;
    numOutputTokens: number;
    numCachedTokens: number;
    state: string;
    isIncremental?: boolean;
    deltaContent?: string;
    previousContentLength?: number;
    totalContentLength?: number;
    agentName?: string;
    totalCost?: number;
    totalInputTokenCost?: number;
    totalOutputTokenCost?: number;
    totalCachedTokenCost?: number;
    totalInputTokens?: number;
    totalOutputTokens?: number;
    totalCachedTokens?: number;
    totalTokens?: number;
    totalMessages?: number;
}
export interface ExecutePromptOptions {
    sessionId?: string | null;
    model?: string | null;
    stream?: boolean;
    profileId?: string;
    selection?: string[];
    selectedText?: string | null;
    agentId?: string;
    addSelectedComponents?: boolean;
    allowedFunctions?: string[];
    addContextContent?: boolean;
    addAllContent?: boolean;
    profile?: string;
    endpoint?: string;
}
export declare function executePrompt(messages: Message[], context: AiContext | {
    editContext: EditContextType;
    createAiContext: ({ editContext }: {
        editContext: any;
    }) => AiContext;
}, options?: ExecutePromptOptions, requestOptions?: RequestInit, callback?: (response: any) => void, stream?: boolean): Promise<ExecutePromptResponse | null>;
/**
 * Executes a prompt and returns the parsed JSON result
 * @param messages - The messages to send
 * @param context - The AI context
 * @param options - Execution options
 * @param requestOptions - Additional request options
 * @param callback - Optional callback for streaming responses
 * @param stream - Whether to stream the response
 * @returns The parsed JSON object from the response content
 * @throws Error if the response cannot be parsed or is not in the expected format
 */
export declare function executePromptWithJsonResult<T = any>(messages: Message[], context: AiContext | {
    editContext: EditContextType;
    createAiContext: ({ editContext }: {
        editContext: any;
    }) => AiContext;
}, options?: ExecutePromptOptions, requestOptions?: RequestInit, callback?: (parsedJson: T) => void, stream?: boolean): Promise<T>;
export declare function generateImage(options: FieldDescriptor & {
    prompt: string;
    sessionId: string;
    pageItem: ItemDescriptor;
    wizardId: ItemDescriptor;
}): Promise<ExecutionResult<any>>;
export type QuotaScope = "me" | "all" | "user";
export type RequestQuotaOptions = {
    scope?: QuotaScope;
    userName?: string;
};
export type QuotaResponsePayload = {
    usage: {
        totalTokens: number;
        totalImages: number;
        dailyTokens: number;
        dailyImages: number;
        totalCost: number;
        dailyCost: number;
        dailyHistory?: Array<{
            date: string;
            tokens: number;
            images: number;
            tokenCost: number;
            imageCost: number;
        }>;
    };
    limits: {
        totalTokens: number;
        dailyTokens: number;
        totalImages: number;
        dailyImages: number;
    };
    scope?: QuotaScope;
    userName?: string;
};
export declare function requestQuota(options?: RequestQuotaOptions): Promise<ExecutionResult<QuotaResponsePayload>>;
export {};
