@optifye/dashboard-core 4.0.2 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +124 -1
- package/dist/index.d.ts +124 -1
- package/dist/index.js +1309 -400
- package/dist/index.mjs +1300 -401
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -209,6 +209,7 @@ interface WorkspaceConfig {
|
|
|
209
209
|
interface EndpointsConfig {
|
|
210
210
|
whatsapp?: string;
|
|
211
211
|
worstPerformingWorkspaces?: string;
|
|
212
|
+
agnoApiUrl?: string;
|
|
212
213
|
}
|
|
213
214
|
interface DateTimeConfig {
|
|
214
215
|
defaultTimezone?: string;
|
|
@@ -923,6 +924,39 @@ interface VideoMetadata {
|
|
|
923
924
|
type VideoType = 'bottleneck' | 'low_value' | 'best_cycle_time' | 'worst_cycle_time' | 'missing_quality_check';
|
|
924
925
|
type VideoSeverity = 'low' | 'medium' | 'high';
|
|
925
926
|
|
|
927
|
+
interface ChatThread {
|
|
928
|
+
id: string;
|
|
929
|
+
user_id: string;
|
|
930
|
+
title: string;
|
|
931
|
+
auto_title: boolean;
|
|
932
|
+
model_id: string;
|
|
933
|
+
has_reasoning: boolean;
|
|
934
|
+
last_message: string | null;
|
|
935
|
+
message_count: number;
|
|
936
|
+
created_at: string;
|
|
937
|
+
updated_at: string;
|
|
938
|
+
}
|
|
939
|
+
interface ChatMessage {
|
|
940
|
+
id: number;
|
|
941
|
+
thread_id: string;
|
|
942
|
+
role: 'user' | 'assistant' | 'system';
|
|
943
|
+
content: string;
|
|
944
|
+
reasoning: string | null;
|
|
945
|
+
model_id: string | null;
|
|
946
|
+
token_usage: {
|
|
947
|
+
prompt_tokens?: number;
|
|
948
|
+
completion_tokens?: number;
|
|
949
|
+
reasoning_tokens?: number;
|
|
950
|
+
} | null;
|
|
951
|
+
metadata: Record<string, any> | null;
|
|
952
|
+
created_at: string;
|
|
953
|
+
position: number;
|
|
954
|
+
}
|
|
955
|
+
interface SSEEvent {
|
|
956
|
+
event: 'thread' | 'message' | 'reasoning' | 'complete' | 'error';
|
|
957
|
+
data: any;
|
|
958
|
+
}
|
|
959
|
+
|
|
926
960
|
interface DashboardProviderProps {
|
|
927
961
|
config: Partial<DashboardConfig>;
|
|
928
962
|
children: React$1.ReactNode;
|
|
@@ -1658,6 +1692,34 @@ declare const useWorkspaceOperators: (workspaceId: string, options?: UseWorkspac
|
|
|
1658
1692
|
refetch: () => Promise<void>;
|
|
1659
1693
|
};
|
|
1660
1694
|
|
|
1695
|
+
interface UseThreadsResult {
|
|
1696
|
+
threads: ChatThread[];
|
|
1697
|
+
isLoading: boolean;
|
|
1698
|
+
error: Error | null;
|
|
1699
|
+
mutate: () => void;
|
|
1700
|
+
createThread: (title?: string) => Promise<ChatThread>;
|
|
1701
|
+
deleteThread: (threadId: string) => Promise<void>;
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Hook to manage chat threads - uses polling/refresh for updates
|
|
1705
|
+
* Streaming is handled by SSE for AI responses, not Supabase realtime
|
|
1706
|
+
*/
|
|
1707
|
+
declare function useThreads(): UseThreadsResult;
|
|
1708
|
+
|
|
1709
|
+
interface UseMessagesResult {
|
|
1710
|
+
messages: ChatMessage[];
|
|
1711
|
+
setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
|
|
1712
|
+
isLoading: boolean;
|
|
1713
|
+
error: Error | null;
|
|
1714
|
+
addMessage: (message: Omit<ChatMessage, 'id' | 'created_at' | 'position'>) => Promise<ChatMessage>;
|
|
1715
|
+
updateMessage: (id: number, content: string) => Promise<void>;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Hook to manage messages within a thread
|
|
1719
|
+
* Updates come from SSE streaming during AI response generation
|
|
1720
|
+
*/
|
|
1721
|
+
declare function useMessages(threadId: string | undefined): UseMessagesResult;
|
|
1722
|
+
|
|
1661
1723
|
/**
|
|
1662
1724
|
* @interface FactoryOverviewData
|
|
1663
1725
|
* @description Represents aggregated overview metrics for the entire factory.
|
|
@@ -2201,6 +2263,50 @@ declare const trackCoreEvent: (eventName: string, properties?: Record<string, an
|
|
|
2201
2263
|
declare const identifyCoreUser: (userId: string, userProperties?: Record<string, any>) => void;
|
|
2202
2264
|
declare const resetCoreMixpanel: () => void;
|
|
2203
2265
|
|
|
2266
|
+
/**
|
|
2267
|
+
* Server-Sent Events (SSE) Client for AI Chat
|
|
2268
|
+
*
|
|
2269
|
+
* This client handles streaming responses from the AGNO AI backend.
|
|
2270
|
+
* No Supabase realtime subscriptions are used - all streaming is done
|
|
2271
|
+
* through SSE for the AI's response generation.
|
|
2272
|
+
*
|
|
2273
|
+
* Event flow:
|
|
2274
|
+
* 1. POST message to /api/chat endpoint
|
|
2275
|
+
* 2. Receive SSE stream with events: thread, message, reasoning, complete, error
|
|
2276
|
+
* 3. AI response is streamed in chunks via 'message' events
|
|
2277
|
+
* 4. Once complete, the full conversation is persisted in Supabase
|
|
2278
|
+
*/
|
|
2279
|
+
declare class SSEChatClient {
|
|
2280
|
+
private controllers;
|
|
2281
|
+
private baseUrl;
|
|
2282
|
+
constructor(baseUrl?: string);
|
|
2283
|
+
sendMessage(message: string, userId: string, threadId: string | null, context: {
|
|
2284
|
+
companyId: string;
|
|
2285
|
+
lineId: string;
|
|
2286
|
+
shiftId: number;
|
|
2287
|
+
}, callbacks: {
|
|
2288
|
+
onThreadCreated?: (threadId: string) => void;
|
|
2289
|
+
onMessage?: (text: string) => void;
|
|
2290
|
+
onReasoning?: (text: string) => void;
|
|
2291
|
+
onComplete?: (messageId: number) => void;
|
|
2292
|
+
onError?: (error: string) => void;
|
|
2293
|
+
}): Promise<void>;
|
|
2294
|
+
private handleSSEStream;
|
|
2295
|
+
abort(threadId?: string): void;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
declare function getUserThreads(userId: string, limit?: number): Promise<ChatThread[]>;
|
|
2299
|
+
declare function getUserThreadsPaginated(userId: string, page?: number, pageSize?: number): Promise<{
|
|
2300
|
+
threads: ChatThread[];
|
|
2301
|
+
totalCount: number;
|
|
2302
|
+
totalPages: number;
|
|
2303
|
+
currentPage: number;
|
|
2304
|
+
}>;
|
|
2305
|
+
declare function getThreadMessages(threadId: string, limit?: number, beforePosition?: number): Promise<ChatMessage[]>;
|
|
2306
|
+
declare function getAllThreadMessages(threadId: string): Promise<ChatMessage[]>;
|
|
2307
|
+
declare function updateThreadTitle(threadId: string, newTitle: string): Promise<ChatThread>;
|
|
2308
|
+
declare function deleteThread(threadId: string): Promise<void>;
|
|
2309
|
+
|
|
2204
2310
|
/**
|
|
2205
2311
|
* Helper object for making authenticated API requests using Supabase auth token.
|
|
2206
2312
|
* Assumes endpoints are relative to the apiBaseUrl configured in DashboardConfig.
|
|
@@ -3669,6 +3775,15 @@ declare const getDefaultCameraStreamUrl: (workspaceName: string, baseUrl: string
|
|
|
3669
3775
|
*/
|
|
3670
3776
|
declare const SingleVideoStream: React__default.FC<SingleVideoStreamProps>;
|
|
3671
3777
|
|
|
3778
|
+
/**
|
|
3779
|
+
* AI Agent Chat View
|
|
3780
|
+
*
|
|
3781
|
+
* Streaming Architecture:
|
|
3782
|
+
* - Uses Server-Sent Events (SSE) for real-time AI response streaming
|
|
3783
|
+
* - No Supabase realtime subscriptions needed
|
|
3784
|
+
* - Flow: User message → Save to DB → Stream AI response → Save complete response to DB
|
|
3785
|
+
* - The SSE client handles the streaming connection to the AGNO API
|
|
3786
|
+
*/
|
|
3672
3787
|
declare const AIAgentView: React__default.FC;
|
|
3673
3788
|
|
|
3674
3789
|
interface AuthCallbackViewProps {
|
|
@@ -4136,4 +4251,12 @@ declare const streamProxyConfig: {
|
|
|
4136
4251
|
};
|
|
4137
4252
|
};
|
|
4138
4253
|
|
|
4139
|
-
|
|
4254
|
+
interface ThreadSidebarProps {
|
|
4255
|
+
activeThreadId?: string;
|
|
4256
|
+
onSelectThread: (threadId: string) => void;
|
|
4257
|
+
onNewThread: () => void;
|
|
4258
|
+
className?: string;
|
|
4259
|
+
}
|
|
4260
|
+
declare const ThreadSidebar: React__default.FC<ThreadSidebarProps>;
|
|
4261
|
+
|
|
4262
|
+
export { ACTION_NAMES, AIAgentView, type Action, type ActionName, type ActionService, type ActionThreshold, type AnalyticsConfig, AuthCallback, type AuthCallbackProps, AuthCallbackView, type AuthCallbackViewProps, type AuthConfig, AuthProvider, type AuthUser, AuthenticatedFactoryView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, type BarChartDataItem, type BarChartProps, type BarProps, BaseHistoryCalendar, type BaseHistoryCalendarProps, type BaseLineMetric, type BasePerformanceMetric, type BottleneckFilterType, type BottleneckVideo, type BottleneckVideoData, BottlenecksContent, type BottlenecksContentProps, type BreadcrumbItem, type Break, type BreakRowProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatThread, type ClipCounts, type ComponentOverride, type CoreComponents, type CurrentShiftResult, CycleTimeChart, type CycleTimeChartProps, CycleTimeOverTimeChart, type CycleTimeOverTimeChartProps, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, type DashboardConfig, DashboardHeader, type DashboardKPIs, DashboardLayout, type DashboardLayoutProps, DashboardOverridesProvider, DashboardProvider, type DashboardService, type DatabaseConfig, DateDisplay, type DateTimeConfig, DateTimeDisplay, type DateTimeDisplayProps, type DayHistoryData, type DaySummaryData, DebugAuth, DebugAuthView, EmptyStateMessage, type EmptyStateMessageProps, type EndpointsConfig, type EntityConfig, type FactoryOverviewData, FactoryView, type FactoryViewProps, type FormatNumberOptions, GridComponentsPlaceholder, Header, type HeaderProps, type HistoryCalendarProps, HomeView, type HookOverride, HourlyOutputChart, type HourlyOutputChartProps, type HourlyPerformance, type ISTDateProps, ISTTimer, type ISTTimerProps, KPICard, type KPICardProps, KPIDetailView, type KPIDetailViewProps, KPIGrid, type KPIGridProps, KPIHeader, type KPIHeaderProps, KPISection, type KPITrend, LINE_1_UUID, LargeOutputProgressChart, type LargeOutputProgressChartProps, LeaderboardDetailView, type LeaderboardDetailViewProps, type LeaderboardEntry, LeaderboardIndexView, type LeaderboardIndexViewProps, type LeaderboardLineOption, Legend, LineChart, type LineChartDataItem, type LineChartProps, type LineDetails, type LineDisplayData, LineHistoryCalendar, type LineHistoryCalendarProps, type LineInfo, type LineMetrics, LineMonthlyHistory, type LineMonthlyHistoryProps, type LineMonthlyMetric, LineMonthlyPdfGenerator, type LineMonthlyPdfGeneratorProps, type LineNavigationParams, LinePdfExportButton, type LinePdfExportButtonProps, LinePdfGenerator, type LinePdfGeneratorProps, type LineProps, type LineShiftConfig, type LineSnapshot, type LineThreshold, LineWhatsAppShareButton, type LineWhatsAppShareProps, LiveTimer, LoadingOverlay, LoadingPage, LoadingSpinner, LoginPage, type LoginPageProps, LoginView, type LoginViewProps, MainLayout, type MainLayoutProps, type Metric, MetricCard, type MetricCardProps$1 as MetricCardProps, type MetricsError, type NavItem, type NavItemTrackingEvent, NoWorkspaceData, type OperatorData, type OperatorInfo, OptifyeAgentClient, type OptifyeAgentContext, type OptifyeAgentRequest, type OptifyeAgentResponse, OutputProgressChart, type OutputProgressChartProps, type OverridesMap, type OverviewLineMetric, type OverviewWorkspaceMetric, PageHeader, type PageHeaderProps, type PageOverride, type PoorPerformingWorkspace, type ProfileMenuItem, ProfileView, type QualityMetric, type QualityOverview, type QualityService, type RateLimitOptions, type RateLimitResult, type RealtimeService, RegistryProvider, type RoutePath, type S3ClipsAPIParams, type S3Config, type S3ListObjectsParams, S3Service, type S3ServiceConfig, SOPComplianceChart, type SOPComplianceChartProps, SSEChatClient, type SSEEvent, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ShiftConfig, type ShiftConfiguration, type ShiftConfigurationRecord, type ShiftData$2 as ShiftData, ShiftDisplay, type ShiftHistoryData, type ShiftHoursMap, type ShiftPanelProps, type ShiftSummaryData, type ShiftTime, ShiftsView, type ShiftsViewProps, SideNavBar, type SideNavBarProps, type SimpleLine, SingleVideoStream, type SingleVideoStreamProps, Skeleton, type StreamProxyConfig, type SupabaseClient, SupabaseProvider, type Target, TargetWorkspaceGrid, type TargetWorkspaceGridProps, TargetsView, type TargetsViewProps, type ThemeColorValue, type ThemeConfig, ThreadSidebar, TimeDisplay, type TrackingEventProperties, type TrendDirection, type UnderperformingWorkspace, type UnderperformingWorkspaces, type UseDashboardMetricsProps, type UseFactoryOverviewOptions, type UseFormatNumberResult, type UseMessagesResult, type UseRealtimeLineMetricsProps, type UseTargetsOptions, type UseThreadsResult, type UseWorkspaceOperatorsOptions, type UserProfileConfig, VideoCard, VideoGridView, type VideoMetadata, VideoPreloader, type VideoSeverity, type VideoSummary, type VideoType, WORKSPACE_POSITIONS, type WhatsAppSendResult, WhatsAppShareButton, type WhatsAppShareButtonProps, type WhatsappService, type Workspace, type WorkspaceActionUpdate, WorkspaceCard, type WorkspaceCardProps, type WorkspaceConfig, WrappedComponent as WorkspaceDetailView, type WorkspaceDetailedMetrics, WorkspaceGrid, WorkspaceGridItem, type WorkspaceGridItemProps, WorkspaceHistoryCalendar, WorkspaceMetricCards, type WorkspaceMetricCardsProps, type WorkspaceMetrics, WorkspaceMonthlyDataFetcher, type WorkspaceMonthlyDataFetcherProps, type WorkspaceMonthlyMetric, WorkspaceMonthlyPdfGenerator, type WorkspaceMonthlyPdfGeneratorProps, type WorkspaceNavigationParams, WorkspacePdfExportButton, type WorkspacePdfExportButtonProps, WorkspacePdfGenerator, type WorkspacePdfGeneratorProps, type WorkspacePosition, type WorkspaceQualityData, type WorkspaceUrlMapping, WorkspaceWhatsAppShareButton, type WorkspaceWhatsAppShareProps, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit, clearAllRateLimits, clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
|
package/dist/index.d.ts
CHANGED
|
@@ -209,6 +209,7 @@ interface WorkspaceConfig {
|
|
|
209
209
|
interface EndpointsConfig {
|
|
210
210
|
whatsapp?: string;
|
|
211
211
|
worstPerformingWorkspaces?: string;
|
|
212
|
+
agnoApiUrl?: string;
|
|
212
213
|
}
|
|
213
214
|
interface DateTimeConfig {
|
|
214
215
|
defaultTimezone?: string;
|
|
@@ -923,6 +924,39 @@ interface VideoMetadata {
|
|
|
923
924
|
type VideoType = 'bottleneck' | 'low_value' | 'best_cycle_time' | 'worst_cycle_time' | 'missing_quality_check';
|
|
924
925
|
type VideoSeverity = 'low' | 'medium' | 'high';
|
|
925
926
|
|
|
927
|
+
interface ChatThread {
|
|
928
|
+
id: string;
|
|
929
|
+
user_id: string;
|
|
930
|
+
title: string;
|
|
931
|
+
auto_title: boolean;
|
|
932
|
+
model_id: string;
|
|
933
|
+
has_reasoning: boolean;
|
|
934
|
+
last_message: string | null;
|
|
935
|
+
message_count: number;
|
|
936
|
+
created_at: string;
|
|
937
|
+
updated_at: string;
|
|
938
|
+
}
|
|
939
|
+
interface ChatMessage {
|
|
940
|
+
id: number;
|
|
941
|
+
thread_id: string;
|
|
942
|
+
role: 'user' | 'assistant' | 'system';
|
|
943
|
+
content: string;
|
|
944
|
+
reasoning: string | null;
|
|
945
|
+
model_id: string | null;
|
|
946
|
+
token_usage: {
|
|
947
|
+
prompt_tokens?: number;
|
|
948
|
+
completion_tokens?: number;
|
|
949
|
+
reasoning_tokens?: number;
|
|
950
|
+
} | null;
|
|
951
|
+
metadata: Record<string, any> | null;
|
|
952
|
+
created_at: string;
|
|
953
|
+
position: number;
|
|
954
|
+
}
|
|
955
|
+
interface SSEEvent {
|
|
956
|
+
event: 'thread' | 'message' | 'reasoning' | 'complete' | 'error';
|
|
957
|
+
data: any;
|
|
958
|
+
}
|
|
959
|
+
|
|
926
960
|
interface DashboardProviderProps {
|
|
927
961
|
config: Partial<DashboardConfig>;
|
|
928
962
|
children: React$1.ReactNode;
|
|
@@ -1658,6 +1692,34 @@ declare const useWorkspaceOperators: (workspaceId: string, options?: UseWorkspac
|
|
|
1658
1692
|
refetch: () => Promise<void>;
|
|
1659
1693
|
};
|
|
1660
1694
|
|
|
1695
|
+
interface UseThreadsResult {
|
|
1696
|
+
threads: ChatThread[];
|
|
1697
|
+
isLoading: boolean;
|
|
1698
|
+
error: Error | null;
|
|
1699
|
+
mutate: () => void;
|
|
1700
|
+
createThread: (title?: string) => Promise<ChatThread>;
|
|
1701
|
+
deleteThread: (threadId: string) => Promise<void>;
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Hook to manage chat threads - uses polling/refresh for updates
|
|
1705
|
+
* Streaming is handled by SSE for AI responses, not Supabase realtime
|
|
1706
|
+
*/
|
|
1707
|
+
declare function useThreads(): UseThreadsResult;
|
|
1708
|
+
|
|
1709
|
+
interface UseMessagesResult {
|
|
1710
|
+
messages: ChatMessage[];
|
|
1711
|
+
setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>;
|
|
1712
|
+
isLoading: boolean;
|
|
1713
|
+
error: Error | null;
|
|
1714
|
+
addMessage: (message: Omit<ChatMessage, 'id' | 'created_at' | 'position'>) => Promise<ChatMessage>;
|
|
1715
|
+
updateMessage: (id: number, content: string) => Promise<void>;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Hook to manage messages within a thread
|
|
1719
|
+
* Updates come from SSE streaming during AI response generation
|
|
1720
|
+
*/
|
|
1721
|
+
declare function useMessages(threadId: string | undefined): UseMessagesResult;
|
|
1722
|
+
|
|
1661
1723
|
/**
|
|
1662
1724
|
* @interface FactoryOverviewData
|
|
1663
1725
|
* @description Represents aggregated overview metrics for the entire factory.
|
|
@@ -2201,6 +2263,50 @@ declare const trackCoreEvent: (eventName: string, properties?: Record<string, an
|
|
|
2201
2263
|
declare const identifyCoreUser: (userId: string, userProperties?: Record<string, any>) => void;
|
|
2202
2264
|
declare const resetCoreMixpanel: () => void;
|
|
2203
2265
|
|
|
2266
|
+
/**
|
|
2267
|
+
* Server-Sent Events (SSE) Client for AI Chat
|
|
2268
|
+
*
|
|
2269
|
+
* This client handles streaming responses from the AGNO AI backend.
|
|
2270
|
+
* No Supabase realtime subscriptions are used - all streaming is done
|
|
2271
|
+
* through SSE for the AI's response generation.
|
|
2272
|
+
*
|
|
2273
|
+
* Event flow:
|
|
2274
|
+
* 1. POST message to /api/chat endpoint
|
|
2275
|
+
* 2. Receive SSE stream with events: thread, message, reasoning, complete, error
|
|
2276
|
+
* 3. AI response is streamed in chunks via 'message' events
|
|
2277
|
+
* 4. Once complete, the full conversation is persisted in Supabase
|
|
2278
|
+
*/
|
|
2279
|
+
declare class SSEChatClient {
|
|
2280
|
+
private controllers;
|
|
2281
|
+
private baseUrl;
|
|
2282
|
+
constructor(baseUrl?: string);
|
|
2283
|
+
sendMessage(message: string, userId: string, threadId: string | null, context: {
|
|
2284
|
+
companyId: string;
|
|
2285
|
+
lineId: string;
|
|
2286
|
+
shiftId: number;
|
|
2287
|
+
}, callbacks: {
|
|
2288
|
+
onThreadCreated?: (threadId: string) => void;
|
|
2289
|
+
onMessage?: (text: string) => void;
|
|
2290
|
+
onReasoning?: (text: string) => void;
|
|
2291
|
+
onComplete?: (messageId: number) => void;
|
|
2292
|
+
onError?: (error: string) => void;
|
|
2293
|
+
}): Promise<void>;
|
|
2294
|
+
private handleSSEStream;
|
|
2295
|
+
abort(threadId?: string): void;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
declare function getUserThreads(userId: string, limit?: number): Promise<ChatThread[]>;
|
|
2299
|
+
declare function getUserThreadsPaginated(userId: string, page?: number, pageSize?: number): Promise<{
|
|
2300
|
+
threads: ChatThread[];
|
|
2301
|
+
totalCount: number;
|
|
2302
|
+
totalPages: number;
|
|
2303
|
+
currentPage: number;
|
|
2304
|
+
}>;
|
|
2305
|
+
declare function getThreadMessages(threadId: string, limit?: number, beforePosition?: number): Promise<ChatMessage[]>;
|
|
2306
|
+
declare function getAllThreadMessages(threadId: string): Promise<ChatMessage[]>;
|
|
2307
|
+
declare function updateThreadTitle(threadId: string, newTitle: string): Promise<ChatThread>;
|
|
2308
|
+
declare function deleteThread(threadId: string): Promise<void>;
|
|
2309
|
+
|
|
2204
2310
|
/**
|
|
2205
2311
|
* Helper object for making authenticated API requests using Supabase auth token.
|
|
2206
2312
|
* Assumes endpoints are relative to the apiBaseUrl configured in DashboardConfig.
|
|
@@ -3669,6 +3775,15 @@ declare const getDefaultCameraStreamUrl: (workspaceName: string, baseUrl: string
|
|
|
3669
3775
|
*/
|
|
3670
3776
|
declare const SingleVideoStream: React__default.FC<SingleVideoStreamProps>;
|
|
3671
3777
|
|
|
3778
|
+
/**
|
|
3779
|
+
* AI Agent Chat View
|
|
3780
|
+
*
|
|
3781
|
+
* Streaming Architecture:
|
|
3782
|
+
* - Uses Server-Sent Events (SSE) for real-time AI response streaming
|
|
3783
|
+
* - No Supabase realtime subscriptions needed
|
|
3784
|
+
* - Flow: User message → Save to DB → Stream AI response → Save complete response to DB
|
|
3785
|
+
* - The SSE client handles the streaming connection to the AGNO API
|
|
3786
|
+
*/
|
|
3672
3787
|
declare const AIAgentView: React__default.FC;
|
|
3673
3788
|
|
|
3674
3789
|
interface AuthCallbackViewProps {
|
|
@@ -4136,4 +4251,12 @@ declare const streamProxyConfig: {
|
|
|
4136
4251
|
};
|
|
4137
4252
|
};
|
|
4138
4253
|
|
|
4139
|
-
|
|
4254
|
+
interface ThreadSidebarProps {
|
|
4255
|
+
activeThreadId?: string;
|
|
4256
|
+
onSelectThread: (threadId: string) => void;
|
|
4257
|
+
onNewThread: () => void;
|
|
4258
|
+
className?: string;
|
|
4259
|
+
}
|
|
4260
|
+
declare const ThreadSidebar: React__default.FC<ThreadSidebarProps>;
|
|
4261
|
+
|
|
4262
|
+
export { ACTION_NAMES, AIAgentView, type Action, type ActionName, type ActionService, type ActionThreshold, type AnalyticsConfig, AuthCallback, type AuthCallbackProps, AuthCallbackView, type AuthCallbackViewProps, type AuthConfig, AuthProvider, type AuthUser, AuthenticatedFactoryView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, type BarChartDataItem, type BarChartProps, type BarProps, BaseHistoryCalendar, type BaseHistoryCalendarProps, type BaseLineMetric, type BasePerformanceMetric, type BottleneckFilterType, type BottleneckVideo, type BottleneckVideoData, BottlenecksContent, type BottlenecksContentProps, type BreadcrumbItem, type Break, type BreakRowProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChatMessage, type ChatThread, type ClipCounts, type ComponentOverride, type CoreComponents, type CurrentShiftResult, CycleTimeChart, type CycleTimeChartProps, CycleTimeOverTimeChart, type CycleTimeOverTimeChartProps, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, type DashboardConfig, DashboardHeader, type DashboardKPIs, DashboardLayout, type DashboardLayoutProps, DashboardOverridesProvider, DashboardProvider, type DashboardService, type DatabaseConfig, DateDisplay, type DateTimeConfig, DateTimeDisplay, type DateTimeDisplayProps, type DayHistoryData, type DaySummaryData, DebugAuth, DebugAuthView, EmptyStateMessage, type EmptyStateMessageProps, type EndpointsConfig, type EntityConfig, type FactoryOverviewData, FactoryView, type FactoryViewProps, type FormatNumberOptions, GridComponentsPlaceholder, Header, type HeaderProps, type HistoryCalendarProps, HomeView, type HookOverride, HourlyOutputChart, type HourlyOutputChartProps, type HourlyPerformance, type ISTDateProps, ISTTimer, type ISTTimerProps, KPICard, type KPICardProps, KPIDetailView, type KPIDetailViewProps, KPIGrid, type KPIGridProps, KPIHeader, type KPIHeaderProps, KPISection, type KPITrend, LINE_1_UUID, LargeOutputProgressChart, type LargeOutputProgressChartProps, LeaderboardDetailView, type LeaderboardDetailViewProps, type LeaderboardEntry, LeaderboardIndexView, type LeaderboardIndexViewProps, type LeaderboardLineOption, Legend, LineChart, type LineChartDataItem, type LineChartProps, type LineDetails, type LineDisplayData, LineHistoryCalendar, type LineHistoryCalendarProps, type LineInfo, type LineMetrics, LineMonthlyHistory, type LineMonthlyHistoryProps, type LineMonthlyMetric, LineMonthlyPdfGenerator, type LineMonthlyPdfGeneratorProps, type LineNavigationParams, LinePdfExportButton, type LinePdfExportButtonProps, LinePdfGenerator, type LinePdfGeneratorProps, type LineProps, type LineShiftConfig, type LineSnapshot, type LineThreshold, LineWhatsAppShareButton, type LineWhatsAppShareProps, LiveTimer, LoadingOverlay, LoadingPage, LoadingSpinner, LoginPage, type LoginPageProps, LoginView, type LoginViewProps, MainLayout, type MainLayoutProps, type Metric, MetricCard, type MetricCardProps$1 as MetricCardProps, type MetricsError, type NavItem, type NavItemTrackingEvent, NoWorkspaceData, type OperatorData, type OperatorInfo, OptifyeAgentClient, type OptifyeAgentContext, type OptifyeAgentRequest, type OptifyeAgentResponse, OutputProgressChart, type OutputProgressChartProps, type OverridesMap, type OverviewLineMetric, type OverviewWorkspaceMetric, PageHeader, type PageHeaderProps, type PageOverride, type PoorPerformingWorkspace, type ProfileMenuItem, ProfileView, type QualityMetric, type QualityOverview, type QualityService, type RateLimitOptions, type RateLimitResult, type RealtimeService, RegistryProvider, type RoutePath, type S3ClipsAPIParams, type S3Config, type S3ListObjectsParams, S3Service, type S3ServiceConfig, SOPComplianceChart, type SOPComplianceChartProps, SSEChatClient, type SSEEvent, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type ShiftConfig, type ShiftConfiguration, type ShiftConfigurationRecord, type ShiftData$2 as ShiftData, ShiftDisplay, type ShiftHistoryData, type ShiftHoursMap, type ShiftPanelProps, type ShiftSummaryData, type ShiftTime, ShiftsView, type ShiftsViewProps, SideNavBar, type SideNavBarProps, type SimpleLine, SingleVideoStream, type SingleVideoStreamProps, Skeleton, type StreamProxyConfig, type SupabaseClient, SupabaseProvider, type Target, TargetWorkspaceGrid, type TargetWorkspaceGridProps, TargetsView, type TargetsViewProps, type ThemeColorValue, type ThemeConfig, ThreadSidebar, TimeDisplay, type TrackingEventProperties, type TrendDirection, type UnderperformingWorkspace, type UnderperformingWorkspaces, type UseDashboardMetricsProps, type UseFactoryOverviewOptions, type UseFormatNumberResult, type UseMessagesResult, type UseRealtimeLineMetricsProps, type UseTargetsOptions, type UseThreadsResult, type UseWorkspaceOperatorsOptions, type UserProfileConfig, VideoCard, VideoGridView, type VideoMetadata, VideoPreloader, type VideoSeverity, type VideoSummary, type VideoType, WORKSPACE_POSITIONS, type WhatsAppSendResult, WhatsAppShareButton, type WhatsAppShareButtonProps, type WhatsappService, type Workspace, type WorkspaceActionUpdate, WorkspaceCard, type WorkspaceCardProps, type WorkspaceConfig, WrappedComponent as WorkspaceDetailView, type WorkspaceDetailedMetrics, WorkspaceGrid, WorkspaceGridItem, type WorkspaceGridItemProps, WorkspaceHistoryCalendar, WorkspaceMetricCards, type WorkspaceMetricCardsProps, type WorkspaceMetrics, WorkspaceMonthlyDataFetcher, type WorkspaceMonthlyDataFetcherProps, type WorkspaceMonthlyMetric, WorkspaceMonthlyPdfGenerator, type WorkspaceMonthlyPdfGeneratorProps, type WorkspaceNavigationParams, WorkspacePdfExportButton, type WorkspacePdfExportButtonProps, WorkspacePdfGenerator, type WorkspacePdfGeneratorProps, type WorkspacePosition, type WorkspaceQualityData, type WorkspaceUrlMapping, WorkspaceWhatsAppShareButton, type WorkspaceWhatsAppShareProps, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit, clearAllRateLimits, clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
|