Route all app commands through a single RPC envelope (#542)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-08-14 14:16:14 -07:00
committed by GitHub
co-authored by Claude Fable 5
parent 1f91cddab9
commit 23e7229e63
37 changed files with 2473 additions and 395 deletions
+7 -6
View File
@@ -30,21 +30,22 @@ export function watchWorkspaceFiles(
callback: (e: WatchEvent) => void,
) {
console.log("Watching workspace files", workspaceId, syncDir);
const unlistenPromise = platform.rpcStream<WatchResult, WatchEvent>(
const handle = platform.rpcStream<WatchResult, WatchEvent>(
"cmd_sync_watch",
{ workspaceId, syncDir },
callback,
);
void unlistenPromise.then(({ unlistenEvent }) => {
addWatchKey(unlistenEvent);
void handle.then(({ result }) => {
addWatchKey(result.unlistenEvent);
});
return () =>
unlistenPromise
.then(async ({ unlistenEvent }) => {
handle
.then(async ({ result, unlisten }) => {
console.log("Unwatching workspace files", workspaceId, syncDir);
unlistenToWatcher(unlistenEvent);
unlistenToWatcher(result.unlistenEvent);
unlisten();
})
.catch(console.error);
}