claude-desktop/src/routes/+page.svelte
Eddy adb11fd121 Phase 16: System-Monitor (Debug-Panel)
Neue Komponenten:
- MonitorPanel.svelte: Live-Event-Stream mit Farbcodierung
- MonitorEvent Store in app.ts (Ringbuffer max 1000)

Features:
- 🔵 API-Events (Request/Response, Token, Kosten, Latenz)
- 🟡 Tool-Events (Name, Parameter, Dauer)
- 🟠 Agent-Events (Start/Stop)
- 🔴 Error-Events
- Filter nach Event-Typ
- Auto-Scroll toggle
- Detail-Ansicht bei Klick
- Copy-Button für Details
- Statistik-Anzeige (API-Calls, Errors, Avg Latency)

claude-bridge.js:
- sendMonitorEvent() Funktion
- summarizeToolInput() für kompakte Zusammenfassung
- Events bei API-Start, API-Ende, Tool-Start, Fehler

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-14 12:40:29 +02:00

182 lines
4.2 KiB
Svelte

<script lang="ts">
import { PaneGroup, Pane, PaneResizer } from 'paneforge';
import SessionList from '$lib/components/SessionList.svelte';
import ChatPanel from '$lib/components/ChatPanel.svelte';
import ActivityPanel from '$lib/components/ActivityPanel.svelte';
import AgentView from '$lib/components/AgentView.svelte';
import MemoryPanel from '$lib/components/MemoryPanel.svelte';
import AuditLog from '$lib/components/AuditLog.svelte';
import GuardRailsPanel from '$lib/components/GuardRailsPanel.svelte';
import SettingsPanel from '$lib/components/SettingsPanel.svelte';
import MonitorPanel from '$lib/components/MonitorPanel.svelte';
let activeMiddleTab = 'activity';
let activeRightTab = 'agents';
const middleTabs = [
{ id: 'activity', label: 'Aktivität', icon: '📋' },
{ id: 'monitor', label: 'Monitor', icon: '📊' },
{ id: 'memory', label: 'Gedächtnis', icon: '🧠' },
{ id: 'audit', label: 'Historie', icon: '📝' },
];
const rightTabs = [
{ id: 'agents', label: 'Agents', icon: '🤖' },
{ id: 'guards', label: 'Guard-Rails', icon: '🛡️' },
{ id: 'settings', label: 'Settings', icon: '⚙️' },
];
</script>
<PaneGroup direction="horizontal" autoSaveId="claude-desktop-panels" class="pane-group">
<!-- Sessions -->
<Pane defaultSize={15} minSize={8} maxSize={30} class="panel">
<SessionList />
</Pane>
<PaneResizer class="resizer">
<div class="resizer-line"></div>
</PaneResizer>
<!-- Chat -->
<Pane defaultSize={35} minSize={15} class="panel">
<ChatPanel />
</Pane>
<PaneResizer class="resizer">
<div class="resizer-line"></div>
</PaneResizer>
<!-- Aktivität / Memory / Audit -->
<Pane defaultSize={25} minSize={10} class="panel">
<div class="panel-tabs">
{#each middleTabs as tab}
<button
class="tab"
class:active={activeMiddleTab === tab.id}
on:click={() => activeMiddleTab = tab.id}
>
{tab.icon} {tab.label}
</button>
{/each}
</div>
<div class="panel-content">
{#if activeMiddleTab === 'activity'}
<ActivityPanel />
{:else if activeMiddleTab === 'monitor'}
<MonitorPanel />
{:else if activeMiddleTab === 'memory'}
<MemoryPanel />
{:else if activeMiddleTab === 'audit'}
<AuditLog />
{/if}
</div>
</Pane>
<PaneResizer class="resizer">
<div class="resizer-line"></div>
</PaneResizer>
<!-- Agents / Guard-Rails -->
<Pane defaultSize={25} minSize={10} class="panel">
<div class="panel-tabs">
{#each rightTabs as tab}
<button
class="tab"
class:active={activeRightTab === tab.id}
on:click={() => activeRightTab = tab.id}
>
{tab.icon} {tab.label}
</button>
{/each}
</div>
<div class="panel-content">
{#if activeRightTab === 'agents'}
<AgentView />
{:else if activeRightTab === 'guards'}
<GuardRailsPanel />
{:else if activeRightTab === 'settings'}
<SettingsPanel />
{/if}
</div>
</Pane>
</PaneGroup>
<style>
/* PaneForge Container */
:global(.pane-group) {
height: 100%;
}
:global(.panel) {
display: flex;
flex-direction: column;
background: var(--bg-primary);
overflow: hidden;
}
/* Resizer Handle */
:global(.resizer) {
width: 8px;
background: var(--border);
display: flex;
align-items: center;
justify-content: center;
cursor: col-resize;
transition: background 0.15s ease;
}
:global(.resizer:hover),
:global(.resizer[data-state="drag"]) {
background: var(--accent);
}
.resizer-line {
width: 2px;
height: 24px;
border-radius: 1px;
background: var(--text-secondary);
opacity: 0;
transition: opacity 0.15s;
}
:global(.resizer:hover) .resizer-line,
:global(.resizer[data-state="drag"]) .resizer-line {
opacity: 0.5;
}
/* Tabs */
.panel-tabs {
display: flex;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.tab {
flex: 1;
padding: var(--spacing-sm);
font-size: 0.75rem;
color: var(--text-secondary);
background: transparent;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
transition: all 0.15s ease;
white-space: nowrap;
}
.tab:hover {
color: var(--text-primary);
background: var(--bg-hover);
}
.tab.active {
color: var(--accent);
border-bottom-color: var(--accent);
}
.panel-content {
flex: 1;
overflow: auto;
}
</style>