@wonderwhy-er/desktop-commander
Version:
MCP server for terminal operations and file editing
47 lines (46 loc) • 2.11 kB
TypeScript
import { type IClientOptions } from "mqtt";
/** Identify a call for MQTT observation. */
export interface MqttDoorbell {
call_id: string;
user_id: string;
device_id: string;
IS_MQTT_EXECUTION_ENABLED?: boolean;
}
export interface MqttConfig {
url: string;
options: IClientOptions;
}
/** Connect using the enrolled device identity and the system's trusted broker certificates. */
export declare function createMqttConfig(credentials: {
url: string;
cert: string;
key: string;
}): MqttConfig;
/** Match the server publisher's exact device topic without granting wildcard subscriptions. */
export declare function mqttDoorbellTopic(userId: string, deviceId: string): string;
/** A per-device subscription that validates and observes shadow notifications. */
export declare class MqttTransport {
private readonly config;
private readonly userId;
private readonly deviceId;
private readonly onDoorbell;
private readonly onReady;
private readonly onMalformed;
/** Called when the receiver stops itself after start() resolved, so RemoteChannel can restart MQTT. */
private readonly onFailed;
private client;
private stopped;
private ready;
private cancelStart;
private readonly topic;
/** Bind verified registration identity and RemoteChannel's delivery/readiness callbacks once. */
constructor(config: MqttConfig, userId: string, deviceId: string, onDoorbell: (payload: MqttDoorbell) => Promise<void>, onReady: (ready: boolean) => Promise<void>, onMalformed?: () => void,
/** Called when the receiver stops itself after start() resolved, so RemoteChannel can restart MQTT. */
onFailed?: () => void);
/** Make one connection attempt and resolve after QoS 1 SUBACK and the readiness update. */
start(): Promise<void>;
/** Publish one bounded result attempt without queuing it for a later connection. */
publishResult(callId: string, originInstance: string): Promise<void>;
/** Stop reconnects, reject pending startup and withdraw readiness on sign-out/shutdown. */
stop(): Promise<void>;
}