@skyhook-io/radar-app 1.18.1 → 1.19.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.
- package/package.json +4 -4
- package/src/App.tsx +23 -9
- package/src/api/client.deleteResource.test.tsx +111 -0
- package/src/api/client.resourceAudit.test.tsx +57 -0
- package/src/api/client.resourcePath.test.ts +107 -0
- package/src/api/client.ts +136 -37
- package/src/api/diagnose.test.ts +33 -2
- package/src/api/diagnose.ts +93 -3
- package/src/api/radarFeatures.ts +1 -0
- package/src/components/capacity/CapacityDemand.tsx +6 -3
- package/src/components/capacity/CapacityOverview.tsx +14 -7
- package/src/components/capacity/CapacityPoolDetail.tsx +7 -5
- package/src/components/capacity/ClusterSchedulingCard.tsx +3 -3
- package/src/components/capacity/shared.tsx +9 -5
- package/src/components/cnpg/CNPGOverview.tsx +4 -1
- package/src/components/cnpg/actions/useCNPGWriteGuard.tsx +1 -0
- package/src/components/diagnose/AIMarkdown.tsx +1 -1
- package/src/components/diagnose/ActivityTurn.tsx +34 -14
- package/src/components/diagnose/AgentControls.tsx +53 -6
- package/src/components/diagnose/AgentSetupNotice.tsx +1 -1
- package/src/components/diagnose/AgentSigninNotice.test.tsx +98 -0
- package/src/components/diagnose/AgentSigninNotice.tsx +61 -0
- package/src/components/diagnose/AnalysisStory.test.tsx +22 -0
- package/src/components/diagnose/AnalysisStory.tsx +17 -4
- package/src/components/diagnose/ApplyDialog.test.tsx +10 -0
- package/src/components/diagnose/ApplyDialog.tsx +8 -1
- package/src/components/diagnose/AssessmentCard.tsx +99 -8
- package/src/components/diagnose/DiagnoseContext.capacity.test.tsx +113 -0
- package/src/components/diagnose/DiagnoseContext.question.test.tsx +245 -0
- package/src/components/diagnose/DiagnoseContext.tsx +205 -9
- package/src/components/diagnose/DiagnoseSurface.test.tsx +54 -0
- package/src/components/diagnose/DiagnoseSurface.tsx +98 -21
- package/src/components/diagnose/EvidenceCard.tsx +67 -14
- package/src/components/diagnose/Home.test.tsx +182 -5
- package/src/components/diagnose/Home.tsx +168 -36
- package/src/components/diagnose/InvestigationCapacityNotice.test.tsx +246 -0
- package/src/components/diagnose/InvestigationCapacityNotice.tsx +241 -0
- package/src/components/diagnose/InvestigationEvidencePane.story.test.tsx +97 -6
- package/src/components/diagnose/InvestigationEvidencePane.test.tsx +119 -2
- package/src/components/diagnose/InvestigationEvidencePane.tsx +59 -11
- package/src/components/diagnose/InvestigationEvidenceSections.tsx +11 -6
- package/src/components/diagnose/InvestigationView.tsx +203 -42
- package/src/components/diagnose/LocalDiagnoseAction.tsx +23 -16
- package/src/components/diagnose/QuestionComposer.test.tsx +553 -0
- package/src/components/diagnose/QuestionComposer.tsx +487 -0
- package/src/components/diagnose/QuestionFocus.test.tsx +38 -0
- package/src/components/diagnose/QuestionFocus.tsx +123 -0
- package/src/components/diagnose/ResourcePicker.tsx +206 -0
- package/src/components/diagnose/StoryExcerpt.tsx +12 -3
- package/src/components/diagnose/assessmentCopy.ts +16 -0
- package/src/components/diagnose/investigationCase.runs.test.tsx +328 -0
- package/src/components/diagnose/investigationCase.ts +33 -1
- package/src/components/diagnose/investigationEvidence/adapters/changes.ts +36 -1
- package/src/components/diagnose/investigationEvidence/adapters/coverage.test.tsx +46 -0
- package/src/components/diagnose/investigationEvidence/adapters/crossplane.test.tsx +85 -0
- package/src/components/diagnose/investigationEvidence/adapters/diagnose.ts +8 -0
- package/src/components/diagnose/investigationEvidence/adapters/issues.ts +1 -0
- package/src/components/diagnose/investigationEvidence/adapters/posture.ts +29 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.test.ts +42 -1
- package/src/components/diagnose/investigationEvidence/adapters/prometheus.ts +29 -2
- package/src/components/diagnose/investigationEvidence/adapters/testdata/crossplane-paused-get-resource.json +28 -0
- package/src/components/diagnose/investigationEvidence/bodies/index.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/bodies/metrics.test.tsx +111 -0
- package/src/components/diagnose/investigationEvidence/bodies/metrics.tsx +67 -16
- package/src/components/diagnose/investigationEvidence/bodies/workload.tsx +5 -1
- package/src/components/diagnose/investigationEvidence/builder.ts +3 -1
- package/src/components/diagnose/investigationEvidence/cardParts.tsx +7 -2
- package/src/components/diagnose/investigationEvidence/excerpt.test.ts +18 -5
- package/src/components/diagnose/investigationEvidence/excerpt.ts +22 -11
- package/src/components/diagnose/investigationEvidence/identity.test.ts +1 -1
- package/src/components/diagnose/investigationEvidence/index.ts +1 -1
- package/src/components/diagnose/investigationEvidence/navigation.tsx +2 -0
- package/src/components/diagnose/investigationEvidence/observations.ts +7 -3
- package/src/components/diagnose/investigationEvidence/projection.test.ts +57 -3
- package/src/components/diagnose/investigationEvidence/types.ts +2 -0
- package/src/components/diagnose/investigationEvidencePartition.ts +6 -1
- package/src/components/diagnose/investigationEvidencePresentation.test.ts +36 -2
- package/src/components/diagnose/investigationEvidencePresentation.ts +33 -8
- package/src/components/diagnose/investigationFocus.test.ts +271 -0
- package/src/components/diagnose/investigationFocus.ts +132 -0
- package/src/components/diagnose/parts.test.tsx +20 -0
- package/src/components/diagnose/questionSuggestions.test.ts +111 -0
- package/src/components/diagnose/questionSuggestions.ts +150 -0
- package/src/components/diagnose/storyParts.test.tsx +66 -0
- package/src/components/diagnose/target.test.ts +143 -2
- package/src/components/diagnose/target.ts +109 -7
- package/src/components/diagnose/testdata/story-runs.json +474 -0
- package/src/components/diagnose/verdictText.test.tsx +87 -0
- package/src/components/diagnose/verdictText.ts +68 -0
- package/src/components/helm/ChartBrowser.tsx +4 -4
- package/src/components/helm/HelmReleaseDrawer.tsx +6 -2
- package/src/components/helm/HelmView.tsx +34 -23
- package/src/components/helm/InstallWizard.tsx +6 -2
- package/src/components/helm/ValuesViewer.test.tsx +1 -0
- package/src/components/helm/ValuesViewer.tsx +4 -2
- package/src/components/home/ClusterHealthCard.tsx +40 -59
- package/src/components/home/HomeAgentBlock.test.tsx +113 -0
- package/src/components/home/HomeAgentBlock.tsx +94 -0
- package/src/components/home/HomeView.tsx +5 -6
- package/src/components/home/MCPSetupDialog.test.tsx +27 -2
- package/src/components/home/MCPSetupDialog.tsx +14 -2
- package/src/components/home/RadarVersionLine.test.tsx +0 -14
- package/src/components/home/RadarVersionLine.tsx +3 -28
- package/src/components/home/mcpToolCatalog.ts +29 -2
- package/src/components/issues/IssuesPane.render.test.tsx +5 -5
- package/src/components/nav/PrimaryNavRail.tsx +34 -2
- package/src/components/product-hunt/ProductHuntNotice.render.test.tsx +120 -0
- package/src/components/product-hunt/ProductHuntNotice.test.ts +121 -0
- package/src/components/product-hunt/ProductHuntNotice.tsx +202 -0
- package/src/components/product-hunt/launchWindow.ts +78 -0
- package/src/components/product-hunt/useProductHuntRailEntry.test.tsx +76 -0
- package/src/components/product-hunt/useProductHuntRailEntry.ts +27 -0
- package/src/components/resources/CompositeRenderer.tsx +4 -0
- package/src/components/resources/ResourcesView.tsx +1 -1
- package/src/components/settings/LocalConnectionSettings.tsx +1 -0
- package/src/components/ui/Omnibar.investigate.test.tsx +105 -0
- package/src/components/ui/Omnibar.tsx +47 -3
- package/src/components/ui/RadarOmnibar.test.tsx +19 -0
- package/src/components/ui/RadarOmnibar.tsx +12 -0
- package/src/components/ui/SearchSyntaxHelp.test.tsx +39 -0
- package/src/components/ui/SearchSyntaxHelp.tsx +23 -2
- package/src/components/ui/UpdateNotification.test.tsx +2 -0
- package/src/components/ui/UpdateNotification.tsx +32 -5
- package/src/components/usage-data/UsageDataPrompt.tsx +19 -1
- package/src/components/whats-new/WhatsNewDialog.test.tsx +3 -3
- package/src/components/whats-new/releaseNotes.ts +60 -1
- package/src/components/workload/WorkloadView.tsx +10 -4
- package/src/components/workspace/layout.tsx +2 -1
- package/src/contexts/CapabilitiesContext.tsx +1 -0
- package/src/hooks/useAgentSignin.test.tsx +190 -0
- package/src/hooks/useAgentSignin.ts +160 -0
- package/src/hooks/useApproveAfterSignin.test.tsx +108 -0
- package/src/hooks/useGitOpsWriteGuard.test.tsx +126 -2
- package/src/hooks/useGitOpsWriteGuard.ts +25 -3
- package/src/hooks/useResolvedGitOpsOwner.ts +14 -9
- package/src/index.css +85 -0
|
@@ -173,7 +173,8 @@ export function CapacityPoolDetail({
|
|
|
173
173
|
|
|
174
174
|
{query.error && <RefreshError message={errorMessage(query.error)} />}
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
{/* Phones: the tabs stay on one line and scroll sideways. */}
|
|
177
|
+
<div className="flex gap-1 border-b border-theme-border phone:overflow-x-auto">
|
|
177
178
|
{POOL_SECTIONS.map((tab) => (
|
|
178
179
|
<button
|
|
179
180
|
key={tab.id}
|
|
@@ -184,7 +185,7 @@ export function CapacityPoolDetail({
|
|
|
184
185
|
tab.id === "summary" ? poolPath : `${poolPath}/${tab.id}`,
|
|
185
186
|
)
|
|
186
187
|
}
|
|
187
|
-
className={`border-b-2 px-3 py-2 text-sm font-medium transition-colors ${
|
|
188
|
+
className={`border-b-2 px-3 py-2 text-sm font-medium transition-colors phone:shrink-0 phone:whitespace-nowrap ${
|
|
188
189
|
section === tab.id
|
|
189
190
|
? "border-skyhook-500 text-theme-text-primary"
|
|
190
191
|
: "border-transparent text-theme-text-secondary hover:text-theme-text-primary"
|
|
@@ -780,15 +781,16 @@ function WorkloadAttribution({
|
|
|
780
781
|
<button
|
|
781
782
|
key={identityKey({ ref: workload.owner })}
|
|
782
783
|
type="button"
|
|
783
|
-
|
|
784
|
+
// Phones: the workload gets its own full line and the counts wrap under it.
|
|
785
|
+
className="flex w-full items-baseline justify-between gap-2 border-b border-theme-border-subtle py-1.5 text-left last:border-b-0 hover:text-accent-text phone:flex-wrap phone:justify-start phone:gap-x-3 phone:gap-y-0.5"
|
|
784
786
|
onClick={() =>
|
|
785
787
|
onOpenResource(refToSelectedResource(workload.owner))
|
|
786
788
|
}
|
|
787
789
|
>
|
|
788
|
-
<span className="min-w-0 flex-1 truncate font-mono text-xs text-theme-text-primary">
|
|
790
|
+
<span className="min-w-0 flex-1 truncate font-mono text-xs text-theme-text-primary phone:basis-full phone:whitespace-normal phone:[overflow-wrap:anywhere]">
|
|
789
791
|
{workload.owner.kind}/{workload.owner.name}
|
|
790
792
|
</span>
|
|
791
|
-
<span className="shrink-0 text-xs text-theme-text-tertiary">
|
|
793
|
+
<span className="shrink-0 text-xs text-theme-text-tertiary phone:shrink phone:min-w-0 phone:[overflow-wrap:anywhere]">
|
|
792
794
|
{workload.owner.namespace}
|
|
793
795
|
</span>
|
|
794
796
|
<span className="shrink-0 font-mono text-xs">
|
|
@@ -428,8 +428,8 @@ function SchedulingBarRowView({ row }: { row: SchedulingBarRow }) {
|
|
|
428
428
|
|
|
429
429
|
return (
|
|
430
430
|
<div role="group" aria-label={ariaLabel}>
|
|
431
|
-
<div className="flex items-center gap-3">
|
|
432
|
-
<span className="flex w-44 shrink-0 items-center gap-1.5">
|
|
431
|
+
<div className="flex items-center gap-3 phone:flex-wrap phone:gap-y-1">
|
|
432
|
+
<span className="flex w-44 shrink-0 items-center gap-1.5 phone:w-full">
|
|
433
433
|
<span className="truncate font-mono text-xs text-theme-text-primary">
|
|
434
434
|
{row.resource === "cpu" || row.resource === "memory"
|
|
435
435
|
? resourceLabel(row.resource)
|
|
@@ -517,7 +517,7 @@ function SchedulingBarRowView({ row }: { row: SchedulingBarRow }) {
|
|
|
517
517
|
</div>
|
|
518
518
|
)}
|
|
519
519
|
</div>
|
|
520
|
-
<div className="ml-[11.75rem] mt-1 flex flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs">
|
|
520
|
+
<div className="ml-[11.75rem] mt-1 flex phone:ml-0 flex-wrap items-baseline gap-x-3 gap-y-0.5 text-xs">
|
|
521
521
|
<NumberPart
|
|
522
522
|
value={
|
|
523
523
|
row.requested !== null
|
|
@@ -1048,6 +1048,7 @@ export function KpiTile({
|
|
|
1048
1048
|
attention = false,
|
|
1049
1049
|
linkLabel,
|
|
1050
1050
|
onClick,
|
|
1051
|
+
className,
|
|
1051
1052
|
}: {
|
|
1052
1053
|
label: string;
|
|
1053
1054
|
value: ReactNode;
|
|
@@ -1057,6 +1058,7 @@ export function KpiTile({
|
|
|
1057
1058
|
attention?: boolean;
|
|
1058
1059
|
linkLabel?: string;
|
|
1059
1060
|
onClick?: () => void;
|
|
1061
|
+
className?: string;
|
|
1060
1062
|
}) {
|
|
1061
1063
|
const clickable = Boolean(onClick);
|
|
1062
1064
|
return (
|
|
@@ -1078,9 +1080,9 @@ export function KpiTile({
|
|
|
1078
1080
|
clickable
|
|
1079
1081
|
? "cursor-pointer transition-colors hover:border-theme-border-light hover:bg-theme-hover/40"
|
|
1080
1082
|
: ""
|
|
1081
|
-
}`}
|
|
1083
|
+
} ${className ?? ""}`}
|
|
1082
1084
|
>
|
|
1083
|
-
<div className="flex items-center gap-1.5">
|
|
1085
|
+
<div className="flex items-center gap-1.5 phone:flex-wrap phone:gap-y-1">
|
|
1084
1086
|
<span className="text-[11px] font-medium uppercase tracking-wide text-theme-text-tertiary">
|
|
1085
1087
|
{label}
|
|
1086
1088
|
</span>
|
|
@@ -1128,10 +1130,11 @@ export function KeyValueRows({ rows }: { rows: [string, ReactNode][] }) {
|
|
|
1128
1130
|
{rows.map(([label, value], index) => (
|
|
1129
1131
|
<div
|
|
1130
1132
|
key={`${label}-${index}`}
|
|
1131
|
-
|
|
1133
|
+
// Phones: a value too long for the row moves under its label and breaks inside it.
|
|
1134
|
+
className="flex items-center justify-between gap-4 py-2 first:pt-0 last:pb-0 phone:flex-wrap phone:gap-y-0.5"
|
|
1132
1135
|
>
|
|
1133
1136
|
<span className="text-sm text-theme-text-secondary">{label}</span>
|
|
1134
|
-
<span className="text-right font-mono text-sm text-theme-text-primary">
|
|
1137
|
+
<span className="text-right font-mono text-sm text-theme-text-primary phone:ml-auto phone:min-w-0 phone:[overflow-wrap:anywhere]">
|
|
1135
1138
|
{value}
|
|
1136
1139
|
</span>
|
|
1137
1140
|
</div>
|
|
@@ -1157,7 +1160,8 @@ export function TokenGroup({
|
|
|
1157
1160
|
<div className="flex flex-wrap gap-1">
|
|
1158
1161
|
{values.length > 0 ? (
|
|
1159
1162
|
values.map((value) => (
|
|
1160
|
-
|
|
1163
|
+
// Phones: a value wider than the row breaks inside its chip instead of being clipped.
|
|
1164
|
+
<Badge key={value} tone="structural" size="sm" className="phone:[overflow-wrap:anywhere]">
|
|
1161
1165
|
{value}
|
|
1162
1166
|
</Badge>
|
|
1163
1167
|
))
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
StatusDot,
|
|
11
11
|
Tooltip,
|
|
12
12
|
toneTextClass,
|
|
13
|
+
usePhoneLayout,
|
|
13
14
|
type CNPGFleetRow,
|
|
14
15
|
type CNPGProblemCategory,
|
|
15
16
|
} from '@skyhook-io/k8s-ui'
|
|
@@ -225,7 +226,9 @@ export function CNPGOverview({
|
|
|
225
226
|
const context = connection.context || data.context
|
|
226
227
|
// Some namespaces were not read: the count is a floor, not the cluster's total.
|
|
227
228
|
const totalText = `${clustersCov?.state === 'partial' ? '≥' : ''}${total}`
|
|
228
|
-
|
|
229
|
+
// No cluster authoring on a phone (a YAML editor follows the dialog).
|
|
230
|
+
const isPhone = usePhoneLayout()
|
|
231
|
+
const createAction = onCreate && !isPhone ? (
|
|
229
232
|
<button type="button" onClick={onCreate} className="btn-secondary inline-flex items-center gap-1.5 px-3 py-1.5 text-sm">
|
|
230
233
|
<Plus className="h-3.5 w-3.5" />
|
|
231
234
|
Create
|
|
@@ -51,6 +51,7 @@ export function useCNPGWriteGuard({
|
|
|
51
51
|
acknowledged={acked}
|
|
52
52
|
onAcknowledgedChange={setAcked}
|
|
53
53
|
onOpenOwner={route ? () => navigate(route) : undefined}
|
|
54
|
+
onOpenManager={(owner) => navigate(gitOpsRouteForOwner(owner))}
|
|
54
55
|
/>
|
|
55
56
|
),
|
|
56
57
|
satisfied: canConfirmGitOpsWrite(guard, acked),
|
|
@@ -68,7 +68,7 @@ export function tidyFences(md: string): string {
|
|
|
68
68
|
|
|
69
69
|
// Diagnosis output is dense with inline `code`; the shared chip's brand tint is
|
|
70
70
|
// too loud at that density, so neutralize it (border/bg only) for this surface.
|
|
71
|
-
const SOFT_INLINE_CODE =
|
|
71
|
+
export const SOFT_INLINE_CODE =
|
|
72
72
|
"[&_.inline-code]:border-theme-border/60 [&_.inline-code]:bg-theme-base [&_.inline-code]:font-normal";
|
|
73
73
|
|
|
74
74
|
// Markdown for agent-generated text — normalizes flaky fences + softens code.
|
|
@@ -242,8 +242,12 @@ export function TurnView({
|
|
|
242
242
|
onViewEvidence,
|
|
243
243
|
sourceRevealRequest,
|
|
244
244
|
assessmentSources,
|
|
245
|
+
openingQuestion,
|
|
245
246
|
}: {
|
|
246
247
|
turn: Turn;
|
|
248
|
+
/** The question the run opened with, shown as the engineer's message on
|
|
249
|
+
* the opening turn (whose own question is empty by design). */
|
|
250
|
+
openingQuestion?: string;
|
|
247
251
|
agentLabel?: string;
|
|
248
252
|
onApply?: (fix: string) => void;
|
|
249
253
|
onViewExplanation?: () => void;
|
|
@@ -304,6 +308,8 @@ export function TurnView({
|
|
|
304
308
|
: "Plain-language explanation"}
|
|
305
309
|
<span className="text-theme-text-tertiary">· View in Findings</span>
|
|
306
310
|
</button>
|
|
311
|
+
) : openingQuestion ? (
|
|
312
|
+
<QuestionBubble text={openingQuestion} />
|
|
307
313
|
) : (
|
|
308
314
|
turn.question &&
|
|
309
315
|
(turn.verify ? (
|
|
@@ -317,18 +323,7 @@ export function TurnView({
|
|
|
317
323
|
</span>
|
|
318
324
|
</div>
|
|
319
325
|
) : (
|
|
320
|
-
<
|
|
321
|
-
<div className="max-w-[85%]">
|
|
322
|
-
{turn.actor && (
|
|
323
|
-
<div className="mb-0.5 text-right text-[10px] text-theme-text-tertiary">
|
|
324
|
-
{turn.actor}
|
|
325
|
-
</div>
|
|
326
|
-
)}
|
|
327
|
-
<div className="rounded-lg rounded-br-sm bg-accent/10 px-3 py-1.5 text-sm text-theme-text-primary [overflow-wrap:anywhere]">
|
|
328
|
-
{turn.question}
|
|
329
|
-
</div>
|
|
330
|
-
</div>
|
|
331
|
-
</div>
|
|
326
|
+
<QuestionBubble text={turn.question} actor={turn.actor} />
|
|
332
327
|
))
|
|
333
328
|
)}
|
|
334
329
|
<Timeline
|
|
@@ -423,6 +418,23 @@ export function TurnView({
|
|
|
423
418
|
);
|
|
424
419
|
}
|
|
425
420
|
|
|
421
|
+
function QuestionBubble({ text, actor }: { text: string; actor?: string }) {
|
|
422
|
+
return (
|
|
423
|
+
<div className="flex justify-end">
|
|
424
|
+
<div className="max-w-[85%]">
|
|
425
|
+
{actor && (
|
|
426
|
+
<div className="mb-0.5 text-right text-[10px] text-theme-text-tertiary">
|
|
427
|
+
{actor}
|
|
428
|
+
</div>
|
|
429
|
+
)}
|
|
430
|
+
<div className="whitespace-pre-wrap rounded-lg rounded-br-sm bg-accent/10 px-3 py-1.5 text-sm text-theme-text-primary [overflow-wrap:anywhere]">
|
|
431
|
+
{text}
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
426
438
|
export function Timeline({
|
|
427
439
|
items,
|
|
428
440
|
running,
|
|
@@ -1137,10 +1149,18 @@ function ToolResultDialog({
|
|
|
1137
1149
|
};
|
|
1138
1150
|
}, [open, display, language, theme]);
|
|
1139
1151
|
return (
|
|
1140
|
-
<DialogPortal
|
|
1152
|
+
<DialogPortal
|
|
1153
|
+
ariaLabelledBy={titleId}
|
|
1154
|
+
open={open}
|
|
1155
|
+
onClose={onClose}
|
|
1156
|
+
className="w-[min(90vw,820px)]"
|
|
1157
|
+
>
|
|
1141
1158
|
<div className="flex items-center justify-between gap-3 border-b border-theme-border p-3">
|
|
1142
1159
|
<div className="min-w-0">
|
|
1143
|
-
<div
|
|
1160
|
+
<div
|
|
1161
|
+
id={titleId}
|
|
1162
|
+
className="truncate font-mono text-sm text-theme-text-primary"
|
|
1163
|
+
>
|
|
1144
1164
|
{title}
|
|
1145
1165
|
</div>
|
|
1146
1166
|
{truncated && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useState, type ReactNode } from "react";
|
|
2
2
|
import { AlertTriangle, Check, ShieldCheck, ChevronDown } from "lucide-react";
|
|
3
3
|
import {
|
|
4
4
|
TRANSITION_MENU,
|
|
@@ -420,11 +420,20 @@ function ConsentCardShell({
|
|
|
420
420
|
approveLabel = "Approve & investigate",
|
|
421
421
|
warning = false,
|
|
422
422
|
error,
|
|
423
|
+
notice,
|
|
424
|
+
approveBusy = false,
|
|
425
|
+
subject,
|
|
423
426
|
onOpenSettings,
|
|
424
427
|
onApprove,
|
|
425
428
|
onCancel,
|
|
426
429
|
}: DiagnoseConsentCopy & {
|
|
427
430
|
warning?: boolean;
|
|
431
|
+
// Something to know before approving, e.g. that the agent isn't signed in.
|
|
432
|
+
// It informs; Approve stays available.
|
|
433
|
+
notice?: ReactNode;
|
|
434
|
+
// Approve was pressed and waits on a check that hasn't answered yet.
|
|
435
|
+
approveBusy?: boolean;
|
|
436
|
+
subject?: ConsentSubject;
|
|
428
437
|
// Why the last approval failed, straight from the server. The card stays up on
|
|
429
438
|
// failure so retrying works in place, which means this is the ONLY chance to
|
|
430
439
|
// say why — a host that records consent above the individual refuses the
|
|
@@ -458,6 +467,18 @@ function ConsentCardShell({
|
|
|
458
467
|
{title}
|
|
459
468
|
</div>
|
|
460
469
|
</div>
|
|
470
|
+
{subject && (
|
|
471
|
+
<div className="mb-3 rounded-md border border-theme-border-subtle bg-theme-surface px-3 py-2">
|
|
472
|
+
<div className="break-words text-sm font-medium text-theme-text-primary">
|
|
473
|
+
{subject.title}
|
|
474
|
+
</div>
|
|
475
|
+
{subject.detail && (
|
|
476
|
+
<div className="mt-0.5 text-xs text-theme-text-tertiary">
|
|
477
|
+
{subject.detail}
|
|
478
|
+
</div>
|
|
479
|
+
)}
|
|
480
|
+
</div>
|
|
481
|
+
)}
|
|
461
482
|
<div className="text-sm leading-relaxed text-theme-text-secondary">
|
|
462
483
|
{body}
|
|
463
484
|
</div>
|
|
@@ -476,6 +497,7 @@ function ConsentCardShell({
|
|
|
476
497
|
{resolvedSettingsLabel}
|
|
477
498
|
</button>
|
|
478
499
|
)}
|
|
500
|
+
{notice}
|
|
479
501
|
{/* Red, not amber: the full-local card is itself amber, so an amber box on
|
|
480
502
|
it reads as another paragraph of body copy. role="alert" because nothing
|
|
481
503
|
else moves on failure — focus stays on Approve, so without it a screen
|
|
@@ -498,9 +520,10 @@ function ConsentCardShell({
|
|
|
498
520
|
</button>
|
|
499
521
|
<button
|
|
500
522
|
onClick={onApprove}
|
|
523
|
+
disabled={approveBusy}
|
|
501
524
|
className="flex-1 rounded-lg btn-brand py-1.5 text-sm"
|
|
502
525
|
>
|
|
503
|
-
{approveLabel}
|
|
526
|
+
{approveBusy ? "Checking sign-in…" : approveLabel}
|
|
504
527
|
</button>
|
|
505
528
|
</div>
|
|
506
529
|
</div>
|
|
@@ -517,12 +540,24 @@ function ConsentCardShell({
|
|
|
517
540
|
// MUST override rather than let Radar assert the local story over its flow.
|
|
518
541
|
// 2. No `copy` — the OSS bring-your-own-local-CLI default, the only tier where
|
|
519
542
|
// "on your machine / no Radar cloud / your account" actually holds.
|
|
543
|
+
// What the consent card is about to investigate: the resource, or the
|
|
544
|
+
// engineer's question and where it starts.
|
|
545
|
+
export interface ConsentSubject {
|
|
546
|
+
title: string;
|
|
547
|
+
detail?: string;
|
|
548
|
+
/** The run starts from a question, not from one resource. */
|
|
549
|
+
question?: boolean;
|
|
550
|
+
}
|
|
551
|
+
|
|
520
552
|
export function ConsentCard({
|
|
521
553
|
agentName,
|
|
522
554
|
agent,
|
|
523
555
|
profile,
|
|
524
556
|
copy,
|
|
525
557
|
error,
|
|
558
|
+
notice,
|
|
559
|
+
approveBusy,
|
|
560
|
+
subject,
|
|
526
561
|
onOpenSettings,
|
|
527
562
|
onApprove,
|
|
528
563
|
onCancel,
|
|
@@ -532,11 +567,23 @@ export function ConsentCard({
|
|
|
532
567
|
profile: ExecutionProfile;
|
|
533
568
|
copy?: DiagnoseConsentCopy;
|
|
534
569
|
error?: string | null;
|
|
570
|
+
notice?: ReactNode;
|
|
571
|
+
approveBusy?: boolean;
|
|
572
|
+
subject?: ConsentSubject;
|
|
535
573
|
onOpenSettings?: () => void;
|
|
536
574
|
onApprove: () => void;
|
|
537
575
|
onCancel: () => void;
|
|
538
576
|
}) {
|
|
539
|
-
const chrome = {
|
|
577
|
+
const chrome = {
|
|
578
|
+
onOpenSettings,
|
|
579
|
+
onApprove,
|
|
580
|
+
onCancel,
|
|
581
|
+
error,
|
|
582
|
+
notice,
|
|
583
|
+
approveBusy,
|
|
584
|
+
subject,
|
|
585
|
+
};
|
|
586
|
+
const about = subject?.question ? "the resources it reads" : "this resource";
|
|
540
587
|
|
|
541
588
|
// Tier 1: a host (e.g. radar-hub-web) supplied its own copy — use it verbatim.
|
|
542
589
|
if (copy) return <ConsentCardShell {...copy} {...chrome} />;
|
|
@@ -562,9 +609,9 @@ export function ConsentCard({
|
|
|
562
609
|
your own {agentName}
|
|
563
610
|
</span>{" "}
|
|
564
611
|
on your machine — no Radar cloud, no API key, no account. Radar sends
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
612
|
+
the spec, recent events, and pod logs of {about} to it (and on to its
|
|
613
|
+
model provider under your account, not to Radar). Transcripts are kept
|
|
614
|
+
in your local Radar history on this machine until cleared.
|
|
568
615
|
{profile === "safeguarded" && (
|
|
569
616
|
<>
|
|
570
617
|
{" "}
|
|
@@ -9,7 +9,7 @@ import { openExternal } from "../../utils/navigation";
|
|
|
9
9
|
const REPORT_URL =
|
|
10
10
|
"https://github.com/skyhook-io/radar/issues/new?labels=bug&template=bug_report.md";
|
|
11
11
|
|
|
12
|
-
function CopyButton({ text, label }: { text: string; label: string }) {
|
|
12
|
+
export function CopyButton({ text, label }: { text: string; label: string }) {
|
|
13
13
|
const [copied, setCopied] = useState(false);
|
|
14
14
|
return (
|
|
15
15
|
<button
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
|
+
import { AgentSigninNotice } from "./AgentSigninNotice";
|
|
4
|
+
import { ConsentCard } from "./parts";
|
|
5
|
+
|
|
6
|
+
const noop = vi.fn();
|
|
7
|
+
|
|
8
|
+
describe("AgentSigninNotice", () => {
|
|
9
|
+
it("names the agent, the command to run and a re-check", () => {
|
|
10
|
+
const html = renderToStaticMarkup(
|
|
11
|
+
<AgentSigninNotice
|
|
12
|
+
agentName="Claude Code"
|
|
13
|
+
signinCmd="claude auth login"
|
|
14
|
+
rechecking={false}
|
|
15
|
+
onRecheck={noop}
|
|
16
|
+
/>,
|
|
17
|
+
);
|
|
18
|
+
expect(html).toContain("Claude Code isn't signed in");
|
|
19
|
+
expect(html).toContain("claude auth login");
|
|
20
|
+
expect(html).toContain("Copy sign-in command");
|
|
21
|
+
expect(html).toContain("Check again");
|
|
22
|
+
expect(html).not.toContain("Still not signed in");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("shows the re-check in progress", () => {
|
|
26
|
+
const html = renderToStaticMarkup(
|
|
27
|
+
<AgentSigninNotice
|
|
28
|
+
agentName="Codex"
|
|
29
|
+
signinCmd="codex login"
|
|
30
|
+
rechecking
|
|
31
|
+
onRecheck={noop}
|
|
32
|
+
/>,
|
|
33
|
+
);
|
|
34
|
+
expect(html).toContain("Checking…");
|
|
35
|
+
expect(html).toContain("disabled");
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe("ConsentCard sign-in notice", () => {
|
|
40
|
+
it("shows the notice above the actions and keeps Approve available", () => {
|
|
41
|
+
const html = renderToStaticMarkup(
|
|
42
|
+
<ConsentCard
|
|
43
|
+
agentName="Claude Code"
|
|
44
|
+
agent="claude"
|
|
45
|
+
profile="safeguarded"
|
|
46
|
+
notice={
|
|
47
|
+
<AgentSigninNotice
|
|
48
|
+
agentName="Claude Code"
|
|
49
|
+
signinCmd="claude auth login"
|
|
50
|
+
rechecking={false}
|
|
51
|
+
onRecheck={noop}
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
onApprove={noop}
|
|
55
|
+
onCancel={noop}
|
|
56
|
+
/>,
|
|
57
|
+
);
|
|
58
|
+
const notice = html.indexOf("isn't signed in");
|
|
59
|
+
const approve = html.indexOf("Approve & investigate");
|
|
60
|
+
expect(notice).toBeGreaterThan(-1);
|
|
61
|
+
expect(approve).toBeGreaterThan(notice);
|
|
62
|
+
const approveButton = html.slice(html.lastIndexOf("<button", approve), approve);
|
|
63
|
+
expect(approveButton).not.toContain("disabled");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("says Approve is waiting on the check", () => {
|
|
67
|
+
const html = renderToStaticMarkup(
|
|
68
|
+
<ConsentCard
|
|
69
|
+
agentName="Codex"
|
|
70
|
+
agent="codex"
|
|
71
|
+
profile="safeguarded"
|
|
72
|
+
approveBusy
|
|
73
|
+
onApprove={noop}
|
|
74
|
+
onCancel={noop}
|
|
75
|
+
/>,
|
|
76
|
+
);
|
|
77
|
+
const label = html.indexOf("Checking sign-in…");
|
|
78
|
+
expect(label).toBeGreaterThan(-1);
|
|
79
|
+
expect(html.slice(html.lastIndexOf("<button", label), label)).toContain(
|
|
80
|
+
"disabled",
|
|
81
|
+
);
|
|
82
|
+
expect(html).not.toContain("Approve & investigate");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("renders as before without a notice (signed in or unknown)", () => {
|
|
86
|
+
const html = renderToStaticMarkup(
|
|
87
|
+
<ConsentCard
|
|
88
|
+
agentName="Claude Code"
|
|
89
|
+
agent="claude"
|
|
90
|
+
profile="safeguarded"
|
|
91
|
+
onApprove={noop}
|
|
92
|
+
onCancel={noop}
|
|
93
|
+
/>,
|
|
94
|
+
);
|
|
95
|
+
expect(html).not.toContain("signed in");
|
|
96
|
+
expect(html).toContain("Approve & investigate");
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { RotateCw } from "lucide-react";
|
|
4
|
+
import { AlertBanner } from "@skyhook-io/k8s-ui";
|
|
5
|
+
import { CopyButton } from "./AgentSetupNotice";
|
|
6
|
+
|
|
7
|
+
// Shown on the consent card when the agent's own status command says it is
|
|
8
|
+
// signed out. It warns rather than blocks: status commands can be wrong (a
|
|
9
|
+
// credential they don't see), so Approve stays available.
|
|
10
|
+
export function AgentSigninNotice({
|
|
11
|
+
agentName,
|
|
12
|
+
signinCmd,
|
|
13
|
+
rechecking,
|
|
14
|
+
onRecheck,
|
|
15
|
+
}: {
|
|
16
|
+
agentName: string;
|
|
17
|
+
signinCmd: string;
|
|
18
|
+
rechecking: boolean;
|
|
19
|
+
onRecheck: () => void;
|
|
20
|
+
}) {
|
|
21
|
+
const [asked, setAsked] = useState(false);
|
|
22
|
+
return (
|
|
23
|
+
<AlertBanner
|
|
24
|
+
variant="warning"
|
|
25
|
+
className="mt-3"
|
|
26
|
+
title={`${agentName} isn't signed in`}
|
|
27
|
+
message={
|
|
28
|
+
<>
|
|
29
|
+
The investigation will fail until it is. Run this in a terminal, then
|
|
30
|
+
check again.
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
action={
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
disabled={rechecking}
|
|
37
|
+
onClick={() => {
|
|
38
|
+
setAsked(true);
|
|
39
|
+
onRecheck();
|
|
40
|
+
}}
|
|
41
|
+
className="inline-flex items-center gap-1 text-xs text-accent hover:underline disabled:opacity-60"
|
|
42
|
+
>
|
|
43
|
+
<RotateCw className={clsx("h-3 w-3", rechecking && "animate-spin")} />
|
|
44
|
+
{rechecking ? "Checking…" : "Check again"}
|
|
45
|
+
</button>
|
|
46
|
+
}
|
|
47
|
+
>
|
|
48
|
+
<div className="mt-2 flex items-center gap-1.5 rounded-md bg-theme-base px-2 py-1.5">
|
|
49
|
+
<code className="min-w-0 flex-1 overflow-x-auto whitespace-nowrap font-mono text-xs text-theme-text-secondary">
|
|
50
|
+
{signinCmd}
|
|
51
|
+
</code>
|
|
52
|
+
<CopyButton text={signinCmd} label="Copy sign-in command" />
|
|
53
|
+
</div>
|
|
54
|
+
{asked && !rechecking && (
|
|
55
|
+
<p role="status" className="mt-1.5 text-xs text-theme-text-secondary">
|
|
56
|
+
Still not signed in.
|
|
57
|
+
</p>
|
|
58
|
+
)}
|
|
59
|
+
</AlertBanner>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -66,6 +66,28 @@ describe("resolveStoryPlacements", () => {
|
|
|
66
66
|
expect(html).toContain('data-story-lost-support="unlinked"');
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
+
it("names which kind of loss each unrendered citation is", () => {
|
|
70
|
+
const html = renderToStaticMarkup(
|
|
71
|
+
<AnalysisStory
|
|
72
|
+
placements={resolveStoryPlacements(
|
|
73
|
+
"One [[radar:evidence=0]]. Two [[radar:evidence=1]]. Three [[radar:evidence=2]].",
|
|
74
|
+
resolver({ 0: "invalid", 1: "unlinked", 2: "unplaced" }),
|
|
75
|
+
)}
|
|
76
|
+
renderPlacement={() => null}
|
|
77
|
+
onReveal={vi.fn()}
|
|
78
|
+
/>,
|
|
79
|
+
);
|
|
80
|
+
expect(html).toMatch(
|
|
81
|
+
/data-story-lost-support="invalid"[^>]*>.*?unknown citation/,
|
|
82
|
+
);
|
|
83
|
+
expect(html).toMatch(
|
|
84
|
+
/data-story-lost-support="unlinked"[^>]*>.*?unverified/,
|
|
85
|
+
);
|
|
86
|
+
expect(html).toMatch(
|
|
87
|
+
/data-story-lost-support="unplaced"[^>]*>.*?unclear citation/,
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
|
|
69
91
|
it("places a card under the paragraph that first mentions it inline, and drops that marker from the sentence", () => {
|
|
70
92
|
const story = resolveStoryPlacements(
|
|
71
93
|
"Envoy boots [[radar:evidence=0]] then hangs on xDS.\n\nLater, see [[radar:evidence=0]] again.",
|
|
@@ -212,7 +212,16 @@ function removeInlineMarker(markdown: string, index: number): string {
|
|
|
212
212
|
return before + after;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
type NamedLoss = Exclude<StoryPlacementLoss, object>;
|
|
216
|
+
|
|
217
|
+
// The chip names which failure it is; the tooltip says what it means.
|
|
218
|
+
const LOSS_LABEL: Record<NamedLoss, string> = {
|
|
219
|
+
invalid: "unknown citation",
|
|
220
|
+
unlinked: "unverified",
|
|
221
|
+
unplaced: "unclear citation",
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const LOSS_COPY: Record<NamedLoss, string> = {
|
|
216
225
|
invalid: "The agent cited a result Radar cannot identify.",
|
|
217
226
|
unlinked: "Radar could not verify this citation against its record.",
|
|
218
227
|
unplaced:
|
|
@@ -269,7 +278,7 @@ function LostSupport({
|
|
|
269
278
|
className="h-3 w-3 shrink-0 text-amber-500"
|
|
270
279
|
aria-hidden
|
|
271
280
|
/>
|
|
272
|
-
|
|
281
|
+
{LOSS_LABEL[reason]}
|
|
273
282
|
</span>
|
|
274
283
|
</Tooltip>
|
|
275
284
|
);
|
|
@@ -325,10 +334,13 @@ export function AnalysisStory({
|
|
|
325
334
|
}: {
|
|
326
335
|
/** Resolved once by the host, which also needs it for its own counts. */
|
|
327
336
|
placements: StoryPlacements;
|
|
328
|
-
/**
|
|
337
|
+
/**
|
|
338
|
+
* Renders the card for a placed item: `compact` when the agent placed it
|
|
339
|
+
* compact or it sits in the collapsed preview, `preview` for the latter.
|
|
340
|
+
*/
|
|
329
341
|
renderPlacement: (
|
|
330
342
|
target: StoryPlacementTarget,
|
|
331
|
-
options: { compact: boolean },
|
|
343
|
+
options: { compact: boolean; preview: boolean },
|
|
332
344
|
) => ReactNode;
|
|
333
345
|
onReveal: (target: StoryPlacementTarget) => void;
|
|
334
346
|
/** Opens a cited call's raw result in Activity when Radar renders no card for it. */
|
|
@@ -443,6 +455,7 @@ export function AnalysisStory({
|
|
|
443
455
|
>
|
|
444
456
|
{renderPlacement(resolution.target, {
|
|
445
457
|
compact: compact || segment.compact === true,
|
|
458
|
+
preview: compact,
|
|
446
459
|
})}
|
|
447
460
|
</div>
|
|
448
461
|
);
|
|
@@ -123,3 +123,13 @@ it("distinguishes local execution from sending resource data to the model provid
|
|
|
123
123
|
expect(html).toContain("model provider under your account, not to Radar");
|
|
124
124
|
expect(html).not.toContain("never leaves your machine");
|
|
125
125
|
});
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
it("explains pause conditionally even when the proposed fix removes it, without changing the existing gate", () => {
|
|
129
|
+
const resourceData = { metadata: { name: "archive", annotations: { "crossplane.io/paused": "true" } }, spec: { providerConfigRef: { name: "default" } } };
|
|
130
|
+
const result = renderToStaticMarkup(<ApplyDialog open onClose={() => {}} onConfirm={() => {}} agentLabel="Local agent" resourceLabel="Bucket archive" context="fixture" fix="Remove the pause annotation." gitOpsGuard={unmanaged} resourceData={resourceData} />);
|
|
131
|
+
expect(result).toContain("Pause affects reconciliation");
|
|
132
|
+
expect(result).toContain("requests resumption");
|
|
133
|
+
expect(result).not.toContain("will resume");
|
|
134
|
+
expect(applyButton(result)).not.toContain('disabled=""');
|
|
135
|
+
});
|