experimental: pop-out container terminals into dedicated windows
Release rolling / release (push) Successful in 7m56s

Pin PTY sessions to the peer they were opened on so shells survive
active-node switches until the window is closed. Electron host owns
the connection; pop-out windows relay I/O via IPC (BroadcastChannel
fallback). Explicit terminal sessionIds no longer wipe sibling PTYs
on the same container.
This commit is contained in:
Raven Scott
2026-07-29 06:34:13 -04:00
parent dcb5b3db4f
commit 26529e92c6
14 changed files with 1710 additions and 4 deletions
+13 -4
View File
@@ -412,13 +412,22 @@ export function registerTerminalHandlers(session) {
const sessions = getSessions(session)
const sessionId = resolveSessionId(args)
// Always clear any prior PTY for this id/container before opening a new one.
// Prevents races where a late killTerminal and a re-entry startTerminal overlap,
// and avoids "stuck" sessions when the client re-enters the Terminal tab.
// Replace any prior PTY for this exact session id (re-entry / restart).
// Explicit unique sessionIds (details-*, popout-*) may coexist on the same
// container so pop-out windows stay alive while the in-app tab reopens.
if (sessions.has(sessionId)) {
endOne(sessions, sessionId)
}
cleanupTerminalsForContainer(session, containerId)
// Legacy clients key the session by containerId only — clear leftovers for
// that container so re-open is clean. Explicit multi-session ids skip this.
const explicitSession =
args.sessionId != null &&
String(args.sessionId) !== '' &&
String(args.sessionId) !== String(containerId) &&
String(args.sessionId) !== 'default'
if (!explicitSession) {
cleanupTerminalsForContainer(session, containerId)
}
const useTty = args.tty !== false
const shellCandidates = buildShellCandidates(args)