@skyhook-io/radar-app 1.22.2 → 1.23.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/package.json +8 -8
- package/src/App.tsx +49 -13
- package/src/RadarApp.basename.test.tsx +177 -0
- package/src/RadarApp.settings.test.tsx +33 -0
- package/src/api/agentSandbox.ts +259 -0
- package/src/api/client.autoPromConnect.test.tsx +43 -0
- package/src/api/client.metricsRelayCheck.test.tsx +134 -0
- package/src/api/client.ts +151 -27
- package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
- package/src/api/cloudInstallDiscover.test.tsx +76 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/kagent.test.ts +82 -0
- package/src/api/kagent.ts +230 -0
- package/src/api/poll.ts +78 -0
- package/src/api/prometheusCharts.ts +5 -0
- package/src/api/radarFeatures.test.ts +9 -0
- package/src/api/radarFeatures.ts +16 -0
- package/src/api/substrateWorkspace.test.ts +72 -0
- package/src/api/substrateWorkspace.ts +1394 -0
- package/src/api/vulnerabilities.ts +207 -9
- package/src/api/workloadSource.test.tsx +315 -0
- package/src/api/workloadSource.ts +128 -12
- package/src/components/CloudConnectFlow.tsx +46 -7
- package/src/components/CloudFunnelButton.test.tsx +193 -7
- package/src/components/CloudFunnelButton.tsx +128 -32
- package/src/components/SelfManagedStart.tsx +12 -2
- package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
- package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
- package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
- package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
- package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
- package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
- package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
- package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
- package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
- package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
- package/src/components/agentsandbox/data.ts +135 -0
- package/src/components/agentsandbox/host.test.ts +27 -0
- package/src/components/agentsandbox/host.tsx +85 -0
- package/src/components/agentsandbox/labels.test.ts +42 -0
- package/src/components/agentsandbox/labels.ts +146 -0
- package/src/components/agentsandbox/listFilters.ts +85 -0
- package/src/components/agentsandbox/lists.ts +52 -0
- package/src/components/agentsandbox/routes.ts +23 -0
- package/src/components/agentsandbox/shared.tsx +321 -0
- package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
- package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
- package/src/components/agentsandbox/workspace.tsx +258 -0
- package/src/components/agentsandbox/workspaceRoute.ts +18 -0
- package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
- package/src/components/applications/ApplicationsView.tsx +156 -3
- package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
- package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
- package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
- package/src/components/audit/VulnerabilitiesView.tsx +639 -199
- package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
- package/src/components/cloudHints/CloudHintLink.tsx +29 -0
- package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
- package/src/components/cloudHints/cloudHints.test.ts +126 -0
- package/src/components/cloudHints/cloudHints.ts +131 -0
- package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
- package/src/components/cloudHints/cloudLinks.test.ts +52 -0
- package/src/components/cloudHints/cloudLinks.ts +31 -0
- package/src/components/cloudHints/hintStorage.ts +28 -0
- package/src/components/cnpg/CNPGView.tsx +4 -7
- package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
- package/src/components/diagnose/DiagnoseContext.tsx +7 -0
- package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
- package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
- package/src/components/helm/HelmView.tsx +4 -3
- package/src/components/helm/ObservedHelmNotice.tsx +39 -17
- package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
- package/src/components/home/HomeAgentBlock.tsx +2 -0
- package/src/components/home/HomeView.tsx +3 -3
- package/src/components/home/MCPSetupDialog.test.tsx +9 -0
- package/src/components/home/MCPSetupDialog.tsx +6 -2
- package/src/components/home/McpCloudLine.test.tsx +162 -0
- package/src/components/home/McpCloudLine.tsx +95 -0
- package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
- package/src/components/home/mcpToolCatalog.test.ts +10 -0
- package/src/components/home/mcpToolCatalog.ts +4 -4
- package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
- package/src/components/issues/IssuesPane.render.test.tsx +36 -1
- package/src/components/issues/IssuesPane.tsx +181 -23
- package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
- package/src/components/issues/SinceLastVisitRow.tsx +71 -0
- package/src/components/issues/sinceLastVisit.test.ts +266 -0
- package/src/components/issues/sinceLastVisit.ts +439 -0
- package/src/components/issues/uncheckedSources.test.ts +8 -0
- package/src/components/issues/uncheckedSources.ts +3 -0
- package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
- package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
- package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
- package/src/components/kagent/KagentAgentSessions.tsx +124 -0
- package/src/components/kagent/KagentDetailPage.tsx +106 -0
- package/src/components/kagent/KagentLists.tsx +412 -0
- package/src/components/kagent/KagentOverview.tsx +234 -0
- package/src/components/kagent/KagentPages.tsx +690 -0
- package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
- package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
- package/src/components/kagent/KagentSidebar.test.tsx +112 -0
- package/src/components/kagent/KagentView.tsx +109 -0
- package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
- package/src/components/kagent/host.tsx +144 -0
- package/src/components/kagent/routes.ts +31 -0
- package/src/components/kagent/shared.tsx +336 -0
- package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
- package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
- package/src/components/kagent/workspace.fixtures.ts +108 -0
- package/src/components/kagent/workspaceRoute.ts +18 -0
- package/src/components/nudges/activeNudges.test.ts +39 -0
- package/src/components/nudges/activeNudges.ts +76 -0
- package/src/components/poll/OssPoll.tsx +871 -0
- package/src/components/poll/mount.test.ts +12 -0
- package/src/components/poll/pollCloud.test.ts +23 -0
- package/src/components/poll/pollCloud.ts +6 -0
- package/src/components/poll/pollDefinition.ts +93 -0
- package/src/components/poll/pollFlow.test.ts +140 -0
- package/src/components/poll/pollFlow.ts +137 -0
- package/src/components/poll/pollSender.test.ts +137 -0
- package/src/components/poll/pollSender.ts +76 -0
- package/src/components/poll/pollStorage.test.ts +53 -0
- package/src/components/poll/pollStorage.ts +77 -0
- package/src/components/poll/round.json +350 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
- package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
- package/src/components/resource/MetricsNotConnected.tsx +10 -7
- package/src/components/resource/PrometheusCharts.tsx +10 -1
- package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
- package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
- package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
- package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
- package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
- package/src/components/resources/ImageFilesystemModal.tsx +42 -3
- package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
- package/src/components/resources/ResourcesView.tsx +24 -11
- package/src/components/resources/renderers/PodRenderer.tsx +8 -2
- package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
- package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
- package/src/components/settings/SettingsDialog.tsx +84 -16
- package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
- package/src/components/settings/SubstrateSettings.test.tsx +131 -0
- package/src/components/settings/SubstrateSettings.tsx +544 -0
- package/src/components/settings/settings-state.test.ts +21 -3
- package/src/components/settings/settings-state.ts +13 -3
- package/src/components/share/ShareLinkButton.test.tsx +360 -0
- package/src/components/share/ShareLinkButton.tsx +391 -0
- package/src/components/share/openShareInCloud.test.ts +29 -0
- package/src/components/share/openShareInCloud.ts +10 -0
- package/src/components/share/shareLink.test.ts +129 -0
- package/src/components/share/shareLink.ts +175 -0
- package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
- package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
- package/src/components/substrate/SubstrateActorPage.tsx +384 -0
- package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
- package/src/components/substrate/SubstrateActors.tsx +612 -0
- package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
- package/src/components/substrate/SubstrateConnect.tsx +88 -0
- package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
- package/src/components/substrate/SubstrateOverview.tsx +575 -0
- package/src/components/substrate/SubstratePages.test.tsx +478 -0
- package/src/components/substrate/SubstratePool.test.tsx +462 -0
- package/src/components/substrate/SubstratePoolPage.tsx +95 -0
- package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
- package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
- package/src/components/substrate/SubstrateStateBar.tsx +63 -0
- package/src/components/substrate/SubstrateTemplates.tsx +376 -0
- package/src/components/substrate/SubstrateView.tsx +173 -0
- package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
- package/src/components/substrate/SubstrateWorkers.tsx +389 -0
- package/src/components/substrate/attention.ts +81 -0
- package/src/components/substrate/contextPin.tsx +69 -0
- package/src/components/substrate/host.tsx +83 -0
- package/src/components/substrate/kubectlTarget.test.tsx +77 -0
- package/src/components/substrate/readings.test.ts +484 -0
- package/src/components/substrate/readings.ts +997 -0
- package/src/components/substrate/routes.ts +103 -0
- package/src/components/substrate/shared.tsx +426 -0
- package/src/components/substrate/substrate.fixtures.ts +325 -0
- package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
- package/src/components/substrate/workspaceRoute.ts +23 -0
- package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
- package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
- package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
- package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
- package/src/components/traffic/TrafficFlowList.tsx +9 -5
- package/src/components/traffic/TrafficGraph.test.tsx +26 -0
- package/src/components/traffic/TrafficGraph.tsx +17 -14
- package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
- package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
- package/src/components/traffic/TrafficView.tsx +26 -56
- package/src/components/traffic/trafficFilters.test.ts +61 -1
- package/src/components/traffic/trafficFilters.ts +68 -8
- package/src/components/ui/UpdateNotification.tsx +2 -0
- package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
- package/src/components/velero/VeleroOverview.tsx +2 -2
- package/src/components/velero/VeleroView.tsx +3 -6
- package/src/components/vulnerabilities/columns.tsx +132 -0
- package/src/components/vulnerabilities/filters.tsx +317 -0
- package/src/components/vulnerabilities/owner.test.ts +54 -0
- package/src/components/vulnerabilities/owner.tsx +163 -0
- package/src/components/vulnerabilities/parts.test.ts +126 -12
- package/src/components/vulnerabilities/parts.tsx +612 -52
- package/src/components/vulnerabilities/traffic.test.tsx +65 -0
- package/src/components/vulnerabilities/traffic.tsx +40 -0
- package/src/components/whats-new/WhatsNew.tsx +2 -0
- package/src/components/whats-new/releaseNotes.ts +75 -1
- package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
- package/src/components/workload/WorkloadView.tsx +52 -13
- package/src/components/workspace/layout.tsx +13 -7
- package/src/components/workspace/sidebar.test.ts +48 -0
- package/src/components/workspace/sidebar.ts +73 -3
- package/src/components/workspace/table.ts +2 -1
- package/src/contexts/RegistryAccessMode.test.tsx +51 -0
- package/src/contexts/RegistryAccessMode.tsx +25 -0
- package/src/integrations/resourceHost.ts +12 -6
- package/src/integrations/resourceHosts.test.tsx +27 -1
- package/src/integrations/resourceHosts.tsx +15 -7
- package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
- package/src/integrations/sidebarWorkspaces.ts +41 -0
- package/src/integrations/workspaceRoute.ts +1 -1
- package/src/integrations/workspaceRoutes.ts +7 -1
- package/src/integrations/workspaceScreens.tsx +6 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
|
2
|
+
import type { HealthLevel } from '@skyhook-io/k8s-ui'
|
|
3
|
+
import { fetchJSON, isStillLoadingError, useClusterInfo, useRadarFeature } from './client'
|
|
4
|
+
import { getApiBase } from './config'
|
|
5
|
+
import { shouldRetryRadarQuery } from './radarFeatures'
|
|
6
|
+
import type { WorkspaceKindCoverage } from '../components/workspace/coverage'
|
|
7
|
+
import type {
|
|
8
|
+
KagentAgentSessions,
|
|
9
|
+
SubstrateAPITier,
|
|
10
|
+
SubstrateCoverage,
|
|
11
|
+
SubstratePoolRef,
|
|
12
|
+
SubstrateRef,
|
|
13
|
+
} from './substrateWorkspace'
|
|
14
|
+
|
|
15
|
+
export interface KagentRef {
|
|
16
|
+
group: string
|
|
17
|
+
kind: string
|
|
18
|
+
namespace: string
|
|
19
|
+
name: string
|
|
20
|
+
}
|
|
21
|
+
export interface KagentReading {
|
|
22
|
+
state: string
|
|
23
|
+
tone: HealthLevel
|
|
24
|
+
text: string
|
|
25
|
+
summary: string
|
|
26
|
+
condition?: string
|
|
27
|
+
reason?: string
|
|
28
|
+
message?: string
|
|
29
|
+
since?: string
|
|
30
|
+
egress?: string
|
|
31
|
+
}
|
|
32
|
+
export interface KagentDependency {
|
|
33
|
+
ref: KagentRef
|
|
34
|
+
state: string
|
|
35
|
+
unread?: string
|
|
36
|
+
reading?: KagentReading
|
|
37
|
+
}
|
|
38
|
+
export interface KagentReference {
|
|
39
|
+
role: string
|
|
40
|
+
target: KagentRef
|
|
41
|
+
from: KagentRef
|
|
42
|
+
field: string
|
|
43
|
+
state: string
|
|
44
|
+
unread?: string
|
|
45
|
+
reading?: KagentReading
|
|
46
|
+
policyUnknown?: boolean
|
|
47
|
+
tools?: string[]
|
|
48
|
+
key?: string
|
|
49
|
+
fallback?: boolean
|
|
50
|
+
}
|
|
51
|
+
export interface KagentToolAsk {
|
|
52
|
+
server: KagentRef
|
|
53
|
+
tool: string
|
|
54
|
+
agents?: KagentRef[]
|
|
55
|
+
}
|
|
56
|
+
export interface KagentAgent {
|
|
57
|
+
ref: KagentRef
|
|
58
|
+
reading: KagentReading
|
|
59
|
+
latestChange: { state: string; message?: string }
|
|
60
|
+
newSessionsRevision?: string
|
|
61
|
+
desiredRevision?: string
|
|
62
|
+
created?: string
|
|
63
|
+
description?: string
|
|
64
|
+
inlineTemplate: boolean
|
|
65
|
+
harnessType?: string
|
|
66
|
+
model?: KagentDependency
|
|
67
|
+
mcpServers: { declared: number; failing: number; absent: number; unread: number; notPermitted: number }
|
|
68
|
+
references: KagentReference[]
|
|
69
|
+
toolsNotOffered?: KagentToolAsk[]
|
|
70
|
+
incomplete?: boolean
|
|
71
|
+
cycle?: string[]
|
|
72
|
+
}
|
|
73
|
+
export interface KagentAffected {
|
|
74
|
+
agent: KagentRef
|
|
75
|
+
effect: 'blocked' | 'mayRunWithoutTools' | 'usesIt'
|
|
76
|
+
roles: string[]
|
|
77
|
+
through?: string[]
|
|
78
|
+
}
|
|
79
|
+
export interface KagentImpact {
|
|
80
|
+
agents: KagentAffected[]
|
|
81
|
+
count: number
|
|
82
|
+
lowerBound: boolean
|
|
83
|
+
consumers: 'seen' | 'none' | 'noneSeen'
|
|
84
|
+
byRole?: Record<string, number>
|
|
85
|
+
}
|
|
86
|
+
export interface KagentFinding {
|
|
87
|
+
id: string
|
|
88
|
+
subject: KagentRef
|
|
89
|
+
severity: 'critical' | 'warning'
|
|
90
|
+
reason: string
|
|
91
|
+
kagentReason?: string
|
|
92
|
+
message: string
|
|
93
|
+
action: string
|
|
94
|
+
since?: string
|
|
95
|
+
secret?: KagentRef
|
|
96
|
+
cause?: { target: KagentRef; role: string; form: string }
|
|
97
|
+
affects?: KagentImpact
|
|
98
|
+
}
|
|
99
|
+
export interface KagentGroup {
|
|
100
|
+
id: string
|
|
101
|
+
severity: 'critical' | 'warning'
|
|
102
|
+
secret?: KagentRef
|
|
103
|
+
findings: string[]
|
|
104
|
+
folded?: { finding: string; under: string }[]
|
|
105
|
+
}
|
|
106
|
+
export interface KagentMCPServer {
|
|
107
|
+
ref: KagentRef
|
|
108
|
+
reading: KagentReading
|
|
109
|
+
url?: string
|
|
110
|
+
protocol?: string
|
|
111
|
+
toolsOffered: string[]
|
|
112
|
+
toolsOfferedKnown: boolean
|
|
113
|
+
failing: boolean
|
|
114
|
+
headers?: { name: string; from?: KagentRef; key?: string; inline?: boolean }[]
|
|
115
|
+
usedBy: KagentImpact
|
|
116
|
+
askedNotOffered?: KagentToolAsk[]
|
|
117
|
+
}
|
|
118
|
+
export interface KagentCredential {
|
|
119
|
+
mode: string
|
|
120
|
+
secret?: KagentRef
|
|
121
|
+
key?: string
|
|
122
|
+
}
|
|
123
|
+
export interface KagentModel {
|
|
124
|
+
ref: KagentRef
|
|
125
|
+
reading: KagentReading
|
|
126
|
+
provider?: string
|
|
127
|
+
model?: string
|
|
128
|
+
credential: KagentCredential
|
|
129
|
+
usedBy: KagentImpact
|
|
130
|
+
}
|
|
131
|
+
export interface KagentCount {
|
|
132
|
+
n: number
|
|
133
|
+
lowerBound: boolean
|
|
134
|
+
}
|
|
135
|
+
export type KagentCoverageKey =
|
|
136
|
+
'agents' | 'agentTemplates' | 'harnesses' | 'models' | 'mcpServers' | 'egressPolicies' | 'modelProviders' | 'sandboxTemplates'
|
|
137
|
+
export interface KagentWorkspace {
|
|
138
|
+
context: string
|
|
139
|
+
installed: boolean
|
|
140
|
+
namespaces: string[]
|
|
141
|
+
forcedNamespace?: string
|
|
142
|
+
coverage: Record<KagentCoverageKey, WorkspaceKindCoverage>
|
|
143
|
+
referenceCoverage: Record<KagentCoverageKey, WorkspaceKindCoverage>
|
|
144
|
+
agents: KagentAgent[]
|
|
145
|
+
models: KagentModel[]
|
|
146
|
+
mcpServers: KagentMCPServer[]
|
|
147
|
+
modelProviders: { ref: KagentRef; reading: KagentReading; provider?: string }[]
|
|
148
|
+
findings: KagentFinding[]
|
|
149
|
+
groups: KagentGroup[]
|
|
150
|
+
counts: Record<
|
|
151
|
+
'findings' | 'critical' | 'agents' | 'agentsAffected' | 'mcpServers' | 'mcpServersFailing' | 'models' | 'modelsWithProblems',
|
|
152
|
+
KagentCount
|
|
153
|
+
> & { groups: { n: number; incomplete: boolean }; agentsByLatestChange: Record<string, number> }
|
|
154
|
+
}
|
|
155
|
+
export interface KagentSessionRow extends Pick<
|
|
156
|
+
KagentAgentSessions,
|
|
157
|
+
| 'agent'
|
|
158
|
+
| 'revisions'
|
|
159
|
+
| 'sessions'
|
|
160
|
+
| 'onEarlierRevisions'
|
|
161
|
+
| 'complete'
|
|
162
|
+
| 'needAttention'
|
|
163
|
+
| 'attention'
|
|
164
|
+
| 'hintedEarlierRevisions'
|
|
165
|
+
| 'hintShared'
|
|
166
|
+
> {
|
|
167
|
+
crashed: number
|
|
168
|
+
onNewSessionsRevision: number
|
|
169
|
+
onOtherRevisions: number
|
|
170
|
+
placement: {
|
|
171
|
+
state: 'unknown' | 'mayFit' | 'noActiveWorkers' | 'full' | 'noRoom'
|
|
172
|
+
reading: string
|
|
173
|
+
template?: SubstrateRef
|
|
174
|
+
pools: SubstratePoolRef[]
|
|
175
|
+
complete: boolean
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export interface KagentSessionSummary {
|
|
179
|
+
apiTier: SubstrateAPITier
|
|
180
|
+
coverage: {
|
|
181
|
+
actors: SubstrateCoverage
|
|
182
|
+
templates: SubstrateCoverage
|
|
183
|
+
workers: SubstrateCoverage
|
|
184
|
+
atespaces: SubstrateCoverage
|
|
185
|
+
}
|
|
186
|
+
rows: KagentSessionRow[]
|
|
187
|
+
total: number
|
|
188
|
+
lowerBound: boolean
|
|
189
|
+
limit: number
|
|
190
|
+
offset: number
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function useKagentWorkspace(namespaces: string[], enabled = true) {
|
|
194
|
+
const feature = useRadarFeature('kagentWorkspace')
|
|
195
|
+
const { data: cluster } = useClusterInfo()
|
|
196
|
+
const params = new URLSearchParams()
|
|
197
|
+
if (namespaces.length) params.set('namespaces', [...namespaces].sort().join(','))
|
|
198
|
+
return useQuery<KagentWorkspace>({
|
|
199
|
+
queryKey: ['kagent', 'workspace', getApiBase(), cluster?.context, params.toString(), ...feature.gatedKey],
|
|
200
|
+
queryFn: ({ signal }) => feature.guard(() => fetchJSON<KagentWorkspace>(`/kagent/workspace?${params}`, signal)),
|
|
201
|
+
enabled: enabled && feature.support === 'supported',
|
|
202
|
+
staleTime: 10_000,
|
|
203
|
+
refetchInterval: 30_000,
|
|
204
|
+
retry: (count, error) => isStillLoadingError(error) || shouldRetryRadarQuery(count, error),
|
|
205
|
+
retryDelay: (count, error) => isStillLoadingError(error) ? 2000 : Math.min(1000 * 2 ** count, 30_000),
|
|
206
|
+
})
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function useKagentSessionSummary(namespaces: string[], enabled = true) {
|
|
210
|
+
const feature = useRadarFeature('kagentWorkspace')
|
|
211
|
+
const { data: cluster } = useClusterInfo()
|
|
212
|
+
const scope = [...namespaces].sort().join(',')
|
|
213
|
+
return useInfiniteQuery({
|
|
214
|
+
queryKey: ['substrate', getApiBase(), cluster?.context, 'kagent-summary', scope, ...feature.gatedKey],
|
|
215
|
+
initialPageParam: 0,
|
|
216
|
+
queryFn: ({ signal, pageParam }) =>
|
|
217
|
+
feature.guard(() =>
|
|
218
|
+
fetchJSON<KagentSessionSummary>(
|
|
219
|
+
`/substrate/kagent/summary?${new URLSearchParams({ namespaces: scope, offset: String(pageParam), limit: '1000' })}`,
|
|
220
|
+
signal,
|
|
221
|
+
),
|
|
222
|
+
),
|
|
223
|
+
getNextPageParam: (last) =>
|
|
224
|
+
last.offset + last.rows.length < last.total && last.rows.length > 0 ? last.offset + last.rows.length : undefined,
|
|
225
|
+
enabled: enabled && feature.support === 'supported',
|
|
226
|
+
staleTime: 5_000,
|
|
227
|
+
refetchInterval: 15_000,
|
|
228
|
+
retry: false,
|
|
229
|
+
})
|
|
230
|
+
}
|
package/src/api/poll.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query'
|
|
2
|
+
import { apiUrl, getAuthHeaders, getCredentialsMode } from './config'
|
|
3
|
+
import { CURRENT_ROUND, type PollAnswers } from '../components/poll/pollDefinition'
|
|
4
|
+
|
|
5
|
+
export interface PollStatus {
|
|
6
|
+
eligible: boolean
|
|
7
|
+
reason?: string
|
|
8
|
+
round: string
|
|
9
|
+
mode: 'local' | 'in-cluster' | 'cloud'
|
|
10
|
+
/** Whether the poll may offer a call. A shared Radar without sign-in never passes on an email. */
|
|
11
|
+
contactAllowed?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface PollSubmitResult {
|
|
15
|
+
answers: 'ok' | 'skipped'
|
|
16
|
+
contact: 'ok' | 'failed' | 'none'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class PollSubmitError extends Error {
|
|
20
|
+
constructor(message: string, readonly status: number) {
|
|
21
|
+
super(message)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function usePollStatus(enabled: boolean) {
|
|
26
|
+
return useQuery<PollStatus>({
|
|
27
|
+
queryKey: ['poll-status'],
|
|
28
|
+
queryFn: async () => {
|
|
29
|
+
const res = await fetch(apiUrl('/poll'), { credentials: getCredentialsMode(), headers: getAuthHeaders() })
|
|
30
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
|
31
|
+
return res.json()
|
|
32
|
+
},
|
|
33
|
+
enabled,
|
|
34
|
+
staleTime: Infinity,
|
|
35
|
+
retry: false,
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function post(path: string, body: unknown): Promise<Response> {
|
|
40
|
+
return fetch(apiUrl(path), {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
credentials: getCredentialsMode(),
|
|
43
|
+
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
|
|
44
|
+
body: JSON.stringify(body),
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function recordPollShown(): void {
|
|
49
|
+
void post('/poll/shown', {}).catch(() => {})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function dismissPoll(kind: 'snooze' | 'never'): void {
|
|
53
|
+
void post('/poll/dismiss', { kind }).catch(() => {})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function submitPoll(body: {
|
|
57
|
+
submissionId: string
|
|
58
|
+
seq?: number
|
|
59
|
+
complete?: boolean
|
|
60
|
+
answers: PollAnswers
|
|
61
|
+
email?: string
|
|
62
|
+
wantsCall?: boolean
|
|
63
|
+
contactOnly?: boolean
|
|
64
|
+
}): Promise<PollSubmitResult> {
|
|
65
|
+
let res: Response
|
|
66
|
+
try {
|
|
67
|
+
// The round this tab is showing, so a tab left open across an upgrade can't
|
|
68
|
+
// file its answers under a different round.
|
|
69
|
+
res = await post('/poll/submit', { round: CURRENT_ROUND.id, ...body })
|
|
70
|
+
} catch {
|
|
71
|
+
throw new PollSubmitError('network', 0)
|
|
72
|
+
}
|
|
73
|
+
if (!res.ok) {
|
|
74
|
+
const data = await res.json().catch(() => ({}))
|
|
75
|
+
throw new PollSubmitError(typeof data.error === 'string' ? data.error : `HTTP ${res.status}`, res.status)
|
|
76
|
+
}
|
|
77
|
+
return res.json()
|
|
78
|
+
}
|
|
@@ -9,6 +9,11 @@ export function metricsSourceUnavailable(status: PrometheusStatus | null | undef
|
|
|
9
9
|
return status?.source?.kind === 'openobserve' && status.source.unavailable === true
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/** Radar is still checking whether OpenObserve has this cluster's metrics. */
|
|
13
|
+
export function metricsSourceChecking(status: PrometheusStatus | null | undefined): boolean {
|
|
14
|
+
return status?.source?.kind === 'openobserve' && status.source.pending === true && !status.connected
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
export function hasPrometheusCharts(status: PrometheusStatus | null | undefined): boolean {
|
|
13
18
|
if (metricsSourceUnavailable(status)) return false
|
|
14
19
|
return status?.connected === true || status?.gkeSystemMetrics === true
|
|
@@ -79,6 +79,15 @@ describe('workload history, whose flag shipped with its endpoint', () => {
|
|
|
79
79
|
})
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
+
describe('runningCodeHistory capability flag', () => {
|
|
83
|
+
it('reports supported only when advertised, unsupported when omitted or false, and unknown before capabilities load', () => {
|
|
84
|
+
expect(radarFeatureSupport('runningCodeHistory', { features: { runningCodeHistory: true } }, undefined)).toBe('supported')
|
|
85
|
+
expect(radarFeatureSupport('runningCodeHistory', { features: { runningCodeHistory: false } }, 'v99.0.0')).toBe('unsupported')
|
|
86
|
+
expect(radarFeatureSupport('runningCodeHistory', { features: { workloadHistory: true } }, 'v99.0.0')).toBe('unsupported')
|
|
87
|
+
expect(radarFeatureSupport('runningCodeHistory', undefined, 'v99.0.0')).toBe('unknown')
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
82
91
|
// A behavior change on endpoints every Radar serves: only the flag tells.
|
|
83
92
|
describe('Argo CD rollback and auto-sync, gated on argoRollbackSync', () => {
|
|
84
93
|
it.each(['argoRollback', 'argoAutoSyncEnable'] as const)('%s trusts the flag and reads its absence as too old', (feature) => {
|
package/src/api/radarFeatures.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface RadarFeatureSpec {
|
|
|
32
32
|
export const RADAR_FEATURES = {
|
|
33
33
|
datadogRightsizing: { label: 'Datadog-backed rightsizing', flag: 'datadogRightsizing', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
34
34
|
datadogAgentPresence: { label: 'Datadog Agent setup hints', flag: 'datadogAgentPresence', flagShippedWithEndpoint: true },
|
|
35
|
+
cloudClusterAccess: { label: 'Cloud cluster access settings', flag: 'cloudClusterAccess', flagShippedWithEndpoint: true },
|
|
35
36
|
ownerAccessGrantReview: { label: 'Cloud Owner permission checks', flag: 'ownerAccessGrantReview', flagShippedWithEndpoint: true },
|
|
36
37
|
gitopsActionCapabilities: { label: 'GitOps action permission checks', flag: 'gitopsActionCapabilities', flagShippedWithEndpoint: true },
|
|
37
38
|
openobserveCollectorPresence: { label: 'OpenObserve collector setup hints', flag: 'openobserveCollectorPresence', flagShippedWithEndpoint: true },
|
|
@@ -56,8 +57,15 @@ export const RADAR_FEATURES = {
|
|
|
56
57
|
applications: { label: 'Applications', minimumVersion: 'v1.7.7' },
|
|
57
58
|
workloadHistory: { label: 'Workload history', flag: 'workloadHistory', flagShippedWithEndpoint: true },
|
|
58
59
|
workloadSource: { label: 'Workload source', flag: 'workloadSource', flagShippedWithEndpoint: true },
|
|
60
|
+
// Never blocks a control: tells Deploys whether this Radar records
|
|
61
|
+
// RunningCodeChanged rows so an older Radar does not draw a code-change
|
|
62
|
+
// recording divider or "code not recorded" / "shipped code" delivery labels.
|
|
63
|
+
runningCodeHistory: { label: 'Recorded running-code changes', flag: 'runningCodeHistory', flagShippedWithEndpoint: true },
|
|
59
64
|
deploymentPause: { label: 'Deployment rollout pause and resume', flag: 'deploymentPause', flagShippedWithEndpoint: true },
|
|
60
65
|
substrateHealthMetrics: { label: 'Agent Substrate charts', flag: 'substrateHealthMetrics', flagShippedWithEndpoint: true, requireAffirmativeSupport: true },
|
|
66
|
+
substrateWorkspace: { label: 'Agent Substrate actors, templates and workers', flag: 'substrateWorkspace', flagShippedWithEndpoint: true },
|
|
67
|
+
kagentWorkspace: { label: 'kagent workspace', flag: 'kagentWorkspace', flagShippedWithEndpoint: true },
|
|
68
|
+
kagentAttribution: { label: 'kagent Agent sessions in Agent Substrate', flag: 'kagentAttribution', flagShippedWithEndpoint: true },
|
|
61
69
|
cnpgWorkspace: { label: 'CloudNativePG views', flag: 'cnpgWorkspace', flagShippedWithEndpoint: true },
|
|
62
70
|
sealedSecretsController: { label: 'Sealed Secrets controller status', flag: 'sealedSecretsController', flagShippedWithEndpoint: true },
|
|
63
71
|
traefikRoutes: { label: 'Traefik routes', flag: 'traefikRoutes', flagShippedWithEndpoint: true },
|
|
@@ -67,6 +75,7 @@ export const RADAR_FEATURES = {
|
|
|
67
75
|
cnpgProtectionSetup: { label: 'CloudNativePG backup setup', flag: 'cnpgProtectionSetup', flagShippedWithEndpoint: true },
|
|
68
76
|
// Radars from v1.21.0 report these Checks in the workspace without advertising the flag.
|
|
69
77
|
cnpgPostureChecks: { label: 'CloudNativePG backup and availability counts', minimumVersion: 'v1.21.0', flag: 'cnpgPostureChecks' },
|
|
78
|
+
agentSandboxWorkspace: { label: 'Agent Sandbox overview', flag: 'agentSandboxWorkspace', flagShippedWithEndpoint: true },
|
|
70
79
|
veleroWorkspace: { label: 'Velero views', flag: 'veleroWorkspace', flagShippedWithEndpoint: true },
|
|
71
80
|
veleroBackupNow: { label: 'Back up now', flag: 'veleroBackupNow', flagShippedWithEndpoint: true },
|
|
72
81
|
veleroSchedulePause: { label: 'Pause and resume Velero schedules', flag: 'veleroSchedulePause', flagShippedWithEndpoint: true },
|
|
@@ -99,6 +108,9 @@ export const RADAR_FEATURES = {
|
|
|
99
108
|
helmSourceIdentity: { label: 'Helm source selection', flag: 'helmSourceIdentity', flagShippedWithEndpoint: true },
|
|
100
109
|
// Never blocks a control: on an older Radar the Helm view reads /helm/releases.
|
|
101
110
|
helmInventory: { label: 'Helm releases without Secret access', flag: 'helmInventory', flagShippedWithEndpoint: true },
|
|
111
|
+
// Never blocks a control: an older Radar answers a Secrets list with Secret
|
|
112
|
+
// collection off by saying it doesn't collect them, and the list keeps that notice.
|
|
113
|
+
secretLiveRead: { label: 'Secrets read as you when Radar does not collect them', flag: 'secretLiveRead', flagShippedWithEndpoint: true },
|
|
102
114
|
agentSigninCheck: { label: 'Agent sign-in checks', flag: 'agentSigninCheck', flagShippedWithEndpoint: true },
|
|
103
115
|
podFileUpload: { label: 'Pod file uploads', flag: 'podFileUpload', flagShippedWithEndpoint: true },
|
|
104
116
|
vulnerabilities: { label: 'Vulnerability views', flag: 'vulnerabilities', flagShippedWithEndpoint: true },
|
|
@@ -108,6 +120,10 @@ export const RADAR_FEATURES = {
|
|
|
108
120
|
// Never blocks a control: an older Radar ignores the request body and names
|
|
109
121
|
// the Job itself, so Trigger stays one click without the Job name dialog.
|
|
110
122
|
cronJobTriggerJobName: { label: 'Job names for manual CronJob runs', flag: 'cronJobTriggerJobName', flagShippedWithEndpoint: true },
|
|
123
|
+
// A Radar with the flag answers kev=1 and carries KEV and EPSS in `intel`
|
|
124
|
+
// when Radar Cloud provides them; without Radar Cloud the answers have no
|
|
125
|
+
// `intel`.
|
|
126
|
+
vulnerabilityIntel: { label: 'Known exploited CVEs and EPSS scores', flag: 'vulnerabilityIntel', flagShippedWithEndpoint: true },
|
|
111
127
|
} as const satisfies Record<string, RadarFeatureSpec>
|
|
112
128
|
|
|
113
129
|
export type RadarFeature = keyof typeof RADAR_FEATURES
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { beforeEach, expect, it, vi } from 'vitest'
|
|
2
|
+
import { useMutation, useQuery } from '@tanstack/react-query'
|
|
3
|
+
import { useSubstrateActor, useSubstrateActorLogs, useSubstrateActors, useSubstrateStatus, useUpdateSubstrateConnection } from './substrateWorkspace'
|
|
4
|
+
|
|
5
|
+
vi.mock('@tanstack/react-query', () => ({ useQuery: vi.fn(() => ({})), useMutation: vi.fn(), useQueryClient: vi.fn() }))
|
|
6
|
+
const feature = vi.hoisted(() => ({ support: 'unsupported', gatedKey: ['radar-feature-unsupported'] }))
|
|
7
|
+
vi.mock('./config', () => ({ getApiBase: () => '/api' }))
|
|
8
|
+
vi.mock('./client', () => ({
|
|
9
|
+
ApiError: class extends Error {},
|
|
10
|
+
apiFetch: vi.fn(),
|
|
11
|
+
fetchJSON: vi.fn(),
|
|
12
|
+
useClusterInfo: () => ({ data: { context: 'cluster-a' } }),
|
|
13
|
+
useRadarFeature: () => ({
|
|
14
|
+
support: feature.support,
|
|
15
|
+
gatedKey: feature.gatedKey,
|
|
16
|
+
upgrade: undefined,
|
|
17
|
+
blockedReason: undefined,
|
|
18
|
+
guard: (request: () => Promise<unknown>) => request(),
|
|
19
|
+
}),
|
|
20
|
+
}))
|
|
21
|
+
beforeEach(() => vi.clearAllMocks())
|
|
22
|
+
|
|
23
|
+
type Placeholder = (previous: unknown, query?: { queryKey: readonly unknown[] }) => unknown
|
|
24
|
+
function lastQuery() { return vi.mocked(useQuery).mock.calls.at(-1)![0] }
|
|
25
|
+
|
|
26
|
+
it('lets the feature guard decide, so an unsupported Radar reaches the upgrade path', () => {
|
|
27
|
+
useSubstrateStatus()
|
|
28
|
+
const options = lastQuery()
|
|
29
|
+
expect(options.enabled).toBe(true)
|
|
30
|
+
expect(options.queryKey).toEqual(['substrate', '/api', 'cluster-a', 'status', 'radar-feature-unsupported'])
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('keeps no previous answer for a detail, only for another page of the same actor list', () => {
|
|
34
|
+
feature.gatedKey = []
|
|
35
|
+
useSubstrateActor({ atespace: 'research', name: 'a' })
|
|
36
|
+
const a = lastQuery()
|
|
37
|
+
expect(a.placeholderData).toBeUndefined()
|
|
38
|
+
|
|
39
|
+
useSubstrateActors({ state: 'crashed', offset: 0, limit: 50 })
|
|
40
|
+
const page1 = lastQuery()
|
|
41
|
+
useSubstrateActors({ state: 'crashed', offset: 50, limit: 50 })
|
|
42
|
+
const page2 = lastQuery()
|
|
43
|
+
useSubstrateActors({ state: 'running', offset: 50, limit: 50 })
|
|
44
|
+
const otherFilter = lastQuery()
|
|
45
|
+
const previous = { rows: [] }
|
|
46
|
+
const keep = page2.placeholderData as Placeholder
|
|
47
|
+
expect(keep(previous, { queryKey: page1.queryKey })).toBe(previous)
|
|
48
|
+
expect((otherFilter.placeholderData as Placeholder)(previous, { queryKey: page2.queryKey })).toBeUndefined()
|
|
49
|
+
expect(keep(previous, { queryKey: ['substrate', '/api', 'cluster-b', ...page1.queryKey.slice(3)] })).toBeUndefined()
|
|
50
|
+
expect(keep(previous, { queryKey: ['substrate', '/other', 'cluster-a', ...page1.queryKey.slice(3)] })).toBeUndefined()
|
|
51
|
+
expect(keep(previous, { queryKey: a.queryKey })).toBeUndefined()
|
|
52
|
+
expect(keep(previous, undefined)).toBeUndefined()
|
|
53
|
+
feature.gatedKey = ['radar-feature-unsupported']
|
|
54
|
+
useSubstrateActors({ state: 'crashed', offset: 50, limit: 50 })
|
|
55
|
+
expect((lastQuery().placeholderData as Placeholder)(previous, { queryKey: page2.queryKey })).toBeUndefined()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('reads a new log window after a crash and leaves last-node polling off', () => {
|
|
59
|
+
const actor = { atespace: 'research', name: 'a' }
|
|
60
|
+
useSubstrateActorLogs({ ...actor, state: 'running', assignment: { worker: 'w', namespace: 'agents', pool: 'pool', pod: 'pod', node: 'node' } }, { tailLines: 8 })
|
|
61
|
+
const running = lastQuery()
|
|
62
|
+
useSubstrateActorLogs({ ...actor, state: 'crashed', crash: { time: '2026-11-26T00:00:00Z' } }, { tailLines: 8, pollMs: false })
|
|
63
|
+
const crashed = lastQuery()
|
|
64
|
+
expect(running.refetchInterval).toBe(15_000)
|
|
65
|
+
expect(crashed.queryKey).not.toEqual(running.queryKey)
|
|
66
|
+
expect(crashed.refetchInterval).toBe(false)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('leaves save and disconnect feedback to the connection form', () => {
|
|
70
|
+
useUpdateSubstrateConnection()
|
|
71
|
+
expect(vi.mocked(useMutation).mock.calls.at(-1)?.[0].meta).toBeUndefined()
|
|
72
|
+
})
|