feat: skip connect and terminal mount for remote sessions in openSession

When opts.sourceUrl is non-empty (remote session), skip the POST
/api/sessions/{name}/connect call and skip window._openTerminal(name).
Remote terminal connections are deferred to Phase 3.
Local sessions (empty sourceUrl) continue to work as before.

Co-authored-by: Amplifier <amplifier@amplified.dev>
This commit is contained in:
Brian Krabach
2026-03-31 01:31:09 -07:00
parent 70b8df1458
commit 2b5b6e3003
+4 -1
View File
@@ -1086,10 +1086,13 @@ async function openSession(name, opts = {}) {
if (fab) fab.classList.add('hidden');
// Connect to session (kill old ttyd, spawn new one for this session)
var sourceUrl = opts.sourceUrl || '';
try {
if (!opts.skipConnect) {
if (!sourceUrl) {
await api('POST', `/api/sessions/${name}/connect`);
}
}
} catch (err) {
showToast(err.message || 'Connection failed');
return closeSession();
@@ -1099,7 +1102,7 @@ async function openSession(name, opts = {}) {
await animDone;
// Mount terminal NOW — /connect has completed, new ttyd is serving the correct session
if (window._openTerminal) window._openTerminal(name);
if (!sourceUrl && window._openTerminal) window._openTerminal(name);
}
/**