← back to kkokio88-creator__Z-CMS

Function bodies 601 total

All specs Real LLM only Function bodies
getInventoryAtDate method · typescript · L420-L430 (11 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getInventoryAtDate(targetDate: string): Promise<InventoryRow[]> {
    const client = this.getClient();
    const { data, error } = await client.rpc('get_inventory_at_date', {
      p_date: targetDate,
    });
    if (error) {
      console.error(`[SupabaseAdapter] getInventoryAtDate(${targetDate}) 실패:`, error.message);
      return [];
    }
    return (data ?? []) as InventoryRow[];
  }
getInventory method · typescript · L432-L437 (6 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getInventory(): Promise<InventoryRow[]> {
    return this.fetchAllPaginated<InventoryRow>('inventory', {
      orderBy: 'product_name',
      ascending: true,
    });
  }
upsertUtilities method · typescript · L443-L456 (14 LOC)
server/src/adapters/SupabaseAdapter.ts
  async upsertUtilities(rows: UtilityRow[]): Promise<number> {
    if (rows.length === 0) return 0;
    const client = this.getClient();

    const { error } = await client
      .from('utilities')
      .upsert(
        rows.map(r => ({ ...r, synced_at: new Date().toISOString() })),
        { onConflict: 'date' }
      );

    if (error) throw new Error(`utilities upsert failed: ${error.message}`);
    return rows.length;
  }
getUtilities method · typescript · L458-L460 (3 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getUtilities(dateFrom?: string, dateTo?: string): Promise<UtilityRow[]> {
    return this.fetchAllPaginated<UtilityRow>('utilities', { dateFrom, dateTo });
  }
createSyncLog method · typescript · L466-L477 (12 LOC)
server/src/adapters/SupabaseAdapter.ts
  async createSyncLog(log: Omit<SyncLogRow, 'id'>): Promise<string> {
    const client = this.getClient();

    const { data, error } = await client
      .from('sync_log')
      .insert(log)
      .select('id')
      .single();

    if (error) throw new Error(`sync_log insert failed: ${error.message}`);
    return data.id;
  }
updateSyncLog method · typescript · L479-L487 (9 LOC)
server/src/adapters/SupabaseAdapter.ts
  async updateSyncLog(
    id: string,
    updates: Partial<Pick<SyncLogRow, 'status' | 'records_synced' | 'error_message' | 'completed_at' | 'content_hash' | 'tables_updated'>>
  ): Promise<void> {
    const client = this.getClient();

    const { error } = await client.from('sync_log').update(updates).eq('id', id);
    if (error) throw new Error(`sync_log update failed: ${error.message}`);
  }
getRecentSyncLogs method · typescript · L489-L500 (12 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getRecentSyncLogs(limit: number = 10): Promise<SyncLogRow[]> {
    const client = this.getClient();

    const { data, error } = await client
      .from('sync_log')
      .select('*')
      .order('started_at', { ascending: false })
      .limit(limit);

    if (error) throw new Error(`sync_log query failed: ${error.message}`);
    return data || [];
  }
Repobility · MCP-ready · https://repobility.com
getLastSyncTime method · typescript · L502-L516 (15 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getLastSyncTime(source: string): Promise<string | null> {
    const client = this.getClient();

    const { data, error } = await client
      .from('sync_log')
      .select('completed_at')
      .eq('source', source)
      .eq('status', 'success')
      .order('completed_at', { ascending: false })
      .limit(1)
      .single();

    if (error || !data) return null;
    return data.completed_at;
  }
getLastContentHash method · typescript · L519-L538 (20 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getLastContentHash(source: string): Promise<Record<string, string> | null> {
    const client = this.getClient();

    const { data, error } = await client
      .from('sync_log')
      .select('content_hash')
      .eq('source', source)
      .eq('status', 'success')
      .not('content_hash', 'is', null)
      .order('completed_at', { ascending: false })
      .limit(1)
      .single();

    if (error || !data?.content_hash) return null;
    try {
      return JSON.parse(data.content_hash);
    } catch {
      return null;
    }
  }
upsertLaborDaily method · typescript · L544-L557 (14 LOC)
server/src/adapters/SupabaseAdapter.ts
  async upsertLaborDaily(rows: LaborDailyRow[]): Promise<number> {
    if (rows.length === 0) return 0;
    const client = this.getClient();

    const { error } = await client
      .from('labor_daily')
      .upsert(
        rows.map(r => ({ ...r, synced_at: new Date().toISOString() })),
        { onConflict: 'date,department' }
      );

    if (error) throw new Error(`labor_daily upsert failed: ${error.message}`);
    return rows.length;
  }
getLaborDaily method · typescript · L559-L561 (3 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getLaborDaily(dateFrom?: string, dateTo?: string): Promise<LaborDailyRow[]> {
    return this.fetchAllPaginated<LaborDailyRow>('labor_daily', { dateFrom, dateTo });
  }
upsertBom method · typescript · L567-L587 (21 LOC)
server/src/adapters/SupabaseAdapter.ts
  async upsertBom(rows: BomRow[]): Promise<number> {
    if (rows.length === 0) return 0;
    const client = this.getClient();

    // BOM 데이터가 많을 수 있으므로 배치 처리
    const batchSize = 500;
    for (let i = 0; i < rows.length; i += batchSize) {
      const batch = rows.slice(i, i + batchSize).map(r => ({
        ...r,
        synced_at: new Date().toISOString(),
      }));

      const { error } = await client
        .from('bom')
        .upsert(batch, { onConflict: 'source,product_code,material_code' });

      if (error) throw new Error(`bom upsert failed: ${error.message}`);
    }

    return rows.length;
  }
getBom method · typescript · L589-L614 (26 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getBom(source?: string): Promise<BomRow[]> {
    const client = this.getClient();
    const pageSize = 1000;
    const allData: BomRow[] = [];
    let from = 0;

    while (true) {
      let query = client
        .from('bom')
        .select('*')
        .order('product_code', { ascending: true })
        .range(from, from + pageSize - 1);

      if (source) query = query.eq('source', source);

      const { data, error } = await query;
      if (error) throw new Error(`bom query failed: ${error.message}`);
      if (!data || data.length === 0) break;

      allData.push(...data);
      if (data.length < pageSize) break;
      from += pageSize;
    }

    return allData;
  }
upsertMaterialMaster method · typescript · L620-L633 (14 LOC)
server/src/adapters/SupabaseAdapter.ts
  async upsertMaterialMaster(rows: MaterialMasterRow[]): Promise<number> {
    if (rows.length === 0) return 0;
    const client = this.getClient();

    const { error } = await client
      .from('material_master')
      .upsert(
        rows.map(r => ({ ...r, synced_at: new Date().toISOString() })),
        { onConflict: 'material_code' }
      );

    if (error) throw new Error(`material_master upsert failed: ${error.message}`);
    return rows.length;
  }
getMaterialMaster method · typescript · L635-L640 (6 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getMaterialMaster(): Promise<MaterialMasterRow[]> {
    return this.fetchAllPaginated<MaterialMasterRow>('material_master', {
      orderBy: 'no',
      ascending: true,
    });
  }
Powered by Repobility — scan your code at https://repobility.com
batchUpsert method · typescript · L654-L661 (8 LOC)
server/src/adapters/SupabaseAdapter.ts
  async batchUpsert(operations: {
    dailySales?: DailySalesRow[];
    salesDetail?: SalesDetailRow[];
    production?: ProductionDailyRow[];
    purchases?: PurchaseRow[];
    utilities?: UtilityRow[];
    inventory?: InventoryRow[];
  }, stopOnError = false): Promise<{ success: boolean; records: Record<string, number>; errors: string[] }> {
saveAgentState method · typescript · L700-L713 (14 LOC)
server/src/adapters/SupabaseAdapter.ts
  async saveAgentState(agentId: string, state: Record<string, any>): Promise<void> {
    const client = this.getClient();
    const { error } = await client
      .from('agent_state')
      .upsert({
        agent_id: agentId,
        state,
        updated_at: new Date().toISOString(),
      }, { onConflict: 'agent_id' });

    if (error) {
      console.error(`[SupabaseAdapter] 에이전트 상태 저장 실패 (${agentId}):`, error.message);
    }
  }
loadAgentState method · typescript · L715-L725 (11 LOC)
server/src/adapters/SupabaseAdapter.ts
  async loadAgentState(agentId: string): Promise<Record<string, any> | null> {
    const client = this.getClient();
    const { data, error } = await client
      .from('agent_state')
      .select('state')
      .eq('agent_id', agentId)
      .single();

    if (error || !data) return null;
    return data.state;
  }
getTableCounts method · typescript · L730-L741 (12 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getTableCounts(): Promise<Record<string, number>> {
    const client = this.getClient();
    const tables = ['daily_sales', 'sales_detail', 'production_daily', 'purchases', 'inventory', 'utilities', 'labor_daily', 'bom', 'material_master'];
    const counts: Record<string, number> = {};

    await Promise.all(tables.map(async (table) => {
      const { count, error } = await client.from(table).select('*', { count: 'exact', head: true });
      counts[table] = error ? -1 : (count ?? 0);
    }));

    return counts;
  }
validateSalesDetail method · typescript · L746-L751 (6 LOC)
server/src/adapters/SupabaseAdapter.ts
  async validateSalesDetail(): Promise<{
    totalRows: number;
    zeroRecommended: number;
    negativeSupply: number;
    mismatchRows: number;
  }> {
validateDailySalesChannels method · typescript · L789-L792 (4 LOC)
server/src/adapters/SupabaseAdapter.ts
  async validateDailySalesChannels(): Promise<{
    totalRows: number;
    mismatchRows: { date: string; channelSum: number; totalRevenue: number; diff: number }[];
  }> {
upsertDebate method · typescript · L820-L830 (11 LOC)
server/src/adapters/SupabaseAdapter.ts
  async upsertDebate(row: import('../utils/debateSerializer.js').DebateRow): Promise<void> {
    const client = this.getClient();
    const { error } = await client
      .from('debates')
      .upsert({
        ...row,
        updated_at: new Date().toISOString(),
      }, { onConflict: 'id' });

    if (error) throw new Error(`debates upsert failed: ${error.message}`);
  }
getDebate method · typescript · L832-L842 (11 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getDebate(id: string): Promise<import('../utils/debateSerializer.js').DebateRow | null> {
    const client = this.getClient();
    const { data, error } = await client
      .from('debates')
      .select('*')
      .eq('id', id)
      .single();

    if (error || !data) return null;
    return data as import('../utils/debateSerializer.js').DebateRow;
  }
Source: Repobility analyzer · https://repobility.com
getActiveDebates method · typescript · L844-L854 (11 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getActiveDebates(): Promise<import('../utils/debateSerializer.js').DebateRow[]> {
    const client = this.getClient();
    const { data, error } = await client
      .from('debates')
      .select('*')
      .neq('current_phase', 'complete')
      .order('started_at', { ascending: false });

    if (error || !data) return [];
    return data as import('../utils/debateSerializer.js').DebateRow[];
  }
getDebateHistory method · typescript · L856-L867 (12 LOC)
server/src/adapters/SupabaseAdapter.ts
  async getDebateHistory(limit = 100): Promise<import('../utils/debateSerializer.js').DebateRow[]> {
    const client = this.getClient();
    const { data, error } = await client
      .from('debates')
      .select('*')
      .eq('current_phase', 'complete')
      .order('completed_at', { ascending: false })
      .limit(limit);

    if (error || !data) return [];
    return data as import('../utils/debateSerializer.js').DebateRow[];
  }
Agent class · typescript · L18-L229 (212 LOC)
server/src/agents/base/Agent.ts
export abstract class Agent {
  protected id: AgentId;
  protected status: AgentStatus = 'idle';
  protected eventBus: EventBus;
  protected stateManager: StateManager;
  protected learningRegistry: LearningRegistry;
  protected processedTasks = 0;
  protected successfulTasks = 0;
  protected totalProcessingTime = 0;
  protected currentTask?: Task;
  protected unsubscribe?: () => void;

  constructor(
    id: AgentId,
    eventBus: EventBus,
    stateManager: StateManager,
    learningRegistry: LearningRegistry
  ) {
    this.id = id;
    this.eventBus = eventBus;
    this.stateManager = stateManager;
    this.learningRegistry = learningRegistry;
  }

  /**
   * Start the agent and subscribe to events
   */
  start(): void {
    this.status = 'idle';
    this.unsubscribe = this.eventBus.subscribeAgent(this.id, this.handleMessage.bind(this));
    console.log(`Agent ${this.id} started`);
  }

  /**
   * Stop the agent
   */
  stop(): void {
    this.status = 'stopped';
    if (this.unsub
constructor method · typescript · L30-L40 (11 LOC)
server/src/agents/base/Agent.ts
  constructor(
    id: AgentId,
    eventBus: EventBus,
    stateManager: StateManager,
    learningRegistry: LearningRegistry
  ) {
    this.id = id;
    this.eventBus = eventBus;
    this.stateManager = stateManager;
    this.learningRegistry = learningRegistry;
  }
start method · typescript · L45-L49 (5 LOC)
server/src/agents/base/Agent.ts
  start(): void {
    this.status = 'idle';
    this.unsubscribe = this.eventBus.subscribeAgent(this.id, this.handleMessage.bind(this));
    console.log(`Agent ${this.id} started`);
  }
stop method · typescript · L54-L60 (7 LOC)
server/src/agents/base/Agent.ts
  stop(): void {
    this.status = 'stopped';
    if (this.unsubscribe) {
      this.unsubscribe();
    }
    console.log(`Agent ${this.id} stopped`);
  }
getStatus method · typescript · L65-L79 (15 LOC)
server/src/agents/base/Agent.ts
  getStatus(): AgentState {
    return {
      id: this.id,
      status: this.status,
      lastActivity: new Date(),
      processedTasks: this.processedTasks,
      successRate:
        this.processedTasks > 0
          ? Math.round((this.successfulTasks / this.processedTasks) * 100)
          : 100,
      avgProcessingTime:
        this.processedTasks > 0 ? Math.round(this.totalProcessingTime / this.processedTasks) : 0,
      currentTask: this.currentTask,
    };
  }
handleMessage method · typescript · L84-L102 (19 LOC)
server/src/agents/base/Agent.ts
  protected async handleMessage(message: AgentMessage): Promise<void> {
    switch (message.type) {
      case 'TASK_ASSIGNMENT':
        await this.handleTaskAssignment(message);
        break;
      case 'COACHING_FEEDBACK':
        await this.handleCoaching(message as CoachingMessage);
        break;
      case 'INSIGHT_SHARE':
        await this.handleInsightShare(message);
        break;
      case 'DATA_REQUEST':
        await this.handleDataRequest(message);
        break;
      default:
        // Ignore other message types
        break;
    }
  }
Want this analysis on your repo? https://repobility.com/scan/
handleTaskAssignment method · typescript · L107-L141 (35 LOC)
server/src/agents/base/Agent.ts
  protected async handleTaskAssignment(message: AgentMessage): Promise<void> {
    const task = message.payload as Task;
    this.currentTask = task;
    this.status = 'processing';
    const startTime = Date.now();

    try {
      const result = await this.process(task);
      this.processedTasks++;
      this.totalProcessingTime += Date.now() - startTime;

      if (result.success) {
        this.successfulTasks++;
      }

      // Send result back to coordinator
      const sender = this.eventBus.createSender(this.id);
      sender.reply(message, 'TASK_RESULT', result);
    } catch (error) {
      console.error(`Agent ${this.id} task error:`, error);
      this.status = 'error';

      const sender = this.eventBus.createSender(this.id);
      sender.reply(message, 'TASK_RESULT', {
        taskId: task.id,
        agentId: this.id,
        success: false,
        error: error instanceof Error ? error.message : 'Unknown error',
        processingTime: Date.now() - startTime,
      }
handleCoaching method · typescript · L146-L152 (7 LOC)
server/src/agents/base/Agent.ts
  protected async handleCoaching(message: CoachingMessage): Promise<void> {
    const { feedback } = message.payload;
    console.log(`Agent ${this.id} received coaching:`, feedback.suggestion);

    // Record that coaching was applied
    await this.applyCoaching(feedback);
  }
handleInsightShare method · typescript · L157-L159 (3 LOC)
server/src/agents/base/Agent.ts
  protected async handleInsightShare(message: AgentMessage): Promise<void> {
    // Default: do nothing. Override in subclasses if needed.
  }
handleDataRequest method · typescript · L164-L166 (3 LOC)
server/src/agents/base/Agent.ts
  protected async handleDataRequest(message: AgentMessage): Promise<void> {
    // Default: do nothing. Override in subclasses if needed.
  }
publishInsight method · typescript · L171-L213 (43 LOC)
server/src/agents/base/Agent.ts
  protected publishInsight(
    domain: InsightDomain,
    title: string,
    description: string,
    options: {
      highlight?: string;
      level?: InsightLevel;
      confidence?: number;
      data?: unknown;
      actionable?: boolean;
      suggestedActions?: string[];
    } = {}
  ): AgentInsight {
    const insight: AgentInsight = {
      id: uuidv4(),
      agentId: this.id,
      domain,
      timestamp: new Date(),
      title,
      description,
      highlight: options.highlight,
      level: options.level || 'info',
      confidence: options.confidence || 0.8,
      data: options.data,
      actionable: options.actionable ?? true,
      suggestedActions: options.suggestedActions,
    };

    // Add to state manager
    this.stateManager.addInsight(insight);

    // Record for learning
    this.learningRegistry.recordOutput(this.id, insight.id, {
      type: 'reasoning',
      content: { title, description },
    });

    // Broadcast to other agents and frontend
    c
constructor method · typescript · L48-L59 (12 LOC)
server/src/agents/base/TrioPersona.ts
  constructor(
    id: AgentId,
    config: TrioPersonaConfig,
    eventBus: EventBus,
    stateManager: StateManager,
    learningRegistry: LearningRegistry
  ) {
    super(id, eventBus, stateManager, learningRegistry);
    this.role = config.role;
    this.team = config.team;
    this.domain = config.domain;
  }
injectDependencies method · typescript · L64-L67 (4 LOC)
server/src/agents/base/TrioPersona.ts
  injectDependencies(debateManager: DebateManager, geminiAdapter: GeminiAdapter): void {
    this.debateManager = debateManager;
    this.geminiAdapter = geminiAdapter;
  }
handleMessage method · typescript · L72-L89 (18 LOC)
server/src/agents/base/TrioPersona.ts
  protected async handleMessage(message: AgentMessage): Promise<void> {
    switch (message.type) {
      case 'DEBATE_START':
        await this.handleDebateStart(message);
        break;
      case 'DEBATE_THESIS':
        await this.handleDebateThesis(message);
        break;
      case 'DEBATE_ANTITHESIS':
        await this.handleDebateAntithesis(message);
        break;
      case 'DEBATE_SYNTHESIS':
        await this.handleDebateSynthesis(message);
        break;
      default:
        await super.handleMessage(message);
    }
  }
Repobility · MCP-ready · https://repobility.com
handleDebateStart method · typescript · L94-L154 (61 LOC)
server/src/agents/base/TrioPersona.ts
  protected async handleDebateStart(message: AgentMessage): Promise<void> {
    if (this.role !== 'optimist') return;

    const payload = message.payload as {
      debateId: string;
      topic: string;
      contextData: unknown;
    };

    this.currentDebateId = payload.debateId;
    this.status = 'processing';
    const startTime = Date.now();

    try {
      const catsCommand = this.createCATSCommand(
        `${payload.topic}에 대한 가능성과 기회를 분석하세요.`,
        payload
      );

      const position = await this.generatePosition(payload.topic, payload.contextData, catsCommand);

      const round: DebateRound = {
        id: uuidv4(),
        debateId: payload.debateId,
        phase: 'thesis',
        role: 'optimist',
        agentId: this.id,
        content: position,
        timestamp: new Date(),
        catsCommand,
      };

      // 토론 매니저에 라운드 기록
      if (this.debateManager) {
        await this.debateManager.recordRound(payload.debateId, round);
      }

      // Pessimi
handleDebateThesis method · typescript · L159-L226 (68 LOC)
server/src/agents/base/TrioPersona.ts
  protected async handleDebateThesis(message: AgentMessage): Promise<void> {
    if (this.role !== 'pessimist') return;

    const payload = message.payload as {
      debateId: string;
      thesis: DebateRound;
      contextData: unknown;
    };

    this.currentDebateId = payload.debateId;
    this.status = 'processing';
    const startTime = Date.now();

    try {
      const catsCommand = this.createCATSCommand(
        `낙관론(${payload.thesis.content.position})에 대한 리스크와 제약을 분석하세요.`,
        payload
      );

      const position = await this.generatePosition(
        payload.thesis.content.position,
        payload.contextData,
        catsCommand,
        [payload.thesis]
      );

      const round: DebateRound = {
        id: uuidv4(),
        debateId: payload.debateId,
        phase: 'antithesis',
        role: 'pessimist',
        agentId: this.id,
        content: position,
        timestamp: new Date(),
        catsCommand,
        respondsTo: [payload.thesis.id],
      };
handleDebateAntithesis method · typescript · L231-L299 (69 LOC)
server/src/agents/base/TrioPersona.ts
  protected async handleDebateAntithesis(message: AgentMessage): Promise<void> {
    if (this.role !== 'mediator') return;

    const payload = message.payload as {
      debateId: string;
      thesis: DebateRound;
      antithesis: DebateRound;
      contextData: unknown;
    };

    this.currentDebateId = payload.debateId;
    this.status = 'processing';
    const startTime = Date.now();

    try {
      const catsCommand = this.createCATSCommand(
        `낙관론과 비관론을 종합하여 균형 잡힌 결론을 도출하세요.`,
        payload
      );

      const position = await this.generatePosition(
        `${payload.thesis.content.position} vs ${payload.antithesis.content.position}`,
        payload.contextData,
        catsCommand,
        [payload.thesis, payload.antithesis]
      );

      const round: DebateRound = {
        id: uuidv4(),
        debateId: payload.debateId,
        phase: 'synthesis',
        role: 'mediator',
        agentId: this.id,
        content: position,
        timestamp: new Date(),
handleDebateSynthesis method · typescript · L304-L306 (3 LOC)
server/src/agents/base/TrioPersona.ts
  protected async handleDebateSynthesis(message: AgentMessage): Promise<void> {
    // 기본 구현: 아무것도 하지 않음
  }
createCATSCommand method · typescript · L311-L324 (14 LOC)
server/src/agents/base/TrioPersona.ts
  protected createCATSCommand(task: string, payload: { contextData?: unknown }): CATSCommand {
    const roleDescriptions: Record<TrioRole, string> = {
      optimist: '가능성, 확장성, 창의적 대안 제시',
      pessimist: '제약 조건, 리스크, 잠재적 실패 요인 분석',
      mediator: '두 관점을 통합하여 실행 가능한 결론 도출',
    };

    return {
      context: JSON.stringify(payload.contextData || {}).slice(0, 1000),
      agentRole: this.role,
      task: `[${this.team}] ${roleDescriptions[this.role]}. ${task}`,
      successCriteria: this.getSuccessCriteria(),
    };
  }
getSuccessCriteria method · typescript · L329-L339 (11 LOC)
server/src/agents/base/TrioPersona.ts
  protected getSuccessCriteria(): string {
    const criteria: Record<TrioRole, string> = {
      optimist:
        'position(주장), reasoning(추론), evidence(근거 배열), confidence(0-100)를 JSON으로 반환',
      pessimist:
        'position(반론), reasoning(리스크 분석), evidence(위험 요소 배열), confidence(0-100)를 JSON으로 반환',
      mediator:
        'position(종합), reasoning(균형 분석), suggestedActions(권고 조치 배열), confidence(0-100)를 JSON으로 반환',
    };
    return criteria[this.role];
  }
process method · typescript · L354-L363 (10 LOC)
server/src/agents/base/TrioPersona.ts
  async process(task: Task): Promise<TaskResult> {
    // 토론 외 일반 태스크 처리
    return {
      taskId: task.id,
      agentId: this.id,
      success: true,
      output: { message: `${this.role} persona processed task` },
      processingTime: 0,
    };
  }
getCapabilities method · typescript · L368-L382 (15 LOC)
server/src/agents/base/TrioPersona.ts
  getCapabilities(): string[] {
    const baseCapabilities = [
      'dialectical_debate',
      'cats_command_execution',
      `${this.role}_perspective`,
    ];

    const roleCapabilities: Record<TrioRole, string[]> = {
      optimist: ['opportunity_analysis', 'growth_projection', 'innovation_proposal'],
      pessimist: ['risk_assessment', 'constraint_analysis', 'failure_mode_detection'],
      mediator: ['synthesis_generation', 'consensus_building', 'action_planning'],
    };

    return [...baseCapabilities, ...roleCapabilities[this.role]];
  }
Powered by Repobility — scan your code at https://repobility.com
applyCoaching method · typescript · L387-L420 (34 LOC)
server/src/agents/base/TrioPersona.ts
  protected async applyCoaching(feedback: CoachingMessage['payload']['feedback']): Promise<void> {
    console.log(`[${this.id}] 코칭 적용: ${feedback.suggestion}`);

    switch (feedback.metric) {
      case 'accuracy':
        // 정확도 개선을 위한 신뢰도 조정
        if (feedback.score < feedback.benchmark) {
          this.confidenceAdjustment -= 5;
        } else {
          this.confidenceAdjustment += 2;
        }
        break;

      case 'latency':
        // 응답 속도 개선을 위한 상세도 조정
        if (feedback.score > feedback.benchmark) {
          this.verbosityLevel = 'concise';
        }
        break;

      case 'user_acceptance':
        // 사용자 수용도 개선
        if (feedback.score < feedback.benchmark) {
          this.verbosityLevel = 'detailed';
        }
        break;
    }

    // 학습 레지스트리에 기록
    this.learningRegistry.recordCoaching(this.id, '', [
      `confidenceAdjustment: ${this.confidenceAdjustment}`,
      `verbosityLevel: ${this.verbosityLevel}`,
    ]);
  }
getRoleInfo method · typescript · L425-L429 (5 LOC)
server/src/agents/base/TrioPersona.ts
  getRoleInfo(): {
    role: TrioRole;
    team: DomainTeam;
    domain: InsightDomain;
  } {
getAdjustedConfidence method · typescript · L440-L443 (4 LOC)
server/src/agents/base/TrioPersona.ts
  protected getAdjustedConfidence(baseConfidence: number): number {
    const adjusted = baseConfidence + this.confidenceAdjustment;
    return Math.max(0, Math.min(100, adjusted));
  }
‹ prevpage 3 / 13next ›