feat: add multi-session desktop workspace

This commit is contained in:
2026-08-13 21:34:04 +02:00
parent 12b9b83d51
commit 475f95ba70
56 changed files with 8998 additions and 3805 deletions
+9 -1
View File
@@ -4,6 +4,7 @@ import path from "node:path";
import { StringDecoder } from "node:string_decoder";
export const DEFAULT_COMMAND_TIMEOUT_MS = 30_000;
export const COMPACT_COMMAND_TIMEOUT_MS = 5 * 60_000;
export const MAX_PI_RPC_FRAME_BYTES = 1024 * 1024;
const supportedCommands = new Set([
@@ -18,6 +19,8 @@ const supportedCommands = new Set([
"get_messages",
"get_available_models",
"get_commands",
"set_session_name",
"compact",
"set_model",
"set_thinking_level",
]);
@@ -126,6 +129,7 @@ export function startPiRpcAdapter({
onEvent = () => {},
onError = () => {},
commandTimeoutMs = DEFAULT_COMMAND_TIMEOUT_MS,
compactCommandTimeoutMs = COMPACT_COMMAND_TIMEOUT_MS,
maxFrameBytes = MAX_PI_RPC_FRAME_BYTES,
}) {
assertAbsolutePath(cwd, "cwd");
@@ -316,6 +320,10 @@ export function startPiRpcAdapter({
}
const id = `bridge-${randomUUID()}`;
const timeoutMs =
commandInput.type === "compact"
? compactCommandTimeoutMs
: commandTimeoutMs;
return new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
pending.delete(id);
@@ -325,7 +333,7 @@ export function startPiRpcAdapter({
`Pi RPC command timed out: ${commandInput.type}`,
),
);
}, commandTimeoutMs);
}, timeoutMs);
timeout.unref?.();
pending.set(id, { resolve, reject, timeout });
try {