@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.
Files changed (228) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +49 -13
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/api/agentSandbox.ts +259 -0
  6. package/src/api/client.autoPromConnect.test.tsx +43 -0
  7. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  8. package/src/api/client.ts +151 -27
  9. package/src/api/client.updateResource.secretExpiry.test.tsx +47 -0
  10. package/src/api/cloudInstallDiscover.test.tsx +76 -0
  11. package/src/api/diagnose.ts +4 -0
  12. package/src/api/kagent.test.ts +82 -0
  13. package/src/api/kagent.ts +230 -0
  14. package/src/api/poll.ts +78 -0
  15. package/src/api/prometheusCharts.ts +5 -0
  16. package/src/api/radarFeatures.test.ts +9 -0
  17. package/src/api/radarFeatures.ts +16 -0
  18. package/src/api/substrateWorkspace.test.ts +72 -0
  19. package/src/api/substrateWorkspace.ts +1394 -0
  20. package/src/api/vulnerabilities.ts +207 -9
  21. package/src/api/workloadSource.test.tsx +315 -0
  22. package/src/api/workloadSource.ts +128 -12
  23. package/src/components/CloudConnectFlow.tsx +46 -7
  24. package/src/components/CloudFunnelButton.test.tsx +193 -7
  25. package/src/components/CloudFunnelButton.tsx +128 -32
  26. package/src/components/SelfManagedStart.tsx +12 -2
  27. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  28. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  29. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  30. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  31. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  32. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  33. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  34. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  35. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  36. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  37. package/src/components/agentsandbox/data.ts +135 -0
  38. package/src/components/agentsandbox/host.test.ts +27 -0
  39. package/src/components/agentsandbox/host.tsx +85 -0
  40. package/src/components/agentsandbox/labels.test.ts +42 -0
  41. package/src/components/agentsandbox/labels.ts +146 -0
  42. package/src/components/agentsandbox/listFilters.ts +85 -0
  43. package/src/components/agentsandbox/lists.ts +52 -0
  44. package/src/components/agentsandbox/routes.ts +23 -0
  45. package/src/components/agentsandbox/shared.tsx +321 -0
  46. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  47. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  48. package/src/components/agentsandbox/workspace.tsx +258 -0
  49. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  50. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  51. package/src/components/applications/ApplicationsView.tsx +156 -3
  52. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  53. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  54. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  55. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  56. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  57. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  58. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  59. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  60. package/src/components/cloudHints/cloudHints.ts +131 -0
  61. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  62. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  63. package/src/components/cloudHints/cloudLinks.ts +31 -0
  64. package/src/components/cloudHints/hintStorage.ts +28 -0
  65. package/src/components/cnpg/CNPGView.tsx +4 -7
  66. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  67. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  68. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  69. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  70. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  71. package/src/components/helm/HelmDrawerRouting.test.tsx +34 -1
  72. package/src/components/helm/HelmReleaseDrawer.tsx +6 -4
  73. package/src/components/helm/HelmView.tsx +4 -3
  74. package/src/components/helm/ObservedHelmNotice.tsx +39 -17
  75. package/src/components/helm/ObservedHelmRelease.test.tsx +62 -3
  76. package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +18 -0
  77. package/src/components/helm/ObservedHelmReleaseDrawer.tsx +4 -2
  78. package/src/components/home/HomeAgentBlock.tsx +2 -0
  79. package/src/components/home/HomeView.tsx +3 -3
  80. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  81. package/src/components/home/MCPSetupDialog.tsx +6 -2
  82. package/src/components/home/McpCloudLine.test.tsx +162 -0
  83. package/src/components/home/McpCloudLine.tsx +95 -0
  84. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  85. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  86. package/src/components/home/mcpToolCatalog.ts +4 -4
  87. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  88. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  89. package/src/components/issues/IssuesPane.tsx +181 -23
  90. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  91. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  92. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  93. package/src/components/issues/sinceLastVisit.ts +439 -0
  94. package/src/components/issues/uncheckedSources.test.ts +8 -0
  95. package/src/components/issues/uncheckedSources.ts +3 -0
  96. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  97. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  98. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  99. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  100. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  101. package/src/components/kagent/KagentLists.tsx +412 -0
  102. package/src/components/kagent/KagentOverview.tsx +234 -0
  103. package/src/components/kagent/KagentPages.tsx +690 -0
  104. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  105. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  106. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  107. package/src/components/kagent/KagentView.tsx +109 -0
  108. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  109. package/src/components/kagent/host.tsx +144 -0
  110. package/src/components/kagent/routes.ts +31 -0
  111. package/src/components/kagent/shared.tsx +336 -0
  112. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  113. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  114. package/src/components/kagent/workspace.fixtures.ts +108 -0
  115. package/src/components/kagent/workspaceRoute.ts +18 -0
  116. package/src/components/nudges/activeNudges.test.ts +39 -0
  117. package/src/components/nudges/activeNudges.ts +76 -0
  118. package/src/components/poll/OssPoll.tsx +871 -0
  119. package/src/components/poll/mount.test.ts +12 -0
  120. package/src/components/poll/pollCloud.test.ts +23 -0
  121. package/src/components/poll/pollCloud.ts +6 -0
  122. package/src/components/poll/pollDefinition.ts +93 -0
  123. package/src/components/poll/pollFlow.test.ts +140 -0
  124. package/src/components/poll/pollFlow.ts +137 -0
  125. package/src/components/poll/pollSender.test.ts +137 -0
  126. package/src/components/poll/pollSender.ts +76 -0
  127. package/src/components/poll/pollStorage.test.ts +53 -0
  128. package/src/components/poll/pollStorage.ts +77 -0
  129. package/src/components/poll/round.json +350 -0
  130. package/src/components/product-hunt/ProductHuntNotice.tsx +2 -0
  131. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  132. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  133. package/src/components/resource/PrometheusCharts.tsx +10 -1
  134. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  135. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  136. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  137. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  138. package/src/components/resources/ImageFilesystemModal.test.tsx +21 -1
  139. package/src/components/resources/ImageFilesystemModal.tsx +42 -3
  140. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  141. package/src/components/resources/ResourcesView.tsx +24 -11
  142. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  143. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  144. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  145. package/src/components/settings/SettingsDialog.tsx +84 -16
  146. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  147. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  148. package/src/components/settings/SubstrateSettings.tsx +544 -0
  149. package/src/components/settings/settings-state.test.ts +21 -3
  150. package/src/components/settings/settings-state.ts +13 -3
  151. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  152. package/src/components/share/ShareLinkButton.tsx +391 -0
  153. package/src/components/share/openShareInCloud.test.ts +29 -0
  154. package/src/components/share/openShareInCloud.ts +10 -0
  155. package/src/components/share/shareLink.test.ts +129 -0
  156. package/src/components/share/shareLink.ts +175 -0
  157. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  158. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  159. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  160. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  161. package/src/components/substrate/SubstrateActors.tsx +612 -0
  162. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  163. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  164. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  165. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  166. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  167. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  168. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  169. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  170. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  171. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  172. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  173. package/src/components/substrate/SubstrateView.tsx +173 -0
  174. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  175. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  176. package/src/components/substrate/attention.ts +81 -0
  177. package/src/components/substrate/contextPin.tsx +69 -0
  178. package/src/components/substrate/host.tsx +83 -0
  179. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  180. package/src/components/substrate/readings.test.ts +484 -0
  181. package/src/components/substrate/readings.ts +997 -0
  182. package/src/components/substrate/routes.ts +103 -0
  183. package/src/components/substrate/shared.tsx +426 -0
  184. package/src/components/substrate/substrate.fixtures.ts +325 -0
  185. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  186. package/src/components/substrate/workspaceRoute.ts +23 -0
  187. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  188. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  189. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  190. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  191. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  192. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  193. package/src/components/traffic/TrafficGraph.tsx +17 -14
  194. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  195. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  196. package/src/components/traffic/TrafficView.tsx +26 -56
  197. package/src/components/traffic/trafficFilters.test.ts +61 -1
  198. package/src/components/traffic/trafficFilters.ts +68 -8
  199. package/src/components/ui/UpdateNotification.tsx +2 -0
  200. package/src/components/usage-data/UsageDataPrompt.tsx +2 -0
  201. package/src/components/velero/VeleroOverview.tsx +2 -2
  202. package/src/components/velero/VeleroView.tsx +3 -6
  203. package/src/components/vulnerabilities/columns.tsx +132 -0
  204. package/src/components/vulnerabilities/filters.tsx +317 -0
  205. package/src/components/vulnerabilities/owner.test.ts +54 -0
  206. package/src/components/vulnerabilities/owner.tsx +163 -0
  207. package/src/components/vulnerabilities/parts.test.ts +126 -12
  208. package/src/components/vulnerabilities/parts.tsx +612 -52
  209. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  210. package/src/components/vulnerabilities/traffic.tsx +40 -0
  211. package/src/components/whats-new/WhatsNew.tsx +2 -0
  212. package/src/components/whats-new/releaseNotes.ts +75 -1
  213. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  214. package/src/components/workload/WorkloadView.tsx +52 -13
  215. package/src/components/workspace/layout.tsx +13 -7
  216. package/src/components/workspace/sidebar.test.ts +48 -0
  217. package/src/components/workspace/sidebar.ts +73 -3
  218. package/src/components/workspace/table.ts +2 -1
  219. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  220. package/src/contexts/RegistryAccessMode.tsx +25 -0
  221. package/src/integrations/resourceHost.ts +12 -6
  222. package/src/integrations/resourceHosts.test.tsx +27 -1
  223. package/src/integrations/resourceHosts.tsx +15 -7
  224. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  225. package/src/integrations/sidebarWorkspaces.ts +41 -0
  226. package/src/integrations/workspaceRoute.ts +1 -1
  227. package/src/integrations/workspaceRoutes.ts +7 -1
  228. 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
+ }
@@ -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) => {
@@ -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
+ })