@skyhook-io/radar-app 1.22.1 → 1.23.0

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 (234) hide show
  1. package/package.json +8 -8
  2. package/src/App.tsx +131 -38
  3. package/src/RadarApp.basename.test.tsx +177 -0
  4. package/src/RadarApp.settings.test.tsx +33 -0
  5. package/src/RadarApp.tsx +5 -0
  6. package/src/api/agentSandbox.ts +259 -0
  7. package/src/api/client.autoPromConnect.test.tsx +43 -0
  8. package/src/api/client.metricsRelayCheck.test.tsx +134 -0
  9. package/src/api/client.ts +128 -25
  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/prometheusCharts.ts +5 -0
  15. package/src/api/radarFeatures.test.ts +9 -0
  16. package/src/api/radarFeatures.ts +13 -0
  17. package/src/api/substrateWorkspace.test.ts +72 -0
  18. package/src/api/substrateWorkspace.ts +1394 -0
  19. package/src/api/vulnerabilities.ts +207 -9
  20. package/src/api/workloadSource.test.tsx +1172 -0
  21. package/src/api/workloadSource.ts +408 -0
  22. package/src/components/APIUnreachableBanner.test.tsx +19 -0
  23. package/src/components/APIUnreachableBanner.tsx +20 -0
  24. package/src/components/CloudConnectFlow.tsx +46 -7
  25. package/src/components/CloudFunnelButton.test.tsx +193 -7
  26. package/src/components/CloudFunnelButton.tsx +127 -32
  27. package/src/components/ConnectionErrorView.test.tsx +63 -2
  28. package/src/components/ConnectionErrorView.tsx +88 -68
  29. package/src/components/SelfManagedStart.tsx +12 -2
  30. package/src/components/agentsandbox/AgentSandboxKindLists.tsx +41 -0
  31. package/src/components/agentsandbox/AgentSandboxLists.test.tsx +410 -0
  32. package/src/components/agentsandbox/AgentSandboxOverview.test.tsx +333 -0
  33. package/src/components/agentsandbox/AgentSandboxOverview.tsx +555 -0
  34. package/src/components/agentsandbox/AgentSandboxSidebar.test.tsx +97 -0
  35. package/src/components/agentsandbox/AgentSandboxSummary.test.tsx +439 -0
  36. package/src/components/agentsandbox/AgentSandboxSummary.tsx +956 -0
  37. package/src/components/agentsandbox/AgentSandboxTables.tsx +966 -0
  38. package/src/components/agentsandbox/AgentSandboxView.tsx +34 -0
  39. package/src/components/agentsandbox/agentsandbox.fixtures.ts +135 -0
  40. package/src/components/agentsandbox/data.ts +135 -0
  41. package/src/components/agentsandbox/host.test.ts +27 -0
  42. package/src/components/agentsandbox/host.tsx +85 -0
  43. package/src/components/agentsandbox/labels.test.ts +42 -0
  44. package/src/components/agentsandbox/labels.ts +146 -0
  45. package/src/components/agentsandbox/listFilters.ts +85 -0
  46. package/src/components/agentsandbox/lists.ts +52 -0
  47. package/src/components/agentsandbox/routes.ts +23 -0
  48. package/src/components/agentsandbox/shared.tsx +321 -0
  49. package/src/components/agentsandbox/useAgentSandboxSidebarWorkspace.ts +69 -0
  50. package/src/components/agentsandbox/workspace.fixtures.ts +125 -0
  51. package/src/components/agentsandbox/workspace.tsx +258 -0
  52. package/src/components/agentsandbox/workspaceRoute.ts +18 -0
  53. package/src/components/applications/ApplicationsView.openResource.test.tsx +248 -3
  54. package/src/components/applications/ApplicationsView.tsx +156 -3
  55. package/src/components/audit/VulnerabilitiesColumns.test.tsx +487 -0
  56. package/src/components/audit/VulnerabilitiesRisk.test.tsx +318 -0
  57. package/src/components/audit/VulnerabilitiesView.test.tsx +458 -13
  58. package/src/components/audit/VulnerabilitiesView.tsx +639 -199
  59. package/src/components/cloudHints/AgentSetupCloudRow.tsx +28 -0
  60. package/src/components/cloudHints/CloudHintLink.tsx +29 -0
  61. package/src/components/cloudHints/SharedInstallAiLine.tsx +36 -0
  62. package/src/components/cloudHints/cloudHints.test.ts +126 -0
  63. package/src/components/cloudHints/cloudHints.ts +131 -0
  64. package/src/components/cloudHints/cloudHintsGate.test.tsx +70 -0
  65. package/src/components/cloudHints/cloudLinks.test.ts +52 -0
  66. package/src/components/cloudHints/cloudLinks.ts +31 -0
  67. package/src/components/cloudHints/hintStorage.ts +28 -0
  68. package/src/components/cnpg/CNPGView.tsx +4 -7
  69. package/src/components/diagnose/ActivityTurn.tsx +6 -4
  70. package/src/components/diagnose/AgentSetupNotice.tsx +5 -0
  71. package/src/components/diagnose/AssessmentCard.tsx +1 -2
  72. package/src/components/diagnose/ContinueInAgentButton.test.tsx +7 -0
  73. package/src/components/diagnose/DiagnoseContext.tsx +7 -0
  74. package/src/components/diagnose/DiagnoseSurface.escape.test.tsx +215 -0
  75. package/src/components/diagnose/DiagnoseSurface.tsx +57 -1
  76. package/src/components/diagnose/Home.test.tsx +6 -0
  77. package/src/components/diagnose/Home.tsx +10 -3
  78. package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +1 -1
  79. package/src/components/diagnose/InvestigationEvidencePane.tsx +19 -2
  80. package/src/components/diagnose/InvestigationFindingsFooter.test.tsx +413 -0
  81. package/src/components/diagnose/InvestigationView.tsx +120 -23
  82. package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
  83. package/src/components/diagnose/investigationEvidence/projection.test.ts +1 -1
  84. package/src/components/diagnose/investigationState.ts +9 -0
  85. package/src/components/diagnose/parts.test.tsx +11 -3
  86. package/src/components/diagnose/toolCallLabel.ts +3 -0
  87. package/src/components/gitops/RemoteDestinationCloudHint.tsx +6 -14
  88. package/src/components/home/ActivitySummary.tsx +3 -8
  89. package/src/components/home/ClusterHealthCard.tsx +91 -17
  90. package/src/components/home/ClusterHealthCard.utilization.test.tsx +187 -0
  91. package/src/components/home/HomeAgentBlock.tsx +2 -0
  92. package/src/components/home/HomeView.tsx +9 -29
  93. package/src/components/home/MCPSetupDialog.test.tsx +9 -0
  94. package/src/components/home/MCPSetupDialog.tsx +6 -2
  95. package/src/components/home/McpCloudLine.test.tsx +162 -0
  96. package/src/components/home/McpCloudLine.tsx +95 -0
  97. package/src/components/home/ProblemsPanel.investigate.test.tsx +2 -2
  98. package/src/components/home/TopologyPreview.test.tsx +31 -30
  99. package/src/components/home/TopologyPreview.tsx +19 -28
  100. package/src/components/home/mcpToolCatalog.test.ts +10 -0
  101. package/src/components/home/mcpToolCatalog.ts +7 -7
  102. package/src/components/issues/ClusterSchedulingBlockerRow.tsx +35 -0
  103. package/src/components/issues/IssuesPane.render.test.tsx +36 -1
  104. package/src/components/issues/IssuesPane.tsx +181 -23
  105. package/src/components/issues/SinceLastVisitRow.render.test.tsx +302 -0
  106. package/src/components/issues/SinceLastVisitRow.tsx +71 -0
  107. package/src/components/issues/sinceLastVisit.test.ts +266 -0
  108. package/src/components/issues/sinceLastVisit.ts +439 -0
  109. package/src/components/kagent/KagentAgentRenderer.test.ts +32 -0
  110. package/src/components/kagent/KagentAgentRenderer.tsx +87 -0
  111. package/src/components/kagent/KagentAgentSessions.test.tsx +166 -0
  112. package/src/components/kagent/KagentAgentSessions.tsx +124 -0
  113. package/src/components/kagent/KagentDetailPage.tsx +106 -0
  114. package/src/components/kagent/KagentLists.tsx +412 -0
  115. package/src/components/kagent/KagentOverview.tsx +234 -0
  116. package/src/components/kagent/KagentPages.tsx +690 -0
  117. package/src/components/kagent/KagentRuntimeTabs.test.tsx +219 -0
  118. package/src/components/kagent/KagentRuntimeTabs.tsx +283 -0
  119. package/src/components/kagent/KagentSidebar.test.tsx +112 -0
  120. package/src/components/kagent/KagentView.tsx +109 -0
  121. package/src/components/kagent/KagentWorkspace.test.tsx +876 -0
  122. package/src/components/kagent/host.tsx +144 -0
  123. package/src/components/kagent/routes.ts +31 -0
  124. package/src/components/kagent/shared.tsx +336 -0
  125. package/src/components/kagent/useKagentRuntime.test.tsx +77 -0
  126. package/src/components/kagent/useKagentSidebarWorkspace.ts +67 -0
  127. package/src/components/kagent/workspace.fixtures.ts +108 -0
  128. package/src/components/kagent/workspaceRoute.ts +18 -0
  129. package/src/components/resource/MetricsNotConnected.test.tsx +28 -0
  130. package/src/components/resource/MetricsNotConnected.tsx +10 -7
  131. package/src/components/resource/PrometheusCharts.tsx +10 -1
  132. package/src/components/resource/PrometheusChartsGrid.render.test.tsx +9 -0
  133. package/src/components/resource/PrometheusChartsGrid.tsx +3 -3
  134. package/src/components/resource/SubstrateHealthCharts.test.tsx +13 -1
  135. package/src/components/resource/SubstrateHealthCharts.tsx +9 -15
  136. package/src/components/resources/ResourceDetailDrawer.tsx +1 -0
  137. package/src/components/resources/ResourcesView.tsx +2 -6
  138. package/src/components/resources/renderers/JobAdmissionRenderers.tsx +5 -4
  139. package/src/components/resources/renderers/PodRenderer.tsx +8 -2
  140. package/src/components/resources/renderers/RolloutRenderer.tsx +4 -1
  141. package/src/components/resources/renderers/WorkloadRenderer.tsx +4 -1
  142. package/src/components/settings/LocalIntegrationStatus.test.tsx +1 -0
  143. package/src/components/settings/LocalIntegrationStatus.tsx +3 -2
  144. package/src/components/settings/SettingsDialog.tsx +84 -16
  145. package/src/components/settings/SubstrateSettings.lifecycle.test.tsx +210 -0
  146. package/src/components/settings/SubstrateSettings.test.tsx +131 -0
  147. package/src/components/settings/SubstrateSettings.tsx +544 -0
  148. package/src/components/settings/settings-state.test.ts +21 -3
  149. package/src/components/settings/settings-state.ts +13 -3
  150. package/src/components/share/ShareLinkButton.test.tsx +360 -0
  151. package/src/components/share/ShareLinkButton.tsx +391 -0
  152. package/src/components/share/openShareInCloud.test.ts +29 -0
  153. package/src/components/share/openShareInCloud.ts +10 -0
  154. package/src/components/share/shareLink.test.ts +129 -0
  155. package/src/components/share/shareLink.ts +175 -0
  156. package/src/components/substrate/SubstrateActorDrawer.tsx +87 -0
  157. package/src/components/substrate/SubstrateActorOverview.tsx +489 -0
  158. package/src/components/substrate/SubstrateActorPage.tsx +384 -0
  159. package/src/components/substrate/SubstrateActors.test.tsx +1094 -0
  160. package/src/components/substrate/SubstrateActors.tsx +612 -0
  161. package/src/components/substrate/SubstrateAttentionList.tsx +441 -0
  162. package/src/components/substrate/SubstrateConnect.tsx +88 -0
  163. package/src/components/substrate/SubstrateOverview.test.tsx +396 -0
  164. package/src/components/substrate/SubstrateOverview.tsx +575 -0
  165. package/src/components/substrate/SubstratePages.test.tsx +478 -0
  166. package/src/components/substrate/SubstratePool.test.tsx +462 -0
  167. package/src/components/substrate/SubstratePoolPage.tsx +95 -0
  168. package/src/components/substrate/SubstratePoolSummary.tsx +485 -0
  169. package/src/components/substrate/SubstrateSidebar.test.tsx +101 -0
  170. package/src/components/substrate/SubstrateStateBar.tsx +63 -0
  171. package/src/components/substrate/SubstrateTemplates.tsx +376 -0
  172. package/src/components/substrate/SubstrateView.tsx +173 -0
  173. package/src/components/substrate/SubstrateWorkerPodContext.tsx +73 -0
  174. package/src/components/substrate/SubstrateWorkers.tsx +389 -0
  175. package/src/components/substrate/attention.ts +81 -0
  176. package/src/components/substrate/contextPin.tsx +69 -0
  177. package/src/components/substrate/host.tsx +83 -0
  178. package/src/components/substrate/kubectlTarget.test.tsx +77 -0
  179. package/src/components/substrate/readings.test.ts +484 -0
  180. package/src/components/substrate/readings.ts +997 -0
  181. package/src/components/substrate/routes.ts +103 -0
  182. package/src/components/substrate/shared.tsx +426 -0
  183. package/src/components/substrate/substrate.fixtures.ts +325 -0
  184. package/src/components/substrate/useSubstrateSidebarWorkspace.ts +87 -0
  185. package/src/components/substrate/workspaceRoute.ts +23 -0
  186. package/src/components/traffic/TrafficConnectionsTable.test.tsx +9 -0
  187. package/src/components/traffic/TrafficConnectionsTable.tsx +4 -2
  188. package/src/components/traffic/TrafficFilterSidebar.tsx +19 -14
  189. package/src/components/traffic/TrafficFlowList.test.tsx +63 -0
  190. package/src/components/traffic/TrafficFlowList.tsx +9 -5
  191. package/src/components/traffic/TrafficGraph.test.tsx +26 -0
  192. package/src/components/traffic/TrafficGraph.tsx +17 -14
  193. package/src/components/traffic/TrafficGraphTooLarge.tsx +2 -0
  194. package/src/components/traffic/TrafficGraphUnavailable.tsx +3 -1
  195. package/src/components/traffic/TrafficView.tsx +26 -56
  196. package/src/components/traffic/trafficFilters.test.ts +61 -1
  197. package/src/components/traffic/trafficFilters.ts +68 -8
  198. package/src/components/velero/VeleroOverview.tsx +2 -2
  199. package/src/components/velero/VeleroView.tsx +3 -6
  200. package/src/components/vulnerabilities/columns.tsx +132 -0
  201. package/src/components/vulnerabilities/filters.tsx +317 -0
  202. package/src/components/vulnerabilities/owner.test.ts +54 -0
  203. package/src/components/vulnerabilities/owner.tsx +163 -0
  204. package/src/components/vulnerabilities/parts.test.ts +126 -12
  205. package/src/components/vulnerabilities/parts.tsx +612 -52
  206. package/src/components/vulnerabilities/traffic.test.tsx +65 -0
  207. package/src/components/vulnerabilities/traffic.tsx +40 -0
  208. package/src/components/workload/WorkloadView.substrateVersion.test.tsx +88 -0
  209. package/src/components/workload/WorkloadView.tsx +119 -14
  210. package/src/components/workload/WorkloadView.workloadSource.test.tsx +121 -0
  211. package/src/components/workspace/layout.tsx +13 -7
  212. package/src/components/workspace/sidebar.test.ts +48 -0
  213. package/src/components/workspace/sidebar.ts +73 -3
  214. package/src/components/workspace/table.ts +2 -1
  215. package/src/context/ConnectionContext.tsx +24 -5
  216. package/src/context/ConnectionProvider.connectionId.test.tsx +14 -0
  217. package/src/context/ConnectionProvider.handover.test.tsx +94 -0
  218. package/src/context/DiagnoseCustomization.tsx +20 -2
  219. package/src/contexts/RegistryAccessMode.test.tsx +51 -0
  220. package/src/contexts/RegistryAccessMode.tsx +25 -0
  221. package/src/hooks/useEventSource.test.tsx +275 -4
  222. package/src/hooks/useEventSource.ts +278 -51
  223. package/src/index.ts +1 -0
  224. package/src/integrations/resourceHost.ts +12 -6
  225. package/src/integrations/resourceHosts.test.tsx +27 -1
  226. package/src/integrations/resourceHosts.tsx +15 -7
  227. package/src/integrations/sidebarWorkspaces.test.tsx +63 -0
  228. package/src/integrations/sidebarWorkspaces.ts +41 -0
  229. package/src/integrations/workspaceRoute.ts +1 -1
  230. package/src/integrations/workspaceRoutes.ts +7 -1
  231. package/src/integrations/workspaceScreens.tsx +6 -0
  232. package/src/utils/navigation.test.ts +1 -6
  233. package/src/utils/navigation.ts +9 -44
  234. package/src/utils/network-policy-navigation.test.ts +21 -36
