@elevasis/ui 1.7.4 → 1.7.6

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.
@@ -0,0 +1,96 @@
1
+ import { useElevasisServices } from './chunk-KA7LO7U5.js';
2
+ import { useQuery } from '@tanstack/react-query';
3
+
4
+ // src/hooks/observability/queryKeys.ts
5
+ var observabilityKeys = {
6
+ all: ["observability"],
7
+ // Error analysis
8
+ errorAnalysis: (organizationId, timeRange) => [...observabilityKeys.all, "error-analysis", organizationId, timeRange],
9
+ // Error details list
10
+ errorDetails: (organizationId, filters) => [...observabilityKeys.all, "error-details", organizationId, filters],
11
+ // Single execution error detail
12
+ errorDetail: (organizationId, executionId) => [...observabilityKeys.all, "error-detail", organizationId, executionId],
13
+ // Error trends time-series
14
+ errorTrends: (organizationId, startDate, endDate, granularity) => [...observabilityKeys.all, "error-trends", organizationId, startDate, endDate, granularity],
15
+ // Error distribution breakdown
16
+ errorDistribution: (organizationId, startDate, endDate, groupBy) => [...observabilityKeys.all, "error-distribution", organizationId, startDate, endDate, groupBy],
17
+ // Top failing resources
18
+ topFailingResources: (organizationId, startDate, endDate, limit) => [...observabilityKeys.all, "top-failing-resources", organizationId, startDate, endDate, limit],
19
+ // Cost trends time-series
20
+ costTrends: (organizationId, timeRange, granularity) => [...observabilityKeys.all, "cost-trends", organizationId, timeRange, granularity],
21
+ // Cost by model breakdown
22
+ costByModel: (organizationId, timeRange) => [...observabilityKeys.all, "cost-by-model", organizationId, timeRange],
23
+ // Cost breakdown per resource/model
24
+ costBreakdown: (organizationId, timeRange) => [...observabilityKeys.all, "cost-breakdown", organizationId, timeRange],
25
+ // Composite dashboard metrics
26
+ dashboardMetrics: (organizationId, timeRange) => [...observabilityKeys.all, "dashboard-metrics", organizationId, timeRange],
27
+ // Business impact / automation ROI
28
+ businessImpact: (organizationId, timeRange) => [...observabilityKeys.all, "business-impact", organizationId, timeRange],
29
+ // Resources health batch
30
+ resourcesHealth: (organizationId, resources, startDate, endDate, granularity) => [...observabilityKeys.all, "resources-health", organizationId, resources, startDate, endDate, granularity]
31
+ };
32
+ function useErrorTrends({ startDate, endDate, granularity }) {
33
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
34
+ return useQuery({
35
+ queryKey: observabilityKeys.errorTrends(organizationId, startDate, endDate, granularity),
36
+ queryFn: async () => {
37
+ const params = new URLSearchParams({ startDate, endDate, granularity });
38
+ return apiRequest(`/observability/error-analytics/trends?${params.toString()}`);
39
+ },
40
+ enabled: isReady,
41
+ refetchInterval: 6e4,
42
+ staleTime: 3e4
43
+ });
44
+ }
45
+
46
+ // ../core/src/operations/observability/utils.ts
47
+ function getTimeRangeDates(range) {
48
+ const end = /* @__PURE__ */ new Date();
49
+ const start = /* @__PURE__ */ new Date();
50
+ switch (range) {
51
+ case "1h":
52
+ start.setHours(start.getHours() - 1);
53
+ break;
54
+ case "24h":
55
+ start.setHours(start.getHours() - 24);
56
+ break;
57
+ case "7d":
58
+ start.setDate(start.getDate() - 7);
59
+ break;
60
+ case "30d":
61
+ start.setDate(start.getDate() - 30);
62
+ break;
63
+ }
64
+ return {
65
+ startDate: start.toISOString(),
66
+ endDate: end.toISOString()
67
+ };
68
+ }
69
+ function getTimeRangeLabel(range) {
70
+ switch (range) {
71
+ case "1h":
72
+ return "Last 1 hour";
73
+ case "24h":
74
+ return "Last 24 hours";
75
+ case "7d":
76
+ return "Last 7 days";
77
+ case "30d":
78
+ return "Last 30 days";
79
+ }
80
+ }
81
+ function formatBucketTime(timestamp, granularity) {
82
+ const date = new Date(timestamp);
83
+ if (granularity === "hour") {
84
+ return date.toLocaleTimeString("en-US", {
85
+ hour: "2-digit",
86
+ minute: "2-digit",
87
+ hour12: false
88
+ });
89
+ }
90
+ return date.toLocaleDateString("en-US", {
91
+ month: "short",
92
+ day: "numeric"
93
+ });
94
+ }
95
+
96
+ export { formatBucketTime, getTimeRangeDates, getTimeRangeLabel, observabilityKeys, useErrorTrends };
@@ -1,10 +1,11 @@
1
+ import { getTimeRangeDates, observabilityKeys } from './chunk-6HZAMY6T.js';
1
2
  import { useSupabase } from './chunk-JGJSZ3UE.js';
