/** * Resource monitoring and limits configuration. */ export type ResourceLimit = { /** Maximum CPU usage percentage (0-1000, where 1000 = 10 cores at 100%) */ maxCpuPercent?: number; /** Maximum memory RSS in megabytes */ maxMemoryRssMb?: number; /** Maximum heap memory in megabytes */ maxMemoryHeapMb?: number; /** Maximum disk usage percentage for monitored paths */ maxDiskUsagePercent?: number; /** Maximum number of open file descriptors */ maxFileDescriptors?: number; /** Maximum total sessions (active + idle) */ maxSessions?: number; /** Maximum concurrent agents */ maxConcurrentAgents?: number; /** Maximum concurrent subagents per agent */ maxConcurrentSubagents?: number; /** Maximum total size of session data in bytes */ maxSessionDataBytes?: number; }; export type ResourceThreshold = { /** Resource metric name (e.g., 'memory.rss', 'cpu.usage', 'disk.usage') */ metric: string; /** Warning threshold (percentage of limit, 0-100) */ warning: number; /** Critical threshold (percentage of limit, 0-100) */ critical: number; /** Degradation action to take when critical threshold is exceeded */ degradationAction?: "warn" | "pause_non_critical" | "reject_new" | "shutdown"; }; export type ResourceMonitoringConfig = { /** Enable resource monitoring */ enabled?: boolean; /** Collection interval in milliseconds */ collectionIntervalMs?: number; /** Paths to monitor disk usage for (default: config dir, sessions dir, temp dir) */ diskPaths?: string[]; /** Global resource limits */ limits?: ResourceLimit; /** Thresholds for proactive alerting and degradation */ thresholds?: ResourceThreshold[]; /** Enable metrics export to existing metrics pipeline */ metricsExport?: boolean; /** Enable logging of resource events */ logging?: boolean; };