/**
 * Gateway REST helpers for multi-agent management.
 */
import type { Config } from '../config/schema.js';
import type { AgentTypedModel } from '../config/schema.js';
export type GatewayAgentTypedModelsInfo = {
    defaults: AgentTypedModel[];
    entry?: AgentTypedModel[];
    effective: AgentTypedModel[];
};
export type GatewayAgentRow = {
    id: string;
    name?: string;
    description?: string;
    /** Value from `IDENTITY.md` **Avatar:** line when present (may be URL, `xopc:…`, etc.). */
    avatar?: string;
    workspace: string;
    /** Absolute directory for profile Markdown (`SOUL.md`, …) and gateway avatars: `agents/<id>/profile/`. */
    profileDir: string;
    model?: {
        primary?: string;
        fallbacks?: string[];
    };
    typedModels: GatewayAgentTypedModelsInfo;
    isDefault: boolean;
    skills: {
        defaults: string[];
        entry?: string[];
        effectiveAllowlist?: string[];
    };
    tools: {
        defaultsDisable: string[];
        entryDisable: string[];
        effectiveDisable: string[];
    };
};
export type GatewayAgentsListResponse = {
    defaultId: string;
    agents: GatewayAgentRow[];
    builtinToolIds: string[];
};
/** Extract `**Avatar:**` value from profile IDENTITY.md (same line shape as the gateway console parser). */
export declare function extractAvatarFromIdentityMarkdown(content: string): string | undefined;
export declare function listGatewayAgents(cfg: Config): Promise<GatewayAgentsListResponse>;
export type CreateAgentBody = {
    /** Display name stored on the agent entry. */
    name: string;
    /** Optional id seed; normalized agent id defaults from `name` when omitted. */
    id?: string;
    workspace: string;
    model?: string;
    agentDir?: string;
    description?: string;
    /** Initial `agents.list[].tools.disable` for the new entry. */
    toolsDisable?: string[];
    /** Profile markdown files to write after seeding (e.g. `IDENTITY.md`, `SOUL.md`). */
    profileFiles?: Record<string, string>;
};
export type AgentAdminHttpStatus = 400 | 404 | 409;
export type AgentAdminResult<T> = {
    ok: true;
    data: T;
} | {
    ok: false;
    error: string;
    status?: AgentAdminHttpStatus;
};
export declare function prepareCreateAgent(cfg: Config, body: CreateAgentBody): AgentAdminResult<{
    nextConfig: Config;
    agentId: string;
    workspace: string;
}>;
export type PreparedBatchCreateAgent = {
    agentId: string;
    profileFiles?: Record<string, string>;
};
export declare function prepareCreateAgentsBatch(cfg: Config, bodies: CreateAgentBody[]): AgentAdminResult<{
    nextConfig: Config;
    created: PreparedBatchCreateAgent[];
}>;
export declare function finalizeCreateAgentDirs(cfg: Config, agentId: string, opts?: {
    profileFiles?: Record<string, string>;
}): Promise<AgentAdminResult<void>>;
export type UpdateAgentBody = {
    name?: string;
    description?: string | null;
    workspace?: string;
    model?: string | null;
    agentDir?: string | null;
    setDefault?: boolean;
    /** Replace `agents.list[].skills`; `null` removes the key (inherit defaults). */
    skills?: string[] | null;
    /** Replace `agents.list[].tools.disable`; `null` clears entry-level disables. */
    toolsDisable?: string[] | null;
    /** Replace `agents.list[].models`; `null` removes entry overrides (inherit defaults). */
    models?: AgentTypedModel[] | null;
};
export declare function prepareUpdateAgent(cfg: Config, agentIdRaw: string, body: UpdateAgentBody): AgentAdminResult<{
    nextConfig: Config;
}>;
export declare function prepareDeleteAgent(cfg: Config, agentIdRaw: string): AgentAdminResult<{
    nextConfig: Config;
    agentId: string;
}>;
export declare function runAfterDeletePurge(cfg: Config, agentId: string): Promise<void>;
export type AgentFileEntry = {
    name: string;
    missing: boolean;
    size?: number;
    updatedAtMs?: number;
};
export declare function listAgentProfileFiles(cfg: Config, agentId: string): Promise<AgentAdminResult<{
    agentId: string;
    profileDir: string;
    files: AgentFileEntry[];
}>>;
export declare function readAgentProfileFile(cfg: Config, agentId: string, name: string): Promise<AgentAdminResult<{
    agentId: string;
    content: string;
    path: string;
}>>;
export declare function writeAgentProfileFile(cfg: Config, agentId: string, name: string, content: string): Promise<AgentAdminResult<{
    agentId: string;
    path: string;
}>>;
export declare function readAgentAvatarFile(cfg: Config, agentId: string): Promise<AgentAdminResult<{
    agentId: string;
    buffer: Buffer;
    contentType: string;
    path: string;
}>>;
export declare function writeAgentAvatarFromBase64(cfg: Config, agentId: string, base64: string, mimeType: string): Promise<AgentAdminResult<{
    agentId: string;
    path: string;
}>>;
/** Remove any `agent-avatar.*` in the agent profile markdown root. Idempotent: ok even when no file existed. */
export declare function deleteAgentAvatarFile(cfg: Config, agentId: string): Promise<AgentAdminResult<{
    agentId: string;
}>>;
