UNPKG

claritykit-svelte

Version:

A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility

442 lines 11.8 kB
import type { HTMLAttributes } from 'svelte/elements'; export type ProcessStatus = 'deploying' | 'active' | 'stopping' | 'failed' | 'terminated'; export interface AgentProcess { id: string; serviceName: string; status: ProcessStatus; processId?: number; port: number; poolId?: string; createdAt: Date; startedAt?: Date; stoppedAt?: Date; lastHealthCheck?: Date; resourceUsage: { cpu: number; memory: number; storage: number; }; resourceLimits?: { cpu: number; memory: number; storage: number; }; healthStatus: 'healthy' | 'warning' | 'critical' | 'unknown'; uptime: number; requestCount: number; errorCount: number; agentCode?: string; environment?: Record<string, string>; workingDirectory?: string; endpoint: string; healthEndpoint: string; mcpEndpoint: string; lastError?: string; crashCount: number; restartCount: number; } export interface WorkerPool { id: string; name: string; maxAgents: number; healthCheckInterval: number; createdAt: Date; resourceLimits: { cpu: number; memory: number; storage: number; }; autoScaling?: { enabled: boolean; minAgents: number; maxAgents: number; scaleUpThreshold: number; scaleDownThreshold: number; cooldownPeriod: number; }; loadBalancing?: { strategy: 'round-robin' | 'least-connections' | 'resource-based'; stickySession: boolean; }; } export interface ResourceMonitor { systemCpuUsage: number; systemMemoryUsage: number; systemMemoryTotal: number; systemStorageUsage: number; systemStorageTotal: number; networkIn: number; networkOut: number; processMetrics: Map<string, { cpuUsage: number; memoryUsage: number; storageUsage: number; threadCount: number; fileDescriptors: number; networkConnections: number; }>; history: { timestamp: Date; systemCpu: number; systemMemory: number; totalProcesses: number; activeProcesses: number; }[]; alerts: ResourceAlert[]; } export interface ResourceAlert { id: string; type: 'cpu' | 'memory' | 'storage' | 'network'; severity: 'info' | 'warning' | 'critical'; processId?: string; poolId?: string; message: string; value: number; threshold: number; timestamp: Date; acknowledged: boolean; } export interface DeploymentConfig { maxAgentsPerPool: number; healthCheckInterval: number; autoRestartFailures: boolean; resourceLimits: { memory: number; cpu: number; storage: number; }; portRange: { start: number; end: number; }; processTimeout: number; gracefulShutdownTimeout: number; maxRestartAttempts: number; metricsCollection: boolean; logLevel: 'debug' | 'info' | 'warning' | 'error'; logRotation: { maxFiles: number; maxSize: number; }; } export interface ProcessDeploymentRequest { serviceName: string; agentCode: string; port?: number; poolId?: string; resourceLimits?: { cpu: number; memory: number; storage: number; }; environment?: Record<string, string>; healthCheckPath?: string; } export interface IntegrationWorkerProps extends HTMLAttributes<HTMLDivElement> { /** * Currently running agent processes */ agentProcesses?: AgentProcess[]; /** * Available worker pools */ workerPools?: WorkerPool[]; /** * Resource monitoring data */ resourceMonitor?: ResourceMonitor; /** * Deployment configuration */ deploymentConfig?: DeploymentConfig; /** * Show detailed process information * @default true */ showProcessDetails?: boolean; /** * Show resource usage monitoring * @default true */ showResourceUsage?: boolean; /** * Show worker pool management * @default true */ showPoolManagement?: boolean; /** * Enable automatic scaling of worker pools * @default true */ enableAutoScaling?: boolean; /** * Callback when new process is deployed */ onProcessDeploy?: (process: AgentProcess, agentCode: string) => void; /** * Callback when process is terminated */ onProcessTerminate?: (process: AgentProcess) => void; /** * Callback when worker pool is created */ onPoolCreate?: (pool: WorkerPool) => void; /** * Callback when resource alert is triggered */ onResourceAlert?: (alert: ResourceAlert) => void; /** * Callback when process is restarted */ onProcessRestart?: (process: AgentProcess) => void; /** * Callback when process is stopped */ onProcessStop?: (process: AgentProcess) => void; /** * Callback when pool is scaled */ onPoolScale?: (poolId: string, newMaxAgents: number) => void; } export interface ProcessManager { /** * Deploy a new agent process */ deploy: (request: ProcessDeploymentRequest) => Promise<AgentProcess>; /** * Terminate an existing process */ terminate: (processId: string) => Promise<void>; /** * Restart a failed or stopped process */ restart: (processId: string) => Promise<AgentProcess>; /** * Stop a running process gracefully */ stop: (processId: string) => Promise<void>; /** * Get process status and metrics */ getStatus: (processId: string) => Promise<AgentProcess>; /** * Scale a worker pool */ scalePool: (poolId: string, newMaxAgents: number) => Promise<WorkerPool>; /** * Health check all processes */ healthCheck: () => Promise<Map<string, boolean>>; } export interface ContainerOrchestration { /** * Deploy agent as Docker container */ deployContainer: (serviceName: string, agentCode: string, config: ContainerConfig) => Promise<ContainerProcess>; /** * Kubernetes deployment */ deployKubernetes: (serviceName: string, agentCode: string, config: KubernetesConfig) => Promise<KubernetesProcess>; /** * Container health monitoring */ monitorContainers: () => Promise<ContainerMetrics[]>; } export interface ContainerConfig { image: string; ports: number[]; environment: Record<string, string>; resources: { limits: { cpu: string; memory: string; }; requests: { cpu: string; memory: string; }; }; volumes?: Array<{ name: string; mountPath: string; type: 'configMap' | 'secret' | 'emptyDir' | 'hostPath'; }>; } export interface KubernetesConfig extends ContainerConfig { namespace: string; replicas: number; serviceType: 'ClusterIP' | 'NodePort' | 'LoadBalancer'; ingress?: { enabled: boolean; hosts: string[]; tls?: boolean; }; } export interface ContainerProcess extends AgentProcess { containerId: string; imageId: string; containerName: string; containerStatus: 'created' | 'running' | 'paused' | 'restarting' | 'removing' | 'exited' | 'dead'; } export interface KubernetesProcess extends ContainerProcess { namespace: string; podName: string; serviceName: string; deploymentName: string; podStatus: 'Pending' | 'Running' | 'Succeeded' | 'Failed' | 'Unknown'; } export interface ContainerMetrics { containerId: string; name: string; status: string; cpuUsage: number; memoryUsage: number; networkIn: number; networkOut: number; blockIn: number; blockOut: number; restartCount: number; } export interface LoadBalancer { /** * Register an agent process for load balancing */ register: (process: AgentProcess) => Promise<void>; /** * Unregister an agent process */ unregister: (processId: string) => Promise<void>; /** * Get the next available process for a service */ getNextProcess: (serviceName: string) => Promise<AgentProcess | null>; /** * Health check all registered processes */ healthCheck: () => Promise<Map<string, boolean>>; /** * Get load balancing statistics */ getStats: () => Promise<LoadBalancerStats>; } export interface LoadBalancerStats { totalRequests: number; requestsPerService: Map<string, number>; averageResponseTime: number; errorRate: number; activeConnections: number; processUtilization: Map<string, number>; } export interface BMSIntegrationWorker { /** * Deploy agent for Oracle integration requests */ deployOracleIntegration: (serviceName: string, intent: string) => Promise<AgentProcess>; /** * Deploy agent for Scribe data access */ deployScribeIntegration: (serviceName: string, dataTypes: string[]) => Promise<AgentProcess>; /** * Deploy agent for Architect workflow orchestration */ deployArchitectIntegration: (services: string[], workflow: any) => Promise<AgentProcess[]>; /** * Get integration capabilities */ getIntegrationCapabilities: () => Promise<{ availableServices: string[]; deployedAgents: AgentProcess[]; resourceCapacity: { maxAdditionalAgents: number; availableMemory: number; availableCpu: number; }; }>; } export interface WorkerObservability { /** * Collect metrics from all processes */ collectMetrics: () => Promise<WorkerMetrics>; /** * Export metrics in Prometheus format */ exportPrometheusMetrics: () => string; /** * Generate worker status report */ generateStatusReport: () => Promise<WorkerStatusReport>; /** * Set up alerts and notifications */ configureAlerts: (config: AlertConfig) => Promise<void>; } export interface WorkerMetrics { timestamp: Date; totalProcesses: number; activeProcesses: number; failedProcesses: number; totalCpuUsage: number; totalMemoryUsage: number; totalNetworkTraffic: number; requestsPerSecond: number; averageResponseTime: number; errorRate: number; processMetrics: Map<string, ProcessMetrics>; } export interface ProcessMetrics { processId: string; serviceName: string; cpuUsage: number; memoryUsage: number; requestCount: number; errorCount: number; responseTime: number; uptime: number; } export interface WorkerStatusReport { generatedAt: Date; overallHealth: 'healthy' | 'warning' | 'critical'; totalProcesses: number; resourceUtilization: { cpu: number; memory: number; storage: number; }; performanceMetrics: { throughput: number; latency: number; errorRate: number; }; issues: Array<{ severity: 'low' | 'medium' | 'high' | 'critical'; component: string; description: string; recommendation: string; }>; recommendations: string[]; } export interface AlertConfig { thresholds: { cpuUsage: number; memoryUsage: number; errorRate: number; responseTime: number; }; notifications: { email?: string[]; webhook?: string; slack?: { channel: string; webhook: string; }; }; escalation: { enabled: boolean; levels: Array<{ threshold: number; actions: string[]; }>; }; } //# sourceMappingURL=types.d.ts.map