// Generated by generate.py; edit messages.json. import './schema.js'; import './runtime.js'; export type ClientMessage = | { "type": "configRequest"; "protocolVersion"?: 1 } | { "type": "skinCatalogRequest"; "protocolVersion"?: 1 } | { "type": "openSkinDirectory"; "protocolVersion"?: 1 } | { "type": "openHelpcodeDirectory"; "protocolVersion"?: 1 } | { "type": "openShuangpinDirectory"; "protocolVersion"?: 1 } | { "type": "collocationModelDownload"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelDelete"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelImport"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelStatusRequest"; "protocolVersion"?: 1 } | { "type": "neuralModelDownload"; "protocolVersion"?: 1 } | { "type": "neuralModelImport"; "protocolVersion"?: 1 } | { "type": "neuralModelDelete"; "protocolVersion"?: 1 } | { "type": "neuralModelStatusRequest"; "protocolVersion"?: 1 } | { "type": "openHandwritingPanel"; "protocolVersion"?: 1 } | { "type": "restartServer"; "protocolVersion"?: 1 } | { "type": "copyText"; "protocolVersion"?: 1; "data": string } | { "type": "openExternalUrl"; "protocolVersion"?: 1; "data": string } | { "type": "dragStart"; "protocolVersion"?: 1 } | { "type": "focus"; "protocolVersion"?: 1 } | { "type": "resizeStart"; "protocolVersion"?: 1; "data": "left" | "right" | "top" | "bottom" | "left-top" | "right-top" | "left-bottom" | "right-bottom" | "client" } | { "type": "resizeHitTest"; "protocolVersion"?: 1; "data": "left" | "right" | "top" | "bottom" | "left-top" | "right-top" | "left-bottom" | "right-bottom" | "client" } | { "type": "windowControl"; "protocolVersion"?: 1; "data": "minimize" | "maximize" | "restore" | "close" } | { "type": "maximizeButtonRect"; "protocolVersion"?: 1; "data": { "x": number; "y": number; "width": number; "height": number; "dpr": number } } | { "type": "configUpdate"; "protocolVersion"?: 1; "data": { "path": string; "value": string | number | boolean } } | { "type": "apiCredentialTest"; "protocolVersion"?: 1; "data": { "requestId": string; "service": "translation.tencent" | "translation.niutrans" | "translation.custom" | "translation.ai" | "voice.asr" | "voice.polish" | "ai.assistant"; "config": { [key: string]: unknown } } } | { "type": "apiModelList"; "protocolVersion"?: 1; "data": { "requestId": string; "service": "ai.assistant" | "voice.asr" | "voice.polish"; "config": { [key: string]: unknown } } } | { "type": "aiProviderSync"; "protocolVersion"?: 1; "data": { "requestId": string; "entries": Array<{ "id": string; "name": string; "endpoint": string; "token": string; "model": string }> } } | { "type": "dictionaryRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "dictionary": "quanpin" | "wubi" | "english" | "quick"; "action": "query" | "create" | "update" | "delete" | "import" | "importHans" | "export"; "word"?: string; "code"?: string; "content"?: string; "weight"?: number; "oldWord"?: string; "oldCode"?: string; "display"?: string; "oldDisplay"?: string; "offset"?: number; "limit"?: number } } | { "type": "statsRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "overview" | "clearAll" | "openDirectory" } } | { "type": "defaultImeRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "status" | "setDefault" | "openSystemSettings" } } | { "type": "gameCompatRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "status" | "apply"; "enabled"?: boolean; "name"?: string } } | { "type": "openKeyboardPanel"; "protocolVersion"?: 1 } | { "type": "candidate"; "protocolVersion"?: 1; "data": number } | { "type": "delete"; "protocolVersion"?: 1; "data": number } | { "type": "pin"; "protocolVersion"?: 1; "data": number } | { "type": "clearPosition"; "protocolVersion"?: 1; "data": number } | { "type": "candidateWheel"; "protocolVersion"?: 1; "data": number } | { "type": "candidatePage"; "protocolVersion"?: 1; "data": "previous" | "next" } | { "type": "fixPosition"; "protocolVersion"?: 1; "data": { "index": number; "position": number } } | { "type": "contextMenuResize"; "protocolVersion"?: 1; "data": { "width": number; "height": number; "topExpansion"?: number; "leftExpansion"?: number } } | { "type": "contextMenuClosed"; "protocolVersion"?: 1 } | { "type": "candidatePointerArmed"; "protocolVersion"?: 1 } | { "type": "candidatePointerMotion"; "protocolVersion"?: 1 } | { "type": "candidateFrameProbe"; "protocolVersion"?: 1; "data": { "revision": number; "stage": number; "performanceMs": number } } | { "type": "candidatePointerProbe"; "protocolVersion"?: 1; "data": { "probe": number; "screenX": number; "screenY": number; "clientX": number; "clientY": number; "movementX": number; "movementY": number; "armed": boolean } } | { "type": "contentTruncated"; "protocolVersion"?: 1; "data": { "surface": "candidate" | "toolbar" | "menu" | "ftb" | "candwnd" | "cand"; "width": number; "height": number; [key: string]: unknown } } | { "type": "floatingToggle"; "protocolVersion"?: 1; "data": boolean } | { "type": "settings"; "protocolVersion"?: 1 } | { "type": "about"; "protocolVersion"?: 1 } | { "type": "emojiSymbols"; "protocolVersion"?: 1 } | { "type": "keyboardPanel"; "protocolVersion"?: 1 } | { "type": "handwritingPanel"; "protocolVersion"?: 1 } | { "type": "voiceInput"; "protocolVersion"?: 1 } | { "type": "changeInputScheme"; "protocolVersion"?: 1; "data": "quanpin" | "shuangpin" | "wubi" } | { "type": "inputSchemeSubmenu"; "protocolVersion"?: 1; "data": { "open": boolean; "width": number } } | { "type": "ready"; "protocolVersion"?: 1 } | { "type": "exitEnglishInputMode"; "protocolVersion"?: 1 } | { "type": "changeCharacterSet"; "protocolVersion"?: 1 } | { "type": "openSettings"; "protocolVersion"?: 1 } | { "type": "openEmojiPanel"; "protocolVersion"?: 1 } | { "type": "changeIMEMode"; "protocolVersion"?: 1; "data": "cn" | "en" } | { "type": "changeCharMode"; "protocolVersion"?: 1; "data": "fullwidth" | "halfwidth" } | { "type": "changePuncMode"; "protocolVersion"?: 1; "data": "puncEn" | "puncCn" }; export type ServerMessage = | { "type": "configSnapshot"; "protocolVersion"?: 1; "data": { [key: string]: unknown } } | { "type": "windowState"; "protocolVersion"?: 1; "data": { "isMaximized": boolean } } | { "type": "maxButtonEvent"; "protocolVersion"?: 1; "data": { "event": "enter" | "leave" | "down" | "up" | "click" } } | { "type": "apiCredentialTestResult"; "protocolVersion"?: 1; "requestId": string; "ok": boolean; "message": string } | { "type": "defaultImeResponse"; "protocolVersion"?: 1; "requestId": string; "action": string; "ok": boolean; "message": string; "enabled"?: boolean; "isDefault"?: boolean } | { "type": "gameCompatResponse"; "protocolVersion"?: 1; "requestId": string; "action": string; "ok": boolean; "message": string; "enabled"?: boolean; "name"?: string; "registeredName"?: string; "defaultName"?: string } | { "type": "apiModelListResult"; "protocolVersion"?: 1; "requestId": string; "ok": boolean; "message": string; "models"?: Array } | { "type": "aiProviderSyncResult"; "protocolVersion"?: 1; "requestId": string; "ok": boolean; "message": string } | { "type": "dictionaryResponse"; "protocolVersion"?: 1; "requestId": string; "action"?: string; "dictionary"?: string; "ok": boolean; "message": string; "rows": Array<{ "word": string; "code"?: string; "display"?: string; "weight"?: number }>; "content"?: string; "filename"?: string; "offset"?: number; "hasMore"?: boolean; [key: string]: unknown } | { "type": "statsResponse"; "protocolVersion"?: 1; "requestId": string; "action": string; "ok": boolean; "message": string; "overview"?: { "hasData": boolean; "firstDayKey": number; "lastDayKey": number; "days": number; "totalChars": number; "totalActiveMs": number; "todayDayKey": number; "todayChars": number; "todayActiveMs": number; "averagePerDay": number; "currentStreak": number; "longestStreak": number; "bestDayKey": number; "bestDayChars": number; "todaySpeed": number; "averageSpeed": number; "fastestSpeed": number; "fastestDayKey": number; "todayFirstWordRatio": number | null; "totalFirstWordRatio": number | null; "todayFirstWordTotal": number; "categories": { "cjk": number; "latin": number; "digit": number; "punct": number; "other": number }; "todayHourly": Array; "daily": Array<{ "dayKey": number; "cjk": number; "latin": number; "digit": number; "punct": number; "other": number; "activeMs": number; "firstWordHits": number; "firstWordTotal": number }> }; "removedDays"?: number; [key: string]: unknown }; export type SettingsMessage = | { "type": "configRequest"; "protocolVersion"?: 1 } | { "type": "skinCatalogRequest"; "protocolVersion"?: 1 } | { "type": "openSkinDirectory"; "protocolVersion"?: 1 } | { "type": "openHelpcodeDirectory"; "protocolVersion"?: 1 } | { "type": "openShuangpinDirectory"; "protocolVersion"?: 1 } | { "type": "collocationModelDownload"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelDelete"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelImport"; "protocolVersion"?: 1; "data": { "modelId": string } } | { "type": "collocationModelStatusRequest"; "protocolVersion"?: 1 } | { "type": "neuralModelDownload"; "protocolVersion"?: 1 } | { "type": "neuralModelImport"; "protocolVersion"?: 1 } | { "type": "neuralModelDelete"; "protocolVersion"?: 1 } | { "type": "neuralModelStatusRequest"; "protocolVersion"?: 1 } | { "type": "openHandwritingPanel"; "protocolVersion"?: 1 } | { "type": "restartServer"; "protocolVersion"?: 1 } | { "type": "copyText"; "protocolVersion"?: 1; "data": string } | { "type": "openExternalUrl"; "protocolVersion"?: 1; "data": string } | { "type": "dragStart"; "protocolVersion"?: 1 } | { "type": "focus"; "protocolVersion"?: 1 } | { "type": "resizeStart"; "protocolVersion"?: 1; "data": "left" | "right" | "top" | "bottom" | "left-top" | "right-top" | "left-bottom" | "right-bottom" | "client" } | { "type": "resizeHitTest"; "protocolVersion"?: 1; "data": "left" | "right" | "top" | "bottom" | "left-top" | "right-top" | "left-bottom" | "right-bottom" | "client" } | { "type": "windowControl"; "protocolVersion"?: 1; "data": "minimize" | "maximize" | "restore" | "close" } | { "type": "maximizeButtonRect"; "protocolVersion"?: 1; "data": { "x": number; "y": number; "width": number; "height": number; "dpr": number } } | { "type": "configUpdate"; "protocolVersion"?: 1; "data": { "path": string; "value": string | number | boolean } } | { "type": "apiCredentialTest"; "protocolVersion"?: 1; "data": { "requestId": string; "service": "translation.tencent" | "translation.niutrans" | "translation.custom" | "translation.ai" | "voice.asr" | "voice.polish" | "ai.assistant"; "config": { [key: string]: unknown } } } | { "type": "apiModelList"; "protocolVersion"?: 1; "data": { "requestId": string; "service": "ai.assistant" | "voice.asr" | "voice.polish"; "config": { [key: string]: unknown } } } | { "type": "aiProviderSync"; "protocolVersion"?: 1; "data": { "requestId": string; "entries": Array<{ "id": string; "name": string; "endpoint": string; "token": string; "model": string }> } } | { "type": "dictionaryRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "dictionary": "quanpin" | "wubi" | "english" | "quick"; "action": "query" | "create" | "update" | "delete" | "import" | "importHans" | "export"; "word"?: string; "code"?: string; "content"?: string; "weight"?: number; "oldWord"?: string; "oldCode"?: string; "display"?: string; "oldDisplay"?: string; "offset"?: number; "limit"?: number } } | { "type": "statsRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "overview" | "clearAll" | "openDirectory" } } | { "type": "defaultImeRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "status" | "setDefault" | "openSystemSettings" } } | { "type": "gameCompatRequest"; "protocolVersion"?: 1; "data": { "requestId": string; "action": "status" | "apply"; "enabled"?: boolean; "name"?: string } } | { "type": "openKeyboardPanel"; "protocolVersion"?: 1 }; declare global { var MsimeProtocol: { validate(message: unknown, direction: 'client' | 'server', surface?: string): boolean; serializeClientMessage(message: ClientMessage, surface: string): string; version: number; }; } export function serializeHostMessage(message: SettingsMessage): string { return globalThis.MsimeProtocol.serializeClientMessage(message, 'settings'); } export function isServerMessage(message: unknown): message is ServerMessage { return globalThis.MsimeProtocol.validate(message, 'server'); }