@skyhook-io/radar-app 1.19.0 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +5 -5
- package/src/App.tsx +37 -9
- package/src/api/application-evidence.ts +63 -0
- package/src/api/argoSync.test.ts +22 -0
- package/src/api/client.audit-gating.test.tsx +48 -0
- package/src/api/client.kueuePosition.test.ts +32 -0
- package/src/api/client.kueueQueueWorkloads.test.tsx +71 -0
- package/src/api/client.resource-identity.test.ts +3 -0
- package/src/api/client.resourceIssues.test.tsx +239 -0
- package/src/api/client.resourcePath.test.ts +3 -0
- package/src/api/client.ts +353 -64
- package/src/api/config.ts +21 -0
- package/src/api/diagnose.ts +4 -0
- package/src/api/helmInventory.test.tsx +108 -0
- package/src/api/radarFeatures.render.test.tsx +33 -1
- package/src/api/radarFeatures.test.ts +47 -0
- package/src/api/radarFeatures.ts +42 -1
- package/src/api/rbac.settled.test.tsx +42 -0
- package/src/api/rbac.test.ts +18 -0
- package/src/api/rbac.ts +37 -7
- package/src/api/traffic.ts +9 -4
- package/src/api/usage-data.fixtures.ts +3 -1
- package/src/api/usage-data.test.tsx +134 -0
- package/src/api/usage-data.ts +35 -7
- package/src/api/workloadPodsPolling.test.ts +26 -0
- package/src/components/CloudConnectFlow.test.tsx +86 -0
- package/src/components/CloudConnectFlow.tsx +65 -27
- package/src/components/CloudFunnelButton.test.tsx +140 -5
- package/src/components/CloudFunnelButton.tsx +50 -9
- package/src/components/ConnectionErrorView.test.tsx +34 -0
- package/src/components/ConnectionErrorView.tsx +35 -11
- package/src/components/ContextSwitcher.tsx +5 -2
- package/src/components/SwitchAwareConnectionError.test.tsx +43 -0
- package/src/components/SwitchAwareConnectionError.tsx +85 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.flow.test.tsx +234 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.test.tsx +144 -0
- package/src/components/application-evidence/ApplicationEvidenceAction.tsx +218 -0
- package/src/components/capacity/CapacityDemand.tsx +3 -2
- package/src/components/capacity/demandSummary.test.ts +38 -0
- package/src/components/capacity/shared.tsx +12 -1
- package/src/components/cost/ApplicationCostTab.tsx +4 -0
- package/src/components/cost/CostTrendChart.tsx +2 -0
- package/src/components/cost/WorkloadCostTab.tsx +4 -0
- package/src/components/cost/source.test.ts +5 -0
- package/src/components/cost/source.ts +11 -0
- package/src/components/curl/ServiceCurlAvailability.test.tsx +32 -0
- package/src/components/curl/ServiceCurlButton.tsx +2 -2
- package/src/components/diagnose/AIMarkdown.tsx +3 -0
- package/src/components/diagnose/AgentSetupNotice.test.tsx +17 -0
- package/src/components/diagnose/AgentSetupNotice.tsx +21 -3
- package/src/components/diagnose/ContinueInAgentButton.mounted.test.tsx +182 -0
- package/src/components/diagnose/ContinueInAgentButton.test.tsx +128 -0
- package/src/components/diagnose/ContinueInAgentButton.tsx +303 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +1 -1
- package/src/components/diagnose/DiagnoseContext.tsx +68 -2
- package/src/components/diagnose/DiagnoseSurface.tsx +58 -113
- package/src/components/diagnose/ExampleInvestigationLink.tsx +20 -0
- package/src/components/diagnose/Home.test.tsx +26 -0
- package/src/components/diagnose/Home.tsx +20 -1
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +45 -22
- package/src/components/diagnose/InvestigationView.tsx +94 -26
- package/src/components/diagnose/LocalDiagnoseAction.history.test.tsx +450 -0
- package/src/components/diagnose/LocalDiagnoseAction.tsx +354 -35
- package/src/components/diagnose/NextStepJump.test.tsx +92 -0
- package/src/components/diagnose/NextStepJump.tsx +75 -0
- package/src/components/diagnose/QuestionComposer.tsx +8 -0
- package/src/components/diagnose/exampleInvestigation.events.json +191 -0
- package/src/components/diagnose/exampleInvestigation.loadFailure.test.tsx +94 -0
- package/src/components/diagnose/exampleInvestigation.test.tsx +248 -0
- package/src/components/diagnose/exampleInvestigation.ts +121 -0
- package/src/components/diagnose/investigationCase.test.tsx +50 -1
- package/src/components/diagnose/investigationEvidence/adapters/applicationFindings.test.ts +739 -0
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +72 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +50 -2
- package/src/components/diagnose/investigationEvidence/adapters/helm.ts +51 -16
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +9 -0
- package/src/components/diagnose/investigationEvidence/adapters/listings.ts +34 -4
- package/src/components/diagnose/investigationEvidence/adapters/resource.ts +3 -2
- package/src/components/diagnose/investigationEvidence/builder.ts +30 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +121 -2
- package/src/components/diagnose/investigationEvidence/projection.test.ts +85 -3
- package/src/components/diagnose/investigationEvidence/types.ts +5 -0
- package/src/components/diagnose/investigationState.ts +28 -0
- package/src/components/diagnose/lastInvestigation.test.ts +95 -0
- package/src/components/diagnose/lastInvestigation.ts +58 -0
- package/src/components/diagnose/launch.test.ts +125 -1
- package/src/components/diagnose/launch.ts +57 -10
- package/src/components/diagnose/toolCallLabel.test.ts +10 -4
- package/src/components/execution/BatchExecutionView.tsx +24 -11
- package/src/components/execution/JobSetAdmission.test.tsx +42 -0
- package/src/components/execution/JobSetAdmission.tsx +18 -3
- package/src/components/execution/JobSetMemberComparison.tsx +2 -1
- package/src/components/execution/runState.test.ts +14 -0
- package/src/components/execution/runState.ts +8 -0
- package/src/components/gitops/GitOpsView.rollbackGate.test.tsx +202 -0
- package/src/components/gitops/GitOpsView.syncRequest.test.tsx +369 -0
- package/src/components/gitops/GitOpsView.tsx +86 -17
- package/src/components/gitops/RemoteDestinationCloudHint.tsx +2 -3
- package/src/components/gitops/destination-toast.test.ts +1 -1
- package/src/components/gitops/destination-toast.ts +2 -2
- package/src/components/helm/HelmDrawerFrame.tsx +101 -0
- package/src/components/helm/HelmDrawerRouting.test.tsx +86 -0
- package/src/components/helm/HelmReleaseDrawer.tsx +23 -86
- package/src/components/helm/HelmView.tsx +213 -71
- package/src/components/helm/ObservedHelmNotice.tsx +146 -0
- package/src/components/helm/ObservedHelmRelease.test.tsx +261 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.test.tsx +80 -0
- package/src/components/helm/ObservedHelmReleaseDrawer.tsx +228 -0
- package/src/components/helm/OwnedResources.tsx +4 -2
- package/src/components/home/ClusterHealthCard.restricted.test.tsx +76 -0
- package/src/components/home/ClusterHealthCard.tsx +28 -5
- package/src/components/home/HelmSummary.tsx +23 -4
- package/src/components/home/HelmSummary.unread.test.ts +16 -0
- package/src/components/home/HomeAgentBlock.test.tsx +31 -3
- package/src/components/home/HomeAgentBlock.tsx +20 -4
- package/src/components/home/HomeDiagramCard.tsx +47 -0
- package/src/components/home/HomeView.tsx +81 -41
- package/src/components/home/MCPSetupDialog.test.tsx +126 -10
- package/src/components/home/MCPSetupDialog.tsx +33 -5
- package/src/components/home/ProblemsPanel.investigate.test.tsx +171 -0
- package/src/components/home/ProblemsPanel.test.tsx +3 -1
- package/src/components/home/TopologyPreview.test.tsx +73 -0
- package/src/components/home/TopologyPreview.tsx +120 -233
- package/src/components/home/TrafficSummary.test.tsx +63 -0
- package/src/components/home/TrafficSummary.tsx +135 -138
- package/src/components/home/mcpToolCatalog.ts +67 -14
- package/src/components/issues/IssuesPane.test.ts +11 -0
- package/src/components/issues/IssuesPane.tsx +15 -5
- package/src/components/issues/uncheckedSources.test.ts +22 -1
- package/src/components/issues/uncheckedSources.ts +21 -0
- package/src/components/kueue/KueuePendingPosition.tsx +35 -0
- package/src/components/kueue/useRelatedObjects.test.tsx +219 -0
- package/src/components/kueue/useRelatedReads.test.ts +56 -0
- package/src/components/kueue/useRelatedReads.ts +205 -0
- package/src/components/logs/MultiPodLogsTab.test.tsx +93 -0
- package/src/components/logs/MultiPodLogsTab.tsx +120 -0
- package/src/components/logs/PodLogsUnavailable.test.tsx +18 -0
- package/src/components/logs/PodLogsUnavailable.tsx +21 -0
- package/src/components/logs/RayClusterLogsTab.reselect.test.tsx +67 -0
- package/src/components/logs/RayClusterLogsTab.test.tsx +167 -0
- package/src/components/logs/RayClusterLogsTab.tsx +109 -0
- package/src/components/logs/ScheduledWorkloadLogsViewer.tsx +3 -2
- package/src/components/logs/rayClusterPods.ts +32 -0
- package/src/components/outageSince.test.ts +21 -0
- package/src/components/outageSince.ts +10 -0
- package/src/components/resource/PrometheusCharts.overlays.test.ts +12 -0
- package/src/components/resource/PrometheusCharts.tsx +3 -40
- package/src/components/resources/crd/CRDSchemaTab.test.tsx +28 -0
- package/src/components/resources/crd/CRDSchemaTab.tsx +13 -0
- package/src/components/resources/crd/host.tsx +14 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.test.tsx +27 -0
- package/src/components/resources/renderers/CustomResourceDefinitionRenderer.tsx +12 -0
- package/src/components/resources/renderers/JobAdmissionRenderers.test.tsx +4 -1
- package/src/components/resources/renderers/JobAdmissionRenderers.tsx +4 -3
- package/src/components/resources/renderers/KueueHostRenderers.test.tsx +117 -0
- package/src/components/resources/renderers/KueueQueueRenderers.test.tsx +97 -0
- package/src/components/resources/renderers/KueueQueueRenderers.tsx +139 -0
- package/src/components/resources/renderers/KueueWorkloadRenderer.test.tsx +7 -1
- package/src/components/resources/renderers/KueueWorkloadRenderer.tsx +47 -7
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.test.tsx +67 -0
- package/src/components/resources/renderers/OpenTelemetryCollectorRenderer.tsx +31 -0
- package/src/components/resources/renderers/RayClusterRenderer.test.tsx +81 -3
- package/src/components/resources/renderers/RayClusterRenderer.tsx +19 -4
- package/src/components/resources/renderers/ServiceRenderer.test.tsx +15 -2
- package/src/components/resources/renderers/ServiceRenderer.tsx +1 -1
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.test.tsx +160 -0
- package/src/components/resources/renderers/ValidatingAdmissionPolicyRenderer.tsx +128 -0
- package/src/components/traffic/TrafficView.tsx +3 -3
- package/src/components/ui/command-items-crd.test.tsx +23 -0
- package/src/components/ui/command-items.ts +2 -1
- package/src/components/useContextSwitchFlow.test.tsx +61 -0
- package/src/components/useContextSwitchFlow.tsx +21 -4
- package/src/components/whats-new/WhatsNew.test.ts +10 -3
- package/src/components/whats-new/WhatsNew.tsx +5 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +17 -3
- package/src/components/whats-new/releaseNotes.ts +77 -4
- package/src/components/workload/RelatedFindingsSection.test.tsx +126 -0
- package/src/components/workload/RelatedFindingsSection.tsx +80 -0
- package/src/components/workload/WorkloadView.test.ts +10 -1
- package/src/components/workload/WorkloadView.tsx +85 -98
- package/src/components/workload/issueResourceOpener.test.ts +20 -0
- package/src/components/workload/issueResourceOpener.ts +17 -0
- package/src/context/ConnectionContext.tsx +133 -60
- package/src/context/ConnectionProvider.retry.test.tsx +176 -0
- package/src/context/ContextSwitchContext.tsx +14 -1
- package/src/context/DiagnoseCustomization.tsx +3 -0
- package/src/context/clusterConnected.ts +10 -0
- package/src/contexts/CapabilitiesContext.tsx +8 -4
- package/src/hooks/useElementSize.ts +30 -0
- package/src/hooks/useResolvedGitOpsOwner.test.ts +22 -0
- package/src/hooks/useResolvedGitOpsOwner.ts +6 -3
- package/src/integrations/resourceHost.test.tsx +1 -0
- package/src/integrations/resourceHost.ts +5 -1
- package/src/integrations/resourceHosts.test.tsx +21 -4
- package/src/integrations/resourceHosts.tsx +17 -0
- package/src/main.tsx +5 -0
- package/src/utils/related-findings.ts +46 -0
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
Maximize2,
|
|
17
17
|
Minimize2,
|
|
18
18
|
Settings2,
|
|
19
|
-
MoreVertical,
|
|
20
|
-
TerminalSquare,
|
|
21
|
-
Copy,
|
|
22
|
-
Check,
|
|
23
19
|
RotateCcw,
|
|
24
20
|
PanelLeftOpen,
|
|
25
21
|
} from "lucide-react";
|
|
26
22
|
import { Tooltip } from "../ui/Tooltip";
|
|
23
|
+
import {
|
|
24
|
+
ContinueInAgentButton,
|
|
25
|
+
useContinueInAgentCommand,
|
|
26
|
+
} from "./ContinueInAgentButton";
|
|
27
27
|
import { useAnimatedUnmount } from "../../hooks/useAnimatedUnmount";
|
|
28
28
|
import {
|
|
29
29
|
TRANSITION_BACKDROP,
|
|
@@ -51,6 +51,12 @@ import {
|
|
|
51
51
|
statusWord,
|
|
52
52
|
} from "./Home";
|
|
53
53
|
import { AgentSetupNotice } from "./AgentSetupNotice";
|
|
54
|
+
import {
|
|
55
|
+
EXAMPLE_INVESTIGATION_ID,
|
|
56
|
+
EXAMPLE_INVESTIGATION_RUN,
|
|
57
|
+
exampleInvestigationOffered,
|
|
58
|
+
isExampleInvestigation,
|
|
59
|
+
} from "./exampleInvestigation";
|
|
54
60
|
import { AgentSigninNotice } from "./AgentSigninNotice";
|
|
55
61
|
import {
|
|
56
62
|
useAgentSignin,
|
|
@@ -58,10 +64,7 @@ import {
|
|
|
58
64
|
} from "../../hooks/useAgentSignin";
|
|
59
65
|
import { ConsentCard } from "./parts";
|
|
60
66
|
import type { ConsentSubject } from "./AgentControls";
|
|
61
|
-
import { buildLaunchCommand, launchAgentLabel, openInTerminal } from "./launch";
|
|
62
67
|
import { type RunSummary, type ExecutionProfile } from "../../api/diagnose";
|
|
63
|
-
import { mcpEndpointUrl } from "../../api/config";
|
|
64
|
-
import { useCapabilitiesContext } from "../../contexts/CapabilitiesContext";
|
|
65
68
|
import { useContexts } from "../../api/client";
|
|
66
69
|
import {
|
|
67
70
|
formatInvestigationTarget,
|
|
@@ -99,107 +102,6 @@ function buildConfigLine(cfg: {
|
|
|
99
102
|
return "via " + parts.join(" · ");
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
// InvestigationMenu hands an investigation off to the user's own full agent. The
|
|
103
|
-
// PRIMARY action copies a resume command they can paste wherever they actually
|
|
104
|
-
// work (terminal, tmux, IDE) — destination-agnostic. Running it in Radar's built-in
|
|
105
|
-
// terminal is the secondary "run it here" convenience.
|
|
106
|
-
function InvestigationMenu({ run }: { run: RunSummary }) {
|
|
107
|
-
const [open, setOpen] = useState(false);
|
|
108
|
-
const [copied, setCopied] = useState(false);
|
|
109
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
110
|
-
const { localTerminal, mcpReadOnly } = useCapabilitiesContext();
|
|
111
|
-
const label = launchAgentLabel(run);
|
|
112
|
-
const command = buildLaunchCommand(
|
|
113
|
-
run,
|
|
114
|
-
mcpEndpointUrl(mcpReadOnly),
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
// The diagnose root is a CSS container, so a position:fixed click-away layer
|
|
118
|
-
// inside it is panel-bound rather than viewport-bound. Dismiss from the
|
|
119
|
-
// document instead; the anchored menu itself can stay next to its trigger.
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
if (!open) return;
|
|
122
|
-
const onPointerDown = (event: PointerEvent) => {
|
|
123
|
-
if (!menuRef.current?.contains(event.target as Node)) setOpen(false);
|
|
124
|
-
};
|
|
125
|
-
const onKeyDown = (event: KeyboardEvent) => {
|
|
126
|
-
if (event.key === "Escape") setOpen(false);
|
|
127
|
-
};
|
|
128
|
-
document.addEventListener("pointerdown", onPointerDown);
|
|
129
|
-
document.addEventListener("keydown", onKeyDown);
|
|
130
|
-
return () => {
|
|
131
|
-
document.removeEventListener("pointerdown", onPointerDown);
|
|
132
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
133
|
-
};
|
|
134
|
-
}, [open]);
|
|
135
|
-
|
|
136
|
-
// No resumable session yet (or stale run) → nothing to hand off.
|
|
137
|
-
if (!command) return null;
|
|
138
|
-
const toggle = () => {
|
|
139
|
-
setCopied(false);
|
|
140
|
-
setOpen((v) => !v);
|
|
141
|
-
};
|
|
142
|
-
const copy = () => {
|
|
143
|
-
void navigator.clipboard?.writeText(command);
|
|
144
|
-
setCopied(true);
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
setCopied(false);
|
|
147
|
-
setOpen(false);
|
|
148
|
-
}, 1100);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
return (
|
|
152
|
-
<div ref={menuRef} className="relative flex items-center">
|
|
153
|
-
<Tooltip content="More" position="bottom">
|
|
154
|
-
<button
|
|
155
|
-
onClick={toggle}
|
|
156
|
-
className="rounded-md p-1 text-theme-text-tertiary hover:bg-theme-hover hover:text-theme-text-primary"
|
|
157
|
-
aria-label="More actions"
|
|
158
|
-
aria-haspopup="menu"
|
|
159
|
-
aria-expanded={open}
|
|
160
|
-
>
|
|
161
|
-
<MoreVertical className="h-4 w-4" />
|
|
162
|
-
</button>
|
|
163
|
-
</Tooltip>
|
|
164
|
-
{open && (
|
|
165
|
-
<div className="absolute right-0 top-full z-20 mt-1 w-64 rounded-lg border border-theme-border bg-theme-surface py-1 shadow-theme-lg">
|
|
166
|
-
<button
|
|
167
|
-
onClick={copy}
|
|
168
|
-
className="flex w-full items-start gap-2 px-3 py-1.5 text-left text-sm text-theme-text-primary hover:bg-theme-hover"
|
|
169
|
-
>
|
|
170
|
-
{copied ? (
|
|
171
|
-
<Check className="mt-0.5 h-4 w-4 shrink-0 text-emerald-500" />
|
|
172
|
-
) : (
|
|
173
|
-
<Copy className="mt-0.5 h-4 w-4 shrink-0 text-theme-text-tertiary" />
|
|
174
|
-
)}
|
|
175
|
-
<span>
|
|
176
|
-
{copied ? "Copied ✓" : `Copy command to continue in ${label}`}
|
|
177
|
-
{!copied && (
|
|
178
|
-
<span className="block text-[11px] text-theme-text-tertiary">
|
|
179
|
-
Paste it wherever you run {label} — resumes this exact
|
|
180
|
-
session.
|
|
181
|
-
</span>
|
|
182
|
-
)}
|
|
183
|
-
</span>
|
|
184
|
-
</button>
|
|
185
|
-
{localTerminal && (
|
|
186
|
-
<button
|
|
187
|
-
onClick={() => {
|
|
188
|
-
openInTerminal(command, "Radar Investigation");
|
|
189
|
-
setOpen(false);
|
|
190
|
-
}}
|
|
191
|
-
className="flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm text-theme-text-primary hover:bg-theme-hover"
|
|
192
|
-
>
|
|
193
|
-
<TerminalSquare className="h-4 w-4 shrink-0 text-theme-text-tertiary" />
|
|
194
|
-
Run in a Radar terminal
|
|
195
|
-
</button>
|
|
196
|
-
)}
|
|
197
|
-
</div>
|
|
198
|
-
)}
|
|
199
|
-
</div>
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
105
|
// The panel is an ABSOLUTE slot inside the app's body frame (the column under the
|
|
204
106
|
// header, right of the nav rail) — App renders it there and passes topInset (the
|
|
205
107
|
// header height; 0 in chromeless embeds). It shares that frame with the resource/
|
|
@@ -565,11 +467,26 @@ export function DiagnoseSurface({
|
|
|
565
467
|
const setupPending =
|
|
566
468
|
d.setupState === "needs-install" || d.setupState === "needs-restart";
|
|
567
469
|
|
|
568
|
-
const
|
|
470
|
+
const exampleOpen = isExampleInvestigation(d.activeRunId);
|
|
471
|
+
const activeRun = exampleOpen
|
|
472
|
+
? EXAMPLE_INVESTIGATION_RUN
|
|
473
|
+
: (d.runs.find((r) => r.id === d.activeRunId) ?? null);
|
|
474
|
+
const openExample = exampleInvestigationOffered({
|
|
475
|
+
runs: d.runs,
|
|
476
|
+
runsLoaded: d.runsLoaded,
|
|
477
|
+
setupPending,
|
|
478
|
+
needsConsent: d.needsConsent,
|
|
479
|
+
})
|
|
480
|
+
? () => d.openRun(EXAMPLE_INVESTIGATION_ID)
|
|
481
|
+
: undefined;
|
|
569
482
|
// Consent replaces the detail pane even if goHome retained an older run id.
|
|
570
483
|
// Header identity and actions must describe what is actually visible.
|
|
571
484
|
const visibleRunDetail =
|
|
572
485
|
d.needsConsent || d.startCapacity ? null : activeRun;
|
|
486
|
+
// The investigation view knows when its agent session is quiet; the header
|
|
487
|
+
// offers the hand-off only then.
|
|
488
|
+
const [handoffAllowed, setHandoffAllowed] = useState(false);
|
|
489
|
+
const handoffCommand = useContinueInAgentCommand(visibleRunDetail);
|
|
573
490
|
// A focused run shows the agent it actually ran with; Home reflects the current pick.
|
|
574
491
|
const activeAgentLabel = visibleRunDetail?.agent
|
|
575
492
|
? agentLabelFor(visibleRunDetail.agent)
|
|
@@ -642,9 +559,17 @@ export function DiagnoseSurface({
|
|
|
642
559
|
run={activeRun}
|
|
643
560
|
agentLabel={activeAgentLabel}
|
|
644
561
|
maximized={maximized}
|
|
645
|
-
|
|
646
|
-
|
|
562
|
+
// The example's resources are on a test cluster, not this one.
|
|
563
|
+
onOpenResource={
|
|
564
|
+
onOpenResource && !exampleOpen ? openEvidenceResource : undefined
|
|
565
|
+
}
|
|
566
|
+
onOpenTimeline={
|
|
567
|
+
onOpenTimeline && !exampleOpen ? openEvidenceTimeline : undefined
|
|
568
|
+
}
|
|
647
569
|
onRevealDestination={revealDestination}
|
|
570
|
+
example={exampleOpen}
|
|
571
|
+
onCloseExample={exampleOpen ? d.goHome : undefined}
|
|
572
|
+
onHandoffAllowedChange={setHandoffAllowed}
|
|
648
573
|
/>
|
|
649
574
|
) : d.activeRunId && !d.runsLoaded ? (
|
|
650
575
|
// Deep-linked to a run before the list has ever loaded: show the load
|
|
@@ -699,6 +624,7 @@ export function DiagnoseSurface({
|
|
|
699
624
|
checkingAgents={d.checkingAgents}
|
|
700
625
|
agentsCheckFailed={d.agentsCheckFailed}
|
|
701
626
|
recheckAgents={d.recheckAgents}
|
|
627
|
+
onOpenExample={openExample}
|
|
702
628
|
/>
|
|
703
629
|
</div>
|
|
704
630
|
) : (
|
|
@@ -730,12 +656,14 @@ export function DiagnoseSurface({
|
|
|
730
656
|
checkingAgents={d.checkingAgents}
|
|
731
657
|
agentsCheckFailed={d.agentsCheckFailed}
|
|
732
658
|
recheckAgents={d.recheckAgents}
|
|
659
|
+
onOpenExample={openExample}
|
|
733
660
|
/>
|
|
734
661
|
</div>
|
|
735
662
|
) : (
|
|
736
663
|
<InvestigationHome
|
|
737
664
|
agentLabel={d.agentLabel}
|
|
738
665
|
questions={d.questions}
|
|
666
|
+
onOpenExample={openExample}
|
|
739
667
|
onBrowseIssues={
|
|
740
668
|
d.questions || (d.runsLoaded && d.runs.length === 0)
|
|
741
669
|
? onBrowseIssues
|
|
@@ -847,6 +775,7 @@ export function DiagnoseSurface({
|
|
|
847
775
|
<div className="flex shrink-0 items-center gap-1">
|
|
848
776
|
{activeRun &&
|
|
849
777
|
visibleRunDetail &&
|
|
778
|
+
!exampleOpen &&
|
|
850
779
|
canRerunInvestigation(d.view, activeRun, d.needsConsent) && (
|
|
851
780
|
<Tooltip
|
|
852
781
|
content="Re-run this investigation from scratch"
|
|
@@ -861,7 +790,9 @@ export function DiagnoseSurface({
|
|
|
861
790
|
</button>
|
|
862
791
|
</Tooltip>
|
|
863
792
|
)}
|
|
864
|
-
{visibleRunDetail &&
|
|
793
|
+
{visibleRunDetail &&
|
|
794
|
+
!exampleOpen &&
|
|
795
|
+
headerPresentation.runActionsClass !== null && (
|
|
865
796
|
<div
|
|
866
797
|
className={`items-center gap-1 ${headerPresentation.runActionsClass || "flex"}`}
|
|
867
798
|
>
|
|
@@ -869,7 +800,12 @@ export function DiagnoseSurface({
|
|
|
869
800
|
run: visibleRunDetail,
|
|
870
801
|
onRunUpdated: d.updateRunSummary,
|
|
871
802
|
})}
|
|
872
|
-
|
|
803
|
+
{handoffAllowed && handoffCommand && (
|
|
804
|
+
<ContinueInAgentButton
|
|
805
|
+
run={visibleRunDetail}
|
|
806
|
+
command={handoffCommand}
|
|
807
|
+
/>
|
|
808
|
+
)}
|
|
873
809
|
</div>
|
|
874
810
|
)}
|
|
875
811
|
{!fullWidthForced && (!maximized || d.canRestoreWorkspace) && (
|
|
@@ -946,6 +882,15 @@ export function DiagnoseSurface({
|
|
|
946
882
|
loadFailed={d.runsLoadFailed}
|
|
947
883
|
onRetry={d.refreshRuns}
|
|
948
884
|
questions={d.questions}
|
|
885
|
+
// Beside Home on the full page, Home already offers it.
|
|
886
|
+
onOpenExample={
|
|
887
|
+
persistentHistory || exampleOpen || !openExample
|
|
888
|
+
? undefined
|
|
889
|
+
: () => {
|
|
890
|
+
openExample();
|
|
891
|
+
dismissHistory();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
949
894
|
/>
|
|
950
895
|
</aside>
|
|
951
896
|
)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ArrowRight } from "lucide-react";
|
|
2
|
+
|
|
3
|
+
export function ExampleInvestigationLink({
|
|
4
|
+
onOpen,
|
|
5
|
+
className = "",
|
|
6
|
+
}: {
|
|
7
|
+
onOpen: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}) {
|
|
10
|
+
return (
|
|
11
|
+
<button
|
|
12
|
+
type="button"
|
|
13
|
+
onClick={onOpen}
|
|
14
|
+
className={`inline-flex items-center gap-1 text-xs font-medium text-accent-text hover:underline ${className}`}
|
|
15
|
+
>
|
|
16
|
+
See an example investigation
|
|
17
|
+
<ArrowRight aria-hidden className="h-3 w-3" />
|
|
18
|
+
</button>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -352,6 +352,32 @@ describe("InvestigationHome", () => {
|
|
|
352
352
|
expect(text).toContain("Browse issues");
|
|
353
353
|
expect(html).not.toContain("textarea");
|
|
354
354
|
});
|
|
355
|
+
|
|
356
|
+
it("links to the example only when the surface offers it", () => {
|
|
357
|
+
const link = "See an example investigation";
|
|
358
|
+
expect(
|
|
359
|
+
visible(renderToStaticMarkup(<InvestigationHome agentLabel="Codex" />)),
|
|
360
|
+
).not.toContain(link);
|
|
361
|
+
expect(
|
|
362
|
+
visible(
|
|
363
|
+
renderToStaticMarkup(
|
|
364
|
+
<InvestigationHome agentLabel="Codex" onOpenExample={() => {}} />,
|
|
365
|
+
),
|
|
366
|
+
),
|
|
367
|
+
).toContain(link);
|
|
368
|
+
expect(
|
|
369
|
+
visible(
|
|
370
|
+
renderToStaticMarkup(
|
|
371
|
+
<RecentList
|
|
372
|
+
agentLabel="Codex"
|
|
373
|
+
runs={[]}
|
|
374
|
+
onSelect={() => {}}
|
|
375
|
+
onOpenExample={() => {}}
|
|
376
|
+
/>,
|
|
377
|
+
),
|
|
378
|
+
),
|
|
379
|
+
).toContain(link);
|
|
380
|
+
});
|
|
355
381
|
});
|
|
356
382
|
|
|
357
383
|
describe("RecentList question runs", () => {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { Tooltip } from "../ui/Tooltip";
|
|
23
23
|
import { QuestionComposer } from "./QuestionComposer";
|
|
24
24
|
import { plainVerdictText } from "./verdictText";
|
|
25
|
+
import { ExampleInvestigationLink } from "./ExampleInvestigationLink";
|
|
25
26
|
|
|
26
27
|
function daysBefore(date: Date, now: Date): number {
|
|
27
28
|
const start = (d: Date) =>
|
|
@@ -145,17 +146,22 @@ export function statusWord(status: RunSummary["status"]): {
|
|
|
145
146
|
export function InvestigationHome({
|
|
146
147
|
agentLabel,
|
|
147
148
|
onBrowseIssues,
|
|
149
|
+
onOpenExample,
|
|
148
150
|
questions = false,
|
|
149
151
|
}: {
|
|
150
152
|
agentLabel: string;
|
|
151
153
|
onBrowseIssues?: () => void;
|
|
154
|
+
onOpenExample?: () => void;
|
|
152
155
|
/** The backend opens a run from a question; offer the composer. */
|
|
153
156
|
questions?: boolean;
|
|
154
157
|
}) {
|
|
155
158
|
if (questions) {
|
|
156
159
|
return (
|
|
157
160
|
<div className="flex min-h-full w-full items-start justify-center px-4 py-10 sm:px-6">
|
|
158
|
-
<QuestionComposer
|
|
161
|
+
<QuestionComposer
|
|
162
|
+
onBrowseIssues={onBrowseIssues}
|
|
163
|
+
onOpenExample={onOpenExample}
|
|
164
|
+
/>
|
|
159
165
|
</div>
|
|
160
166
|
);
|
|
161
167
|
}
|
|
@@ -187,6 +193,11 @@ export function InvestigationHome({
|
|
|
187
193
|
<ArrowRight className="h-3.5 w-3.5" />
|
|
188
194
|
</button>
|
|
189
195
|
)}
|
|
196
|
+
{onOpenExample && (
|
|
197
|
+
<div className="mt-4">
|
|
198
|
+
<ExampleInvestigationLink onOpen={onOpenExample} />
|
|
199
|
+
</div>
|
|
200
|
+
)}
|
|
190
201
|
</section>
|
|
191
202
|
</div>
|
|
192
203
|
);
|
|
@@ -202,6 +213,7 @@ export function RecentList({
|
|
|
202
213
|
loaded = true,
|
|
203
214
|
loadFailed = false,
|
|
204
215
|
onRetry,
|
|
216
|
+
onOpenExample,
|
|
205
217
|
questions = false,
|
|
206
218
|
}: {
|
|
207
219
|
agentLabel: string;
|
|
@@ -216,6 +228,7 @@ export function RecentList({
|
|
|
216
228
|
/** The latest list request failed. */
|
|
217
229
|
loadFailed?: boolean;
|
|
218
230
|
onRetry?: () => void;
|
|
231
|
+
onOpenExample?: () => void;
|
|
219
232
|
/** Home offers the question composer beside this list. */
|
|
220
233
|
questions?: boolean;
|
|
221
234
|
}) {
|
|
@@ -355,6 +368,12 @@ export function RecentList({
|
|
|
355
368
|
background and are kept in your history here.
|
|
356
369
|
</p>
|
|
357
370
|
)}
|
|
371
|
+
{onOpenExample && (
|
|
372
|
+
<ExampleInvestigationLink
|
|
373
|
+
onOpen={onOpenExample}
|
|
374
|
+
className="mt-3"
|
|
375
|
+
/>
|
|
376
|
+
)}
|
|
358
377
|
</div>
|
|
359
378
|
</div>
|
|
360
379
|
);
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
CircleAlert,
|
|
7
7
|
Info,
|
|
8
8
|
SearchCheck,
|
|
9
|
+
XCircle,
|
|
9
10
|
} from "lucide-react";
|
|
10
11
|
import { Collapse, CollapseChevron } from "@skyhook-io/k8s-ui";
|
|
11
12
|
import type { EvidenceCoverageGroup } from "./investigationEvidencePresentation";
|
|
@@ -25,9 +26,14 @@ import { investigationEvidenceFullRowFlags } from "./investigationEvidencePartit
|
|
|
25
26
|
import { EvidenceCard } from "./EvidenceCard";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* Hypotheses the agent dropped, each
|
|
29
|
-
* result contradicted it
|
|
30
|
-
*
|
|
29
|
+
* Hypotheses the agent dropped, each with the claim of the Radar observation
|
|
30
|
+
* whose result contradicted it, so the reason reads without a click. The
|
|
31
|
+
* agent writes a hypothesis as a statement, which on its own reads like a
|
|
32
|
+
* finding; the heading, the mark and the screen-reader prefix say it is not
|
|
33
|
+
* the cause. The exclusion is the agent's reading, so the heading keeps the
|
|
34
|
+
* Agent tag in panel mode, where no "Agent analysis" label sits above it.
|
|
35
|
+
* Entries whose item could not be placed on an observation are filtered out
|
|
36
|
+
* by the resolver and never rendered here.
|
|
31
37
|
*/
|
|
32
38
|
export function RuledOutBlock({
|
|
33
39
|
entries,
|
|
@@ -47,32 +53,39 @@ export function RuledOutBlock({
|
|
|
47
53
|
id={headingId}
|
|
48
54
|
className="flex items-center gap-2 text-xs font-semibold text-theme-text-secondary"
|
|
49
55
|
>
|
|
50
|
-
|
|
56
|
+
Ruled out
|
|
51
57
|
<span className="text-[10px] font-semibold uppercase tracking-wide text-accent-text">
|
|
52
58
|
Agent
|
|
53
59
|
</span>
|
|
54
60
|
</h3>
|
|
55
|
-
<ul className="mt-1.5 space-y-
|
|
61
|
+
<ul className="mt-1.5 space-y-2">
|
|
56
62
|
{entries.map((entry, position) => {
|
|
57
63
|
const observation = entry.item.observation!;
|
|
58
64
|
return (
|
|
59
|
-
<li
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className="
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
<li key={position} className="flex min-w-0 gap-2 text-xs">
|
|
66
|
+
<XCircle
|
|
67
|
+
className="mt-0.5 h-3.5 w-3.5 shrink-0 text-theme-text-tertiary"
|
|
68
|
+
aria-hidden
|
|
69
|
+
/>
|
|
70
|
+
<div className="min-w-0">
|
|
71
|
+
<p className="font-medium text-theme-text-secondary [overflow-wrap:anywhere]">
|
|
72
|
+
<span className="sr-only">Ruled out: </span>
|
|
73
|
+
{entry.hypothesis}
|
|
74
|
+
</p>
|
|
75
|
+
<p className="text-theme-text-tertiary [overflow-wrap:anywhere]">
|
|
76
|
+
{entry.item.claim ? <>{entry.item.claim} </> : null}
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
onClick={() => onReveal(entry.item)}
|
|
80
|
+
className="rounded text-accent-text hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50"
|
|
81
|
+
>
|
|
82
|
+
See {ruledOutEvidenceLabel(observation)}
|
|
83
|
+
{entry.item.placement === "revision"
|
|
84
|
+
? " (earlier observation)"
|
|
85
|
+
: ""}
|
|
86
|
+
</button>
|
|
87
|
+
</p>
|
|
88
|
+
</div>
|
|
76
89
|
</li>
|
|
77
90
|
);
|
|
78
91
|
})}
|
|
@@ -81,6 +94,16 @@ export function RuledOutBlock({
|
|
|
81
94
|
);
|
|
82
95
|
}
|
|
83
96
|
|
|
97
|
+
// An issue's title is only its reason ("IPExhaustion"), which says neither
|
|
98
|
+
// that it is an issue nor which resource it is on; two entries can cite the
|
|
99
|
+
// same reason on different resources.
|
|
100
|
+
function ruledOutEvidenceLabel(
|
|
101
|
+
observation: NonNullable<InvestigationCaseItem["observation"]>,
|
|
102
|
+
): string {
|
|
103
|
+
if (observation.data.type !== "issue") return observation.title;
|
|
104
|
+
return `${observation.title} issue on ${observation.data.issue.name}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
84
107
|
export function AssessmentEvidenceQualification({
|
|
85
108
|
resolution,
|
|
86
109
|
onViewActivity,
|