import { type Action, type ActionResult, type Agent, ChannelType, type Character, type Component, type Content, type Entity, type Evaluator, type EventHandler, type EventPayload, type EventPayloadMap, type GenerateTextOptions, type GenerateTextParams, type GenerateTextResult, type HandlerCallback, type IAgentRuntime, type IDatabaseAdapter, type IMessagingAdapter, type JsonValue, type Log, type LogBody, type Memory, type MemoryMetadata, type Metadata, type ModelHandler, type ModelParamsMap, type ModelResultMap, type ModelTypeName, type PairingAllowlistEntry, type PairingChannel, type PairingRequest, type Participant, type PatchOp, type Plugin, type PluginOwnership, type Provider, type Relationship, type Room, type Route, type RuntimeEventStorage, type RuntimeSettings, type SendHandlerFunction, type Service, type ServiceClass, type ServiceTypeName, type State, type StreamChunkCallback, type TargetInfo, type Task, type TaskWorker, type UUID, type World } from "./types";
import type { IMessageService } from "./types/message-service";
import type { RetryBackoffConfig, SchemaRow, StreamEvent } from "./types/state";
import type { ToolPolicyConfig, ToolProfileId } from "./types/tools";
export declare class AgentRuntime implements IAgentRuntime {
    #private;
    readonly agentId: UUID;
    readonly character: Character;
    adapter: IDatabaseAdapter;
    readonly actions: Action[];
    readonly evaluators: Evaluator[];
    readonly providers: Provider[];
    readonly plugins: Plugin[];
    unloadPlugin: (pluginName: string) => Promise<PluginOwnership | null>;
    reloadPlugin: (plugin: Plugin) => Promise<void>;
    applyPluginConfig: (pluginName: string, config: Record<string, string>) => Promise<boolean>;
    getPluginOwnership: (pluginName: string) => PluginOwnership | null;
    getAllPluginOwnership: () => PluginOwnership[];
    events: RuntimeEventStorage;
    stateCache: Map<string, State>;
    readonly fetch: typeof fetch;
    services: Map<ServiceTypeName, Service[]>;
    private serviceTypes;
    models: Map<string, ModelHandler<Record<string, object | import("@bufbuild/protobuf").JsonValue>, object | import("@bufbuild/protobuf").JsonValue>[]>;
    routes: Route[];
    private taskWorkers;
    private sendHandlers;
    private eventHandlers;
    private allAvailablePlugins;
    private characterPlugins;
    private capabilityOptions;
    private readonly nativeFeatureOptions;
    private actionPlanningOption?;
    private llmModeOption?;
    private checkShouldRespondOption?;
    private isAnonymousCharacter;
    logger: import("./logger").Logger;
    enableAutonomy: boolean;
    private settings;
    private servicePromiseHandlers;
    private servicePromises;
    /** In-flight service start promises; dedupes concurrent getService() for the same type. */
    private startingServices;
    private serviceRegistrationStatus;
    initPromise: Promise<void>;
    private initResolver;
    private currentRunId?;
    private currentRoomId?;
    private currentActionContext?;
    private maxWorkingMemoryEntries;
    messageService: IMessageService | null;
    companionUrl?: string;
    /** Set when stop() has been called; prevents new service starts and use-after-stop. */
    private stopped;
    constructor(opts: {
        conversationLength?: number;
        agentId?: UUID;
        /** Optional character configuration. If not provided, an anonymous character is created. */
        character?: Character;
        plugins?: Plugin[];
        fetch?: typeof fetch;
        /** Database adapter. Use InMemoryDatabaseAdapter for in-memory-only runs. WHY: Caller owns DB lifecycle; no plugin registration race; single source of truth. */
        adapter?: IDatabaseAdapter;
        settings?: RuntimeSettings;
        allAvailablePlugins?: Plugin[];
        /**
         * Log level for this runtime. Defaults to "error".
         * Valid levels: "trace", "debug", "info", "warn", "error", "fatal"
         */
        logLevel?: "trace" | "debug" | "info" | "warn" | "error" | "fatal";
        /** Disable basic basic-capabilities capabilities (reply, ignore, none, core providers) */
        disableBasicCapabilities?: boolean;
        /** Enable extended/advanced basic-capabilities capabilities (facts, roles, settings, room actions, etc.) */
        enableExtendedCapabilities?: boolean;
        /** Alias for enableExtendedCapabilities - Enable advanced basic-capabilities capabilities */
        advancedCapabilities?: boolean;
        /**
         * Enable action planning mode for multi-action execution.
         * When true (default), agent can plan and execute multiple actions per response.
         * When false, agent executes only a single action per response (performance optimization
         * useful for game situations where state updates with every action).
         */
        actionPlanning?: boolean;
        /**
         * LLM mode for overriding model selection.
         * - "DEFAULT": Use the model type specified in the useModel call (no override)
         * - "SMALL": Override all text generation model calls to use TEXT_SMALL
         * - "LARGE": Override all text generation model calls to use TEXT_LARGE
         *
         * This is useful for cost optimization (force SMALL) or quality (force LARGE).
         * While not recommended for production, it can be a fast way to make the agent run cheaper.
         */
        llmMode?: import("./types").LLMModeType;
        /**
         * Enable or disable the shouldRespond evaluation.
         * When true (default), the agent evaluates whether to respond to each message.
         * When false, the agent always responds (ChatGPT mode) - useful for direct chat interfaces.
         */
        checkShouldRespond?: boolean;
        /**
         * Enable autonomy capabilities for autonomous agent operation.
         * When true, the agent can operate autonomously with its own thinking loop,
         * communicating with admin users and running continuous background processing.
         * Can be enabled at construction time or lazily via settings.
         */
        enableAutonomy?: boolean;
        /** Enable trust engine, security, and permissions infrastructure. */
        enableTrust?: boolean;
        /** Enable encrypted secrets management and dynamic plugin activation. */
        enableSecretsManager?: boolean;
        /** Enable plugin introspection, install/eject/sync. */
        enablePluginManager?: boolean;
        enableKnowledge?: boolean;
        enableRelationships?: boolean;
        enableTrajectories?: boolean;
        /** Optional URL of a long-lived companion runtime for fire-and-forget embedding/task work. WHY: Thin runtimes (e.g. serverless) delegate embeddings and task-dirty notifications without blocking. */
        companionUrl?: string;
    });
    /**
     * Create a new run ID for tracking a sequence of model calls
     */
    createRunId(): UUID;
    /**
     * Start a new run for tracking prompts
     * @param roomId Optional room ID to associate logs with this conversation
     */
    startRun(roomId?: UUID): UUID;
    /**
     * End the current run
     */
    endRun(): void;
    /**
     * Get the current run ID (creates one if it doesn't exist)
     */
    getCurrentRunId(): UUID;
    private resolveServiceTypeAlias;
    private resolveNativeFeatureEnabled;
    private hasNativeRuntimeFeature;
    private resolveNativeFeatureForServiceType;
    private isNativeFeatureServiceEnabled;
    private isPluginManagedAsNativeFeature;
    private setNativeRuntimeFeatureEnabled;
    enableKnowledge(): Promise<void>;
    disableKnowledge(): Promise<void>;
    isKnowledgeEnabled(): boolean;
    enableRelationships(): Promise<void>;
    disableRelationships(): Promise<void>;
    isRelationshipsEnabled(): boolean;
    enableTrajectories(): Promise<void>;
    disableTrajectories(): Promise<void>;
    isTrajectoriesEnabled(): boolean;
    registerPlugin(plugin: Plugin): Promise<void>;
    getAllServices(): Map<ServiceTypeName, Service[]>;
    /**
     * Stops all started services and clears runtime caches/handlers.
     * For full teardown (including DB/adapter connection), call close() after stop().
     */
    stop(): Promise<void>;
    /**
     * Slim init: register plugins, ensure adapter ready, create message service.
     * Does NOT run migrations, agent/entity/room creation, or embedding dimension.
     * WHY: Those belong to provisioning (once at daemon boot); edge/ephemeral skip them.
     */
    initialize(options?: {
        skipMigrations?: boolean;
        /** Allow running without a persistent database adapter (benchmarks/tests). */
        allowNoDatabase?: boolean;
    }): Promise<void>;
    private _initializeCore;
    private getBasicCapabilitiesSettings;
    registerDatabaseAdapter(adapter: IDatabaseAdapter): void;
    runPluginMigrations(): Promise<void>;
    getConnection(): Promise<object>;
    setSetting(key: string, value: string | boolean | null, secret?: boolean): void;
    getSetting(key: string): string | boolean | number | null;
    getConversationLength(): number;
    /**
     * Check if action planning mode is enabled.
     *
     * When enabled (default), the agent can plan and execute multiple actions per response.
     * When disabled, the agent executes only a single action per response - a performance
     * optimization useful for game situations where state updates with every action.
     *
     * Priority: constructor option > character setting ACTION_PLANNING > default (true)
     */
    isActionPlanningEnabled(): boolean;
    /**
     * Get the LLM mode for model selection override.
     *
     * - `DEFAULT`: Use the model type specified in the useModel call (no override)
     * - `SMALL`: Override all text generation model calls to use TEXT_SMALL
     * - `LARGE`: Override all text generation model calls to use TEXT_LARGE
     *
     * Priority: constructor option > character setting LLM_MODE > default (DEFAULT)
     */
    getLLMMode(): import("./types").LLMModeType;
    /**
     * Check if the shouldRespond evaluation is enabled.
     *
     * When enabled (default: true), the agent evaluates whether to respond to each message.
     * When disabled, the agent always responds (ChatGPT mode) - useful for direct chat interfaces.
     *
     * Priority: constructor option > character setting CHECK_SHOULD_RESPOND > default (true)
     */
    isCheckShouldRespondEnabled(): boolean;
    /**
     * Get the messaging adapter if available
     *
     * WHY: Messaging functionality is optional (only SQL adapters support it).
     * Client plugins check this before using messaging features.
     *
     * @returns IMessagingAdapter if the current adapter implements it, null otherwise
     */
    getMessagingAdapter(): IMessagingAdapter | null;
    registerProvider(provider: Provider): void;
    registerAction(action: Action): void;
    getAllActions(): Action[];
    /**
     * Get actions filtered by tool policy.
     *
     * @param context - Optional policy context for filtering
     * @returns Filtered actions based on policy
     */
    getFilteredActions(context?: {
        profile?: ToolProfileId;
        characterPolicy?: ToolPolicyConfig;
        channelPolicy?: ToolPolicyConfig;
        providerPolicy?: ToolPolicyConfig;
        worldPolicy?: ToolPolicyConfig;
        roomPolicy?: ToolPolicyConfig;
    }): Promise<Action[]>;
    /**
     * Check if a specific action is allowed by tool policy.
     *
     * @param actionName - The action name to check
     * @param context - Optional policy context
     * @returns Whether the action is allowed
     */
    isActionAllowed(actionName: string, context?: {
        profile?: ToolProfileId;
        characterPolicy?: ToolPolicyConfig;
        channelPolicy?: ToolPolicyConfig;
        providerPolicy?: ToolPolicyConfig;
        worldPolicy?: ToolPolicyConfig;
        roomPolicy?: ToolPolicyConfig;
    }): Promise<{
        allowed: boolean;
        reason: string;
    }>;
    registerEvaluator(evaluator: Evaluator): void;
    private updateActionPlan;
    private updateActionStep;
    processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback, processOptions?: {
        onStreamChunk?: StreamChunkCallback;
    }): Promise<void>;
    getActionResults(messageId: UUID): ActionResult[];
    evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[]>;
    ensureConnections(entities: Entity[], rooms: Room[], source: string, world: World): Promise<void>;
    ensureConnection(params: {
        entityId: UUID;
        roomId: UUID;
        roomName?: string;
        worldId?: UUID;
        worldName?: string;
        userName?: string;
        name?: string;
        source?: string;
        type?: ChannelType | string;
        channelId?: string;
        messageServerId?: UUID;
        userId?: UUID;
        metadata?: Record<string, JsonValue>;
    }): Promise<void>;
    ensureParticipantInRoom(entityId: UUID, roomId: UUID): Promise<void>;
    getParticipantsForEntity(entityId: UUID): Promise<Participant[]>;
    getParticipantsForEntities(entityIds: UUID[]): Promise<Participant[]>;
    getParticipantsForRoom(roomId: UUID): Promise<UUID[]>;
    getParticipantsForRooms(roomIds: UUID[]): Promise<import("./types/database").ParticipantsForRoomsResult>;
    isRoomParticipant(roomId: UUID, entityId: UUID): Promise<boolean>;
    areRoomParticipants(pairs: Array<{
        roomId: UUID;
        entityId: UUID;
    }>): Promise<boolean[]>;
    addParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
    createRoomParticipants(entityIds: UUID[], roomId: UUID): Promise<UUID[]>;
    /**
     * Ensure the existence of a world.
     *
     * WHY upsert: Eliminates race condition where concurrent agent basic-capabilitiess
     * could both try to create the same world. Upsert is atomic.
     */
    ensureWorldExists({ id, name, messageServerId, metadata }: World): Promise<void>;
    /**
     * Ensure the existence of a room.
     *
     * WHY upsert: Eliminates race condition where concurrent connection attempts
     * (e.g., Discord bot receiving messages in same channel simultaneously) could
     * both try to create the same room. Upsert is atomic.
     */
    ensureRoomExists({ id, name, source, type, channelId, messageServerId, worldId, metadata, }: Room): Promise<void>;
    composeState(message: Memory, includeList?: string[] | null, onlyInclude?: boolean, skipCache?: boolean): Promise<State>;
    /** Lazy service start: used internally by _ensureServiceStarted / getServiceLoadPromise. */
    /** Dedupes concurrent starts for the same type via startingServices so only one start runs. */
    private _ensureServiceStarted;
    /** Runs one service start; used by _ensureServiceStarted with startingServices dedupe. */
    private _runServiceStart;
    /** Returns the service instance or null. Synchronous lookup from the services map. */
    getService<T extends Service = Service>(serviceName: ServiceTypeName | string): T | null;
    /**
     * Type-safe service getter that ensures the correct service type is returned
     * @template T - The expected service class type
     * @param serviceName - The service type name
     * @returns The service instance with proper typing, or null if not found
     */
    getTypedService<T extends Service = Service>(serviceName: ServiceTypeName | string): T | null;
    /**
     * Get all services of a specific type
     * @template T - The expected service class type
     * @param serviceName - The service type name
     * @returns Array of service instances with proper typing
     */
    getServicesByType<T extends Service = Service>(serviceName: ServiceTypeName | string): T[];
    /**
     * Get all registered service types (includes lazy-registered, not yet started)
     * @returns Array of registered service type names
     */
    getRegisteredServiceTypes(): ServiceTypeName[];
    /**
     * Check if a service type is registered (class registered; may not be started yet)
     * @param serviceType - The service type to check
     * @returns true if the service is registered
     */
    hasService(serviceType: ServiceTypeName | string): boolean;
    /**
     * Get the registration status of a service
     * @param serviceType - The service type to check
     * @returns the current registration status
     */
    getServiceRegistrationStatus(serviceType: ServiceTypeName | string): "pending" | "registering" | "registered" | "failed" | "unknown";
    /**
     * Get service health information
     * @returns Object containing service health status
     */
    getServiceHealth(): Record<string, {
        status: "pending" | "registering" | "registered" | "failed" | "unknown";
        instances: number;
        hasPromise: boolean;
    }>;
    registerService(serviceDef: ServiceClass): Promise<void>;
    private _createServiceResolver;
    getServiceLoadPromise(serviceType: ServiceTypeName | string): Promise<Service>;
    registerModel(modelType: ModelTypeName | string, handler: (runtime: IAgentRuntime, params: Record<string, JsonValue | object>) => Promise<JsonValue | object>, provider: string, priority?: number): void;
    private resolveModelRegistration;
    getModel(modelType: ModelTypeName | string): ((runtime: IAgentRuntime, params: Record<string, JsonValue | object>) => Promise<JsonValue | object>) | undefined;
    /**
     * Retrieves model configuration settings from character settings with support for
     * model-specific overrides and default fallbacks.
     *
     * Precedence order (highest to lowest):
     * 1. Model-specific settings (e.g., TEXT_SMALL_TEMPERATURE)
     * 2. Default settings (e.g., DEFAULT_TEMPERATURE)
     *
     * @param modelType The specific model type to get settings for
     * @returns Object containing model parameters if they exist, or null if no settings are configured
     */
    private getModelSettings;
    /**
     * Helper to log model calls to the database (used by both streaming and non-streaming paths)
     */
    private logModelCall;
    useModel<T extends keyof ModelParamsMap, R = ModelResultMap[T]>(modelType: T, params: ModelParamsMap[T], provider?: string): Promise<R>;
    /**
     * Simplified text generation with optional character context.
     */
    generateText(input: string, options?: GenerateTextOptions): Promise<GenerateTextResult>;
    /**
     * Performance metrics for dynamic prompt execution.
     * Tracks success/failure rates per model+schema combination.
     *
     * Uses LRU-style eviction to prevent unbounded growth:
     * - Max 100 entries (sufficient for typical model+schema combinations)
     * - Entries older than 1 hour are pruned on access
     */
    private static dynamicPromptMetrics;
    private static readonly METRICS_MAX_ENTRIES;
    private static readonly METRICS_TTL_MS;
    private static readonly STRUCTURED_FAILURE_PREVIEW_LIMIT;
    /**
     * Get or create metrics entry with LRU eviction.
     */
    private static getOrCreateMetrics;
    private setStructuredOutputFailureState;
    private clearStructuredOutputFailureState;
    /**
     * Dynamic prompt execution with state injection, schema-based parsing, and validation-aware streaming.
     *
     * WHY THIS EXISTS:
     * LLMs are powerful but unreliable for structured outputs. They can:
     * - Silently truncate output when hitting token limits
     * - Skip fields or produce malformed structures
     * - Hallucinate or ignore parts of the prompt
     *
     * This method addresses these issues by:
     * 1. Validation codes: Injects UUID codes the LLM must echo back
     * 2. Streaming with safety: Enables streaming while detecting truncation
     * 3. Performance tracking: Tracks success/failure rates per model+schema
     */
    dynamicPromptExecFromState({ state, params, schema, options, }: {
        state: State;
        params: Omit<GenerateTextParams, "prompt"> & {
            prompt: string | ((ctx: {
                state: State;
            }) => string);
        };
        schema: SchemaRow[];
        options?: {
            key?: string;
            modelSize?: "nano" | "small" | "medium" | "large" | "mega";
            modelType?: import("./types").TextGenerationModelType;
            model?: string;
            preferredEncapsulation?: "json" | "xml" | "toon";
            forceFormat?: "json" | "xml" | "toon";
            requiredFields?: string[];
            contextCheckLevel?: 0 | 1 | 2 | 3;
            checkpointCodes?: boolean;
            maxRetries?: number;
            retryBackoff?: number | RetryBackoffConfig;
            disableCache?: boolean;
            cacheTTL?: number;
            onStreamChunk?: StreamChunkCallback;
            onStreamEvent?: (event: StreamEvent, messageId?: string) => void | Promise<void>;
            abortSignal?: AbortSignal;
        };
    }): Promise<Record<string, unknown> | null>;
    private flattenSchemaRows;
    private schemaHasNestedStructure;
    private renderXmlSchemaExample;
    private renderJsonSchemaExample;
    private renderToonSchemaExample;
    private buildJsonExampleValue;
    private buildJsonExampleValueAtDepth;
    private validateResponseAgainstSchema;
    private validateSchemaValue;
    private validateSchemaValueAtDepth;
    private buildValidationOutputInstructions;
    private getEffectiveSchemaValueType;
    private collectSchemaDefinitionWarnings;
    private collectSchemaSpecWarnings;
    private buildSchemaMetricKey;
    private serializeSchemaMetricRow;
    private serializeSchemaMetricSpec;
    private serializeSchemaMetricSpecAtDepth;
    /**
     * Calculate retry backoff delay.
     */
    private calculateBackoffDelay;
    /**
     * Sleep for a duration that can be interrupted by an abort signal.
     * Returns true if aborted, false if sleep completed normally.
     */
    private abortableSleep;
    /**
     * Template rendering helpers for prompt caching and deterministic compilation.
     */
    private getCompiledRuntimeTemplate;
    private cleanDynamicPromptTemplateOutput;
    private extractTemplatePlaceholderKeys;
    private isTemplateChunkStable;
    private getPromptProviderSegments;
    private renderPromptTemplateSegments;
    private joinPromptSegmentGroups;
    private mergePromptSegments;
    /**
     * Convert double-brace Handlebars bindings to triple-brace (non-escaping).
     *
     * Handlebars uses:
     * - `{{var}}` for HTML-escaped output
     * - `{{{var}}}` for raw/unescaped output
     *
     * This function upgrades simple variable bindings to triple-brace so that
     * special characters in state values don't get HTML-encoded in prompts.
     *
     * The regex preserves Handlebars helpers and special syntax:
     * - `{{#if}}`, `{{/if}}` - block helpers (start with # or /)
     * - `{{! comment }}` - comments (start with !)
     * - `{{> partial}}` - partials (start with >)
     * - `{{{already_raw}}}` - already triple-braced
     * - `{{else}}` - else blocks
     */
    private upgradeDoubleToTriple;
    /**
     * Normalize structured response (handle nested response objects).
     *
     * Some LLMs wrap their output in extra `{response: {...}}` layers.
     * This recursively unwraps them up to a reasonable depth limit.
     */
    private normalizeStructuredResponse;
    private parseStructuredResponse;
    private extractStructuredResponseCandidates;
    private detectStructuredResponseFormats;
    private looksLikeJsonObject;
    private looksLikeToonDocument;
    private extractEmbeddedToonDocument;
    private extractEmbeddedJsonObject;
    private extractBalancedJsonObject;
    registerEvent<T extends keyof EventPayloadMap>(event: T, handler: EventHandler<T>): void;
    registerEvent<P extends EventPayload = EventPayload>(event: string, handler: (params: P) => Promise<void>): void;
    getEvent(event: string): ((params: EventPayloadMap[keyof EventPayloadMap] | EventPayload) => Promise<void>)[] | undefined;
    emitEvent(event: string | string[], params: JsonValue | object): Promise<void>;
    ensureEmbeddingDimension(): Promise<void>;
    registerTaskWorker(taskHandler: TaskWorker): void;
    getTaskWorker(name: string): TaskWorker | undefined;
    get db(): object;
    init(): Promise<void>;
    /**
     * Closes the database adapter. Call after stop() for full teardown (stops services then closes DB/connection).
     */
    close(): Promise<void>;
    getAgent(agentId: UUID): Promise<Agent | null>;
    getAgents(): Promise<Partial<Agent>[]>;
    createAgent(agent: Partial<Agent>): Promise<boolean>;
    updateAgent(agentId: UUID, agent: Partial<Agent>): Promise<boolean>;
    deleteAgent(agentId: UUID): Promise<boolean>;
    countAgents(): Promise<number>;
    cleanupAgents(): Promise<void>;
    getAgentsByIds(agentIds: UUID[]): Promise<Agent[]>;
    createAgents(agents: Partial<Agent>[]): Promise<UUID[]>;
    upsertAgents(agents: Partial<Agent>[]): Promise<void>;
    updateAgents(updates: Array<{
        agentId: UUID;
        agent: Partial<Agent>;
    }>): Promise<boolean>;
    deleteAgents(agentIds: UUID[]): Promise<boolean>;
    ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
    getEntityById(entityId: UUID): Promise<Entity | null>;
    getEntitiesForRooms(roomIds: UUID[], includeComponents?: boolean): Promise<import("./types/database").EntitiesForRoomsResult>;
    getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
    createEntity(entity: Entity): Promise<boolean>;
    createEntities(entities: Entity[]): Promise<UUID[]>;
    upsertEntities(entities: Entity[]): Promise<void>;
    getComponents(entityId: UUID, worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
    getComponentsByNaturalKeys(keys: Array<{
        entityId: UUID;
        type: string;
        worldId?: UUID;
        sourceEntityId?: UUID;
    }>): Promise<(Component | null)[]>;
    getComponentsForEntities(entityIds: UUID[], worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
    addEmbeddingToMemory(memory: Memory): Promise<Memory>;
    /**
     * Queue a memory for embedding generation. If companionUrl is set, POSTs to companion
     * and returns without waiting (fire-and-forget). WHY: Thin runtime doesn't block on embedding.
     */
    queueEmbeddingGeneration(memory: Memory, priority?: "high" | "normal" | "low"): Promise<void>;
    getMemories(params: {
        entityId?: UUID;
        agentId?: UUID;
        roomId?: UUID;
        limit?: number;
        count?: number;
        offset?: number;
        unique?: boolean;
        tableName: string;
        start?: number;
        end?: number;
        worldId?: UUID;
        metadata?: Record<string, unknown>;
        orderBy?: "createdAt";
        orderDirection?: "asc" | "desc";
    }): Promise<Memory[]>;
    getAllMemories(): Promise<Memory[]>;
    getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
    getMemoriesByRoomIds(params: {
        tableName: string;
        roomIds: UUID[];
        limit?: number;
    }): Promise<Memory[]>;
    getCachedEmbeddings(params: {
        query_table_name: string;
        query_threshold: number;
        query_input: string;
        query_field_name: string;
        query_field_sub_name: string;
        query_match_count: number;
    }): Promise<{
        embedding: number[];
        levenshtein_score: number;
    }[]>;
    searchMemories(params: {
        embedding: number[];
        query?: string;
        match_threshold?: number;
        limit?: number;
        roomId?: UUID;
        unique?: boolean;
        worldId?: UUID;
        entityId?: UUID;
        tableName: string;
    }): Promise<Memory[]>;
    rerankMemories(query: string, memories: Memory[]): Promise<Memory[]>;
    /**
     * Get the secrets to redact from character settings.
     * Returns an empty object if no secrets are configured.
     */
    private getSecretsForRedaction;
    /**
     * Redact secrets from text content.
     * This prevents character secrets from appearing in outputs or memories.
     */
    redactSecrets(text: string): string;
    clearAllAgentMemories(): Promise<void>;
    deleteAllMemories(roomIds: UUID[], tableName: string): Promise<void>;
    countMemories(roomIdOrParams: UUID | {
        roomId?: UUID;
        unique?: boolean;
        tableName?: string;
        entityId?: UUID;
        agentId?: UUID;
        metadata?: Record<string, unknown>;
    }, unique?: boolean, tableName?: string): Promise<number>;
    getLogs(params: {
        entityId?: UUID;
        roomId?: UUID;
        type?: string;
        limit?: number;
        offset?: number;
    }): Promise<Log[]>;
    getLogsByIds(logIds: UUID[]): Promise<Log[]>;
    createLogs(params: Array<{
        body: LogBody;
        entityId: UUID;
        roomId: UUID;
        type: string;
    }>): Promise<void>;
    updateLogs(logs: Array<{
        id: UUID;
        updates: Partial<Log>;
    }>): Promise<void>;
    deleteLogs(logIds: UUID[]): Promise<void>;
    createWorld(world: World): Promise<UUID>;
    getWorld(id: UUID): Promise<World | null>;
    deleteWorld(worldId: UUID): Promise<void>;
    getAllWorlds(): Promise<World[]>;
    updateWorld(world: World): Promise<void>;
    getWorldsByIds(worldIds: UUID[]): Promise<World[]>;
    createWorlds(worlds: World[]): Promise<UUID[]>;
    upsertWorlds(worlds: World[]): Promise<void>;
    deleteWorlds(worldIds: UUID[]): Promise<void>;
    updateWorlds(worlds: World[]): Promise<void>;
    getRoom(roomId: UUID): Promise<Room | null>;
    getRoomsByIds(roomIds: UUID[]): Promise<Room[]>;
    createRoom({ id, name, source, type, channelId, messageServerId, worldId, }: Room): Promise<UUID>;
    createRooms(rooms: Room[]): Promise<UUID[]>;
    upsertRooms(rooms: Room[]): Promise<void>;
    deleteRoomsByWorldId(worldId: UUID): Promise<void>;
    getRoomsForParticipant(entityId: UUID): Promise<UUID[]>;
    getRoomsForParticipants(entityIds: UUID[]): Promise<UUID[]>;
    getRooms(worldId: UUID): Promise<Room[]>;
    getRoomsByWorld(worldId: UUID): Promise<Room[]>;
    getParticipantUserState(roomId: UUID, entityId: UUID): Promise<"FOLLOWED" | "MUTED" | null>;
    updateParticipantUserState(roomId: UUID, entityId: UUID, state: "FOLLOWED" | "MUTED" | null): Promise<void>;
    getParticipantUserStates(pairs: Array<{
        roomId: UUID;
        entityId: UUID;
    }>): Promise<("FOLLOWED" | "MUTED" | null)[]>;
    updateParticipantUserStates(updates: Array<{
        roomId: UUID;
        entityId: UUID;
        state: "FOLLOWED" | "MUTED" | null;
    }>): Promise<void>;
    getRelationships(params: {
        entityIds?: UUID[];
        entityId?: UUID;
        tags?: string[];
        limit?: number;
        offset?: number;
    }): Promise<Relationship[]>;
    getCaches<T>(keys: string[]): Promise<Map<string, T>>;
    setCaches<T>(entries: Array<{
        key: string;
        value: T;
    }>): Promise<boolean>;
    deleteCaches(keys: string[]): Promise<boolean>;
    getTasks(params: {
        roomId?: UUID;
        tags?: string[];
        entityId?: UUID;
    }): Promise<Task[]>;
    getTasksByName(name: string): Promise<Task[]>;
    /** WHY fire-and-forget: Notify companion that tasks changed so it can poll/process; no need to block. */
    private _notifyCompanionTasksDirty;
    createTask(task: Task): Promise<UUID>;
    getTask(id: UUID): Promise<Task | null>;
    updateTask(id: UUID, task: Partial<Task>): Promise<void>;
    deleteTask(id: UUID): Promise<void>;
    log(params: {
        body: LogBody;
        entityId: UUID;
        roomId: UUID;
        type: string;
    }): Promise<void>;
    deleteLog(logId: UUID): Promise<void>;
    getCache<T>(key: string): Promise<T | undefined>;
    setCache<T>(key: string, value: T): Promise<boolean>;
    deleteCache(key: string): Promise<boolean>;
    createTasks(tasks: Task[]): Promise<UUID[]>;
    getTasksByIds(taskIds: UUID[]): Promise<Task[]>;
    updateTasks(updates: Array<{
        id: UUID;
        task: Partial<Task>;
    }>): Promise<void>;
    deleteTasks(taskIds: UUID[]): Promise<void>;
    /**
     * Run callback in a database transaction. Forwards options.entityContext to the adapter.
     * WHY forward only: RLS (withEntityContext) is implemented in the adapter (e.g. plugin-sql Postgres);
     * runtime does not touch Postgres or connection context.
     */
    transaction<T>(callback: (tx: IDatabaseAdapter<object>) => Promise<T>, options?: {
        entityContext?: UUID;
    }): Promise<T>;
    queryEntities(params: {
        componentType?: string;
        componentDataFilter?: Record<string, unknown>;
        agentId?: UUID;
        entityIds?: UUID[];
        worldId?: UUID;
        limit?: number;
        offset?: number;
        includeAllComponents?: boolean;
        entityContext?: UUID;
    }): Promise<Entity[]>;
    getEntitiesByIds(entityIds: UUID[]): Promise<Entity[]>;
    updateEntities(entities: Entity[]): Promise<void>;
    deleteEntities(entityIds: UUID[]): Promise<void>;
    searchEntitiesByName(params: {
        query: string;
        agentId?: UUID;
        limit?: number;
    }): Promise<Entity[]>;
    getEntitiesByNames(params: {
        names: string[];
        agentId?: UUID;
    }): Promise<Entity[]>;
    updateEntity(entity: Entity): Promise<void>;
    createComponents(components: Component[]): Promise<UUID[]>;
    getComponentsByIds(componentIds: UUID[]): Promise<Component[]>;
    updateComponents(components: Component[]): Promise<void>;
    deleteComponents(componentIds: UUID[]): Promise<void>;
    createComponent(component: Component): Promise<boolean>;
    getComponent(entityId: UUID, type: string, worldId?: UUID, sourceEntityId?: UUID): Promise<Component | null>;
    updateComponent(component: Component): Promise<void>;
    deleteComponent(componentId: UUID): Promise<void>;
    upsertComponent(component: Component): Promise<void>;
    upsertComponents(components: Component[], options?: {
        entityContext?: UUID;
    }): Promise<void>;
    patchComponent(componentId: UUID, ops: PatchOp[], options?: {
        entityContext?: UUID;
    }): Promise<void>;
    patchComponents(updates: Array<{
        componentId: UUID;
        ops: PatchOp[];
    }>, options?: {
        entityContext?: UUID;
    }): Promise<void>;
    patchComponentField(componentId: UUID, op: PatchOp, options?: {
        entityContext?: UUID;
    }): Promise<void>;
    getComponentsByType(type: string, agentId?: UUID, options?: {
        entityContext?: UUID;
    }): Promise<Component[]>;
    upsertMemory(memory: Memory, tableName: string, options?: {
        entityContext?: UUID;
    }): Promise<void>;
    upsertMemories(memories: Array<{
        memory: Memory;
        tableName: string;
    }>, options?: {
        entityContext?: UUID;
    }): Promise<void>;
    createRelationships(relationships: Array<{
        sourceEntityId: UUID;
        targetEntityId: UUID;
        tags?: string[];
        metadata?: Metadata;
    }>): Promise<UUID[]>;
    getRelationshipsByIds(relationshipIds: UUID[]): Promise<Relationship[]>;
    getRelationshipsByPairs(pairs: Array<{
        sourceEntityId: UUID;
        targetEntityId: UUID;
    }>): Promise<(Relationship | null)[]>;
    updateRelationships(relationships: Relationship[]): Promise<void>;
    deleteRelationships(relationshipIds: UUID[]): Promise<void>;
    createRelationship(params: {
        sourceEntityId: UUID;
        targetEntityId: UUID;
        tags?: string[];
        metadata?: Metadata;
    }): Promise<boolean>;
    getRelationship(params: {
        sourceEntityId: UUID;
        targetEntityId: UUID;
    }): Promise<Relationship | null>;
    updateRelationship(relationship: Relationship): Promise<void>;
    createMemories(memories: Array<{
        memory: Memory;
        tableName: string;
        unique?: boolean;
    }>): Promise<UUID[]>;
    updateMemories(memories: Array<Partial<Memory> & {
        id: UUID;
        metadata?: MemoryMetadata;
    }>): Promise<void>;
    deleteMemories(memoryIds: UUID[]): Promise<void>;
    getMemoryById(id: UUID): Promise<Memory | null>;
    createMemory(memory: Memory, tableName: string, unique?: boolean): Promise<UUID>;
    updateMemory(memory: Partial<Memory> & {
        id: UUID;
        metadata?: MemoryMetadata;
    }): Promise<boolean>;
    deleteMemory(memoryId: UUID): Promise<void>;
    deleteParticipants(participants: Array<{
        entityId: UUID;
        roomId: UUID;
    }>): Promise<boolean>;
    updateParticipants(participants: Array<{
        entityId: UUID;
        roomId: UUID;
        updates: Partial<Participant>;
    }>): Promise<void>;
    removeParticipant(entityId: UUID, roomId: UUID): Promise<boolean>;
    updateRooms(rooms: Room[]): Promise<void>;
    deleteRooms(roomIds: UUID[]): Promise<void>;
    updateRoom(room: Room): Promise<void>;
    deleteRoom(roomId: UUID): Promise<void>;
    on(event: string, callback: (data: EventPayload) => void): void;
    off(event: string, callback: (data: EventPayload) => void): void;
    emit(event: string, data: EventPayload): void;
    sendControlMessage(params: {
        roomId: UUID;
        action: "enable_input" | "disable_input";
        target?: string;
    }): Promise<void>;
    registerSendHandler(source: string, handler: SendHandlerFunction): void;
    sendMessageToTarget(target: TargetInfo, content: Content): Promise<void>;
    getMemoriesByWorldId(params: {
        worldId: UUID;
        limit?: number;
        tableName?: string;
    }): Promise<Memory[]>;
    runMigrations(migrationsPaths?: string[]): Promise<void>;
    isReady(): Promise<boolean>;
    getPairingRequestsForChannel(channel: PairingChannel, agentId: UUID): Promise<PairingRequest[]>;
    getPairingRequests(queries: Array<{
        channel: PairingChannel;
        agentId: UUID;
    }>): Promise<import("./types/database").PairingRequestsResult>;
    getPairingAllowlistForChannel(channel: PairingChannel, agentId: UUID): Promise<PairingAllowlistEntry[]>;
    getPairingAllowlists(queries: Array<{
        channel: PairingChannel;
        agentId: UUID;
    }>): Promise<import("./types/database").PairingAllowlistsResult>;
    createPairingRequests(requests: PairingRequest[]): Promise<UUID[]>;
    updatePairingRequests(requests: PairingRequest[]): Promise<void>;
    deletePairingRequests(ids: UUID[]): Promise<void>;
    createPairingAllowlistEntries(entries: PairingAllowlistEntry[]): Promise<UUID[]>;
    updatePairingAllowlistEntries(entries: PairingAllowlistEntry[]): Promise<void>;
    deletePairingAllowlistEntries(ids: UUID[]): Promise<void>;
    createPairingRequest(request: PairingRequest): Promise<UUID>;
    updatePairingRequest(request: PairingRequest): Promise<void>;
    deletePairingRequest(id: UUID): Promise<void>;
    createPairingAllowlistEntry(entry: PairingAllowlistEntry): Promise<UUID>;
    deletePairingAllowlistEntry(id: UUID): Promise<void>;
    deleteRoomsByWorldIds(worldIds: UUID[]): Promise<void>;
    getRoomsByWorlds(worldIds: UUID[], limit?: number, offset?: number): Promise<Room[]>;
}
//# sourceMappingURL=runtime.d.ts.map