import { type ExtendEventMap, type Frame, Session, type SessionEvents } from './base.js'; import { type ChatEventFrameType, type ChatSubscribeBody, type ChatUnsubscribeBody, type CommandRequestBody, type CommandRequestLegacyBody, type DataRequestPurpose, EncryptionMode, type EncryptRequestBody, type EventSubscriptionBody, type MinecraftAgentActionType, RequestPurpose } from './protocol.js'; import { Version } from './version.js'; export type CommandFrameBase = Frame; export interface CommandFrame extends CommandFrameBase { commandLine: string; respond(body: unknown): void; handleEncryptionHandshake(): boolean; } export type LegacyCommandFrameBase = Frame; export interface LegacyCommandFrame extends LegacyCommandFrameBase { commandName: string; overload: string; input: Record; respond(body: unknown): void; /** @deprecated Not supported */ handleEncryptionHandshake(): boolean; } export type EventSubscribeFrameBase = Frame; export interface SubscribeFrame extends EventSubscribeFrameBase { eventName: string; } export type EventUnsubscribeFrameBase = Frame; export interface UnsubscribeFrame extends EventUnsubscribeFrameBase { eventName: string; } export type AgentActionFrameBase = Frame; export interface AgentActionFrame extends AgentActionFrameBase { commandLine: string; respondCommand(body: unknown): void; respondAgentAction(action: MinecraftAgentActionType, actionName: string, body: unknown): void; } export type ChatSubscribeFrameBase = Frame; export interface ChatSubscribeFrame extends ChatSubscribeFrameBase { sender?: string; receiver?: string; chatMessage?: string; } export type ChatUnsubscribeFrameBase = Frame; export interface ChatUnsubscribeFrame extends ChatUnsubscribeFrameBase { subscribeRequestId?: string; } export type DataRequestFrameBase = Frame>; export interface DataRequestFrame extends DataRequestFrameBase { respond(body: unknown): void; } export type EncryptRequestFrameBase = Frame; export interface EncryptRequest extends EncryptRequestFrameBase { cancel(): void; } export interface WSClientEvents extends SessionEvents { subscribe: [event: SubscribeFrame]; unsubscribe: [event: UnsubscribeFrame]; command: [event: CommandFrame]; commandLegacy: [event: LegacyCommandFrame]; agentAction: [event: AgentActionFrame]; chatSubscribe: [event: ChatSubscribeFrame]; chatUnsubscribe: [event: ChatUnsubscribeFrame]; encryptRequest: [event: EncryptRequest]; } declare const WSClient_base: ExtendEventMap; export declare class WSClient extends WSClient_base { private eventListenMap; constructor(address: string, version?: Version); handleKeyExchange(mode: EncryptionMode, serverPubKey: string, salt: string): { publicKey: string; complete: () => void; }; handleEncryptionHandshake(requestId: string, commandLine: string): boolean; sendError(statusCode?: number, statusMessage?: string, requestId?: string): void; sendEvent(eventName: string, body: Record): void; publishEvent(eventName: string, body: Record): void; respondCommand(requestId: string, body: unknown): void; respondAgentAction(requestId: string, action: MinecraftAgentActionType, actionName: string, body: unknown): void; sendChat(requestId: string, type: ChatEventFrameType, sender: string, receiver: string, message: string): void; setDataResponser(dataType: T, responser: (frame: DataRequestFrame) => void): void; clearDataResponser(dataType: string): void; sendDataResponse(requestId: string, dataType: string, type: number, body: unknown): void; sendEncryptResponse(requestId: string, publicKey: string, body?: Record): void; disconnect(): void; } export {};