import type { MessageListQuery, MessageWithMeta, SearchMessageResult, MessageBlock, SendDmResponse, DmMessage, CreateGroupDmRequest, CreateGroupDmResponse, GroupDmMessageResponse, GroupDmParticipantResponse, DmConversationSummary, CreateChannelRequest, UpdateChannelRequest, Channel, ChannelMemberInfo, JoinChannelResponse, InviteChannelResponse, AddedReaction, ReadReceipt, ReactionGroup, InboxResponse, ReaderInfo, ChannelReadStatus, UploadRequest, UploadResponse, CompleteUploadResponse, FileInfo, InvokeCommandRequest, CommandInvokeResult, WsClientEvent, MessageCreatedEvent, MessageUpdatedEvent, ThreadReplyEvent, MessageReadEvent, ReactionAddedEvent, ReactionRemovedEvent, DmReceivedEvent, GroupDmReceivedEvent, RelaycastMessageEvent, AgentOnlineEvent, AgentOfflineEvent, ChannelCreatedEvent, ChannelUpdatedEvent, ChannelArchivedEvent, MemberJoinedEvent, MemberLeftEvent, ChannelMutedEvent, ChannelUnmutedEvent, FileUploadedEvent, WebhookReceivedEvent, CommandInvokedEvent } from './types.js'; import { HttpClient } from './client.js'; import { type WsClientOptions } from './ws.js'; import type { Subscription } from './subscription.js'; interface IdempotencyOption { idempotencyKey?: string; } interface ChannelListOptions { includeArchived?: boolean; } interface FileListOptions { uploadedBy?: string; limit?: number; } export interface AgentClientOptions { autoHeartbeatMs?: number | false; ws?: Omit; } type RelaycastMessageHandler = (event: RelaycastMessageEvent) => void | Promise; export declare class AgentClient { readonly client: HttpClient; private ws; private autoHeartbeatMs; private autoHeartbeatTimer; private pendingHeartbeat; private wsOptions; private manualSubscriptions; private managedSubscriptions; private activeWsChannels; constructor(client: HttpClient, options?: AgentClientOptions); /** * Presence lifecycle ownership: * - worker identities should call `markOnline`/`heartbeat`/`markOffline`. * - broker identities should signal presence only when they directly own worker lifecycle. * - reader identities should not publish presence. */ presence: { markOnline: () => Promise; heartbeat: () => Promise; markOffline: () => Promise; }; private startAutoHeartbeat; private stopAutoHeartbeat; connect(): void; /** Send a REST heartbeat to keep this agent online in PresenceDO without a WebSocket. */ heartbeat(): Promise; disconnect(): Promise; subscribe(channels: string[]): void; subscribe(channels: string[], onMessage: RelaycastMessageHandler): Subscription; unsubscribe(channels: string[]): void; private onEvent; on: { messageCreated: (handler: (e: MessageCreatedEvent) => void) => (() => void); messageUpdated: (handler: (e: MessageUpdatedEvent) => void) => (() => void); threadReply: (handler: (e: ThreadReplyEvent) => void) => (() => void); messageRead: (handler: (e: MessageReadEvent) => void) => (() => void); reactionAdded: (handler: (e: ReactionAddedEvent) => void) => (() => void); reactionRemoved: (handler: (e: ReactionRemovedEvent) => void) => (() => void); dmReceived: (handler: (e: DmReceivedEvent) => void) => (() => void); groupDmReceived: (handler: (e: GroupDmReceivedEvent) => void) => (() => void); agentOnline: (handler: (e: AgentOnlineEvent) => void) => (() => void); agentOffline: (handler: (e: AgentOfflineEvent) => void) => (() => void); channelCreated: (handler: (e: ChannelCreatedEvent) => void) => (() => void); channelUpdated: (handler: (e: ChannelUpdatedEvent) => void) => (() => void); channelArchived: (handler: (e: ChannelArchivedEvent) => void) => (() => void); memberJoined: (handler: (e: MemberJoinedEvent) => void) => (() => void); memberLeft: (handler: (e: MemberLeftEvent) => void) => (() => void); channelMuted: (handler: (e: ChannelMutedEvent) => void) => (() => void); channelUnmuted: (handler: (e: ChannelUnmutedEvent) => void) => (() => void); fileUploaded: (handler: (e: FileUploadedEvent) => void) => (() => void); webhookReceived: (handler: (e: WebhookReceivedEvent) => void) => (() => void); commandInvoked: (handler: (e: CommandInvokedEvent) => void) => (() => void); connected: (handler: () => void) => (() => void); disconnected: (handler: () => void) => (() => void); error: (handler: () => void) => (() => void); reconnecting: (handler: (attempt: number) => void) => (() => void); permanentlyDisconnected: (handler: (attempt: number) => void) => (() => void); any: (handler: (e: WsClientEvent) => void) => (() => void); }; send(channel: string, text: string, opts?: { attachments?: string[]; blocks?: MessageBlock[]; mode?: 'wait' | 'steer'; idempotencyKey?: string; }): Promise; post(channel: string, text: string, opts?: { attachments?: string[]; blocks?: MessageBlock[]; mode?: 'wait' | 'steer'; idempotencyKey?: string; }): Promise; messages(channel: string, opts?: MessageListQuery): Promise; message(id: string): Promise; reply(id: string, text: string, opts?: { blocks?: MessageBlock[]; idempotencyKey?: string; }): Promise; thread(id: string, opts?: MessageListQuery): Promise<{ parent: MessageWithMeta; replies: MessageWithMeta[]; }>; dm(agent: string, text: string, opts?: (IdempotencyOption & { mode?: 'wait' | 'steer'; attachments?: string[]; })): Promise; dms: { conversations: () => Promise; messages: (conversationId: string, opts?: MessageListQuery) => Promise; createGroup: (opts: CreateGroupDmRequest, idempotency?: IdempotencyOption) => Promise; sendMessage: (conversationId: string, text: string, opts?: (IdempotencyOption & { attachments?: string[]; mode?: "wait" | "steer"; })) => Promise; addParticipant: (conversationId: string, agent: string) => Promise; removeParticipant: (conversationId: string, agent: string) => Promise; }; private matchesSubscription; private desiredWsChannels; private syncDesiredSubscriptions; channels: { create: (data: CreateChannelRequest) => Promise; list: (opts?: ChannelListOptions) => Promise; get: (name: string) => Promise; join: (name: string) => Promise; leave: (name: string) => Promise; setTopic: (name: string, topic: string) => Promise; archive: (name: string) => Promise; invite: (channel: string, agent: string) => Promise; members: (name: string) => Promise; update: (name: string, data: UpdateChannelRequest) => Promise; mute: (name: string) => Promise; unmute: (name: string) => Promise; }; react(messageId: string, emoji: string): Promise; unreact(messageId: string, emoji: string): Promise; reactions(messageId: string): Promise; search(query: string, opts?: { channel?: string; from?: string; limit?: number; before?: string; after?: string; }): Promise; inbox(options?: { limit?: number; }): Promise; markRead(messageId: string): Promise; readers(messageId: string): Promise; readStatus(channel: string): Promise; commands: { invoke: (command: string, data: InvokeCommandRequest) => Promise; }; files: { upload: (data: UploadRequest) => Promise; complete: (fileId: string) => Promise; get: (fileId: string) => Promise; delete: (fileId: string) => Promise; list: (opts?: FileListOptions) => Promise; }; } export {}; //# sourceMappingURL=agent.d.ts.map