import type { IMailbox } from '../../engine/mailbox/IMailbox';
import type { IMatrixContext } from '../../engine/core/IMatrixContext';
import type { AcceptsDefinition } from './AcceptsDefinition';
import type { IActorBehavior } from './IActorBehavior';
import type { IDispatchStrategy } from './IDispatchStrategy';
import type { IMessageMeta } from './IMessageMeta';
import type { IDispatchPriorities } from './IDispatchPriorities';
/** @deprecated Use IMessageMeta instead */
type MessageMeta = IMessageMeta;
/** @deprecated Use IDispatchPriorities instead */
type DispatchPriorities = IDispatchPriorities;
/**
 * Options for ActorBehavior construction.
 */
export interface IActorBehaviorOptions {
    /**
     * Whether to yield between messages (cooperative scheduling).
     * Default: true
     */
    cooperativeYield?: boolean;
}
/** @deprecated Use IActorBehaviorOptions instead */
export type ActorBehaviorOptions = IActorBehaviorOptions;
/**
 * ActorBehavior - Encapsulates mailbox and handler dispatch.
 *
 * This class implements the composed actor behavior pattern:
 * - MatrixActor composes ActorBehavior (not extends)
 * - Mailbox ownership is exclusive to this behavior
 * - Handlers are registered and dispatched through strategies
 * - Erlang-style become() enables state machine patterns
 *
 * @example
 * ```typescript
 * class MyActor extends MatrixActor {
 *   protected onBootstrap() {
 *     this.enableActorMode({
 *       increment: this.handleIncrement.bind(this),
 *       query: this.handleQuery.bind(this),
 *     });
 *   }
 * }
 * ```
 */
export declare class ActorBehavior<TAccepts extends AcceptsDefinition = AcceptsDefinition> implements IActorBehavior<TAccepts> {
    private readonly mailbox;
    private readonly context;
    private readonly handlers;
    private readonly strategies;
    private readonly cooperativeYield;
    private priorities;
    private running;
    constructor(context: IMatrixContext, options?: IActorBehaviorOptions);
    get isRunning(): boolean;
    get address(): string;
    /**
     * Get the underlying mailbox for message queuing.
     *
     * This allows external code (like MatrixActor._bindAccepts) to queue
     * messages to the actor's mailbox. The ActorBehavior maintains ownership
     * and processes messages through its dispatch loop.
     */
    getMailbox(): IMailbox;
    registerHandler<K extends keyof TAccepts & string>(command: K, handler: (payload: TAccepts[K], meta: MessageMeta) => Promise<unknown>): void;
    unregisterHandler(command: string): void;
    become(handlers: Partial<{
        [K in keyof TAccepts]: (payload: TAccepts[K], meta: MessageMeta) => Promise<unknown>;
    }>): void;
    addDispatchStrategy(strategy: IDispatchStrategy): void;
    removeDispatchStrategy(name: string): void;
    /**
     * Configure dispatch priorities.
     * Re-sorts strategies after update.
     */
    configurePriorities(priorities: Partial<DispatchPriorities>): void;
    /**
     * Check if a handler exists for a command.
     */
    hasHandler(command: string): boolean;
    /**
     * Get list of registered handler commands.
     */
    listHandlers(): string[];
    start(): void;
    stop(): void;
    /**
     * Main message processing loop.
     *
     * Dispatch order:
     * 1. System commands ($* prefix) - built-in handling
     * 2. Dispatch strategies (in priority order)
     * 3. TypeScript handlers (fallback)
     */
    private runLoop;
    /**
     * Dispatch a single message.
     *
     * Vision 27 Security: Messages are verified before dispatch.
     * Joe Armstrong: "Every message must be verified at the boundary."
     */
    private dispatch;
    /**
     * Type guard for BecomePayload.
     */
    private isBecomePayload;
    /**
     * Handle system commands ($* prefix).
     *
     * System commands:
     * - $close: Stop the actor
     * - $ping: Health check
     * - $introspect: Return handler info
     * - $become: Change behavior at runtime
     */
    private handleSystemCommand;
    /**
     * Determine message direction for security verification.
     *
     * Vision 27: Direction determines trust level:
     * - parent-to-child: TRUSTED (supervisor relationship)
     * - child-to-parent: VERIFIED (requires capability)
     * - sibling: VERIFIED (requires capability)
     * - external: UNTRUSTED (requires capability + signature)
     *
     * Joe Armstrong (Erlang, "Programming Erlang"):
     *   "In Erlang, every message knows who sent it."
     *
     * @param from - Sender's mount path
     * @returns Message direction for policy lookup
     */
    private _determineDirection;
}
export {};
//# sourceMappingURL=ActorBehavior.d.ts.map