import React from 'react'; import { Edgework } from '../index.mjs'; import { D as DownloadProgress, G as GenerateResult, C as ChatMessage } from '../base-storage-CfkDwX0r.mjs'; import 'zod'; import '../data/storage/index.mjs'; import '../factory-2SldefsH.mjs'; import '../data/sync/index.mjs'; import '../compute/rlhf/index.mjs'; import '../index-BRjPIr0_.mjs'; import '../index-CnOow4Yv.mjs'; import '../index-i7o3ADbK.mjs'; /** * FeedbackButton - Simple thumbs up/down feedback buttons * * Collects user feedback for RLHF training of local models. */ interface FeedbackButtonProps { /** Unique identifier for the message being rated */ messageId: string; /** Callback when feedback is submitted */ onFeedback?: (messageId: string, rating: 'positive' | 'negative') => void; /** Current feedback state (if controlled) */ currentFeedback?: 'positive' | 'negative' | null; /** Size of the buttons */ size?: 'sm' | 'md' | 'lg'; /** Disabled state */ disabled?: boolean; /** Custom class names */ className?: string; } /** * Simple feedback buttons for collecting user preferences */ declare function FeedbackButton({ messageId, onFeedback, currentFeedback, size, disabled, className, }: FeedbackButtonProps): React.ReactElement; /** * FeedbackPanel - Detailed feedback collection panel * * Provides a more detailed feedback interface with categories and comments. */ interface FeedbackPanelProps { /** Unique identifier for the message being rated */ messageId: string; /** The text content being evaluated */ content?: string; /** Callback when feedback is submitted */ onSubmit?: (feedback: DetailedFeedback) => void; /** Callback to close the panel */ onClose?: () => void; /** Show content preview */ showPreview?: boolean; /** Custom class names */ className?: string; } interface DetailedFeedback { messageId: string; rating: 'positive' | 'negative'; categories: FeedbackCategory[]; comment?: string; timestamp: string; } type FeedbackCategory = 'accurate' | 'helpful' | 'clear' | 'creative' | 'inaccurate' | 'unhelpful' | 'confusing' | 'inappropriate'; /** * Detailed feedback collection panel */ declare function FeedbackPanel({ messageId, content, onSubmit, onClose, showPreview, className, }: FeedbackPanelProps): React.ReactElement; /** * ModelStatus - Display model download and inference status * * Shows download progress, model readiness, and inference stats. */ interface ModelStatusProps { /** Model identifier */ modelId: string; /** Download progress (0-100) */ downloadProgress?: number; /** Whether the model is ready for inference */ isReady: boolean; /** Whether currently generating */ isGenerating?: boolean; /** Current inference speed (tokens/sec) */ tokensPerSecond?: number; /** Storage used by the model (bytes) */ storageUsed?: number; /** Inference backend being used */ backend?: 'webgpu' | 'wasm' | 'cpu'; /** Whether SIMD is enabled */ simdEnabled?: boolean; /** Error message if any */ error?: string; /** Compact display mode */ compact?: boolean; /** Custom class names */ className?: string; } /** * Model status indicator component */ declare function ModelStatus({ modelId, downloadProgress, isReady, isGenerating, tokensPerSecond, storageUsed, backend, simdEnabled, error, compact, className, }: ModelStatusProps): React.ReactElement; /** * EdgeworkContext - React context for Edgework SDK * * Provides SDK instance and state management for React applications. */ interface EdgeworkContextValue { /** SDK instance (null until initialized) */ sdk: Edgework | null; /** Whether the SDK is initialized */ isInitialized: boolean; /** Whether the model is ready for inference */ isReady: boolean; /** Whether currently generating */ isGenerating: boolean; /** Download progress during model loading */ downloadProgress: DownloadProgress | null; /** Current error if any */ error: Error | null; /** Initialize the SDK */ initialize: () => Promise; /** Generate text */ generate: (prompt: string) => Promise; /** Chat with messages */ chat: (messages: ChatMessage[]) => Promise; /** Submit feedback for RLHF */ submitFeedback: (messageHash: string, rating: 'positive' | 'negative') => Promise; } interface EdgeworkProviderProps { /** Model to use */ model: string; /** Children components */ children: React.ReactNode; /** Auto-initialize on mount */ autoInit?: boolean; /** Storage backend preference */ storageBackend?: 'opfs' | 'indexeddb' | 'memory'; /** Enable RLHF */ enableRLHF?: boolean; /** User ID for personalization */ userId?: string; } /** * Provider component for Edgework SDK */ declare function EdgeworkProvider({ model, children, autoInit, storageBackend, enableRLHF, userId, }: EdgeworkProviderProps): React.ReactElement; /** * Hook to use Edgework SDK in components */ declare function useEdgework(): EdgeworkContextValue; export { type DetailedFeedback, type EdgeworkContextValue, EdgeworkProvider, type EdgeworkProviderProps, FeedbackButton, type FeedbackButtonProps, FeedbackPanel, type FeedbackPanelProps, ModelStatus, type ModelStatusProps, useEdgework };