{#if !isRunning}
Terminal unavailable
Start the capsule to connect
{:else}
{#each sessions as session (session.id)}
switchTo(session.id)} onkeydown={(e) => { if (e.key === 'Enter' || e.key === ' ') switchTo(session.id); }} role="tab" tabindex="0" aria-selected={session.id === activeSessionId} class="term-tab group flex shrink-0 cursor-pointer items-center gap-2.5 px-5 py-2.5 text-meta transition-colors {session.id === activeSessionId ? 'term-tab-active bg-[var(--color-bg-0)] text-[var(--color-text-primary)]' : 'bg-[var(--color-bg-1)] text-[var(--color-text-tertiary)] hover:bg-[var(--color-bg-2)] hover:text-[var(--color-text-secondary)] border-b border-b-[var(--color-border)]'}" > {#if session.state === 'connected'}
{:else if session.state === 'connecting'}
{:else if session.state === 'error'}
{:else}
{/if}
bash{#if session.ptyPid}
:{session.ptyPid}
{/if}
{ e.stopPropagation(); closeSession(session.id); }} class="ml-0.5 flex h-5 w-5 items-center justify-center rounded-[3px] text-[var(--color-text-muted)] opacity-0 transition-all group-hover:opacity-100 hover:bg-[var(--color-bg-4)] hover:text-[var(--color-text-secondary)]" title="Close session" >
{/each}
= MAX_SESSIONS} class="flex shrink-0 items-center justify-center aspect-square self-stretch border-b border-[var(--color-border)] text-[var(--color-text-tertiary)] transition-colors hover:bg-[var(--color-bg-2)] hover:text-[var(--color-text-primary)] disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent disabled:hover:text-[var(--color-text-tertiary)]" title={sessions.length >= MAX_SESSIONS ? `Maximum ${MAX_SESSIONS} sessions` : 'New terminal session'} >
{#if activeSession}
{#if activeSession.state === 'error' && activeSession.errorMessage}
{activeSession.errorMessage}
{/if} {#if (activeSession.state === 'disconnected' || activeSession.state === 'error') && activeSession.ptyTag}
activeSession && reconnectSession(activeSession.id)} class="flex items-center gap-1.5 rounded-[var(--radius-button)] border border-[var(--color-border)] bg-[var(--color-bg-3)] px-3 py-1 text-meta font-medium text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-bg-4)] hover:text-[var(--color-text-primary)]" >
Reconnect
{/if} {#if activeSession.ptyTag}
{activeSession.ptyTag}
{/if}
{/if}
{#each sessions as session (session.id)}
{/each} {#if sessions.length === 0}
No active sessions
All terminal sessions have been closed
New session
{/if}
{/if}