diff --git a/cptr/frontend/src/lib/components/ArtifactViewer.svelte b/cptr/frontend/src/lib/components/ArtifactViewer.svelte
new file mode 100644
index 0000000..1e160dc
--- /dev/null
+++ b/cptr/frontend/src/lib/components/ArtifactViewer.svelte
@@ -0,0 +1,9 @@
+
+
+
item.id === state.activeGroupId);
+ if (!group) return;
+
+ const existing = group.tabs.find((tab) => tab.type === 'artifact' && tab.content === content);
+ const tab: Tab = existing ?? { id: nextId(), type: 'artifact', label: title, content };
+ const updateGroup = (group: EditorGroup) =>
+ group.id === state.activeGroupId
+ ? { ...group, tabs: existing ? group.tabs : [...group.tabs, tab], activeTabId: tab.id }
+ : group;
+
+ if (workspace) {
+ currentWorkspace.update((current) =>
+ current ? { ...current, groups: current.groups.map(updateGroup) } : current
+ );
+ } else {
+ homeState.update((current) => ({ ...current, groups: current.groups.map(updateGroup) }));
+ }
+}
+
export function openUntitledFileTab(targetGroupId?: string): void {
// Find the lowest unused number across ALL groups
const ws = get(currentWorkspace);
diff --git a/cptr/frontend/src/routes/+page.svelte b/cptr/frontend/src/routes/+page.svelte
index 22580fd..e8adc46 100644
--- a/cptr/frontend/src/routes/+page.svelte
+++ b/cptr/frontend/src/routes/+page.svelte
@@ -43,6 +43,7 @@
import FileEditor from '$lib/components/FileEditor.svelte';
import GitView from '$lib/components/GitView.svelte';
import Terminal from '$lib/components/Terminal.svelte';
+ import ArtifactViewer from '$lib/components/ArtifactViewer.svelte';
import BrowserPreview from '$lib/components/BrowserPreview.svelte';
import ChatPanel from '$lib/components/chat/ChatPanel.svelte';
import DirectoryPicker from '$lib/components/DirectoryPicker.svelte';
@@ -1049,6 +1050,11 @@
/>
{/each}
+ {#each homePane.tabs.filter((tab) => tab.type === 'artifact') as tab (tab.id)}
+
+ {/each}
{#each homePane.tabs.filter((tab) => tab.type === 'terminal' && tab.sessionId) as tab (tab.id)}
@@ -1366,6 +1372,11 @@
/>
{/each}
+ {#each group.tabs.filter((tab) => tab.type === 'artifact') as tab (tab.id)}
+
+ {/each}
{#each group.tabs.filter((tab) => tab.type === 'chat') as tab (tab.id)}