Add multi-workspace support to desktop app (#409)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Wes
2026-04-28 04:47:11 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent f1cef90376
commit a9024c2c78
35 changed files with 1212 additions and 55 deletions
+3 -3
View File
@@ -30,19 +30,19 @@ export class RelayClient {
private wsId: number | null = null;
private relayUrl: string | null = null;
private connectPromise: Promise<void> | null = null;
private reconnectTimeout: ReturnType<typeof setTimeout> | null = null;
private reconnectTimeout: number | null = null;
private reconnectDelayMs = RECONNECT_BASE_DELAY_MS;
private keepAliveRequested = false;
private authRequest: {
pendingEventId: string;
resolve: () => void;
reject: (error: Error) => void;
timeout: ReturnType<typeof setTimeout>;
timeout: number;
} | null = null;
private subscriptions = new Map<string, RelaySubscription>();
private pendingEvents = new Map<string, PendingEvent>();
private eventBuffer: Array<{ subId: string; event: RelayEvent }> = [];
private flushTimeout: ReturnType<typeof setTimeout> | null = null;
private flushTimeout: number | null = null;
private reconnectListeners = new Set<() => void>();
private hasConnectedOnce = false;
private notifyReconnectListeners = false;
+2 -2
View File
@@ -12,7 +12,7 @@ type HistorySubscription = {
events: RelayEvent[];
resolve: (events: RelayEvent[]) => void;
reject: (error: Error) => void;
timeout: ReturnType<typeof setTimeout>;
timeout: number;
};
type LiveSubscription = {
@@ -27,7 +27,7 @@ export type PendingEvent = {
event: RelayEvent;
resolve: (event: RelayEvent) => void;
reject: (error: Error) => void;
timeout: ReturnType<typeof setTimeout>;
timeout: number;
};
export type RelaySubscription = HistorySubscription | LiveSubscription;
+16
View File
@@ -528,6 +528,10 @@ export async function setPresence(
};
}
export function getDefaultRelayUrl(): Promise<string> {
return invokeTauri<string>("get_default_relay_url");
}
export function getRelayWsUrl(): Promise<string> {
return invokeTauri<string>("get_relay_ws_url");
}
@@ -1106,3 +1110,15 @@ export async function confirmPairingSas(): Promise<void> {
export async function cancelPairing(): Promise<void> {
await invokeTauri("cancel_pairing");
}
export async function applyWorkspace(
relayUrl: string,
nsec?: string,
token?: string,
): Promise<void> {
await invokeTauri("apply_workspace", {
relayUrl,
nsec: nsec ?? null,
token: token ?? null,
});
}