import { type Api, type Model } from "@earendil-works/pi-ai";
import type { AgentModelConfig } from "../../config/types.agents-shared.js";
import type { DaoCoreConfig } from "../../config/types.daocore.js";
import type { SsrFPolicy } from "../../infra/net/ssrf.js";
import type { AuthProfileStore } from "../auth-profiles/types.js";
import type { ImageModelConfig } from "./image-tool.helpers.js";
import { type ToolModelConfig } from "./model-config.helpers.js";
type TextToolAttempt = {
    provider: string;
    model: string;
    error: string;
};
type TextToolResult = {
    text: string;
    provider: string;
    model: string;
    attempts: TextToolAttempt[];
};
type GenerationModelRef = {
    provider: string;
    model: string;
};
type ParseGenerationModelRef = (raw: string | undefined) => GenerationModelRef | null;
type MediaReferenceDetailEntry = {
    rewrittenFrom?: string;
};
type TaskRunDetailHandle = {
    taskId: string;
    runId: string;
};
export declare function applyImageModelConfigDefaults(cfg: DaoCoreConfig | undefined, imageModelConfig: ImageModelConfig): DaoCoreConfig | undefined;
export declare function applyImageGenerationModelConfigDefaults(cfg: DaoCoreConfig | undefined, imageGenerationModelConfig: ToolModelConfig): DaoCoreConfig | undefined;
export declare function applyVideoGenerationModelConfigDefaults(cfg: DaoCoreConfig | undefined, videoGenerationModelConfig: ToolModelConfig): DaoCoreConfig | undefined;
export declare function applyMusicGenerationModelConfigDefaults(cfg: DaoCoreConfig | undefined, musicGenerationModelConfig: ToolModelConfig): DaoCoreConfig | undefined;
export declare function readGenerationTimeoutMs(args: Record<string, unknown>): number | undefined;
export declare function resolveRemoteMediaSsrfPolicy(cfg: DaoCoreConfig | undefined): SsrFPolicy | undefined;
type CapabilityProvider = {
    id: string;
    aliases?: string[];
    defaultModel?: string;
    models?: readonly string[];
    isConfigured?: (ctx: {
        cfg?: DaoCoreConfig;
        agentDir?: string;
    }) => boolean;
};
type CapabilityProviderSource = CapabilityProvider[] | (() => CapabilityProvider[]);
type GenerationCapabilityProviderKey = "imageGenerationProviders" | "videoGenerationProviders" | "musicGenerationProviders";
export declare function isCapabilityProviderConfigured<T extends CapabilityProvider>(params: {
    providers: T[];
    provider?: T;
    providerId?: string;
    cfg?: DaoCoreConfig;
    agentDir?: string;
    authStore?: AuthProfileStore;
}): boolean;
export declare function resolveSelectedCapabilityProvider<T extends CapabilityProvider>(params: {
    providers: T[];
    modelConfig: ToolModelConfig;
    modelOverride?: string;
    parseModelRef: ParseGenerationModelRef;
}): T | undefined;
export declare function resolveCapabilityModelConfigForTool(params: {
    cfg?: DaoCoreConfig;
    agentDir?: string;
    authStore?: AuthProfileStore;
    modelConfig?: AgentModelConfig;
    providers: CapabilityProviderSource;
}): ToolModelConfig | null;
export declare function hasGenerationToolAvailability(params: {
    cfg?: DaoCoreConfig;
    agentDir?: string;
    workspaceDir?: string;
    authStore?: AuthProfileStore;
    modelConfig?: AgentModelConfig;
    providers?: CapabilityProvider[] | (() => CapabilityProvider[]);
    providerKey: GenerationCapabilityProviderKey;
}): boolean;
export declare function resolveGenerateAction<TAction extends string>(params: {
    args: Record<string, unknown>;
    allowed: readonly TAction[];
    defaultAction: TAction;
}): TAction;
export declare function readBooleanToolParam(params: Record<string, unknown>, key: string): boolean | undefined;
export declare function normalizeMediaReferenceInputs(params: {
    args: Record<string, unknown>;
    singularKey: string;
    pluralKey: string;
    maxCount: number;
    label: string;
}): string[];
export declare function buildMediaReferenceDetails<T extends MediaReferenceDetailEntry>(params: {
    entries: readonly T[];
    singleKey: string;
    pluralKey: string;
    getResolvedInput: (entry: T) => string | undefined;
    singleRewriteKey?: string;
}): Record<string, unknown>;
export declare function buildTaskRunDetails(handle: TaskRunDetailHandle | null | undefined): Record<string, unknown>;
export declare function resolveMediaToolLocalRoots(workspaceDirRaw: string | undefined, options?: {
    workspaceOnly?: boolean;
}, _mediaSources?: readonly string[]): string[];
export declare function resolvePromptAndModelOverride(args: Record<string, unknown>, defaultPrompt: string): {
    prompt: string;
    modelOverride?: string;
};
export declare function buildTextToolResult(result: TextToolResult, extraDetails: Record<string, unknown>): {
    content: Array<{
        type: "text";
        text: string;
    }>;
    details: Record<string, unknown>;
};
export declare function resolveModelFromRegistry(params: {
    modelRegistry: {
        find: (provider: string, modelId: string) => unknown;
    };
    provider: string;
    modelId: string;
}): Model<Api>;
export declare function resolveModelRuntimeApiKey(params: {
    model: Model<Api>;
    cfg: DaoCoreConfig | undefined;
    agentDir: string;
    authStorage: {
        setRuntimeApiKey: (provider: string, apiKey: string) => void;
    };
}): Promise<string>;
export {};
