дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 01:57:13 +02:00
Closing a remote window (SSH, WSL, Dev Containers) used to end openidea-server --stdio and tear down terminals, runs (running their stop commands), indexing and agent turns. openidea-server --attach now connects through a detached per-project daemon (private 0700 run dir, owner check, flock) that keeps them alive across disconnects; reopening reattaches terminals with bounded scrollback and OSC state, runs and agent turns, and restores remote editor tabs, tool windows and plugin views. The close dialog offers Keep Backend Running / Stop Backend; Stop Remote Backend shuts the daemon down on demand. A disconnected backend with no live work exits after an idle timeout (3 hours by default; presets, custom or Never in Settings › Tools › Remote Development, host override wins). The socket is keyed by project, so a new build replaces an idle backend of another build and reports a busy one; a window taken over by another shows that instead of a dropped connection. Clean documents are released on disconnect while dirty buffers keep the backend alive. Also: a plugin-owned PTY keeps its exit hook across reattach (reattach only rebinds the forwarding sink), and a recent project clicked again while it is still opening joins that attempt instead of connecting twice (a double click made the second attach take over and fail the first). Co-authored-by: dengliu <[email protected]>
27 рядки
1000 B
TypeScript
27 рядки
1000 B
TypeScript
import { useI18n } from "./i18n";
|
|
|
|
export const DEFAULT_REMOTE_IDLE_MINUTES = 180;
|
|
export const MAX_REMOTE_IDLE_MINUTES = 65535;
|
|
|
|
/** Zero is an explicit Never, not the fallback for malformed or missing settings. */
|
|
export function validRemoteIdleMinutes(value: unknown): number {
|
|
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= MAX_REMOTE_IDLE_MINUTES
|
|
? value
|
|
: DEFAULT_REMOTE_IDLE_MINUTES;
|
|
}
|
|
|
|
/** Use the largest whole unit so neither a saved minute nor a host-enforced second gets rounded. */
|
|
export function formatIdleDuration(seconds: number): string {
|
|
const [unit, scale] =
|
|
seconds % 86400 === 0
|
|
? (["day", 86400] as const)
|
|
: seconds % 3600 === 0
|
|
? (["hour", 3600] as const)
|
|
: seconds % 60 === 0
|
|
? (["minute", 60] as const)
|
|
: (["second", 1] as const);
|
|
return new Intl.NumberFormat(useI18n.getState().locale, { style: "unit", unit, unitDisplay: "long" }).format(
|
|
seconds / scale,
|
|
);
|
|
}
|