UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

107 lines (106 loc) 2.82 kB
import type { AgentMetadata } from '../types/types'; export interface AgentCapabilities { supportedMimeTypes: string[]; supportsAttachments: boolean; maxFileSize?: number; maxAttachments?: number; capabilities: string[]; modelName?: string; modelVersion?: string; } export interface AgentConfig { initialized: boolean; capabilities: AgentCapabilities; metadata: AgentMetadata; } /** * AgentService - Manages agent capabilities and metadata * * Responsibilities: * - Process agent capabilities from API metadata * - Validate file support and constraints * - Manage agent configuration state * - Handle capability-based feature enablement * - Track agent initialization status */ export declare class AgentService { private logger; private capabilities; private metadata; private initialized; constructor(debug?: boolean | import('../types/types').DebugConfig); /** * Process capabilities from API metadata response */ processCapabilities(apiMetadata: any): AgentCapabilities; /** * Check if a file type is supported by the agent */ checkFileSupport(fileType: string, mimeType?: string): boolean; /** * Validate file against agent constraints */ validateFile(file: File): { valid: boolean; error?: string; }; /** * Check if agent has a specific capability */ hasCapability(capability: string): boolean; /** * Get maximum number of attachments allowed */ getMaxAttachments(): number; /** * Get maximum file size allowed */ getMaxFileSize(): number; /** * Get supported MIME types */ getSupportedMimeTypes(): string[]; /** * Check if attachments are supported */ supportsAttachments(): boolean; /** * Get current agent configuration */ getConfiguration(): AgentConfig | null; /** * Get default capabilities when no metadata is available */ private getDefaultCapabilities; /** * Reset agent capabilities (for new conversations) */ reset(): void; /** * Check if agent is initialized */ isInitialized(): boolean; /** * Get agent model information */ getModelInfo(): { name?: string; version?: string; }; /** * Get formatted capability summary for debugging */ getCapabilitySummary(): string; /** * Update capabilities (for dynamic updates) */ updateCapabilities(newMetadata: any): AgentCapabilities; /** * Check if file count exceeds maximum */ validateAttachmentCount(currentCount: number): boolean; /** * Get user-friendly error message for file validation */ getFileValidationError(file: File): string | null; }