@@ -0,0 +1,219 @@
1
+ // @vitest-environment jsdom
2
+ import { act } from 'react'
3
+ import { createRoot } from 'react-dom/client'
4
+ import { renderToStaticMarkup } from 'react-dom/server'
5
+ import { MemoryRouter } from 'react-router-dom'
6
+ import { beforeEach, expect, it, vi } from 'vitest'
7
+ import type { KagentAgentSessions, SubstrateTemplateRow } from '../../api/substrateWorkspace'
8
+ import { ApiError } from '../../api/client'
9
+ import { actorRow, actors, connectedTier, counts, status } from '../substrate/substrate.fixtures'
10
+ import { KagentRevisions, KagentSessionsTab } from './KagentRuntimeTabs'
11
+ const state = vi.hoisted(() => ({
12
+ support: 'supported',
13
+ loading: false,
14
+ error: null as unknown,
15
+ data: undefined as KagentAgentSessions | undefined,
16
+ enabled: false,
17
+ sessionReads: [] as unknown[],
18
+ templatesEnabled: false,
19
+ templates: [] as SubstrateTemplateRow[],
20
+ status: undefined as ReturnType<typeof status> | undefined,
21
+ crashed: false,
22
+ haveActors: false,
23
+ }))
24
+ vi.mock('../../api/client', async (original) => ({
25
+ ...(await original<typeof import('../../api/client')>()),
26
+ useRadarFeature: () => ({ support: state.support }),
27
+ }))
28
+ vi.mock('../../api/substrateWorkspace', async (original) => ({
29
+ ...(await original<typeof import('../../api/substrateWorkspace')>()),
30
+ useSubstrateStatus: () => ({ data: state.status, isLoading: !state.status }),
31
+ useKagentAgentSessions: (ref: unknown) => {
32
+ if (ref) state.sessionReads.push(ref)
33
+ return { data: state.data, isLoading: state.loading, error: state.error }
34
+ },
35
+ useSubstrateActors: (_query: unknown, enabled = true) => {
36
+ state.enabled = enabled
37
+ return { data: state.haveActors ? actors({ rows: [actorRow({ state: state.crashed ? 'crashed' : 'suspended', kagent: { kind: 'agentSession', agent: { namespace: 'agents', name: 'helper' }, sessionId: 'session-123', revision: 'abcdef0123456789', newSessions: true } })] }) : undefined, error: state.error, isLoading: state.loading }
38
+ },
39
+ useSubstrateTemplates: (enabled: boolean) => {
40
+ state.templatesEnabled = enabled
41
+ return { data: { templates: state.templates, coverage: { actors: { state: 'full' } } } }
42
+ },
43
+ useSubstrateTemplate: () => ({ data: undefined }),
44
+ }))
45
+ vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { context: 'test' } }) }))
46
+ const agent = { namespace: 'agents', name: 'helper' }
47
+ const render = (node: React.ReactNode) => renderToStaticMarkup(<MemoryRouter>{node}</MemoryRouter>).replace(/<!-- -->/g, '')
48
+ beforeEach(() => {
49
+ state.support = 'supported'
50
+ state.loading = false
51
+ state.error = null
52
+ state.data = undefined
53
+ state.enabled = false
54
+ state.sessionReads = []
55
+ state.templatesEnabled = false
56
+ state.templates = []
57
+ state.status = status({ apiTier: connectedTier })
58
+ state.haveActors = false
59
+ state.crashed = false
60
+ })
61
+ it('shows unavailable tiers and never asks an old Radar for filtered actors', () => {
62
+ state.support = 'unsupported'
63
+ expect(render(<KagentSessionsTab agent={agent} />)).toContain('Sessions need a newer Radar')
64
+ expect(state.enabled).toBe(false)
65
+ expect(render(<KagentRevisions agent={agent} />)).toContain('Revisions from Substrate need a newer Radar')
66
+ })
67
+ it('renders revision loading and a session read failure explicitly', () => {
68
+ state.loading = true
69
+ expect(render(<KagentRevisions agent={agent} />)).toContain('Reading revisions')
70
+ state.loading = false
71
+ state.error = new ApiError('not configured', 409, { error_code: 'notConfigured' })
72
+ expect(render(<KagentRevisions agent={agent} />)).toContain('can’t count')
73
+ expect(render(<KagentSessionsTab agent={agent} />)).not.toContain('0 sessions')
74
+ })
75
+ it('offers one connection notice in Sessions without requesting runtime data', async () => {
76
+ state.status = status({ canConfigure: true, apiTier: { state: 'notConfigured', code: 'notConfigured' } })
77
+ const host = document.createElement('div')
78
+ const root = createRoot(host)
79
+ const openSettings = vi.fn()
80
+ window.addEventListener('radar:open-settings', openSettings)
81
+ vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true)
82
+ try {
83
+ await act(async () => root.render(<MemoryRouter><KagentSessionsTab agent={agent} /></MemoryRouter>))
84
+ expect(host.textContent?.match(/not connected/gi)).toHaveLength(1)
85
+ expect(state.enabled).toBe(false)
86
+ expect(state.sessionReads).toEqual([])
87
+ const settings = [...host.querySelectorAll('button')].filter((button) => button.textContent === 'Open Substrate settings')
88
+ expect(settings).toHaveLength(1)
89
+ act(() => settings[0].click())
90
+ expect(openSettings).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ detail: { section: 'substrate' } }))
91
+ } finally {
92
+ act(() => root.unmount())
93
+ window.removeEventListener('radar:open-settings', openSettings)
94
+ vi.unstubAllGlobals()
95
+ }
96
+ })
97
+ it('shows desired and latest successful revisions from Kubernetes with Substrate disconnected', () => {
98
+ state.status = status({ canConfigure: true, apiTier: { state: 'notConfigured', code: 'notConfigured' } })
99
+ const out = render(
100
+ <KagentRevisions agent={agent} agentRevisions={{ desired: '1111111111112222', latestSuccessful: 'abcdef0123456789' }} latestChange="preparing" />,
101
+ )
102
+ expect(out).toContain('111111111111')
103
+ expect(out).toContain('Latest change, processing')
104
+ expect(out).toContain('abcdef012345')
105
+ expect(out).toContain('New sessions start here')
106
+ expect(out).toContain('Open Substrate settings')
107
+ expect(out).not.toContain('Template created')
108
+ expect(state.sessionReads).toEqual([])
109
+ expect(state.templatesEnabled).toBe(false)
110
+ })
111
+ it('waits for the first runtime read when Substrate is connecting', () => {
112
+ state.status = status({ apiTier: { state: 'connecting' } })
113
+ state.loading = true
114
+ const sessions = render(<KagentSessionsTab agent={agent} />)
115
+ expect(sessions).toContain('Reading this Agent’s sessions')
116
+ expect(sessions).not.toContain('Open Substrate settings')
117
+ expect(state.enabled).toBe(true)
118
+ const revisions = render(<KagentRevisions agent={agent} agentRevisions={{ latestSuccessful: 'abcdef0123456789' }} />)
119
+ expect(revisions).toContain('abcdef012345')
120
+ expect(revisions).not.toContain('Open Substrate settings')
121
+ expect(state.sessionReads).toEqual([agent, agent])
122
+ expect(state.templatesEnabled).toBe(false)
123
+ })
124
+ it('labels desired and prepared revisions separately and keeps unprovable sessions as hints', () => {
125
+ state.data = {
126
+ apiTier: connectedTier,
127
+ agent: { ...agent, desiredRevision: '1111111111112222', latestSuccessfulRevision: 'abcdef0123456789' },
128
+ revisions: [
129
+ {
130
+ revision: 'abcdef0123456789',
131
+ template: { atespace: 'agents', name: 'helper-abcdef012345' },
132
+ newSessions: true,
133
+ ambiguous: true,
134
+ sessions: 0,
135
+ },
136
+ ],
137
+ sessions: counts({ suspended: 1 }),
138
+ onEarlierRevisions: 1,
139
+ complete: false,
140
+ needAttention: 0,
141
+ attention: [],
142
+ hintedEarlierRevisions: 3,
143
+ sources: ['snapshot'],
144
+ coverage: { actors: { state: 'partial' }, templates: { state: 'partial' } },
145
+ }
146
+ const out = render(<KagentRevisions agent={agent} />)
147
+ expect(state.sessionReads).toEqual([agent])
148
+ expect(state.templatesEnabled).toBe(true)
149
+ for (const heading of ['Revision', 'Role', 'Template created', 'Golden snapshot', 'Sessions']) expect(out).toContain(heading)
150
+ expect(out).toContain('111111111111')
151
+ expect(out).toContain('abcdef012345')
152
+ expect(out).toContain('ambiguous attribution')
153
+ expect(out).toContain('unprovable earlier revisions')
154
+ expect(out).not.toContain('prepared 1h')
155
+ state.data.agent.desiredRevision = undefined
156
+ const blocked = render(<KagentRevisions agent={agent} latestChange="blocked" />)
157
+ expect(blocked).toContain('Not compiled')
158
+ expect(blocked).toContain('Latest change, blocked')
159
+ })
160
+
161
+ it('shows recovery guidance only for a crashed session and gives this Agent a Revision column', () => {
162
+ state.haveActors = true
163
+ const calm = render(<KagentSessionsTab agent={agent} />)
164
+ expect(state.enabled).toBe(true)
165
+ expect(calm).not.toContain('Recover crashed sessions')
166
+ expect(calm).not.toContain('kagent Agent</th>')
167
+ expect(calm).toContain('Revision</th>')
168
+ expect(calm).not.toContain('>kagent</span>')
169
+ state.crashed = true
170
+ const crashed = render(<KagentSessionsTab agent={agent} />)
171
+ expect(crashed).toContain('Recover crashed sessions')
172
+ expect(crashed.indexOf('Recover crashed sessions')).toBeLessThan(crashed.indexOf('<table'))
173
+ })
174
+
175
+ it('shows a proven earlier revision with its sessions and golden snapshot badge', () => {
176
+ const revision = '0123456789ab'
177
+ const sessions = counts({ suspended: 2 })
178
+ state.data = {
179
+ apiTier: connectedTier, agent, revisions: [], sessions, complete: true,
180
+ onEarlierRevisions: 2, needAttention: 0, attention: [], hintedEarlierRevisions: 0, sources: ['snapshot'],
181
+ coverage: { actors: { state: 'full' }, templates: { state: 'full' } },
182
+ }
183
+ state.templates = [{
184
+ atespace: agent.namespace, name: `helper-${revision}`, actors: sessions,
185
+ golden: { state: 'ready' }, matchingPools: null, matchingPoolsComplete: false, preferredFidelity: 'memory',
186
+ kagent: { kind: 'agentSession', agent, revision, earlierRevision: true },
187
+ }]
188
+ const out = render(<KagentRevisions agent={agent} />)
189
+ const doc = new DOMParser().parseFromString(out, 'text/html')
190
+ expect([...doc.querySelectorAll('tbody td')].map((cell) => cell.textContent)).toEqual([
191
+ revision, 'Earlier', 'Not reported or unread', 'Ready', '2',
192
+ ])
193
+ expect(doc.querySelector('tbody .badge-sm')?.textContent).toBe('Ready')
194
+ expect(out).not.toContain('unprovable earlier revision')
195
+ expect(render(<KagentSessionsTab agent={agent} />)).toContain('2 on other revisions')
196
+ })
197
+
198
+ it.each(['notReported', 'notProcessed', 'unknown', 'deleting', 'preparing'])('does not infer compilation failure from an unreported digest (%s)', (latestChange) => {
199
+ state.data = {
200
+ apiTier: connectedTier, agent, revisions: [], sessions: counts({}), complete: true,
201
+ onEarlierRevisions: 0, needAttention: 0, attention: [], hintedEarlierRevisions: 0, sources: ['snapshot'],
202
+ coverage: { actors: { state: 'full' }, templates: { state: 'full' } },
203
+ }
204
+ const out = render(<KagentRevisions agent={agent} latestChange={latestChange} />)
205
+ expect(out).toContain('Not reported')
206
+ expect(out).not.toContain('Not compiled')
207
+ })
208
+
209
+ it('includes the latest-change row in the revision display limit and total', () => {
210
+ state.data = {
211
+ apiTier: connectedTier, agent, sessions: counts({}), complete: true,
212
+ revisions: Array.from({ length: 51 }, (_, i) => ({ revision: `revision-${i}`, template: { atespace: 'agents', name: `template-${i}` }, sessions: 0 })),
213
+ onEarlierRevisions: 0, needAttention: 0, attention: [], hintedEarlierRevisions: 0, sources: ['snapshot'],
214
+ coverage: { actors: { state: 'full' }, templates: { state: 'full' } },
215
+ }
216
+ const out = render(<KagentRevisions agent={agent} latestChange="blocked" />)
217
+ expect(out).toContain('Showing 50 of 52 revisions.')
218
+ expect(out.match(/<tr[ >]/g)).toHaveLength(51)
219
+ })
@@ -0,0 +1,283 @@
1
+ import { useState } from 'react'
2
+ import { useLocation } from 'react-router-dom'
3
+ import { PaneLoader, TimeValue } from '@skyhook-io/k8s-ui'
4
+ import type { KagentAgentRevisions } from '@skyhook-io/k8s-ui/components/resources/resource-utils-kagent'
5
+ import { useRadarFeature } from '../../api/client'
6
+ import {
7
+ useKagentAgentSessions,
8
+ useSubstrateActors,
9
+ useSubstrateStatus,
10
+ useSubstrateTemplate,
11
+ useSubstrateTemplates,
12
+ type KagentAgentRef,
13
+ type SubstrateStatus,
14
+ type SubstrateTemplateRow,
15
+ } from '../../api/substrateWorkspace'
16
+ import { useConnection } from '../../context/ConnectionContext'
17
+ import { ActorsTable } from '../substrate/SubstrateActors'
18
+ import { openSubstrateSettings, showsConnectNotice } from '../substrate/SubstrateConnect'
19
+ import { GoldenBadge } from '../substrate/SubstrateTemplates'
20
+ import { tierReading } from '../substrate/readings'
21
+ import { substrateActorPath, substrateActorsPath } from '../substrate/routes'
22
+ import { Notice, RefreshFailedNotice, SectionTable, Sub, type TableColumn } from '../workspace/layout'
23
+ import { useWorkspaceNavigate } from '../workspace/useWorkspaceNavigate'
24
+ import { KagentAgentSessions, sessionsFailure } from './KagentAgentSessions'
25
+ import { changeText, revisionText } from './shared'
26
+
27
+ export function KagentSessionsTab({ agent }: { agent: KagentAgentRef }) {
28
+ const feature = useRadarFeature('kagentWorkspace')
29
+ const status = useSubstrateStatus(feature.support === 'supported')
30
+ if (feature.support !== 'supported')
31
+ return (
32
+ <div className="p-5">
33
+ <Notice>Sessions need a newer Radar in this cluster.</Notice>
34
+ </div>
35
+ )
36
+ if (status.isLoading) return <PaneLoader label="Checking Substrate connection…" className="flex-1" />
37
+ if (!status.data || showsConnectNotice(status.data.apiTier))
38
+ return (
39
+ <div className="p-4">
40
+ <SubstrateRuntimeNotice status={status.data} />
41
+ </div>
42
+ )
43
+ return <SubstrateSessions agent={agent} />
44
+ }
45
+
46
+ function SubstrateRuntimeNotice({ status }: { status?: SubstrateStatus }) {
47
+ if (!status) return <Notice>Could not read the Substrate connection status.</Notice>
48
+ const reading = tierReading(status.apiTier)
49
+ return (
50
+ <Notice>
51
+ <p>Substrate API · {reading.title}</p>
52
+ {reading.detail && <p>{reading.detail}</p>}
53
+ <button type="button" onClick={openSubstrateSettings} className="mt-1 text-sm font-medium text-accent-text hover:underline">
54
+ {status.canConfigure ? 'Open Substrate settings' : 'Connection settings'}
55
+ </button>
56
+ </Notice>
57
+ )
58
+ }
59
+
60
+ function SubstrateSessions({ agent }: { agent: KagentAgentRef }) {
61
+ const [page, setPage] = useState(0)
62
+ const navigate = useWorkspaceNavigate()
63
+ const location = useLocation()
64
+ const { connection } = useConnection()
65
+ const query = useSubstrateActors({ agent: `${agent.namespace}/${agent.name}`, sort: 'attention', limit: 50, offset: page * 50 })
66
+ return (
67
+ <div className="space-y-4 p-4">
68
+ <KagentAgentSessions framed agent={agent} />
69
+ {query.data?.rows.some((r) => r.state === 'crashed') && (
70
+ <Notice>
71
+ Recover crashed sessions through kagent’s SessionService/RevertSession, or stop active turns and delete the chat in kagent. Moving
72
+ or reverting the actor directly can lose the session.
73
+ </Notice>
74
+ )}
75
+ <RefreshFailedNotice queries={[query]} />
76
+ {query.error && !query.data ? (
77
+ <Notice>{sessionsFailure(query.error, agent)}</Notice>
78
+ ) : (
79
+ <ActorsTable
80
+ data={query.data}
81
+ revisionOnly
82
+ loading={query.isLoading}
83
+ placeholder={query.isPlaceholderData}
84
+ page={page}
85
+ onPage={setPage}
86
+ onOpenActor={(actor) =>
87
+ navigate(substrateActorPath(actor, connection.context), {
88
+ state: {
89
+ returnLabel: `Agent: ${agent.name}`,
90
+ returnPath: location.pathname + location.search,
91
+ returnCtx: connection.context,
92
+ },
93
+ })
94
+ }
95
+ openActor={null}
96
+ />
97
+ )}
98
+ <p className="text-sm text-theme-text-tertiary">Conversation outcomes: not visible to Radar.</p>
99
+ </div>
100
+ )
101
+ }
102
+ function TemplateCreated({ template }: { template: SubstrateTemplateRow }) {
103
+ const query = useSubstrateTemplate(template)
104
+ return (
105
+ <span className="text-xs">
106
+ {query.data?.spec?.createTime ? (
107
+ <TimeValue timestamp={query.data.spec.createTime} />
108
+ ) : query.isLoading ? (
109
+ 'Reading…'
110
+ ) : (
111
+ 'Not reported or unread'
112
+ )}
113
+ </span>
114
+ )
115
+ }
116
+ export function KagentRevisions({
117
+ agent,
118
+ agentRevisions,
119
+ latestChange,
120
+ }: {
121
+ agent: KagentAgentRef
122
+ agentRevisions?: KagentAgentRevisions
123
+ latestChange?: string
124
+ }) {
125
+ const feature = useRadarFeature('kagentWorkspace')
126
+ const supported = feature.support === 'supported'
127
+ const status = useSubstrateStatus(supported)
128
+ const canReadRuntime = supported && !!status.data && !showsConnectNotice(status.data.apiTier)
129
+ const summary = useKagentAgentSessions(canReadRuntime ? agent : null)
130
+ const data = canReadRuntime ? summary.data : undefined
131
+ const templates = useSubstrateTemplates(!!data)
132
+ const navigate = useWorkspaceNavigate()
133
+ const current = agentRevisions ? agentRevisions.latestSuccessful : data?.agent.latestSuccessfulRevision
134
+ const desired = agentRevisions ? agentRevisions.desired : data?.agent.desiredRevision
135
+ const runtimeRevisions = data?.revisions ?? []
136
+ const attributed = data
137
+ ? (templates.data?.templates.filter(
138
+ (t) => t.kagent?.kind === 'agentSession' && t.kagent.agent.namespace === agent.namespace && t.kagent.agent.name === agent.name,
139
+ ) ?? [])
140
+ : []
141
+ const revisions = new Map(runtimeRevisions.map((r) => [r.revision, r]))
142
+ const digests = [
143
+ ...new Set(
144
+ [
145
+ current,
146
+ desired,
147
+ ...runtimeRevisions.map((r) => r.revision),
148
+ ...attributed.map((t) => (t.kagent?.kind === 'agentSession' ? t.kagent.revision : undefined)),
149
+ ].filter((r): r is string => !!r),
150
+ ),
151
+ ]
152
+ const changeWithoutRevision = !!latestChange && latestChange !== 'prepared' && !desired
153
+ const rows = digests.slice(0, changeWithoutRevision ? 49 : 50).map((revision) => ({
154
+ revision,
155
+ evidence: revisions.get(revision),
156
+ template: attributed.find((t) => t.kagent?.kind === 'agentSession' && t.kagent.revision === revision),
157
+ current: revision === current,
158
+ desired: revision === desired,
159
+ }))
160
+ if (changeWithoutRevision)
161
+ rows.unshift({ revision: '', evidence: undefined, template: undefined, current: false, desired: true })
162
+ const total = digests.length + Number(changeWithoutRevision)
163
+ const readingRuntime = supported && (status.isLoading || (canReadRuntime && summary.isLoading))
164
+ if (!rows.length && readingRuntime) return <PaneLoader label="Reading revisions…" className="flex-1" />
165
+ const columns: TableColumn<(typeof rows)[number]>[] = [
166
+ {
167
+ header: 'Revision',
168
+ width: data ? '19%' : '30%',
169
+ cell: (r) => (
170
+ <span className="font-mono text-xs">
171
+ {r.revision ? revisionText(r.revision) : latestChange === 'blocked' || latestChange === 'failed' ? 'Not compiled' : 'Not reported'}
172
+ </span>
173
+ ),
174
+ },
175
+ {
176
+ header: 'Role',
177
+ width: data ? '28%' : '70%',
178
+ cell: (r) => (
179
+ <span>
180
+ {r.evidence?.ambiguous
181
+ ? 'Ambiguous — not counted for this Agent'
182
+ : r.current
183
+ ? 'New sessions start here'
184
+ : r.desired
185
+ ? `Latest change${latestChange ? `, ${changeText(latestChange).toLowerCase()}` : ''}`
186
+ : 'Earlier'}
187
+ {r.current && r.desired && <Sub>Latest change</Sub>}
188
+ </span>
189
+ ),
190
+ },
191
+ ]
192
+ if (data)
193
+ columns.push(
194
+ {
195
+ header: 'Template created',
196
+ width: '20%',
197
+ cell: (r) =>
198
+ r.template ? (
199
+ <TemplateCreated template={r.template} />
200
+ ) : (
201
+ <span className="text-xs text-theme-text-tertiary">
202
+ {r.desired && !r.current ? 'No prepared template read' : 'Not reported or unread'}
203
+ </span>
204
+ ),
205
+ },
206
+ { header: 'Golden snapshot', width: '19%', cell: (r) => r.template ? <GoldenBadge template={r.template} /> : 'Unknown' },
207
+ {
208
+ header: 'Sessions',
209
+ width: '14%',
210
+ cell: (r) =>
211
+ r.evidence?.ambiguous ? (
212
+ 'Not counted'
213
+ ) : r.evidence ? (
214
+ <>
215
+ {!data.complete ? '≥' : ''}
216
+ {r.evidence.sessions}
217
+ </>
218
+ ) : r.template?.actors ? (
219
+ <>
220
+ {templates.data?.coverage.actors.state !== 'full' ? '≥' : ''}
221
+ {r.template.actors.total}
222
+ </>
223
+ ) : (
224
+ 'Not read'
225
+ ),
226
+ },
227
+ )
228
+ return (
229
+ <div className="space-y-4 p-5">
230
+ {!supported && <Notice>Revisions from Substrate need a newer Radar in this cluster.</Notice>}
231
+ {supported && !canReadRuntime && !status.isLoading && <SubstrateRuntimeNotice status={status.data} />}
232
+ {canReadRuntime && summary.error && !data && <Notice>{sessionsFailure(summary.error, agent)}</Notice>}
233
+ {data && <RefreshFailedNotice queries={[summary, templates]} />}
234
+ <SectionTable
235
+ rows={rows}
236
+ rowKey={(r) => r.revision || 'latest-change'}
237
+ minWidth={0}
238
+ empty={
239
+ !data
240
+ ? 'No revisions reported in the Agent’s status.'
241
+ : templates.isLoading
242
+ ? 'Reading templates…'
243
+ : templates.error
244
+ ? 'Templates could not be read.'
245
+ : 'No attributed templates in what Radar can read.'
246
+ }
247
+ columns={columns}
248
+ footer={total > rows.length ? `Showing ${rows.length} of ${total} revisions.` : undefined}
249
+ />
250
+ {data && (
251
+ <p className="text-xs text-theme-text-tertiary">
252
+ A template’s creation time is when Substrate created it. kagent reports no time when a revision became prepared.
253
+ </p>
254
+ )}
255
+ {runtimeRevisions
256
+ .filter((r) => r.ambiguous || !attributed.some((t) => t.atespace === r.template.atespace && t.name === r.template.name))
257
+ .map((r) => (
258
+ <Notice key={r.revision}>
259
+ Revision {revisionText(r.revision)}:{' '}
260
+ {r.ambiguous
261
+ ? 'ambiguous attribution; sessions not counted'
262
+ : `template ${r.template.atespace}/${r.template.name} was not read or could not be attributed`}
263
+ .
264
+ </Notice>
265
+ ))}
266
+ {data && data.hintedEarlierRevisions > 0 && (
267
+ <Notice>
268
+ {data.complete ? '' : 'At least '}
269
+ {data.hintedEarlierRevisions}{' '}
270
+ {data.hintedEarlierRevisions === 1 ? 'session has an unprovable earlier revision' : 'sessions have unprovable earlier revisions'}.
271
+ They are hints and do not count as this Agent’s sessions.{' '}
272
+ <button
273
+ type="button"
274
+ onClick={() => navigate(substrateActorsPath({ kagent: 'unattributed', atespace: agent.namespace }))}
275
+ className="text-accent-text hover:underline"
276
+ >
277
+ Inspect unattributed sessions →
278
+ </button>
279
+ </Notice>
280
+ )}
281
+ </div>
282
+ )
283
+ }
@@ -0,0 +1,112 @@
1
+ import { renderToStaticMarkup } from 'react-dom/server'
2
+ import { MemoryRouter } from 'react-router-dom'
3
+ import { describe, expect, it, vi } from 'vitest'
4
+ import { ResourcesSidebar, type SidebarCategoryWorkspace } from '@skyhook-io/k8s-ui'
5
+ import type { AgentSandboxWorkspaceResponse } from '../../api/agentSandbox'
6
+ import type { APIResource } from '../../types'
7
+ import { AGENTS_SIDEBAR_CATEGORY, useMergedSidebarWorkspaces } from '../workspace/sidebar'
8
+ import { useAgentSandboxSidebarWorkspace } from '../agentsandbox/useAgentSandboxSidebarWorkspace'
9
+ import { blockedWorkspace } from './workspace.fixtures'
10
+ import { liveWorkspace } from '../agentsandbox/workspace.fixtures'
11
+ import { useKagentSidebarWorkspace } from './useKagentSidebarWorkspace'
12
+
13
+ const state = vi.hoisted(() => ({ sandbox: undefined as AgentSandboxWorkspaceResponse | undefined, support: 'supported', checking: false }))
14
+
15
+ vi.mock('../../api/client', async (importOriginal) => ({
16
+ ...(await importOriginal<typeof import('../../api/client')>()),
17
+ useRadarFeature: () => ({ support: state.support }),
18
+ useCapabilities: () => ({ isPending: state.checking }),
19
+ }))
20
+ vi.mock('../../api/agentSandbox', async (importOriginal) => ({
21
+ ...(await importOriginal<typeof import('../../api/agentSandbox')>()),
22
+ useAgentSandboxWorkspace: () => ({ data: state.sandbox }),
23
+ }))
24
+ vi.mock('../../api/kagent', () => ({ useKagentWorkspace: () => ({ data: blockedWorkspace() }) }))
25
+ vi.mock('../../context/ConnectionContext', () => ({ useConnection: () => ({ connection: { context: 'kind-demo' } }) }))
26
+
27
+ const crd = (group: string, kind: string, name: string) =>
28
+ ({ group, version: 'v1alpha3', kind, name, namespaced: true, isCrd: true, verbs: ['list'] }) as APIResource
29
+ const KAGENT_KINDS = [
30
+ crd('api.kagent.dev', 'Agent', 'agents'),
31
+ crd('api.kagent.dev', 'ModelConfig', 'modelconfigs'),
32
+ crd('api.kagent.dev', 'Harness', 'harnesses'),
33
+ ]
34
+ const SANDBOX_KINDS = [
35
+ crd('agents.x-k8s.io', 'Sandbox', 'sandboxes'),
36
+ crd('extensions.agents.x-k8s.io', 'SandboxClaim', 'sandboxclaims'),
37
+ crd('extensions.agents.x-k8s.io', 'SandboxWarmPool', 'sandboxwarmpools'),
38
+ crd('extensions.agents.x-k8s.io', 'SandboxTemplate', 'sandboxtemplates'),
39
+ ]
40
+
41
+ function render(apiResources: APIResource[], path = '/kagent') {
42
+ let workspaces: Record<string, SidebarCategoryWorkspace> | undefined
43
+ function Host() {
44
+ const sandbox = useAgentSandboxSidebarWorkspace({ apiResources, namespaces: [] })
45
+ const kagent = useKagentSidebarWorkspace({ apiResources })
46
+ workspaces = useMergedSidebarWorkspaces(undefined, undefined, undefined, sandbox, kagent)
47
+ return (
48
+ <ResourcesSidebar selectedKind={null} onSelectedKindChange={() => {}} apiResources={apiResources} categoryWorkspaces={workspaces} />
49
+ )
50
+ }
51
+ const html = renderToStaticMarkup(
52
+ <MemoryRouter initialEntries={[path]}>
53
+ <Host />
54
+ </MemoryRouter>,
55
+ ).replace(/<!-- -->/g, '')
56
+ return { html, agents: workspaces?.[AGENTS_SIDEBAR_CATEGORY] }
57
+ }
58
+
59
+ describe('kagent in the sidebar', () => {
60
+ it('waits for capability detection, then exposes the same destinations on Overview and Agent pages', () => {
61
+ state.checking = true
62
+ state.support = 'unknown'
63
+ expect(render(KAGENT_KINDS).agents).toBeUndefined()
64
+ state.support = 'supported'
65
+ expect(render(KAGENT_KINDS).agents).toBeDefined()
66
+ state.checking = false
67
+ for (const path of ['/kagent', '/kagent/agents/agents/helper'])
68
+ expect(render(KAGENT_KINDS, path).agents?.destinations.map(d => d.label)).toEqual(['Overview', 'Agents', 'MCP servers', 'Models'])
69
+ })
70
+ it('adds an Agents destination for kagent’s Agent list to the Agents row', () => {
71
+ const { html, agents } = render(KAGENT_KINDS)
72
+ expect(agents?.tools).toBe('kagent')
73
+ expect(agents?.destinations.map((d) => d.label)).toEqual(['Overview', 'Agents', 'MCP servers', 'Models'])
74
+ expect(agents?.destinations[1]).toMatchObject({ id: 'kagent-agents', kind: { name: 'agents', group: 'api.kagent.dev' } })
75
+ expect(agents?.count).toBe(2)
76
+ expect(html).toMatch(/Other kinds \(1\)/)
77
+ })
78
+
79
+ it('shares the row with Agent Sandbox under a heading of its own', () => {
80
+ state.sandbox = liveWorkspace()
81
+ const { html, agents } = render([...SANDBOX_KINDS, ...KAGENT_KINDS])
82
+ expect(html).toMatch(/>Agents<\/span><span[^>]*>Agent Sandbox · kagent</)
83
+ expect(agents?.destinations.map((d) => `${d.section}/${d.label}`)).toEqual([
84
+ 'Sandbox/Overview',
85
+ 'Sandbox/Sandboxes',
86
+ 'Sandbox/Claims',
87
+ 'Sandbox/Warm pools',
88
+ 'kagent/Overview',
89
+ 'kagent/Agents',
90
+ 'kagent/MCP servers',
91
+ 'kagent/Models',
92
+ ])
93
+ expect(agents?.count).toBe(9)
94
+ })
95
+
96
+ it('keeps the existing destination when the workspace is unsupported', () => {
97
+ state.support = 'unsupported'
98
+ const { agents } = render(KAGENT_KINDS)
99
+ expect(agents?.destinations.map((d) => d.label)).toEqual(['Agents'])
100
+ expect(agents?.count).toBeUndefined()
101
+ state.support = 'supported'
102
+ })
103
+
104
+ it('does not highlight kagent on Substrate’s filtered Actors page', () => {
105
+ const { agents } = render(KAGENT_KINDS, '/substrate/actors?kagent=sessions')
106
+ expect(agents?.destinations.filter(d => d.active)).toEqual([])
107
+ })
108
+
109
+ it('is absent when the cluster doesn’t serve kagent’s Agents', () => {
110
+ expect(render([crd('kagent.dev', 'Agent', 'agents')]).agents).toBeUndefined()
111
+ })
112
+ })