import { errors } from '@synnaxlabs/x';
import { state } from '../state';
/** A message from the main thread to update or create an aether component. */
export interface MainUpdateRequest {
    variant: "update";
    /** The path of the component to update. */
    path: string[];
    /** The type of the component to update. */
    type: string;
    /** The state of the component to update. */
    state: state.State;
}
/** A message from the main thread to delete an aether component. */
export interface MainDeleteRequest {
    variant: "delete";
    /** The type of the component to delete. */
    type: string;
    /** The path of the component to delete. */
    path: string[];
}
/** A message from the aether thread to update an aether component. */
export interface AetherUpdateRequest {
    variant: "update";
    /** The key of the component to update. */
    key: string;
    /** The state of the component to update. */
    state: state.State;
}
/** A message from the aether thread to send an error to the main thread. */
export interface AetherNotifyErrorRequest {
    variant: "error";
    error: errors.NativePayload;
}
/** A message from the main thread invoking a method on a worker component. */
export interface MainInvokeRequest {
    variant: "invoke_request";
    /**
     * Correlation ID for matching response. Format: `${componentKey}-${counter}`.
     * If undefined, this is a fire-and-forget call and no response will be sent.
     */
    key?: string;
    /** The path of the component to invoke the method on. */
    path: string[];
    /** The method name to invoke. */
    method: string;
    /** The arguments to pass to the method (spread when calling handler). */
    args: unknown[];
}
/** A message from the worker thread responding to a main invoke request. */
export interface AetherInvokeResponse {
    variant: "invoke_response";
    /** Correlation ID matching the original request. */
    key: string;
    /** The result of the method call. */
    result: unknown;
    /** Error information if the method threw. */
    error?: errors.NativePayload;
}
/** A message from the aether thread to the main thread. */
export type AetherMessage = AetherUpdateRequest | AetherNotifyErrorRequest | AetherInvokeResponse;
/** A message from the main thread to the aether thread. */
export type MainMessage = MainUpdateRequest | MainDeleteRequest | MainInvokeRequest;
//# sourceMappingURL=message.d.ts.map