import type { AgentClientOptions, RelayCastOptions } from '@relaycast/sdk';
import { type RelaycastTelemetryOptions } from '../relaycast-telemetry.js';
import type { RelayActionInvocation, RelayActionInvocationAck, RelayCompleteInvocationInput, RelayAgent, RelayAgentPresence, RelayAgentRegistration, RelayChannel, RelayChannelMember, RelayChannelReadStatus, RelayCapability, RelayCreateChannelInput, RelayCreateGroupDirectMessageInput, RelayCreateInboundWebhookInput, RelayCreateSubscriptionInput, RelayCreateWebhookInput, RelayDeliveryUnsupportedResult, RelayEventSubscription, RelayInboundWebhook, RelaySubscribeInput, RelayWebhookSubscription, RelayGroupDirectConversation, RelayRegisterCapabilityInput, RelayWebhook, RelayWorkspaceInfo, InboxAckInput, InboxDeferInput, InboxFailInput, InboxItem, InboxListInput, InboxListResult, InboxMarkReadInput, InboxSubscribeInput, RelayInbox, RelayListAgentsOptions, RelayListChannelsOptions, RelayListDirectMessagesInput, RelayMessage, RelayMessageBlock, RelayMessageListOptions, RelayMessageReaction, RelayMessagingCapabilities, RelayMessagingClient, RelayMessagingEventMap, RelayReadReceipt, RelayRegisterAgentInput, RelayReplyMessageInput, RelaySearchResult, RelaySendChannelMessageInput, RelaySendDirectMessageInput, RelaySendGroupDirectMessageInput, RelayThread, RelayUpdateAgentInput, RelayUpdateChannelInput } from './types.js';
type RelaycastWorkspaceLike = {
    agents: {
        list(query?: Record<string, unknown>): Promise<unknown[]>;
        get(name: string): Promise<unknown>;
        register(input: unknown): Promise<unknown>;
        update(name: string, input: unknown): Promise<unknown>;
        delete(name: string): Promise<void>;
        presence(): Promise<unknown[]>;
    };
    channels: {
        list(options?: Record<string, unknown>): Promise<unknown[]>;
        get(name: string): Promise<unknown>;
    };
    messages: {
        list(channel: string, options?: RelayMessageListOptions): Promise<unknown[]>;
        get(id: string): Promise<unknown>;
        thread(id: string, options?: RelayMessageListOptions): Promise<unknown>;
        reactions(id: string): Promise<unknown[]>;
    };
    allDmConversations?: () => Promise<unknown[]>;
    dmMessages?: (conversationId: string, options?: RelayMessageListOptions) => Promise<unknown[]>;
    webhooks?: {
        create(data: unknown): Promise<unknown>;
        createInbound(data: unknown): Promise<unknown>;
        list(): Promise<unknown[]>;
        delete(id: string): Promise<void>;
        trigger(id: string, data: unknown, token?: string): Promise<unknown>;
    };
    subscriptions?: {
        create(data: unknown): Promise<unknown>;
        list(): Promise<unknown[]>;
        get(id: string): Promise<unknown>;
        delete(id: string): Promise<void>;
    };
    actions?: {
        register(data: unknown): Promise<unknown>;
        list(): Promise<unknown[]>;
        get(name: string): Promise<unknown>;
        delete(name: string): Promise<void>;
    };
    workspace?: {
        info(): Promise<unknown>;
    };
    as?: (agentToken: string, options?: AgentClientOptions) => RelaycastAgentLike;
    connect?: () => void;
    disconnect?: () => void;
    on?: {
        any(handler: (event: unknown) => void): () => void;
    };
};
type RelaycastAgentLike = {
    me(): Promise<unknown>;
    connect(): void;
    disconnect(): Promise<void>;
    subscribe(channels: string[]): void;
    unsubscribe(channels: string[]): void;
    send(channel: string, text: string, options?: {
        attachments?: string[];
        blocks?: RelayMessageBlock[];
        mode?: 'wait' | 'steer';
        idempotencyKey?: string;
    }): Promise<unknown>;
    messages(channel: string, options?: RelayMessageListOptions): Promise<unknown[]>;
    message(id: string): Promise<unknown>;
    reply(id: string, text: string, options?: {
        blocks?: RelayMessageBlock[];
        idempotencyKey?: string;
    }): Promise<unknown>;
    thread(id: string, options?: RelayMessageListOptions): Promise<unknown>;
    dm(agent: string, text: string, options?: {
        mode?: 'wait' | 'steer';
        attachments?: string[];
        idempotencyKey?: string;
    }): Promise<unknown>;
    dms: {
        conversations(): Promise<unknown[]>;
        messages(conversationId: string, options?: RelayMessageListOptions): Promise<unknown[]>;
        createGroup(options: {
            participants: string[];
            name?: string;
        }, idempotency?: {
            idempotencyKey?: string;
        }): Promise<unknown>;
        sendMessage(conversationId: string, text: string, options?: {
            attachments?: string[];
            mode?: 'wait' | 'steer';
            idempotencyKey?: string;
        }): Promise<unknown>;
    };
    channels: {
        create(input: RelayCreateChannelInput): Promise<unknown>;
        get(name: string): Promise<unknown>;
        join(name: string): Promise<unknown>;
        leave(name: string): Promise<void>;
        setTopic(name: string, topic: string): Promise<unknown>;
        archive(name: string): Promise<void>;
        invite(channel: string, agent: string): Promise<unknown>;
        members(name: string): Promise<unknown[]>;
        update(name: string, input: RelayUpdateChannelInput): Promise<unknown>;
        mute(name: string): Promise<void>;
        unmute(name: string): Promise<void>;
    };
    inbox(options?: {
        limit?: number;
    }): Promise<unknown>;
    markRead(messageId: string): Promise<unknown>;
    readers(messageId: string): Promise<unknown[]>;
    readStatus(channel: string): Promise<unknown[]>;
    reactions(messageId: string): Promise<unknown[]>;
    react(messageId: string, emoji: string): Promise<unknown>;
    unreact(messageId: string, emoji: string): Promise<void>;
    search(query: string, options?: {
        channel?: string;
        from?: string;
        limit?: number;
        before?: string;
        after?: string;
    }): Promise<unknown[]>;
    actions?: {
        invoke(name: string, input?: Record<string, unknown>): Promise<unknown>;
        getInvocation(name: string, invocationId: string): Promise<unknown>;
        completeInvocation(name: string, invocationId: string, data: unknown): Promise<unknown>;
    };
    on: {
        any(handler: (event: unknown) => void): () => void;
        actionInvoked?(handler: (event: unknown) => void): () => void;
    };
};
export interface RelaycastMessagingOptions extends RelaycastTelemetryOptions {
    /** Workspace key returned when creating or joining an Agent Relay workspace. */
    workspaceKey?: string;
    /** @deprecated Use workspaceKey for public Agent Relay flows. */
    apiKey?: string;
    baseUrl?: string;
    retryPolicy?: RelayCastOptions['retryPolicy'];
    relaycast?: RelaycastWorkspaceLike;
    agentToken?: string;
    agentClient?: RelaycastAgentLike;
    agentClientOptions?: AgentClientOptions;
}
export declare class RelaycastMessagingClient implements RelayMessagingClient {
    readonly capabilities: RelayMessagingCapabilities;
    private readonly relaycast;
    private readonly agentClient?;
    private readonly eventHandlers;
    private eventUnsubscribe?;
    constructor(options: RelaycastMessagingOptions);
    readonly agents: {
        list: (options?: RelayListAgentsOptions) => Promise<RelayAgent[]>;
        get: (name: string) => Promise<RelayAgent>;
        register: (input: RelayRegisterAgentInput) => Promise<RelayAgentRegistration>;
        me: () => Promise<RelayAgent>;
        update: (name: string, input: RelayUpdateAgentInput) => Promise<RelayAgent>;
        delete: (name: string) => Promise<void>;
        presence: () => Promise<RelayAgentPresence[]>;
    };
    readonly channels: {
        list: (options?: RelayListChannelsOptions) => Promise<RelayChannel[]>;
        get: (name: string) => Promise<RelayChannel>;
        create: (input: RelayCreateChannelInput) => Promise<RelayChannel>;
        update: (name: string, input: RelayUpdateChannelInput) => Promise<RelayChannel>;
        archive: (name: string) => Promise<void>;
        join: (name: string) => Promise<void>;
        leave: (name: string) => Promise<void>;
        invite: (channel: string, agent: string) => Promise<void>;
        members: (name: string) => Promise<RelayChannelMember[]>;
        mute: (name: string) => Promise<void>;
        unmute: (name: string) => Promise<void>;
    };
    readonly messages: {
        send: (input: RelaySendChannelMessageInput) => Promise<RelayMessage>;
        list: (channel: string, options?: RelayMessageListOptions) => Promise<RelayMessage[]>;
        get: (id: string) => Promise<RelayMessage>;
        reply: (input: RelayReplyMessageInput) => Promise<RelayMessage>;
        direct: (input: RelaySendDirectMessageInput) => Promise<RelayMessage>;
        groupDirect: (input: RelaySendGroupDirectMessageInput) => Promise<RelayMessage>;
        createGroupDirect: (input: RelayCreateGroupDirectMessageInput) => Promise<RelayGroupDirectConversation>;
        listDirect: (input: RelayListDirectMessagesInput) => Promise<RelayMessage[]>;
        markRead: (messageId: string) => Promise<RelayReadReceipt>;
        readers: (messageId: string) => Promise<RelayReadReceipt[]>;
        readStatus: (channel: string) => Promise<RelayChannelReadStatus[]>;
        reactions: (messageId: string) => Promise<RelayMessageReaction[]>;
        react: (messageId: string, emoji: string) => Promise<RelayMessageReaction>;
        unreact: (messageId: string, emoji: string) => Promise<void>;
        search: (query: string, options?: {
            channel?: string;
            from?: string;
            limit?: number;
            before?: string;
            after?: string;
        }) => Promise<RelaySearchResult[]>;
    };
    readonly threads: {
        get: (messageId: string, options?: RelayMessageListOptions) => Promise<RelayThread>;
        reply: (input: RelayReplyMessageInput) => Promise<RelayMessage>;
    };
    readonly inbox: {
        get: (options?: {
            limit?: number;
        }) => Promise<RelayInbox>;
        list: (_input?: InboxListInput) => Promise<InboxListResult>;
        subscribe: (_input?: InboxSubscribeInput) => AsyncIterable<InboxItem>;
        ack: (input: InboxAckInput) => Promise<RelayDeliveryUnsupportedResult>;
        fail: (input: InboxFailInput) => Promise<RelayDeliveryUnsupportedResult>;
        defer: (input: InboxDeferInput) => Promise<RelayDeliveryUnsupportedResult>;
        markRead: (input: InboxMarkReadInput) => Promise<RelayDeliveryUnsupportedResult>;
    };
    readonly events: {
        connect: () => void;
        disconnect: () => Promise<void>;
        subscribe: (channels: string[]) => void;
        unsubscribe: (channels: string[]) => void;
        on: <K extends keyof RelayMessagingEventMap>(event: K, handler: (...args: RelayMessagingEventMap[K]) => void | Promise<void>) => (() => void);
    };
    readonly deliveries: {
        ack: (messageId: string) => Promise<RelayDeliveryUnsupportedResult>;
        fail: (messageId: string, reason?: string) => Promise<RelayDeliveryUnsupportedResult>;
        defer: (messageId: string, deferUntil?: string) => Promise<RelayDeliveryUnsupportedResult>;
    };
    readonly integrations: {
        webhooks: {
            create: (input: RelayCreateWebhookInput) => Promise<RelayWebhook>;
            list: () => Promise<RelayWebhook[]>;
            delete: (id: string) => Promise<void>;
            trigger: (id: string, payload?: Record<string, unknown>) => Promise<unknown>;
        };
        subscriptions: {
            create: (input: RelayCreateSubscriptionInput) => Promise<RelayEventSubscription>;
            list: () => Promise<RelayEventSubscription[]>;
            get: (id: string) => Promise<RelayEventSubscription>;
            delete: (id: string) => Promise<void>;
        };
    };
    readonly webhooks: {
        createInbound: (input: RelayCreateInboundWebhookInput) => Promise<RelayInboundWebhook>;
        subscribe: (input: RelaySubscribeInput) => Promise<RelayWebhookSubscription>;
        list: () => Promise<RelayInboundWebhook[]>;
        delete: (webhookId: string) => Promise<void>;
        subscriptions: () => Promise<RelayWebhookSubscription[]>;
        unsubscribe: (id: string) => Promise<void>;
    };
    readonly commands: {
        register: (input: RelayRegisterCapabilityInput) => Promise<RelayCapability>;
        list: () => Promise<RelayCapability[]>;
        delete: (command: string) => Promise<void>;
        available: () => boolean;
        agentScoped: () => boolean;
        invoke: (name: string, input?: Record<string, unknown>) => Promise<RelayActionInvocationAck>;
        getInvocation: (name: string, invocationId: string) => Promise<RelayActionInvocation>;
        completeInvocation: (name: string, invocationId: string, data: RelayCompleteInvocationInput) => Promise<RelayActionInvocation>;
    };
    readonly workspace: {
        info: () => Promise<RelayWorkspaceInfo>;
    };
    private requireWebhooks;
    private requireSubscriptions;
    private requireActions;
    private requireAgentActions;
    private requireAgentClient;
    private requireWorkspaceDmMessages;
    private emptyInboxSubscription;
    private unsupportedInboxDelivery;
    private normalizeDirectResponse;
    private addEventListener;
    private emitEvent;
}
export {};
//# sourceMappingURL=relaycast.d.ts.map