/**
 * Actor message structure.
 *
 * All messages through mailboxes use this format, enabling:
 * - Typed command dispatch
 * - Request-reply pattern via replyTo
 * - Correlation for async operations
 * - Provenance tracking via from
 * - Capability-based security (Vision 27)
 */
export interface IActorMessage {
    /** Command name (e.g., 'increment', 'query') */
    command: string;
    /** Command payload - consumers must validate/cast */
    payload: unknown;
    /** Optional: mailbox address for reply (request-reply pattern) */
    replyTo?: string;
    /** Message metadata */
    meta: {
        /** Timestamp when message was sent */
        ts: number;
        /** Correlation ID for request-reply matching */
        correlationId?: string;
        /** Sender's mount path (for provenance) */
        from?: string;
        /**
         * Optional capability token ID for authorization.
         *
         * Vision 27 Security: Messages carry capabilities for verification.
         * Mark Miller: "The capability must travel WITH the message."
         *
         * Note: This is the token ID, not the full token object.
         * The receiving SecurityRealm looks up the token by ID.
         */
        capabilityId?: string;
    };
}
/**
 * Mailbox interface - exclusive message queue for an actor.
 *
 * Key properties (per Carl Hewitt's Actor Model):
 * - One owner per mailbox (exclusive)
 * - Serialized delivery (messages processed one at a time)
 * - Anyone can send if they have the address
 *
 * ## SECURITY MODEL: Namespace-Based Capability Security
 *
 * Addresses are strings but **access is enforced at the broker layer**:
 *
 * ```
 * acme.com.private.app.counter.$inbox
 *         └────┬───┘└──┬──┘└────────────────┘
 *         Namespace  Zone    Component Path
 * ```
 *
 * **Capability enforcement hierarchy:**
 *
 * | Layer      | Enforcement                                    |
 * |------------|------------------------------------------------|
 * | TLS        | Transport encryption, broker authentication   |
 * | Broker ACL | `user:alice allow publish acme.com/private/#` |
 * | Namespace  | Security boundary - you own `acme.com.*`      |
 * | Zone       | Private (owner only) vs Public (anyone)       |
 *
 * **Within namespace** = trusted code, forgeability doesn't matter.
 * All components in `acme.com.*` belong to same security principal.
 *
 * **Cross-namespace** = broker ACL enforced. Alice cannot send to
 * `bob.com.private.secret` - broker rejects unauthorized access.
 *
 * **Supervision tree = security tree:**
 * ```
 * broker.example.com/user@company.com/app/supervisor/child
 *         └────────────────┘ └──────────────┘ └────────────────────┘
 *              Broker             Realm          Supervision Tree
 * ```
 *
 * See: docs/design/COMPLETE-SECURITY-AND-DEPLOYMENT-GUIDE.md
 * - Part 3: Identity Models (namespace ownership)
 * - Part 4: Zone System (private/public access control)
 *
 * Limitations (Phase 1):
 * - Single-runtime assumes trusted code (no intra-namespace ACL)
 * - Monitor semantics, not Erlang link (unidirectional supervision)
 */
export interface IMailbox {
    /** Unique mailbox address (e.g., "counter-1.$inbox") */
    readonly address: string;
    /** Current queue depth (for backpressure monitoring) */
    readonly depth: number;
    /** Whether the mailbox is closed */
    readonly closed: boolean;
    /** Whether the mailbox has been claimed */
    readonly claimed: boolean;
    /**
     * Claim exclusive ownership of this mailbox.
     * Only the owner can receive messages.
     * @throws Error if already claimed or closed
     */
    claim(): void;
    /**
     * Send a message to this mailbox.
     * Anyone with the address can send.
     */
    send(message: IActorMessage): void;
    /**
     * Receive the next message (blocks until available).
     * Only the owner can receive.
     * @throws Error if not claimed or closed
     */
    receive(): Promise<IActorMessage>;
    /**
     * Async iteration over messages.
     * Enables: for await (const msg of mailbox) { ... }
     */
    [Symbol.asyncIterator](): AsyncIterableIterator<IActorMessage>;
    /**
     * Close the mailbox.
     * Called on actor termination.
     * Sends $close message to unblock any waiting receiver.
     */
    close(): void;
}
/**
 * Backpressure policy for mailbox queue management.
 */
export interface IBackpressurePolicy {
    /** Max messages in queue before applying policy */
    highWaterMark: number;
    /** What to do when queue is full */
    onFull: 'block' | 'drop-oldest' | 'drop-newest' | 'error';
}
/**
 * Mailbox options for creation.
 */
export interface IMailboxOptions {
    /** Backpressure policy */
    backpressure?: Partial<IBackpressurePolicy>;
    /**
     * Whether to copy payloads on send (Hickey mitigation).
     * Default: false for performance.
     * Set true for safety when mutation is a concern.
     */
    copyPayloads?: boolean;
}
/**
 * Exit signal sent when an actor terminates.
 * Used for supervision (monitor semantics).
 */
export interface IExitSignal {
    type: 'exit';
    /** Mailbox address (mount path) of terminated actor */
    from: string;
    /** Termination reason */
    reason: 'normal' | 'error' | 'killed';
    /** Error details if reason is 'error' */
    error?: {
        message: string;
        stack?: string;
    };
}
/**
 * Down signal received when a monitored actor terminates.
 * Sent to observers who called monitor().
 */
export interface IDownSignal {
    type: 'down';
    /** Mailbox address of terminated actor */
    target: string;
    /** Termination reason */
    reason: 'normal' | 'error' | 'killed';
    /** Error details if reason is 'error' */
    error?: {
        message: string;
        stack?: string;
    };
}
/**
 * Monitor reference (one-way failure notification).
 * NOT Erlang link (bidirectional) - see Vision 12.3.
 */
export interface IMonitorRef {
    /** Unique monitor ID */
    id: string;
    /** Mailbox address being monitored */
    target: string;
    /** Mailbox address receiving notifications */
    observer: string;
}
//# sourceMappingURL=IMailbox.d.ts.map