SSH session management: - SshSession struct + ssh_sessions SQLite table in session.rs - CRUD Tauri commands (ssh_session_list/save/delete) in lib.rs - SshDialog.svelte (create/edit modal), SshSessionList.svelte (sidebar) - SSH pane routes to TerminalPane with shell=/usr/bin/ssh + args ctx context database integration: - ctx.rs: read-only CtxDb (SQLITE_OPEN_READ_ONLY for ~/.claude-context/context.db) - 5 Tauri commands (ctx_list_projects/get_context/get_shared/get_summaries/search) - ContextPane.svelte with project selector, tabs, search - ctx-bridge.ts adapter Catppuccin theme flavors (Latte/Frappe/Macchiato/Mocha): - themes.ts: all 4 palette definitions + buildXtermTheme/applyCssVariables - theme.svelte.ts: reactive store with SQLite persistence - SettingsDialog flavor dropdown, TerminalPane theme-aware Detached pane mode (pop-out windows): - detach.ts: isDetachedMode/getDetachedConfig from URL params - App.svelte: conditional rendering of single pane without chrome Other additions: - Shiki syntax highlighting (highlight.ts, lazy singleton, 13 languages) - Tauri auto-updater plugin (tauri-plugin-updater + updater.ts) - AgentPane markdown rendering with Shiki code highlighting - New deps: shiki, @tauri-apps/plugin-updater, tauri-plugin-updater
139 lines
3.8 KiB
Svelte
139 lines
3.8 KiB
Svelte
<script lang="ts">
|
|
import { onMount, onDestroy } from 'svelte';
|
|
import SessionList from './lib/components/Sidebar/SessionList.svelte';
|
|
import TilingGrid from './lib/components/Layout/TilingGrid.svelte';
|
|
import StatusBar from './lib/components/StatusBar/StatusBar.svelte';
|
|
import ToastContainer from './lib/components/Notifications/ToastContainer.svelte';
|
|
import SettingsDialog from './lib/components/Settings/SettingsDialog.svelte';
|
|
import { addPane, focusPaneByIndex, removePane, getPanes, restoreFromDb } from './lib/stores/layout.svelte';
|
|
import { initTheme } from './lib/stores/theme.svelte';
|
|
import { isDetachedMode, getDetachedConfig } from './lib/utils/detach';
|
|
import TerminalPane from './lib/components/Terminal/TerminalPane.svelte';
|
|
import AgentPane from './lib/components/Agent/AgentPane.svelte';
|
|
|
|
let settingsOpen = $state(false);
|
|
let detached = isDetachedMode();
|
|
let detachedConfig = getDetachedConfig();
|
|
import { startAgentDispatcher, stopAgentDispatcher } from './lib/agent-dispatcher';
|
|
|
|
function newTerminal() {
|
|
const id = crypto.randomUUID();
|
|
const num = getPanes().length + 1;
|
|
addPane({
|
|
id,
|
|
type: 'terminal',
|
|
title: `Terminal ${num}`,
|
|
});
|
|
}
|
|
|
|
function newAgent() {
|
|
const id = crypto.randomUUID();
|
|
const num = getPanes().filter(p => p.type === 'agent').length + 1;
|
|
addPane({
|
|
id,
|
|
type: 'agent',
|
|
title: `Agent ${num}`,
|
|
});
|
|
}
|
|
|
|
onMount(() => {
|
|
initTheme();
|
|
startAgentDispatcher();
|
|
if (!detached) restoreFromDb();
|
|
|
|
function handleKeydown(e: KeyboardEvent) {
|
|
// Ctrl+N — new terminal
|
|
if (e.ctrlKey && !e.shiftKey && e.key === 'n') {
|
|
e.preventDefault();
|
|
newTerminal();
|
|
return;
|
|
}
|
|
|
|
// Ctrl+Shift+N — new agent
|
|
if (e.ctrlKey && e.shiftKey && e.key === 'N') {
|
|
e.preventDefault();
|
|
newAgent();
|
|
return;
|
|
}
|
|
|
|
// Ctrl+1-4 — focus pane by index
|
|
if (e.ctrlKey && !e.shiftKey && e.key >= '1' && e.key <= '4') {
|
|
e.preventDefault();
|
|
focusPaneByIndex(parseInt(e.key) - 1);
|
|
return;
|
|
}
|
|
|
|
// Ctrl+, — settings
|
|
if (e.ctrlKey && e.key === ',') {
|
|
e.preventDefault();
|
|
settingsOpen = !settingsOpen;
|
|
return;
|
|
}
|
|
|
|
// Ctrl+W — close focused pane
|
|
if (e.ctrlKey && !e.shiftKey && e.key === 'w') {
|
|
e.preventDefault();
|
|
const focused = getPanes().find(p => p.focused);
|
|
if (focused) removePane(focused.id);
|
|
return;
|
|
}
|
|
}
|
|
|
|
window.addEventListener('keydown', handleKeydown);
|
|
return () => {
|
|
window.removeEventListener('keydown', handleKeydown);
|
|
stopAgentDispatcher();
|
|
};
|
|
});
|
|
</script>
|
|
|
|
{#if detached && detachedConfig}
|
|
<div class="detached-pane">
|
|
{#if detachedConfig.type === 'terminal' || detachedConfig.type === 'ssh'}
|
|
<TerminalPane
|
|
shell={detachedConfig.shell}
|
|
cwd={detachedConfig.cwd}
|
|
args={detachedConfig.args}
|
|
/>
|
|
{:else if detachedConfig.type === 'agent'}
|
|
<AgentPane
|
|
sessionId={detachedConfig.sessionId ?? crypto.randomUUID()}
|
|
cwd={detachedConfig.cwd}
|
|
/>
|
|
{:else}
|
|
<TerminalPane />
|
|
{/if}
|
|
</div>
|
|
{:else}
|
|
<aside class="sidebar">
|
|
<SessionList />
|
|
</aside>
|
|
<main class="workspace">
|
|
<TilingGrid />
|
|
</main>
|
|
<StatusBar />
|
|
<SettingsDialog open={settingsOpen} onClose={() => settingsOpen = false} />
|
|
{/if}
|
|
<ToastContainer />
|
|
|
|
<style>
|
|
.detached-pane {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
background: var(--bg-primary);
|
|
}
|
|
|
|
.sidebar {
|
|
background: var(--bg-secondary);
|
|
border-right: 1px solid var(--border);
|
|
overflow-y: auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.workspace {
|
|
background: var(--bg-primary);
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
</style>
|