2
3
  import { useNotificationAdapter } from './chunk-TIRMFDM4.js';
3
4
  import { useStableAccessToken } from './chunk-FWZJH3TL.js';
4
5
  import { useElevasisServices } from './chunk-KA7LO7U5.js';
5
- import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
6
+ import { useQuery, useQueryClient, useMutation, useQueries } from '@tanstack/react-query';
6
7
  import { z } from 'zod';
7
- import { useCallback, useState, useEffect, useMemo, useId, useRef } from 'react';
8
+ import { useCallback, useMemo, useState, useEffect, useId, useRef } from 'react';
8
9
 
9
10
  function useCommandQueue({
10
11
  status,
@@ -826,30 +827,6 @@ z.object({
826
827
  ).optional()
827
828
  });
828
829
 
829
- // ../core/src/operations/observability/utils.ts
830
- function getTimeRangeDates(range) {
831
- const end = /* @__PURE__ */ new Date();
832
- const start = /* @__PURE__ */ new Date();
833
- switch (range) {
834
- case "1h":
835
- start.setHours(start.getHours() - 1);
836
- break;
837
- case "24h":
838
- start.setHours(start.getHours() - 24);
839
- break;
840
- case "7d":
841
- start.setDate(start.getDate() - 7);
842
- break;
843
- case "30d":
844
- start.setDate(start.getDate() - 30);
845
- break;
846
- }
847
- return {
848
- startDate: start.toISOString(),
849
- endDate: end.toISOString()
850
- };
851
- }
852
-
853
830
  // src/hooks/monitoring/useCostSummary.ts
854
831
  function useCostSummary(timeRange) {
855
832
  const { apiRequest, isReady, organizationId } = useElevasisServices();
@@ -969,33 +946,6 @@ function useBatchDelete(tableName, invalidateQueryKeys) {
969
946
  }
970
947
  });
971
948
  }
