UNPKG

@gork-labs/secondbrain-mcp

Version:

Second Brain MCP Server - Agent team orchestration with dynamic tool discovery

61 lines (60 loc) 1.73 kB
import { ChatmodeDefinition, SubAgentResponse } from '../utils/types.js'; import { AIClient } from '../ai/client.js'; import { ContextManager } from './context-manager.js'; export interface SpawnAgentRequest { subagentName: string; task: string; context: string; expectedDeliverables: string; urgency: 'low' | 'medium' | 'high' | 'critical'; budget?: number; timeout?: number; } export interface SpawnAgentResult { response: SubAgentResponse; metadata: { tokensUsed: number; timeElapsed: number; cost: number; model: string; quality: number; }; } export declare class AgentSpawner { private readonly aiClient; private readonly contextManager; private readonly chatmodes; constructor(aiClient: AIClient, contextManager: ContextManager, chatmodes: Map<string, ChatmodeDefinition>); /** * Spawn a sub-agent to complete a specific task */ spawnAgent(request: SpawnAgentRequest): Promise<SpawnAgentResult>; /** * Build messages for the specific agent type */ private buildAgentMessages; /** * Request format correction from AI when JSON parsing fails */ private requestFormatCorrection; /** * Calculate quality score based on response characteristics */ private calculateQualityScore; /** * Get default timeout based on urgency */ private getDefaultTimeout; /** * Get context requirements based on urgency and budget */ private getContextRequirements; /** * Calculate cost based on tokens and model */ private calculateCost; /** * Execute function with timeout */ private executeWithTimeout; }