feat(rah-light): remove agent delegation system

- Delete src/services/agents/delegation.ts (AgentDelegationService)
- Delete app/api/rah/delegations/ directory (all routes)
- Delete src/components/agents/DelegationIndicator.tsx
- Update workflowExecutor.ts to work without delegation streaming
- Update executeWorkflow.ts tool to execute workflows directly
- Update quickAdd.ts to execute directly without delegation tracking
- Add stub AgentDelegation types to UI components for compatibility
- Add stub voice hooks to RAHChat.tsx (will be removed in story 2)

Files deleted:
- src/services/agents/delegation.ts
- app/api/rah/delegations/route.ts
- app/api/rah/delegations/stream/route.ts
- app/api/rah/delegations/[sessionId]/route.ts
- app/api/rah/delegations/[sessionId]/summary/route.ts
- src/components/agents/DelegationIndicator.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-29 15:11:15 +11:00
co-authored by Claude Opus 4.5
parent 08012a8e5a
commit 6b7bb5a5f9
19 changed files with 234 additions and 819 deletions
+12 -1
View File
@@ -5,10 +5,21 @@ import RAHChat from './RAHChat';
import QuickAddInput from './QuickAddInput';
import QuickAddStatus from './QuickAddStatus';
import { Zap, Flame, Minimize2 } from 'lucide-react';
import type { AgentDelegation } from '@/services/agents/delegation';
import { Node } from '@/types/database';
import { parseAndRenderContent } from '@/components/helpers/NodeLabelRenderer';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
interface AgentsPanelProps {
openTabsData: Node[];
activeTabId: number | null;
@@ -1,36 +0,0 @@
import type { AgentDelegation } from '@/services/agents/delegation';
interface DelegationIndicatorProps {
delegations: AgentDelegation[];
}
export default function DelegationIndicator({ delegations }: DelegationIndicatorProps) {
if (!delegations.length) return null;
const activeCount = delegations.filter((d) => d.status === 'queued' || d.status === 'in_progress').length;
if (activeCount === 0) return null;
return (
<div style={{
display: 'flex',
alignItems: 'center',
gap: '6px',
padding: '4px 8px',
borderRadius: '4px',
background: '#0f0f0f',
border: '1px solid #1a1a1a',
fontSize: '10px',
fontFamily: "'JetBrains Mono', ui-monospace",
color: '#6b6b6b'
}}>
<span style={{
width: '6px',
height: '6px',
borderRadius: '50%',
background: '#22c55e'
}} />
<span>{activeCount} active</span>
</div>
);
}
+13 -1
View File
@@ -1,5 +1,17 @@
import { ReactNode } from 'react';
import type { AgentDelegation } from '@/services/agents/delegation';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
context: string[];
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
interface MiniRAHPanelProps {
delegation: AgentDelegation;
+10 -1
View File
@@ -1,6 +1,15 @@
"use client";
import type { AgentDelegation } from '@/services/agents/delegation';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
createdAt: string;
updatedAt: string;
};
interface QuickAddStatusProps {
delegations: AgentDelegation[];
+51 -6
View File
@@ -6,15 +6,60 @@ import AsciiBanner from './AsciiBanner';
import TerminalMessage from './TerminalMessage';
import TerminalInput from './TerminalInput';
import { Zap, Flame } from 'lucide-react';
import DelegationIndicator from './DelegationIndicator';
import type { AgentDelegation } from '@/services/agents/delegation';
import { useSSEChat, ChatMessage, MessageRole } from './hooks/useSSEChat';
import { useQuotaHandler } from '@/hooks/useQuotaHandler';
import { apiKeyService } from '@/services/storage/apiKeys';
import { useVoiceSession } from './hooks/useVoiceSession';
import { useAssistantTTS } from './hooks/useAssistantTTS';
import { useRealtimeVoiceClient } from './hooks/useRealtimeVoiceClient';
import { useVoiceInterruption } from './hooks/useVoiceInterruption';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
// Stub DelegationIndicator component (delegation system removed)
function DelegationIndicator({ delegations }: { delegations: AgentDelegation[] }) {
return null;
}
// Stub voice hooks (voice system will be removed in story 2)
function useVoiceSession() {
return {
isActive: false,
amplitude: 0,
startSession: () => {},
stopSession: () => {},
resetTranscript: () => {},
setStatus: (_status: string) => {},
setAmplitude: (_amp: number) => {},
setInterimTranscript: (_text: string) => {},
appendFinalTranscript: (_text: string) => {},
};
}
function useAssistantTTS(_options: { onSpeechStart?: () => void; onSpeechComplete?: () => void; onError?: (e: Error) => void }) {
return {
speak: (_text: string, _options?: { flush?: boolean; metadata?: Record<string, string> }) => {},
stop: () => {},
status: 'idle' as const,
};
}
function useVoiceInterruption(_options: { amplitude: number; isVoiceActive: boolean; ttsStatus: string; onInterruption: () => void }) {}
function useRealtimeVoiceClient(_handlers: { onStatusChange?: (status: string) => void; onInterimTranscript?: (text: string) => void; onFinalTranscript?: (text: string) => void; onAmplitude?: (amp: number) => void; onError?: (e: Error) => void }, _options: { getAuthToken: () => string | null }) {
return {
connect: () => {},
disconnect: () => {},
start: () => {},
stop: () => {},
};
}
const createSessionId = () => `session_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
const createVoiceRequestId = () =>
+13 -1
View File
@@ -1,5 +1,17 @@
import { Fragment, ReactNode, useMemo } from 'react';
import type { AgentDelegation } from '@/services/agents/delegation';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
context: string[];
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
const statusPalette: Record<string, { border: string; badge: string }> = {
queued: { border: '#3a2f5f', badge: '#a78bfa' },
+17 -49
View File
@@ -6,9 +6,21 @@ import SearchModal from '../nodes/SearchModal';
import { Node } from '@/types/database';
import { DatabaseEvent } from '@/services/events';
import { usePersistentState } from '@/hooks/usePersistentState';
import type { AgentDelegation } from '@/services/agents/delegation';
import type { ChatMessage } from '@/components/agents/hooks/useSSEChat';
// Stub type for delegation (delegation system removed in rah-light)
type AgentDelegation = {
id: number;
sessionId: string;
task: string;
context: string[];
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
// Layout components
import LeftToolbar from './LeftToolbar';
import SplitHandle from './SplitHandle';
@@ -66,8 +78,8 @@ export default function ThreePanelLayout() {
// Active dimension tracking (for chat context)
const [activeDimension, setActiveDimension] = usePersistentState<string | null>('ui.focus.activeDimension', null);
// Delegations state (shared between chat and workflows panes)
const [delegationsMap, setDelegationsMap] = useState<Record<string, AgentDelegation>>({});
// Delegations state (deprecated - kept for component compatibility)
const [delegationsMap] = useState<Record<string, AgentDelegation>>({});
const delegations = useMemo(() => Object.values(delegationsMap), [delegationsMap]);
// Chat state (lifted to persist across pane type changes)
@@ -161,32 +173,7 @@ export default function ThreePanelLayout() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [openTabsKey]);
// Load delegations on mount
useEffect(() => {
let cancelled = false;
const loadExisting = async () => {
try {
const response = await fetch('/api/rah/delegations?status=active&includeCompleted=true');
if (!response.ok) return;
const data = await response.json();
if (!Array.isArray(data.delegations)) return;
setDelegationsMap((prev) => {
if (cancelled) return prev;
const next = { ...prev };
for (const delegation of data.delegations as AgentDelegation[]) {
next[delegation.sessionId] = delegation;
}
return next;
});
} catch (error) {
console.error('[ThreePanelLayout] Failed to load delegations:', error);
}
};
loadExisting();
return () => { cancelled = true; };
}, []);
// Delegations loading removed (delegation system removed in rah-light)
// Keyboard shortcut handler
useEffect(() => {
@@ -278,27 +265,8 @@ export default function ThreePanelLayout() {
break;
case 'AGENT_DELEGATION_CREATED':
if (data.data?.delegation) {
setDelegationsMap(prev => ({
...prev,
[data.data.delegation.sessionId]: data.data.delegation
}));
}
if (typeof window !== 'undefined') {
window.dispatchEvent(new CustomEvent('delegations:created', { detail: data.data }));
}
break;
case 'AGENT_DELEGATION_UPDATED':
if (data.data?.delegation) {
setDelegationsMap(prev => ({
...prev,
[data.data.delegation.sessionId]: data.data.delegation
}));
}
if (typeof window !== 'undefined') {
window.dispatchEvent(new CustomEvent('delegations:updated', { detail: data.data }));
}
// Delegation events ignored (delegation system removed in rah-light)
break;
case 'WORKFLOW_PROGRESS':
+1 -2
View File
@@ -3,8 +3,7 @@
import { useState, useCallback, useEffect, useMemo } from 'react';
import RAHChat from '@/components/agents/RAHChat';
import PaneHeader from './PaneHeader';
import { WorkflowsPaneProps, PaneType } from './types';
import type { AgentDelegation } from '@/services/agents/delegation';
import { WorkflowsPaneProps, PaneType, AgentDelegation } from './types';
import { parseAndRenderContent } from '@/components/helpers/NodeLabelRenderer';
import type { ChatMessage } from '@/components/agents/hooks/useSSEChat';
+13 -1
View File
@@ -1,6 +1,18 @@
import React from 'react';
import { Node } from '@/types/database';
import type { AgentDelegation } from '@/services/agents/delegation';
// Stub type for delegation (delegation system removed in rah-light)
export type AgentDelegation = {
id: number;
sessionId: string;
task: string;
context: string[];
status: 'queued' | 'in_progress' | 'completed' | 'failed';
summary?: string | null;
agentType: string;
createdAt: string;
updatedAt: string;
};
// The six pane types
export type PaneType = 'node' | 'chat' | 'workflows' | 'dimensions' | 'map' | 'views';