/** * Forum Engine Agent * * Implements Sisyphus orchestration pattern for multi-agent collaboration * Coordinates specialized agents for structured discussions * * Skills: * - Multi-agent orchestration * - Discussion flow management * - Session management * - Message aggregation * - Todo tracking */ // Mock implementation of sisyphus_task for demonstration purposes // In real implementation, this would come from oh-my-opencode async function sisyphus_task(taskConfig: any): Promise { // Simulate delegating task to specialized agent console.log(`[SISYPHUS_TASK] Delegating to agent: ${taskConfig.agent}`); console.log(`[SISYPHUS_TASK] Prompt: ${taskConfig.prompt}`); console.log(`[SISYPHUS_TASK] Skills: ${taskConfig.skills.join(', ')}`); // Return mock results based on agent type switch(taskConfig.agent) { case 'forum-engine': if (taskConfig.prompt.includes('Start a')) { return { session: { id: `session-${Date.now()}`, flow_type: 'free_debate', participants: ['proponent', 'opponent', 'moderator'], phase: 1, messages: [], created_at: new Date(), updated_at: new Date(), completed: false } }; } break; default: return { result: 'mock_result' }; } } export interface ForumEngineOptions { agents?: string[]; flows?: string[]; } export interface DiscussionSession { id: string; flow_type: string; participants: string[]; phase: number; messages: ForumMessage[]; created_at: Date; updated_at: Date; completed?: boolean; } export interface ForumMessage { agent_name: string; content: string; timestamp: Date; } /** * Starts a multi-agent discussion using Sisyphus orchestration */ export async function startDiscussion( flowType: string, participants: string[], topic: string, options?: ForumEngineOptions ): Promise { // Delegate to specialized forum engine agent using Sisyphus pattern const result = await sisyphus_task({ agent: "forum-engine", prompt: `Start a ${flowType} discussion on topic: "${topic}" with participants: [${participants.join(', ')}]`, skills: ["forum-operations", "session-management", "message-aggregation"], run_in_background: false }); return result.session as DiscussionSession; } /** * Executes a discussion phase using Sisyphus orchestration */ export async function executePhase( sessionId: string, phaseNumber: number ): Promise { // Delegate to specialized forum engine agent using Sisyphus pattern const result = await sisyphus_task({ agent: "forum-engine", prompt: `Execute phase ${phaseNumber} for session: ${sessionId}`, skills: ["forum-operations", "phase-execution"], run_in_background: false }); return result; } /** * Adds a message to a discussion session */ export async function addMessage( sessionId: string, agentName: string, content: string ): Promise { // Delegate to specialized forum engine agent using Sisyphus pattern await sisyphus_task({ agent: "forum-engine", prompt: `Add message from ${agentName} to session ${sessionId}: "${content}"`, skills: ["message-aggregation"], run_in_background: false }); } /** * Gets all messages from a discussion session */ export async function getAllMessages(sessionId: string): Promise { // Delegate to specialized forum engine agent using Sisyphus pattern const result = await sisyphus_task({ agent: "forum-engine", prompt: `Get all messages for session: ${sessionId}`, skills: ["message-aggregation"], run_in_background: false }); return result.messages as ForumMessage[]; } /** * Completes a discussion session */ export async function completeSession(sessionId: string): Promise { // Delegate to specialized forum engine agent using Sisyphus pattern await sisyphus_task({ agent: "forum-engine", prompt: `Complete discussion session: ${sessionId}`, skills: ["session-management"], run_in_background: false }); }