import type { OpenClawConfig } from 'openclaw/plugin-sdk/setup'; import type { Locale } from './i18n'; export type SetupLocale = Locale; export interface TrueConfAccountConfig { serverUrl: string; username: string; password: string | { useEnv: string; }; useTls: boolean; port?: number; clientId?: string; clientSecret?: string; enabled?: boolean; caPath?: string; tlsVerify?: boolean; setupLocale?: SetupLocale; } export type TrueConfChannelSection = Partial>; export declare function readTrueConfSection(cfg: OpenClawConfig): TrueConfChannelSection; export interface TrueConfRequest { type: 1; id: number; method: string; payload?: Record; } export interface TrueConfResponse { type: 2; id: number; payload?: Record; } export declare const EnvelopeType: { readonly ADD_PARTICIPANT: 1; readonly REMOVE_PARTICIPANT: 2; readonly PARTICIPANT_ROLE: 110; readonly PLAIN_MESSAGE: 200; readonly FORWARDED_MESSAGE: 201; readonly ATTACHMENT: 202; readonly LOCATION: 203; readonly SURVEY: 204; }; export type EnvelopeType = (typeof EnvelopeType)[keyof typeof EnvelopeType]; export declare const TrueConfChatType: { readonly UNDEF: 0; readonly P2P: 1; readonly GROUP: 2; readonly SYSTEM: 3; readonly FAVORITES: 5; readonly CHANNEL: 6; }; export type TrueConfChatType = (typeof TrueConfChatType)[keyof typeof TrueConfChatType]; export type ResolvedChatKind = 'p2p' | 'group' | 'channel' | 'unknown'; export declare const FileReadyState: { readonly NOT_AVAILABLE: 0; readonly UPLOADING: 1; readonly READY: 2; }; export type FileReadyState = (typeof FileReadyState)[keyof typeof FileReadyState]; export declare const ErrorCode: { readonly DUPLICATE_ID: 2; readonly NOT_AUTHORIZED: 200; readonly INVALID_CREDENTIALS: 201; readonly CREDENTIALS_EXPIRED: 203; readonly INTERNAL_ERROR: 300; readonly CHAT_NOT_FOUND: 304; readonly MESSAGE_NOT_FOUND: 306; }; export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode]; interface BaseEnvelope { messageId: string; chatId: string; timestamp: number; replyMessageId?: string; isEdited: boolean; author: { id: string; type: 0 | 1; }; box: { id: number; position: string; }; } export interface TextEnvelope extends BaseEnvelope { type: typeof EnvelopeType.PLAIN_MESSAGE; content: { text: string; parseMode: 'text' | 'markdown' | 'html'; }; } export interface AttachmentEnvelope extends BaseEnvelope { type: typeof EnvelopeType.ATTACHMENT; content: AttachmentContent; } export interface SystemEnvelope extends BaseEnvelope { type: Exclude; content?: unknown; } export type Envelope = TextEnvelope | AttachmentEnvelope | SystemEnvelope; export interface AttachmentContent { name: string; mimeType: string; size: number; fileId: string; readyState: FileReadyState; } export interface FileInfo { name: string; size: number; mimeType: string; downloadUrl: string | null; readyState: FileReadyState; infoHash: string; previews: Array<{ name: string; mimeType: string; size: number; downloadUrl: string; }> | null; } export interface OAuthTokenResponse { access_token: string; token_type: string; expires_at: number; } export type InboundEnvelopeHint = { TrueConfEnvelopeType: 'forwarded'; } | { TrueConfEnvelopeType: 'location'; location: { latitude: number; longitude: number; description: string | null; }; } | { TrueConfEnvelopeType: 'survey'; survey: unknown; }; export interface InboundMediaContext { MediaPath: string; MediaType: string; MediaPaths: string[]; MediaTypes: string[]; } export type InboundExtraContext = InboundEnvelopeHint | InboundMediaContext | (InboundEnvelopeHint & InboundMediaContext); export declare function widenExtraContext(e: InboundExtraContext | undefined): Record | undefined; export interface InboundMessage { channel: string; accountId: string; peerId: string; chatId: string; text: string; messageId: string; timestamp: number; isGroup: boolean; senderName: string; senderId: string; attachmentContent?: AttachmentContent; replyMessageId?: string; parseMode?: 'text' | 'markdown' | 'html'; extraContext?: InboundExtraContext; } export type InboundDispatchFn = (msg: InboundMessage) => void | Promise; export interface Logger { info(message: string): void; warn(message: string): void; error(message: string): void; } export declare const DmPolicy: { readonly OPEN: "open"; readonly PAIRING: "pairing"; readonly ALLOWLIST: "allowlist"; readonly CLOSED: "closed"; readonly DISABLED: "disabled"; }; export type DmPolicy = (typeof DmPolicy)[keyof typeof DmPolicy]; export interface TrueConfFlatConfig extends TrueConfAccountConfig { enabled?: boolean; dmPolicy?: DmPolicy; allowFrom?: string[]; maxFileSize?: number; groupAlwaysRespondIn?: string[]; } export interface TrueConfMultiAccountConfig { accounts: Record; dmPolicy?: DmPolicy; allowFrom?: string[]; maxFileSize?: number; groupAlwaysRespondIn?: string[]; } export type TrueConfChannelConfig = TrueConfFlatConfig | TrueConfMultiAccountConfig; export interface ResolvedAccount { accountId: string; configured: boolean; enabled: boolean; serverUrl?: string; username?: string; password?: string; useTls?: boolean; port?: number; clientId?: string; clientSecret?: string; caPath?: string; tlsVerify?: boolean; setupLocale?: SetupLocale; } export interface AccountDescription { accountId: string; name: string; enabled: boolean; configured: boolean; } export interface AuthRequestOptions { receiveUnread?: boolean; receiveSystemMessageEnvelopes?: boolean; } export declare function buildAuthRequest(id: number, token: string, options?: AuthRequestOptions): TrueConfRequest; export type NetworkErrorPhase = 'oauth' | 'websocket' | 'ws-handshake' | 'ws-message' | 'unknown'; export declare class NetworkError extends Error { readonly phase: NetworkErrorPhase; readonly cause?: Error | undefined; readonly code?: string | undefined; readonly syscall?: string | undefined; readonly hostname?: string | undefined; readonly parkable: boolean; constructor(message: string, phase?: NetworkErrorPhase, cause?: Error | undefined, code?: string | undefined, syscall?: string | undefined, hostname?: string | undefined, options?: { parkable?: boolean; }); static parkable(message: string, phase?: NetworkErrorPhase): NetworkError; static asParkable(err: unknown): NetworkError; } export declare const DNS_ERROR_CODES: ReadonlySet; export declare const DNS_TERMINAL_CODE: "DNS_GIVEUP"; export declare function isAuthTerminalCode(status: number): boolean; export declare const OAUTH_TERMINAL_CODE: "OAUTH_GIVEUP"; export declare class IdCounter { private counter; next(): number; reset(): void; } export declare class RequestMatcher { private timeoutMs; private pending; constructor(timeoutMs?: number); track(id: number): Promise; resolve(id: number, response: TrueConfResponse): boolean; reject(id: number, error: Error): boolean; rejectAll(error: Error): void; } export {}; //# sourceMappingURL=types.d.ts.map