UNPKG

@wonderwhy-er/desktop-commander

Version:

MCP server for terminal operations and file editing

71 lines (70 loc) 2.26 kB
import { Session, User } from '@supabase/supabase-js'; export interface AuthSession { access_token: string; refresh_token: string | null; device_id?: string; } interface DeviceData { user_id: string; device_name: string; capabilities: any; status: string; last_seen: string; } export declare class RemoteChannel { private client; private channel; private heartbeatInterval; private connectionCheckInterval; private deviceId; private onToolCall; private lastDeviceStatus; private lastChannelState; private _user; get user(): User | null; initialize(url: string, key: string): void; setSession(session: AuthSession): Promise<{ error: any; }>; getSession(): Promise<{ data: { session: Session | null; }; error: any; }>; findDevice(deviceId: string): Promise<{ id: any; device_name: any; } | null>; updateDevice(deviceId: string, updates: any): Promise<{ data: any[] | null; error: import("@supabase/postgrest-js").PostgrestError | null; }>; createDevice(deviceData: DeviceData): Promise<{ data: any; error: null; }>; registerDevice(capabilities: any, currentDeviceId: string | undefined, deviceName: string, onToolCall: (payload: any) => void): Promise<void>; /** * Create and subscribe to the channel. * This is used for both initial subscription and recreation after socket reconnects. */ private createChannel; /** * Check if channel is connected, recreate if not. */ private checkConnectionHealth; /** * Recreate the channel by destroying old one and creating fresh instance. */ private recreateChannel; markCallExecuting(callId: string): Promise<void>; updateCallResult(callId: string, status: string, result?: any, errorMessage?: string | null): Promise<void>; updateHeartbeat(deviceId: string): Promise<void>; startHeartbeat(deviceId: string): void; stopHeartbeat(): void; setOnlineStatus(deviceId: string, status: 'online' | 'offline'): Promise<void>; setOffline(deviceId: string | undefined): Promise<void>; unsubscribe(): Promise<void>; } export {};