@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
@@ -119,6 +119,9 @@ export type DiagnoseSetup =
119
119
  interface DiagnoseCtx {
120
120
  available: boolean; // an agent CLI is present (button/entry gate)
121
121
  setupState: DiagnoseSetup; // readiness for the setup nudge (see DiagnoseSetup)
122
+ // Why setupState is "off", when the server says: a team installation
123
+ // ("shared") versus the MCP mount being off ("no-mcp").
124
+ unavailableReason: "" | "shared" | "no-mcp";
122
125
  // Re-reads the agent list; the server turns investigations on if a CLI was
123
126
  // installed since the last check. Resolves once the new state is applied.
124
127
  recheckAgents: () => Promise<void>;
@@ -471,6 +474,8 @@ function RoutedDiagnoseProvider({
471
474
  }, [location]);
472
475
  const [available, setAvailable] = useState(false);
473
476
  const [eligible, setEligible] = useState(false);
477
+ const [unavailableReason, setUnavailableReason] =
478
+ useState<DiagnoseCtx["unavailableReason"]>("");
474
479
  const [agentEligibilityResolved, setAgentEligibilityResolved] =
475
480
  useState(false);
476
481
  const [agents, setAgents] = useState<AgentInfo[]>([]);
@@ -641,6 +646,7 @@ function RoutedDiagnoseProvider({
641
646
  setCliOverride(!!r.cliOverride);
642
647
  setConsented(r.consented ?? {});
643
648
  setEligible(!!r.eligible);
649
+ setUnavailableReason(r.unavailableReason ?? "");
644
650
  const supported = r.agents.filter(
645
651
  (a) =>
646
652
  a.supported &&
@@ -1375,6 +1381,7 @@ function RoutedDiagnoseProvider({
1375
1381
  const value: DiagnoseCtx = {
1376
1382
  available,
1377
1383
  setupState,
1384
+ unavailableReason,
1378
1385
  recheckAgents,
1379
1386
  checkingAgents,
1380
1387
  agentsCheckFailed,
@@ -0,0 +1,215 @@
1
+ // @vitest-environment jsdom
2
+ import { act, useEffect } from "react";
3
+ import { createRoot, type Root } from "react-dom/client";
4
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
+
7
+ import type { RunSummary } from "../../api/diagnose";
8
+ import {
9
+ DiagnoseProvider,
10
+ useDiagnose,
11
+ useDiagnoseLayout,
12
+ } from "./DiagnoseContext";
13
+ import { DiagnoseSurface } from "./DiagnoseSurface";
14
+
15
+ const api = vi.hoisted(() => ({ runs: [] as RunSummary[] }));
16
+
17
+ vi.mock("../../api/usage-data", async (importOriginal) => ({
18
+ ...(await importOriginal<object>()),
19
+ recordUsageEvent: vi.fn(),
20
+ }));
21
+
22
+ vi.mock("../../api/diagnose", async (importOriginal) => ({
23
+ ...(await importOriginal<object>()),
24
+ fetchAgents: async () => ({
25
+ enabled: true,
26
+ eligible: true,
27
+ consented: { "claude:safeguarded": true },
28
+ agents: [
29
+ {
30
+ name: "claude",
31
+ label: "Claude Code",
32
+ path: "/bin/claude",
33
+ version: "",
34
+ present: true,
35
+ supported: true,
36
+ hosted: false,
37
+ targetQuestions: true,
38
+ profiles: ["safeguarded"],
39
+ consentSurfaces: { safeguarded: "claude:safeguarded" },
40
+ },
41
+ ],
42
+ }),
43
+ listRuns: async () => ({ runs: api.runs }),
44
+ getRun: vi.fn(() => new Promise(() => {})),
45
+ subscribeRun: () => () => {},
46
+ }));
47
+
48
+ vi.mock("../../api/client", async (importOriginal) => ({
49
+ ...(await importOriginal<object>()),
50
+ useContexts: () => ({ data: [{ name: "cluster-a", isCurrent: true }] }),
51
+ }));
52
+
53
+ Object.assign(globalThis, {
54
+ IS_REACT_ACT_ENVIRONMENT: true,
55
+ ResizeObserver: class {
56
+ observe() {}
57
+ unobserve() {}
58
+ disconnect() {}
59
+ },
60
+ });
61
+ let root: Root;
62
+ const probe = {} as {
63
+ d: ReturnType<typeof useDiagnose>;
64
+ layout: ReturnType<typeof useDiagnoseLayout>;
65
+ };
66
+
67
+ function Probe() {
68
+ const d = useDiagnose();
69
+ const layout = useDiagnoseLayout();
70
+ useEffect(() => {
71
+ probe.d = d;
72
+ probe.layout = layout;
73
+ });
74
+ return layout.open ? <DiagnoseSurface /> : null;
75
+ }
76
+
77
+ const flush = () =>
78
+ act(async () => {
79
+ await new Promise((resolve) => setTimeout(resolve, 0));
80
+ });
81
+
82
+ const surface = () =>
83
+ document.querySelector<HTMLElement>('[aria-label="AI investigations"]');
84
+ const button = (label: string) =>
85
+ surface()!.querySelector<HTMLButtonElement>(`button[aria-label="${label}"]`)!;
86
+
87
+ function pressEscape(target: Element) {
88
+ const event = new KeyboardEvent("keydown", {
89
+ key: "Escape",
90
+ bubbles: true,
91
+ cancelable: true,
92
+ });
93
+ act(() => {
94
+ target.dispatchEvent(event);
95
+ });
96
+ return event;
97
+ }
98
+
99
+ async function openPanel(open: () => void) {
100
+ await act(async () =>
101
+ root.render(
102
+ <QueryClientProvider
103
+ client={
104
+ new QueryClient({ defaultOptions: { queries: { enabled: false } } })
105
+ }
106
+ >
107
+ <DiagnoseProvider browserURLState={false}>
108
+ <Probe />
109
+ </DiagnoseProvider>
110
+ </QueryClientProvider>,
111
+ ),
112
+ );
113
+ await flush();
114
+ await act(async () => open());
115
+ await flush();
116
+ expect(surface()).not.toBeNull();
117
+ }
118
+
119
+ beforeEach(() => {
120
+ api.runs = [];
121
+ localStorage.clear();
122
+ const element = document.createElement("div");
123
+ document.body.appendChild(element);
124
+ root = createRoot(element);
125
+ });
126
+
127
+ afterEach(async () => {
128
+ await act(async () => root.unmount());
129
+ document.body.replaceChildren();
130
+ });
131
+
132
+ describe("Escape in the docked investigation panel", () => {
133
+ it("moves focus into the docked panel on launch, closes on immediate Escape, and restores opener focus", async () => {
134
+ api.runs = [
135
+ {
136
+ id: "run-cart",
137
+ kind: "Deployment",
138
+ group: "apps",
139
+ namespace: "shop",
140
+ name: "cart",
141
+ context: "cluster-a",
142
+ status: "running",
143
+ createdAt: "2026-01-01T00:00:00Z",
144
+ updatedAt: "2026-01-01T00:00:00Z",
145
+ },
146
+ ];
147
+ const launcher = document.createElement("button");
148
+ launcher.textContent = "Investigate";
149
+ document.body.appendChild(launcher);
150
+ launcher.focus();
151
+ expect(document.activeElement).toBe(launcher);
152
+
153
+ await openPanel(() => probe.d.openRun("run-cart"));
154
+ expect(surface()!.contains(document.activeElement)).toBe(true);
155
+
156
+ const event = pressEscape(document.activeElement!);
157
+ expect(event.defaultPrevented).toBe(true);
158
+ expect(probe.layout.open).toBe(false);
159
+ expect(surface()).toBeNull();
160
+ expect(document.activeElement).toBe(launcher);
161
+ });
162
+
163
+ it("closes the panel when focus is inside it", async () => {
164
+ await openPanel(() => probe.d.openHome());
165
+ const close = button("Close");
166
+ close.focus();
167
+ const event = pressEscape(close);
168
+ expect(event.defaultPrevented).toBe(true);
169
+ expect(probe.layout.open).toBe(false);
170
+ expect(surface()).toBeNull();
171
+ });
172
+
173
+ it("closes the history overlay first, then the panel", async () => {
174
+ api.runs = [
175
+ {
176
+ id: "run-cart",
177
+ kind: "Deployment",
178
+ group: "apps",
179
+ namespace: "shop",
180
+ name: "cart",
181
+ context: "cluster-a",
182
+ status: "running",
183
+ createdAt: "2026-01-01T00:00:00Z",
184
+ updatedAt: "2026-01-01T00:00:00Z",
185
+ },
186
+ ];
187
+ await openPanel(() => probe.d.openRun("run-cart"));
188
+ const history = button("Investigations");
189
+ expect(history.getAttribute("aria-expanded")).toBe("false");
190
+ await act(async () => history.click());
191
+ expect(history.getAttribute("aria-expanded")).toBe("true");
192
+
193
+ pressEscape(history);
194
+ expect(history.getAttribute("aria-expanded")).toBe("false");
195
+ expect(probe.layout.open).toBe(true);
196
+
197
+ pressEscape(history);
198
+ expect(probe.layout.open).toBe(false);
199
+ });
200
+
201
+ it("leaves the panel open when something inside it consumed the Escape", async () => {
202
+ await openPanel(() => probe.d.openHome());
203
+ const close = button("Close");
204
+ close.addEventListener("keydown", (event) => event.preventDefault());
205
+ pressEscape(close);
206
+ expect(probe.layout.open).toBe(true);
207
+ });
208
+
209
+ it("does not close the maximized workspace surface", async () => {
210
+ await openPanel(() => probe.d.openHome());
211
+ await act(async () => probe.layout.setMaximized(true));
212
+ pressEscape(button("Close"));
213
+ expect(probe.layout.open).toBe(true);
214
+ });
215
+ });
@@ -51,6 +51,8 @@ import {
51
51
  statusWord,
52
52
  } from "./Home";
53
53
  import { AgentSetupNotice } from "./AgentSetupNotice";
54
+ import { AgentSetupCloudRow } from "../cloudHints/AgentSetupCloudRow";
55
+ import { useCloudHintsEnabled } from "../cloudHints/cloudHints";
54
56
  import {
55
57
  EXAMPLE_INVESTIGATION_ID,
56
58
  EXAMPLE_INVESTIGATION_RUN,
@@ -464,6 +466,7 @@ export function DiagnoseSurface({
464
466
  // Feature is eligible here but not runnable yet (no agent installed, or one
465
467
  // found that investigations couldn't start with): Home leads with the setup
466
468
  // notice instead of an empty list.
469
+ const cloudHints = useCloudHintsEnabled();
467
470
  const setupPending =
468
471
  d.setupState === "needs-install" || d.setupState === "needs-restart";
469
472
 
@@ -620,6 +623,7 @@ export function DiagnoseSurface({
620
623
  <div className="flex-1 overflow-y-auto">
621
624
  <AgentSetupNotice
622
625
  setupState={d.setupState}
626
+ cloudOption={cloudHints ? <AgentSetupCloudRow /> : undefined}
623
627
  cliOverride={d.cliOverride}
624
628
  checkingAgents={d.checkingAgents}
625
629
  agentsCheckFailed={d.agentsCheckFailed}
@@ -652,6 +656,7 @@ export function DiagnoseSurface({
652
656
  <div className="mx-auto w-full max-w-3xl px-4 py-8 sm:px-6">
653
657
  <AgentSetupNotice
654
658
  setupState={d.setupState}
659
+ cloudOption={cloudHints ? <AgentSetupCloudRow /> : undefined}
655
660
  cliOverride={d.cliOverride}
656
661
  checkingAgents={d.checkingAgents}
657
662
  agentsCheckFailed={d.agentsCheckFailed}
@@ -680,6 +685,39 @@ export function DiagnoseSurface({
680
685
  ? d.view === "home" || !historyCollapsed
681
686
  : historyOverlay);
682
687
 
688
+ // Capture the opener before child layout effects can move focus, so closing
689
+ // the docked panel restores focus cleanly instead of dropping it to body.
690
+ const openerRef = useRef<HTMLElement | null>(
691
+ typeof document !== "undefined" &&
692
+ document.activeElement instanceof HTMLElement
693
+ ? document.activeElement
694
+ : null,
695
+ );
696
+ const maximizedRef = useRef(maximized);
697
+
698
+ useLayoutEffect(() => {
699
+ maximizedRef.current = maximized;
700
+ if (maximized) return;
701
+ const surface = surfaceRef.current;
702
+ if (surface && !surface.contains(document.activeElement)) {
703
+ surface.focus({ preventScroll: true });
704
+ }
705
+ }, [maximized]);
706
+
707
+ useLayoutEffect(() => {
708
+ const surface = surfaceRef.current;
709
+ const opener = openerRef.current;
710
+ return () => {
711
+ if (maximizedRef.current) return;
712
+ if (
713
+ opener?.isConnected &&
714
+ surface?.contains(document.activeElement)
715
+ ) {
716
+ opener.focus({ preventScroll: true });
717
+ }
718
+ };
719
+ }, []);
720
+
683
721
  useLayoutEffect(() => {
684
722
  if (
685
723
  !historyVisible &&
@@ -692,6 +730,7 @@ export function DiagnoseSurface({
692
730
  return (
693
731
  <div
694
732
  ref={surfaceRef}
733
+ tabIndex={-1}
695
734
  role="dialog"
696
735
  aria-label="AI investigations"
697
736
  onKeyDownCapture={(event) => {
@@ -701,7 +740,24 @@ export function DiagnoseSurface({
701
740
  dismissHistory();
702
741
  }
703
742
  }}
704
- className={DIAGNOSE_SURFACE_FRAME_CLASS}
743
+ // Bubble phase, so a menu or picker inside the panel that consumes its
744
+ // own Escape keeps the panel open. React also bubbles events from
745
+ // portaled children (dialogs), which the DOM check leaves to them. The
746
+ // maximized surface is the workspace page, where close() navigates away.
747
+ onKeyDown={(event) => {
748
+ if (
749
+ event.key !== "Escape" ||
750
+ event.defaultPrevented ||
751
+ event.nativeEvent.isComposing ||
752
+ maximized ||
753
+ !surfaceRef.current?.contains(event.target as Node)
754
+ )
755
+ return;
756
+ event.preventDefault();
757
+ event.stopPropagation();
758
+ d.close();
759
+ }}
760
+ className={`${DIAGNOSE_SURFACE_FRAME_CLASS} focus:outline-none`}
705
761
  style={{
706
762
  ...positionStyle,
707
763
  animation: "slide-in-from-right 0.22s cubic-bezier(0.32,0.72,0,1)",
@@ -77,6 +77,12 @@ describe("RecentList", () => {
77
77
  );
78
78
  });
79
79
 
80
+ it("identifies an invited private run without implying organization-wide access", () => {
81
+ const html = visible(render([run({ ownedByMe: false, visibility: "private" })]));
82
+ expect(html).toContain("Shared with you for review");
83
+ expect(html).not.toContain("Organization");
84
+ });
85
+
80
86
  it("keeps the whole row as one button and labels individual identity fields without native tooltips", () => {
81
87
  const html = render([run()]);
82
88
  expect(html.match(/<button\b/g)).toHaveLength(1);
@@ -21,6 +21,7 @@ import {
21
21
  } from "./target";
22
22
  import { Tooltip } from "../ui/Tooltip";
23
23
  import { QuestionComposer } from "./QuestionComposer";
24
+ import { isPrivateRunReviewer } from "./investigationState";
24
25
  import { plainVerdictText } from "./verdictText";
25
26
  import { ExampleInvestigationLink } from "./ExampleInvestigationLink";
26
27
 
@@ -255,13 +256,19 @@ export function RecentList({
255
256
  groups.add(groupQualifiesLaneId(r.group) ? r.group : "");
256
257
  groupsByKind.set(kind, groups);
257
258
  }
259
+ const reviewRuns = runs.filter(isPrivateRunReviewer);
258
260
  const organizationRuns = runs.filter(
259
- (r) => r.trigger === "background" || r.ownedByMe === false,
261
+ (r) =>
262
+ !isPrivateRunReviewer(r) &&
263
+ (r.trigger === "background" || r.ownedByMe === false),
260
264
  );
261
- const yourRuns = runs.filter((r) => !organizationRuns.includes(r));
262
- const collections = organizationRuns.length
265
+ const yourRuns = runs.filter(
266
+ (r) => r.trigger !== "background" && r.ownedByMe !== false,
267
+ );
268
+ const collections = reviewRuns.length || organizationRuns.length
263
269
  ? [
264
270
  { label: "Your investigations", runs: yourRuns },
271
+ { label: "Shared with you for review", runs: reviewRuns },
265
272
  { label: "Organization", runs: organizationRuns },
266
273
  ].filter((collection) => collection.runs.length > 0)
267
274
  : [{ label: "", runs }];
@@ -190,7 +190,7 @@ describe("InvestigationEvidencePane under a story", () => {
190
190
  );
191
191
  expect(html).toContain('data-story-lost-support="nocard"');
192
192
  expect(html).toContain("Result in Activity");
193
- expect(html).toContain("None shown above");
193
+ expect(html).toContain("Recorded during this investigation");
194
194
  expect(html).toMatch(
195
195
  /aria-expanded="true"[^>]*aria-controls="investigation-captured-results"/,
196
196
  );
@@ -205,6 +205,13 @@ export function InvestigationEvidencePane({
205
205
  },
206
206
  [onGroupOpenChange, collectionByGroup, storyMode, resultsOpen],
207
207
  );
208
+ const revealPrimaryGroupId = revealRequest
209
+ ? projection.sources.find((item) => item.id === revealRequest.sourceId)
210
+ ?.primaryGroupId
211
+ : undefined;
212
+ const revealInMain =
213
+ revealPrimaryGroupId !== undefined &&
214
+ collectionByGroup.get(revealPrimaryGroupId) === "main";
208
215
  const revealCollection = revealRequest
209
216
  ? investigationEvidenceRevealCollection(
210
217
  projection,
@@ -237,7 +244,15 @@ export function InvestigationEvidencePane({
237
244
  setEarlierOpen(true);
238
245
  return;
239
246
  }
240
- if (storyMode && revealCollection && !resultsOpen) {
247
+ const placedStoryCard =
248
+ storyMode && revealInMain && revealPrimaryGroupId
249
+ ? document.getElementById(`story-${revealPrimaryGroupId}`)
250
+ : null;
251
+ const needsCapturedResults =
252
+ Boolean(revealCollection) ||
253
+ (revealInMain &&
254
+ (!placedStoryCard || Boolean(placedStoryCard.closest("[inert]"))));
255
+ if (storyMode && needsCapturedResults && !resultsOpen) {
241
256
  openingForRevealRequestRef.current = requestId;
242
257
  setResultsOpen(true);
243
258
  return;
@@ -272,6 +287,8 @@ export function InvestigationEvidencePane({
272
287
  }, [
273
288
  revealRequest,
274
289
  revealCollection,
290
+ revealInMain,
291
+ revealPrimaryGroupId,
275
292
  onRevealReady,
276
293
  earlierOpen,
277
294
  coverageOpen,
@@ -699,7 +716,7 @@ export function InvestigationEvidencePane({
699
716
  ? `${placedCount} shown above`
700
717
  : collecting
701
718
  ? `${capturedTotal} collected so far`
702
- : "None shown above",
719
+ : "Recorded during this investigation",
703
720
  resultsSummary,
704
721
  ]
705
722
  .filter(Boolean)