← back to Dw Boardroom V2

src/agents/president.ts

59 lines

// ═══════════════════════════════════════════════
// DW Boardroom V2 — President / Chair Agent
// Validates agenda, enforces rules, opens/closes
// ═══════════════════════════════════════════════

import type { AgendaItem, MeetingType } from '../types';

const MAX_AGENDA_ITEMS = 5;

export function validateAgenda(items: Partial<AgendaItem>[]): { valid: boolean; errors: string[] } {
  const errors: string[] = [];

  if (items.length > MAX_AGENDA_ITEMS) {
    errors.push(`Maximum ${MAX_AGENDA_ITEMS} agenda items allowed (got ${items.length})`);
  }

  for (let i = 0; i < items.length; i++) {
    const item = items[i];
    if (!item.topic || item.topic.trim().length === 0) {
      errors.push(`Item ${i + 1}: Topic is required`);
    }
    if (item.decision_type && !['A', 'B', 'C'].includes(item.decision_type)) {
      errors.push(`Item ${i + 1}: Invalid decision type (must be A, B, or C)`);
    }
  }

  return { valid: errors.length === 0, errors };
}

export function generateOpeningStatement(meetingType: MeetingType, agendaCount: number): string {
  const typeLabels: Record<MeetingType, string> = {
    strategic: 'Strategic Planning Session',
    initiative: 'Initiative Review',
    ops: 'Operations Sync',
    emergency: 'Emergency Session',
  };

  const label = typeLabels[meetingType] || 'General Meeting';
  return `This ${label} is now called to order by President Lincoln. We have ${agendaCount} agenda item${agendaCount !== 1 ? 's' : ''} to address. Let us proceed with focus and efficiency.`;
}

export function generateClosingStatement(meetingType: MeetingType, decisionsCount: number): string {
  return `This ${meetingType} session stands adjourned by order of President Lincoln. ${decisionsCount} decision${decisionsCount !== 1 ? 's' : ''} were addressed. Action items will be tracked through governance. You are all dismissed.`;
}

export function getPhaseChairMessage(phase: string): string {
  const messages: Record<string, string> = {
    caucus: 'Members, prepare your remarks. President Lincoln will convene us shortly.',
    call_to_order: 'President Lincoln calls this meeting to order. Roll call proceeding.',
    old_business: 'President Lincoln directs we review outstanding items from previous sessions.',
    current_business: 'Moving to current business. Presenters, you have the floor. Address the President directly.',
    new_business: 'The floor is now open for new business items. Present to the President.',
    breakout: 'President Lincoln grants departments leave for brief breakout discussions.',
    minutes: 'The note taker will now summarize our proceedings for the President.',
    adjournment: 'With all business concluded, President Lincoln adjourns this session.',
  };
  return messages[phase] || 'Proceeding to the next phase.';
}