diff --git a/v2/src/lib/components/Terminal/AgentPreviewPane.svelte b/v2/src/lib/components/Terminal/AgentPreviewPane.svelte new file mode 100644 index 0000000..ebfd199 --- /dev/null +++ b/v2/src/lib/components/Terminal/AgentPreviewPane.svelte @@ -0,0 +1,197 @@ + + +
+ + diff --git a/v2/src/lib/components/Workspace/ProjectBox.svelte b/v2/src/lib/components/Workspace/ProjectBox.svelte index 5a8b31d..bacad04 100644 --- a/v2/src/lib/components/Workspace/ProjectBox.svelte +++ b/v2/src/lib/components/Workspace/ProjectBox.svelte @@ -74,7 +74,7 @@
- +
diff --git a/v2/src/lib/components/Workspace/TerminalTabs.svelte b/v2/src/lib/components/Workspace/TerminalTabs.svelte index 3738fb2..edc983f 100644 --- a/v2/src/lib/components/Workspace/TerminalTabs.svelte +++ b/v2/src/lib/components/Workspace/TerminalTabs.svelte @@ -7,12 +7,14 @@ type TerminalTab, } from '../../stores/workspace.svelte'; import TerminalPane from '../Terminal/TerminalPane.svelte'; + import AgentPreviewPane from '../Terminal/AgentPreviewPane.svelte'; interface Props { project: ProjectConfig; + agentSessionId?: string | null; } - let { project }: Props = $props(); + let { project, agentSessionId }: Props = $props(); let tabs = $derived(getTerminalTabs(project.id)); let activeTabId = $state(null); @@ -38,6 +40,26 @@ activeTabId = id; } + function addAgentPreviewTab() { + if (!agentSessionId) return; + // Don't create duplicate — check if one already exists for this session + const existing = tabs.find( + t => t.type === 'agent-preview' && t.agentSessionId === agentSessionId, + ); + if (existing) { + activeTabId = existing.id; + return; + } + const id = crypto.randomUUID(); + addTerminalTab(project.id, { + id, + title: 'Agent Preview', + type: 'agent-preview', + agentSessionId, + }); + activeTabId = id; + } + function closeTab(tabId: string) { removeTerminalTab(project.id, tabId); } @@ -66,18 +88,29 @@ >× {/each} - + + {#if agentSessionId} + + {/if}
{#each tabs as tab (tab.id)}
{#if activeTabId === tab.id} - handleTabExit(tab.id)} - /> + {#if tab.type === 'agent-preview' && tab.agentSessionId} + + {:else} + handleTabExit(tab.id)} + /> + {/if} {/if}
{/each} @@ -171,6 +204,10 @@ background: var(--ctp-surface0); } + .tab-agent-preview { + font-size: 0.7rem; + } + .tab-content { flex: 1; position: relative; diff --git a/v2/src/lib/stores/workspace.svelte.ts b/v2/src/lib/stores/workspace.svelte.ts index 0d42342..ea2d5b0 100644 --- a/v2/src/lib/stores/workspace.svelte.ts +++ b/v2/src/lib/stores/workspace.svelte.ts @@ -7,9 +7,11 @@ export type WorkspaceTab = 'sessions' | 'docs' | 'context' | 'settings'; export interface TerminalTab { id: string; title: string; - type: 'shell' | 'ssh' | 'agent-terminal'; + type: 'shell' | 'ssh' | 'agent-terminal' | 'agent-preview'; /** SSH session ID if type === 'ssh' */ sshSessionId?: string; + /** Agent session ID if type === 'agent-preview' */ + agentSessionId?: string; } // --- Core state ---