← back to Daily Reporting

agent-hierarchy.ts

334 lines

/**
 * DW-Agents Organizational Hierarchy
 *
 * This defines the reporting structure for all agents in the system
 */

export interface Agent {
  id: string;
  name: string;
  port: number;
  url: string;
  role: string;
  department: string;
  level: 'executive' | 'department_head' | 'support' | 'operations';
  reportsTo?: string;
  metrics: string[];
  icon: string;
  color: string;
}

export const AGENT_HIERARCHY: Agent[] = [
  // EXECUTIVE LEVEL - President
  {
    id: 'master-hub',
    name: 'Master Hub (President)',
    port: 9893,
    url: 'http://45.61.58.125:9893',
    role: 'Central Command & Coordination',
    department: 'Executive',
    level: 'executive',
    metrics: [
      'Total agents online',
      'System health score',
      'Critical alerts',
      'Daily task completion rate'
    ],
    icon: '👔',
    color: '#1a1a2e'
  },

  // DEPARTMENT HEADS
  {
    id: 'legal',
    name: 'Legal Team',
    port: 9878,
    url: 'http://45.61.58.125:9878',
    role: 'Legal Compliance & Risk Management',
    department: 'Legal',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'Settlement compliance checks',
      'Contract reviews completed',
      'Legal issues flagged',
      'Compliance score'
    ],
    icon: '⚖️',
    color: '#dc143c'
  },
  {
    id: 'accounting',
    name: 'Accounting',
    port: 9882,
    url: 'http://45.61.58.125:9882',
    role: 'Financial Management & Reporting',
    department: 'Finance',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'Daily revenue',
      'Expenses tracked',
      'P&L accuracy',
      'Budget variance',
      'Outstanding invoices'
    ],
    icon: '💰',
    color: '#43e97b'
  },
  {
    id: 'marketing',
    name: 'Marketing',
    port: 9881,
    url: 'http://45.61.58.125:9881',
    role: 'Marketing Campaigns & Content',
    department: 'Marketing',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'Blog posts published',
      'Social media engagement',
      'Email campaigns sent',
      'Lead generation',
      'Campaign ROI'
    ],
    icon: '📢',
    color: '#f093fb'
  },
  {
    id: 'purchasing',
    name: 'Purchasing Office',
    port: 9880,
    url: 'http://45.61.58.125:9880',
    role: 'Procurement & Vendor Management',
    department: 'Operations',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'Orders placed',
      'Cost savings identified',
      'Vendor response time',
      'Inventory alerts',
      'Price comparisons run'
    ],
    icon: '🛒',
    color: '#667eea'
  },
  {
    id: 'digital-samples',
    name: 'Digital Samples',
    port: 9879,
    url: 'http://45.61.58.125:9879',
    role: 'Sample Processing & Delivery',
    department: 'Operations',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'DIG-series orders processed',
      'Files delivered',
      'Processing time avg',
      'Customer satisfaction',
      'Pending requests'
    ],
    icon: '📦',
    color: '#4facfe'
  },
  {
    id: 'trend-research',
    name: 'Trend Research',
    port: 9883,
    url: 'http://45.61.58.125:9883',
    role: 'Market Intelligence & Analysis',
    department: 'Strategy',
    level: 'department_head',
    reportsTo: 'master-hub',
    metrics: [
      'Trends identified',
      'Market reports generated',
      'Competitor analysis',
      'Forecast accuracy'
    ],
    icon: '📊',
    color: '#38b2ac'
  },

  // SUPPORT SERVICES
  {
    id: 'zendesk-chat',
    name: 'Zendesk Chat',
    port: 9884,
    url: 'http://45.61.58.125:9884',
    role: 'Customer Support & Chat',
    department: 'Customer Service',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'Tickets handled',
      'Response time avg',
      'Customer satisfaction',
      'Open tickets',
      'Chat sessions'
    ],
    icon: '💬',
    color: '#17a2b8'
  },
  {
    id: 'shopify-store',
    name: 'Shopify Store Manager',
    port: 7238,
    url: 'http://45.61.58.125:7238',
    role: 'E-commerce Operations',
    department: 'Sales',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'Orders processed',
      'Inventory sync status',
      'Product updates',
      'Store health score'
    ],
    icon: '🛍️',
    color: '#96bf48'
  },
  {
    id: 'server-uptime',
    name: 'Server Uptime Monitor',
    port: 7242,
    url: 'http://45.61.58.125:7242',
    role: 'Infrastructure Monitoring',
    department: 'IT Operations',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'Server uptime %',
      'Response times',
      'Resource usage',
      'Incidents detected'
    ],
    icon: '🖥️',
    color: '#6c757d'
  },
  {
    id: 'log-monitor',
    name: 'Log Monitor',
    port: 7239,
    url: 'http://45.61.58.125:7239',
    role: 'Error Detection & Analysis',
    department: 'IT Operations',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'Errors detected',
      'Critical issues',
      'Auto-resolved',
      'Logs analyzed'
    ],
    icon: '📝',
    color: '#fd7e14'
  },
  {
    id: 'ui-manager',
    name: 'UI Manager',
    port: 7240,
    url: 'http://45.61.58.125:7240',
    role: 'Design System & UX',
    department: 'Product',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'UI consistency score',
      'Theme updates',
      'User feedback',
      'Accessibility score'
    ],
    icon: '🎨',
    color: '#e83e8c'
  },
  {
    id: 'restart-analyzer',
    name: 'Restart Analyzer',
    port: 7241,
    url: 'http://45.61.58.125:7241',
    role: 'System Health & Pattern Analysis',
    department: 'IT Operations',
    level: 'support',
    reportsTo: 'master-hub',
    metrics: [
      'Restart patterns detected',
      'Agent health scores',
      'Stability metrics',
      'Recommendations'
    ],
    icon: '🔄',
    color: '#20c997'
  },

  // OPERATIONS & ORCHESTRATION
  {
    id: 'task-orchestrator',
    name: 'Task Orchestrator',
    port: 9900,
    url: 'http://45.61.58.125:9900',
    role: 'Task Routing & Coordination',
    department: 'Operations',
    level: 'operations',
    reportsTo: 'master-hub',
    metrics: [
      'Tasks routed',
      'Completion rate',
      'Agent utilization',
      'Queue depth'
    ],
    icon: '🎯',
    color: '#6610f2'
  },
  {
    id: 'needs-attention',
    name: 'Needs Attention',
    port: 7243,
    url: 'http://45.61.58.125:7243',
    role: 'Issue Detection & Escalation',
    department: 'Operations',
    level: 'operations',
    reportsTo: 'master-hub',
    metrics: [
      'Issues flagged',
      'Escalations',
      'Resolution time',
      'Priority distribution'
    ],
    icon: '⚠️',
    color: '#ffc107'
  }
];

/**
 * Get agents by department
 */
export function getAgentsByDepartment(): Map<string, Agent[]> {
  const departments = new Map<string, Agent[]>();

  AGENT_HIERARCHY.forEach(agent => {
    if (!departments.has(agent.department)) {
      departments.set(agent.department, []);
    }
    departments.get(agent.department)!.push(agent);
  });

  return departments;
}

/**
 * Get agents by reporting level
 */
export function getAgentsByLevel(level: Agent['level']): Agent[] {
  return AGENT_HIERARCHY.filter(agent => agent.level === level);
}

/**
 * Get direct reports for an agent
 */
export function getDirectReports(agentId: string): Agent[] {
  return AGENT_HIERARCHY.filter(agent => agent.reportsTo === agentId);
}