972
-
973
- // src/hooks/observability/queryKeys.ts
974
- var observabilityKeys = {
975
- all: ["observability"],
976
- // Error analysis
977
- errorAnalysis: (organizationId, timeRange) => [...observabilityKeys.all, "error-analysis", organizationId, timeRange],
978
- // Error details list
979
- errorDetails: (organizationId, filters) => [...observabilityKeys.all, "error-details", organizationId, filters],
980
- // Single execution error detail
981
- errorDetail: (organizationId, executionId) => [...observabilityKeys.all, "error-detail", organizationId, executionId],
982
- // Error trends time-series
983
- errorTrends: (organizationId, startDate, endDate, granularity) => [...observabilityKeys.all, "error-trends", organizationId, startDate, endDate, granularity],
984
- // Error distribution breakdown
985
- errorDistribution: (organizationId, startDate, endDate, groupBy) => [...observabilityKeys.all, "error-distribution", organizationId, startDate, endDate, groupBy],
986
- // Top failing resources
987
- topFailingResources: (organizationId, startDate, endDate, limit) => [...observabilityKeys.all, "top-failing-resources", organizationId, startDate, endDate, limit],
988
- // Cost trends time-series
989
- costTrends: (organizationId, timeRange, granularity) => [...observabilityKeys.all, "cost-trends", organizationId, timeRange, granularity],
990
- // Cost by model breakdown
991
- costByModel: (organizationId, timeRange) => [...observabilityKeys.all, "cost-by-model", organizationId, timeRange],
992
- // Cost breakdown per resource/model
993
- costBreakdown: (organizationId, timeRange) => [...observabilityKeys.all, "cost-breakdown", organizationId, timeRange],
994
- // Composite dashboard metrics
995
- dashboardMetrics: (organizationId, timeRange) => [...observabilityKeys.all, "dashboard-metrics", organizationId, timeRange],
996
- // Business impact / automation ROI
997
- businessImpact: (organizationId, timeRange) => [...observabilityKeys.all, "business-impact", organizationId, timeRange]
998
- };
999
949
  function useErrorAnalysis(timeRange) {
1000
950
  const { apiRequest, isReady, organizationId } = useElevasisServices();
1001
951
  return useQuery({
@@ -1044,19 +994,6 @@ function useErrorDetail(executionId) {
1044
994
  staleTime: 3e4
1045
995
  });
1046
996
  }
1047
- function useErrorTrends({ startDate, endDate, granularity }) {
1048
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1049
- return useQuery({
1050
- queryKey: observabilityKeys.errorTrends(organizationId, startDate, endDate, granularity),
1051
- queryFn: async () => {
1052
- const params = new URLSearchParams({ startDate, endDate, granularity });
1053
- return apiRequest(`/observability/error-analytics/trends?${params.toString()}`);
1054
- },
1055
- enabled: isReady,
1056
- refetchInterval: 6e4,
1057
- staleTime: 3e4
1058
- });
1059
- }
1060
997
  function useErrorDistribution({ startDate, endDate, groupBy }) {
1061
998
  const { apiRequest, isReady, organizationId } = useElevasisServices();
1062
999
  return useQuery({
@@ -1196,6 +1133,79 @@ function useBusinessImpact(timeRange) {
1196
1133
  refetchInterval: 6e4
1197
1134
  });
1198
1135
  }
1136
+ function useResourcesHealth(params) {
1137
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1138
+ const resourcesKey = params.resources.map((r) => `${r.entityType}-${r.entityId}`).join(",");
1139
+ return useQuery({
1140
+ queryKey: observabilityKeys.resourcesHealth(
1141
+ organizationId,
1142
+ resourcesKey,
1143
+ params.startDate,
1144
+ params.endDate,
1145
+ params.granularity
1146
+ ),
1147
+ queryFn: async () => {
1148
+ return apiRequest("/observability/resources-health", {
1149
+ method: "POST",
1150
+ body: JSON.stringify({
1151
+ resources: params.resources,
1152
+ startDate: params.startDate,
1153
+ endDate: params.endDate,
1154
+ granularity: params.granularity
1155
+ })
1156
+ });
1157
+ },
1158
+ enabled: isReady && params.resources.length > 0,
1159
+ staleTime: 3e4
1160
+ });
1161
+ }
1162
+ var BATCH_SIZE = 20;
1163
+ function useBatchedResourcesHealth(params) {
1164
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
1165
+ const batches = useMemo(() => {
1166
+ const result = [];
1167
+ for (let i = 0; i < params.resources.length; i += BATCH_SIZE) {
1168
+ result.push(params.resources.slice(i, i + BATCH_SIZE));
1169
+ }
1170
+ return result;
1171
+ }, [params.resources]);
1172
+ const queryResults = useQueries({
1173
+ queries: batches.map((batch) => ({
1174
+ queryKey: observabilityKeys.resourcesHealth(
1175
+ organizationId,
1176
+ batch.map((r) => `${r.entityType}-${r.entityId}`).join(","),
1177
+ params.startDate,
1178
+ params.endDate,
1179
+ params.granularity
1180
+ ),
1181
+ queryFn: async () => {
1182
+ return await apiRequest("/observability/resources-health", {
1183
+ method: "POST",
1184
+ body: JSON.stringify({
1185
+ resources: batch,
1186
+ startDate: params.startDate,
1187
+ endDate: params.endDate,
1188
+ granularity: params.granularity
1189
+ })
1190
+ });
1191
+ },
1192
+ enabled: isReady && batch.length > 0,
1193
+ staleTime: 3e4
1194
+ }))
1195
+ });
1196
+ const healthLookup = useMemo(() => {
1197
+ const map = /* @__PURE__ */ new Map();
1198
+ for (const result of queryResults) {
1199
+ if (result.data?.resources) {
1200
+ for (const r of result.data.resources) {
1201
+ map.set(`${r.entityType}-${r.entityId}`, r);
1202
+ }
1203
+ }
1204
+ }
1205
+ return map;
1206
+ }, [queryResults]);
1207
+ return { healthLookup };
1208
+ }
1199
1209
 
1200
1210
  // src/hooks/scheduling/queryKeys.ts
1201
1211
  var scheduleKeys = {
@@ -1583,4 +1593,4 @@ function useSSEConnection({
1583
1593
  return { connected, error };
1584
1594
  }
1585
1595
 
1586
- export { ExecutionIdParamsSchema, OperationsService, SessionIdParamSchema, WebSocketSessionTurnSchema, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCommandQueue, useCommandQueueTotals, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useDeleteTask, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
1596
+ export { ExecutionIdParamsSchema, OperationsService, SessionIdParamSchema, WebSocketSessionTurnSchema, createUseFeatureAccess, executionsKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCommandQueue, useCommandQueueTotals, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useDeleteTask, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResourcesHealth, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
@@ -0,0 +1,48 @@
1
+ // ../core/src/execution/engine/workflow/logging.ts
2
+ function isStepStartedContext(ctx) {
3
+ return ctx.contextType === "step-started" || "stepStatus" in ctx && ctx.stepStatus === "started";
4
+ }
5
+ function isStepCompletedContext(ctx) {
6
+ return ctx.contextType === "step-completed" || "stepStatus" in ctx && ctx.stepStatus === "completed";
7
+ }
8
+ function isStepFailedContext(ctx) {
9
+ return ctx.contextType === "step-failed" || "stepStatus" in ctx && ctx.stepStatus === "failed";
10
+ }
11
+ function isConditionalRouteContext(ctx) {
12
+ return ctx.contextType === "conditional-route" || "target" in ctx && "stepId" in ctx && !("stepStatus" in ctx);
13
+ }
14
+ function toWorkflowLogMessage(log) {
15
+ if (log.context?.type === "workflow") {
16
+ return {
17
+ level: log.level,
18
+ message: log.message,
19
+ timestamp: log.timestamp,
20
+ context: log.context
21
+ };
22
+ }
23
+ return {
24
+ level: log.level,
25
+ message: log.message,
26
+ timestamp: log.timestamp,
27
+ context: log.context
28
+ };
29
+ }
30
+
31
+ // ../core/src/execution/engine/agent/observability/logging.ts
32
+ function isLifecycleEvent(ctx) {
33
+ return "stage" in ctx && ctx.stage !== void 0;
34
+ }
35
+ function isIterationEvent(ctx) {
36
+ return "eventType" in ctx && ctx.eventType !== void 0;
37
+ }
38
+ function isToolCallEvent(ctx) {
39
+ return "eventType" in ctx && ctx.eventType === "tool-call";
40
+ }
41
+
42
+ // ../core/src/execution/engine/base/types.ts
43
+ var ResourceStatusColors = {
44
+ dev: "var(--color-primary)",
45
+ prod: "var(--color-success)"
46
+ };
47
+
48
+ export { ResourceStatusColors, isConditionalRouteContext, isIterationEvent, isLifecycleEvent, isStepCompletedContext, isStepFailedContext, isStepStartedContext, isToolCallEvent, toWorkflowLogMessage };
@@ -1339,6 +1339,13 @@ interface ResourceHealthChartProps {
1339
1339
  */
1340
1340
  declare function ResourceHealthChart({ healthData, hasExecutions, width, height }: ResourceHealthChartProps): react_jsx_runtime.JSX.Element;
1341
1341
 
1342
+ interface ResourceHealthPanelProps {
1343
+ resourceId: string;
1344
+ resourceType: ResourceType;
1345
+ timeRange: TimeRange;
1346
+ }
1347
+ declare function ResourceHealthPanel({ resourceId, resourceType, timeRange }: ResourceHealthPanelProps): react_jsx_runtime.JSX.Element;
1348
+
1342
1349
  interface NotificationBellProps {
1343
1350
  /** Override unread count (e.g., from SSE-enhanced source) */
1344
1351
  unreadCount?: number;
@@ -2043,5 +2050,5 @@ declare const showWarningNotification: (message: string) => void;
2043
2050
  */
2044
2051
  declare const showApiErrorNotification: (error: unknown) => void;
2045
2052
 
2046
- export { APIErrorAlert, ActionModal, AgentDefinitionDisplay, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, CONTAINER_CONSTANTS, CardHeader, CollapsibleJsonSection, CollapsibleSection, ConfigCard, ConfirmationInputModal, ConfirmationModal, ContentSections, ContextViewer, ContractDisplay, CustomModal, CustomSelector, DetailCardSkeleton, ElevasisLoader, EmptyState, EmptyVisualizer, ExecutionLogsTable, ExecutionStats, ExecutionStatusBadge, FilterBar, FormFieldRenderer, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, JsonViewer, ListSkeleton, NavigationButton, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, NotificationBell, NotificationItem, NotificationList, NotificationPanel, PageNotFound, PageTitleCaption, ResourceCard, ResourceDefinitionSection, ResourceHealthChart, SHARED_VIZ_CONSTANTS, SortableHeader, StatCard, StatCardSkeleton, StatsCardSkeleton, StyledMarkdown, TabCountBadge, TableSelectionToolbar, TaskCard, TimeRangeSelector, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, ToolsListDisplay, TrendIndicator, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WorkflowDefinitionDisplay, WorkflowExecutionTimeline, catalogItemToResourceDefinition, getGraphBackgroundStyles, getHealthColor, getIcon, iconMap, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, useGraphBackgroundStyles, useGraphTheme, useNewKnowledgeMapLayout };
2047
- export type { BaseEdgeProps, ContextViewerProps, ExecutionLogEntry, ExecutionLogsTableProps, FitViewButtonVariant, GraphFitViewHandlerProps, JsonViewerProps, KnowledgeMapEdgeData, KnowledgeMapNodeData, NavigationButtonProps, SerializedKnowledgeMap, SerializedKnowledgeNode, StatCardProps, StyledMarkdownProps, TrendIndicatorProps };
2053
+ export { APIErrorAlert, ActionModal, AgentDefinitionDisplay, AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, CONTAINER_CONSTANTS, CardHeader, CollapsibleJsonSection, CollapsibleSection, ConfigCard, ConfirmationInputModal, ConfirmationModal, ContentSections, ContextViewer, ContractDisplay, CustomModal, CustomSelector, DetailCardSkeleton, ElevasisLoader, EmptyState, EmptyVisualizer, ExecutionLogsTable, ExecutionStats, ExecutionStatusBadge, FilterBar, FormFieldRenderer, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, JsonViewer, ListSkeleton, NavigationButton, NewKnowledgeMapEdge, NewKnowledgeMapGraph, NewKnowledgeMapNode, NotificationBell, NotificationItem, NotificationList, NotificationPanel, PageNotFound, PageTitleCaption, ResourceCard, ResourceDefinitionSection, ResourceHealthChart, ResourceHealthPanel, SHARED_VIZ_CONSTANTS, SortableHeader, StatCard, StatCardSkeleton, StatsCardSkeleton, StyledMarkdown, TabCountBadge, TableSelectionToolbar, TaskCard, TimeRangeSelector, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, ToolsListDisplay, TrendIndicator, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, VisualizerContainer, WorkflowDefinitionDisplay, WorkflowExecutionTimeline, catalogItemToResourceDefinition, getGraphBackgroundStyles, getHealthColor, getIcon, iconMap, showApiErrorNotification, showErrorNotification, showInfoNotification, showSuccessNotification, showWarningNotification, useGraphBackgroundStyles, useGraphTheme, useNewKnowledgeMapLayout };
2054
+ export type { BaseEdgeProps, ContextViewerProps, ExecutionLogEntry, ExecutionLogsTableProps, FitViewButtonVariant, GraphFitViewHandlerProps, JsonViewerProps, KnowledgeMapEdgeData, KnowledgeMapNodeData, NavigationButtonProps, ResourceHealthPanelProps, SerializedKnowledgeMap, SerializedKnowledgeNode, StatCardProps, StyledMarkdownProps, TrendIndicatorProps };