chore: codebase audit — remove dead code, unused deps, clean configs

Phase 1: Delete 19 dead component/service/tool files (4,200+ lines)
Phase 2: Remove 13 unused npm packages (Radix UI, shadcn utilities, ytdl-core, etc.)
Phase 3: Database schema — drop agent_delegations, add performance indexes
Phase 4: Remove 12 dead types from database.ts/analytics.ts/helpers.ts
Phase 5: Strip shadcn/ui theme from tailwind config
Phase 6: Clean env vars, fix broken imports (LocalKeyGate, MapViewer)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-29 08:52:15 +11:00
co-authored by Claude Opus 4.5
parent 65d22315e1
commit 9b2db68751
33 changed files with 13 additions and 5683 deletions
-95
View File
@@ -23,92 +23,6 @@ export interface UsageData {
mode?: 'easy' | 'hard';
}
export interface EnhancedChatMetadata {
timestamp: string;
session_id: string;
current_view: 'nodes' | 'memory';
open_tab_count: number;
has_focused_node: boolean;
message_count: number;
input_tokens?: number;
output_tokens?: number;
total_tokens?: number;
cache_write_tokens?: number;
cache_read_tokens?: number;
cache_hit?: boolean;
cache_savings_pct?: number;
estimated_cost_usd?: number;
model_used?: string;
provider?: 'anthropic' | 'openai';
tools_used?: string[];
tool_calls_count?: number;
trace_id?: string;
parent_chat_id?: number;
voice_tts_chars?: number;
voice_tts_cost_usd?: number;
voice_tts_chars_total?: number;
voice_tts_cost_usd_total?: number;
voice_request_id?: string;
voice_tts_request_count?: number;
voice_usage?: Array<{
request_id: string;
message_id?: string | null;
chars: number;
cost_usd: number;
voice?: string;
model?: string;
duration_ms?: number | null;
logged_at?: string;
}>;
}
export interface CostReport {
periodStart: string;
periodEnd: string;
totalCostUsd: number;
totalChats: number;
totalTokens: number;
inputTokens: number;
outputTokens: number;
cacheReadTokens: number;
cacheWriteTokens: number;
cacheHitRate: number;
cacheSavingsUsd: number;
avgCostPerChat: number;
avgTokensPerChat: number;
costByAgent: {
[agentName: string]: {
costUsd: number;
chats: number;
tokens: number;
};
};
costByModel: {
[modelId: string]: {
costUsd: number;
chats: number;
tokens: number;
};
};
}
export interface TraceCostSummary {
traceId: string;
totalCostUsd: number;
chatCount: number;
orchestratorCost: number;
executorCost: number;
plannerCost: number;
totalTokens: number;
interactions: Array<{
chatId: number;
agentName: string;
costUsd: number;
tokens: number;
createdAt: string;
}>;
}
export interface ModelPricing {
provider: 'anthropic' | 'openai';
inputPer1M: number;
@@ -117,12 +31,3 @@ export interface ModelPricing {
cacheReadPer1M?: number;
}
export interface CacheEffectiveness {
totalRequests: number;
cacheHits: number;
cacheMisses: number;
hitRate: number;
totalCacheSavingsUsd: number;
avgSavingsPerHit: number;
totalTokensSaved: number;
}
-84
View File
@@ -21,27 +21,6 @@ export interface Node {
chunk_status?: 'not_chunked' | 'chunking' | 'chunked' | 'error' | null;
}
// Legacy Item interface - DEPRECATED, use Node instead
// Kept temporarily for migration compatibility
export interface Item extends Node {
// Legacy fields for backwards compatibility during transition
description?: string;
abstract?: string;
type?: string;
legacyType?: string[];
stage?: string;
segment?: string[];
tags?: string[];
sub_type?: any;
notes?: any;
extras?: any;
score?: number;
content_embedding?: number[];
embedding_updated_at?: string;
chunk_status?: 'not_chunked' | 'chunking' | 'chunked' | 'error';
chunk_updated_at?: string;
}
export interface Chunk {
id: number;
node_id: number; // Updated from item_id to node_id
@@ -85,36 +64,6 @@ export interface EdgeContext {
created_via: EdgeCreatedVia;
}
export interface Chat {
id: number;
user_message?: string;
assistant_message?: string;
thread_id: string;
focused_node_id?: number; // Updated from focused_item_id
metadata?: any;
embedding?: number[]; // Renamed from content_embedding
created_at: string;
}
export interface SessionContext {
id: number;
session_id: string;
focused_node_id: number; // Updated from focused_item_id
context_data: any;
created_at: string;
last_accessed: string;
expires_at: string;
}
export interface SessionCache {
id: number;
session_id: string;
cache_key: string;
cache_data: any;
expires_at: string;
created_at: string;
}
// New NodeFilters interface replacing rigid ItemFilters
export interface NodeFilters {
dimensions?: string[]; // Filter by dimensions (replaces stage/type filtering)
@@ -124,13 +73,6 @@ export interface NodeFilters {
sortBy?: 'updated' | 'edges'; // Sort by updated_at or edge count
}
// Legacy filters - DEPRECATED, use NodeFilters instead
export interface ItemFilters extends NodeFilters {
stage?: string;
type?: string;
tags?: string[];
}
export interface ChunkData {
node_id: number; // Updated from item_id
chunk_idx?: number;
@@ -158,13 +100,6 @@ export interface ChatData {
embedding?: number[]; // Renamed from content_embedding
}
export interface CachedContext {
sessionId: string;
focusedNodeId: number; // Updated from focusedItemId
contextData: any;
expiresAt: string;
}
// New NodeConnection interface
export interface NodeConnection {
id: number;
@@ -172,25 +107,6 @@ export interface NodeConnection {
edge: Edge;
}
// Legacy connection - DEPRECATED, use NodeConnection instead
export interface ItemConnection {
id: number;
connected_item: Item;
edge: Edge;
}
export interface DatabaseConfig {
host: string;
port: number;
database: string;
user: string;
password: string;
ssl?: boolean;
connectionTimeoutMillis?: number;
idleTimeoutMillis?: number;
max?: number;
}
export interface DatabaseError {
message: string;
code?: string;
-22
View File
@@ -1,22 +0,0 @@
export interface MemoryContext {
insights: {
user_patterns: string[];
preferences: string[];
common_queries: string[];
knowledge_domains: string[];
};
context: string;
}
export interface HelperConfig {
name: string;
display_name: string;
description: string;
system_prompt: string;
component_key: string;
available_tools: string[];
enabled: boolean;
created_at: string;
updated_at: string;
memory?: MemoryContext;
}