Add a dedicated /audit route displaying a chronological timeline of orchestration events (state transitions, tool invocations, errors, messages) grouped by session. Includes session selector, event type filtering, URL deep-linking via ?session=id, and audit event capture during chat streaming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
57 lines
2.3 KiB
Markdown
57 lines
2.3 KiB
Markdown
# Issue #17 — Audit/Activity Log View
|
|
|
|
**Status: COMPLETED**
|
|
|
|
## Overview
|
|
|
|
Timeline view of all orchestration events for a session — state transitions, tool invocations, errors. Populated from the streamed responses captured during the session.
|
|
|
|
## Implementation Steps
|
|
|
|
### 1. Audit Event Store (`src/lib/stores/audit.svelte.ts`) — COMPLETED
|
|
|
|
- Created `AuditEvent` type with `id`, `sessionId`, `timestamp`, `eventType`, `details`, `state?`
|
|
- Event types: `state_change`, `tool_invocation`, `error`, `message`
|
|
- Store events grouped by session using `SvelteMap`, persisted to `localStorage`
|
|
- Functions: `addEvent()`, `getEventsBySession()`, `getAllSessions()`, `clearSession()`
|
|
- Sample data seeded for demo sessions
|
|
|
|
### 2. AuditTimeline Component (`src/lib/components/AuditTimeline.svelte`) — COMPLETED
|
|
|
|
- Vertical timeline with left-aligned time markers and event cards
|
|
- Color-coded type badges: state change=blue, tool=green, error=red, message=gray
|
|
- Each event shows timestamp, type badge, state label (when applicable), and detail text
|
|
- Date headers when events span multiple days
|
|
- Hover shadow effect on event cards
|
|
|
|
### 3. Audit Route (`src/routes/audit/+page.svelte`) — COMPLETED
|
|
|
|
- Dedicated `/audit` route with session selector dropdown and timeline
|
|
- Filter controls for event type (all, state changes, tool invocations, errors, messages)
|
|
- URL query param `?session=id` for deep linking to specific session
|
|
- Empty states when no events or no session selected
|
|
- Header with back-to-chat link and "Sample Data" badge
|
|
|
|
### 4. Audit Route Config (`src/routes/audit/+page.ts`) — COMPLETED
|
|
|
|
- `export const prerender = false` and `export const ssr = false`
|
|
|
|
### 5. Homepage Navigation (`src/routes/+page.svelte`) — COMPLETED
|
|
|
|
- Added "Audit Log" navigation link alongside existing Chat, Lineage, Memory links
|
|
|
|
### 6. Chat Page Integration (`src/routes/chat/+page.svelte`) — COMPLETED
|
|
|
|
- Added "Audit" link in the header navigation bar
|
|
- Capture orchestration state changes during streaming into the audit store
|
|
- Capture errors into the audit store
|
|
|
|
## Files Changed
|
|
|
|
- `src/lib/stores/audit.svelte.ts` (new)
|
|
- `src/lib/components/AuditTimeline.svelte` (new)
|
|
- `src/routes/audit/+page.svelte` (new)
|
|
- `src/routes/audit/+page.ts` (new)
|
|
- `src/routes/+page.svelte` (modified)
|
|
- `src/routes/chat/+page.svelte` (modified)
|