@skyhook-io/radar-app 1.8.12 → 1.8.13
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 +1 -1
- package/src/api/diagnose.ts +1 -0
- package/src/components/diagnose/AISettings.tsx +47 -16
- package/src/components/diagnose/DiagnoseContext.tsx +3 -0
- package/src/components/diagnose/InvestigationView.tsx +8 -3
- package/src/components/diagnose/LocalDiagnoseAction.tsx +21 -9
- package/src/components/settings/SettingsDialog.tsx +22 -17
package/package.json
CHANGED
package/src/api/diagnose.ts
CHANGED
|
@@ -18,7 +18,15 @@ export interface AIDraft {
|
|
|
18
18
|
// ClearHistoryRow is an immediate action (not part of the staged draft): a
|
|
19
19
|
// two-step confirm button that wipes finished investigations from the local
|
|
20
20
|
// history DB. Live investigations survive.
|
|
21
|
-
function ClearHistoryRow({
|
|
21
|
+
function ClearHistoryRow({
|
|
22
|
+
hosted,
|
|
23
|
+
agentLabel,
|
|
24
|
+
onCleared,
|
|
25
|
+
}: {
|
|
26
|
+
hosted: boolean;
|
|
27
|
+
agentLabel: string;
|
|
28
|
+
onCleared: () => void;
|
|
29
|
+
}) {
|
|
22
30
|
const [confirming, setConfirming] = useState(false);
|
|
23
31
|
const [state, setState] = useState<"idle" | "busy" | "done" | "error">(
|
|
24
32
|
"idle",
|
|
@@ -36,9 +44,15 @@ function ClearHistoryRow({ onCleared }: { onCleared: () => void }) {
|
|
|
36
44
|
return (
|
|
37
45
|
<div className="mt-3 flex items-center justify-between gap-2 border-t border-theme-border/60 pt-3">
|
|
38
46
|
<p className="text-[11px] leading-snug text-theme-text-tertiary">
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
{hosted ? (
|
|
48
|
+
`Investigation transcripts are stored by ${agentLabel} so history survives restarts.`
|
|
49
|
+
) : (
|
|
50
|
+
<>
|
|
51
|
+
Investigation transcripts are kept on this machine (
|
|
52
|
+
<code className="font-mono">~/.radar</code>) so history survives
|
|
53
|
+
restarts.
|
|
54
|
+
</>
|
|
55
|
+
)}
|
|
42
56
|
{state === "done" && (
|
|
43
57
|
<span className="ml-1 font-medium text-theme-text-secondary">
|
|
44
58
|
History cleared.
|
|
@@ -85,12 +99,16 @@ function ClearHistoryRow({ onCleared }: { onCleared: () => void }) {
|
|
|
85
99
|
export function AISettingsSection({
|
|
86
100
|
available,
|
|
87
101
|
agents,
|
|
102
|
+
hosted,
|
|
103
|
+
agentLabel,
|
|
88
104
|
draft,
|
|
89
105
|
onChange,
|
|
90
106
|
onHistoryCleared,
|
|
91
107
|
}: {
|
|
92
108
|
available: boolean;
|
|
93
109
|
agents: AgentInfo[];
|
|
110
|
+
hosted: boolean;
|
|
111
|
+
agentLabel: string;
|
|
94
112
|
draft: AIDraft;
|
|
95
113
|
onChange: (patch: Partial<AIDraft>) => void;
|
|
96
114
|
onHistoryCleared: () => void;
|
|
@@ -98,19 +116,32 @@ export function AISettingsSection({
|
|
|
98
116
|
if (!available || agents.length === 0) return null;
|
|
99
117
|
return (
|
|
100
118
|
<>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
{hosted ? (
|
|
120
|
+
// The agent, its model, and how it runs are all fixed by the host — none
|
|
121
|
+
// of the local BYO-agent knobs apply, so there's nothing to configure.
|
|
122
|
+
<p className="text-xs leading-snug text-theme-text-tertiary">
|
|
123
|
+
{agentLabel} manages the model and how it runs — there's nothing to
|
|
124
|
+
configure here.
|
|
125
|
+
</p>
|
|
126
|
+
) : (
|
|
127
|
+
<AgentControls
|
|
128
|
+
agents={agents}
|
|
129
|
+
selectedAgent={draft.agent}
|
|
130
|
+
// Model + effort are agent-specific; reset them when the agent changes.
|
|
131
|
+
onSelectAgent={(a) => onChange({ agent: a, model: "", effort: "" })}
|
|
132
|
+
isolated={draft.isolated}
|
|
133
|
+
onSetIsolated={(v) => onChange({ isolated: v })}
|
|
134
|
+
model={draft.model}
|
|
135
|
+
onSetModel={(v) => onChange({ model: v })}
|
|
136
|
+
effort={draft.effort}
|
|
137
|
+
onSetEffort={(v) => onChange({ effort: v })}
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
<ClearHistoryRow
|
|
141
|
+
hosted={hosted}
|
|
142
|
+
agentLabel={agentLabel}
|
|
143
|
+
onCleared={onHistoryCleared}
|
|
112
144
|
/>
|
|
113
|
-
<ClearHistoryRow onCleared={onHistoryCleared} />
|
|
114
145
|
</>
|
|
115
146
|
);
|
|
116
147
|
}
|
|
@@ -34,6 +34,7 @@ export type DiagnoseView = "home" | "investigation";
|
|
|
34
34
|
interface DiagnoseCtx {
|
|
35
35
|
available: boolean; // an agent CLI is present (button/entry gate)
|
|
36
36
|
agentLabel: string; // label of the selected agent, e.g. "Claude Code"
|
|
37
|
+
hosted: boolean; // selected agent runs on the host's backend, not this machine
|
|
37
38
|
agents: AgentInfo[]; // supported agents detected on PATH (for the picker)
|
|
38
39
|
selectedAgent: string; // name of the chosen backend ("claude"/"codex")
|
|
39
40
|
setSelectedAgent: (name: string) => void;
|
|
@@ -262,6 +263,7 @@ export function DiagnoseProvider({ children }: { children: ReactNode }) {
|
|
|
262
263
|
selectedAgent,
|
|
263
264
|
agents.find((a) => a.name === selectedAgent)?.label,
|
|
264
265
|
);
|
|
266
|
+
const hosted = !!agents.find((a) => a.name === selectedAgent)?.hosted;
|
|
265
267
|
|
|
266
268
|
useEffect(() => {
|
|
267
269
|
const onResize = () => setViewportW(window.innerWidth);
|
|
@@ -434,6 +436,7 @@ export function DiagnoseProvider({ children }: { children: ReactNode }) {
|
|
|
434
436
|
const value: DiagnoseCtx = {
|
|
435
437
|
available,
|
|
436
438
|
agentLabel,
|
|
439
|
+
hosted,
|
|
437
440
|
agents,
|
|
438
441
|
selectedAgent,
|
|
439
442
|
setSelectedAgent,
|
|
@@ -44,7 +44,9 @@ export function InvestigationView({
|
|
|
44
44
|
maximized: boolean;
|
|
45
45
|
}) {
|
|
46
46
|
const { kind, namespace, name } = run;
|
|
47
|
-
|
|
47
|
+
// Apply is off for hosted agents (read-only server-side). Keyed on the selected
|
|
48
|
+
// agent, which matches run.agent unless a deployment mixes hosted + local agents.
|
|
49
|
+
const { refreshRuns, openInvestigation, startError, hosted } = useDiagnose();
|
|
48
50
|
const retryDiagnosis = useCallback(
|
|
49
51
|
() => openInvestigation({ kind, namespace, name }),
|
|
50
52
|
[openInvestigation, kind, namespace, name],
|
|
@@ -498,7 +500,8 @@ export function InvestigationView({
|
|
|
498
500
|
<RunContextCard run={run} />
|
|
499
501
|
{turns.map((t, i) => {
|
|
500
502
|
const isLast = i === turns.length - 1;
|
|
501
|
-
|
|
503
|
+
// Hosted runners are read-only — the server refuses apply turns.
|
|
504
|
+
const canApply = i === lastRemediationIdx && !stale && !hosted;
|
|
502
505
|
const canCheck = isLast && t.status === "done" && !!t.apply;
|
|
503
506
|
return (
|
|
504
507
|
<TurnView
|
|
@@ -541,7 +544,9 @@ export function InvestigationView({
|
|
|
541
544
|
<ResultCard
|
|
542
545
|
diagnosis={turns[pinnedIdx].diagnosis!}
|
|
543
546
|
onApply={
|
|
544
|
-
pinnedIdx === lastRemediationIdx && !stale
|
|
547
|
+
pinnedIdx === lastRemediationIdx && !stale && !hosted
|
|
548
|
+
? requestApply
|
|
549
|
+
: undefined
|
|
545
550
|
}
|
|
546
551
|
onAsk={!busy && !stale ? askFollowup : undefined}
|
|
547
552
|
reveal="full"
|
|
@@ -5,14 +5,15 @@ import type { RenderDiagnoseAction } from "../../context/DiagnoseCustomization";
|
|
|
5
5
|
|
|
6
6
|
// The per-resource AI entry point. It no longer owns a panel — it just dispatches
|
|
7
7
|
// to the single app-level AI surface (DiagnoseContext), opening a new investigation
|
|
8
|
-
// for this resource. Self-hides when no agent CLI is present.
|
|
9
|
-
//
|
|
8
|
+
// for this resource. Self-hides when no agent CLI is present. Hosts can override
|
|
9
|
+
// this slot with their own action.
|
|
10
10
|
//
|
|
11
11
|
// Adaptive by health: on a resource with a live problem it reads as a prominent
|
|
12
12
|
// "Diagnose" (find the root cause); when the resource is fine or health is unknown
|
|
13
13
|
// it shrinks to a quiet colored-icon affordance ("ask my agent about this") — so it
|
|
14
14
|
// never implies "something is wrong here" on a healthy resource. The tooltip leads
|
|
15
|
-
// with the BYO framing
|
|
15
|
+
// with the BYO framing (the user's OWN agent, locally) — unless the agent is
|
|
16
|
+
// hosted, where those claims would be false.
|
|
16
17
|
function DiagnoseResourceButton({
|
|
17
18
|
kind,
|
|
18
19
|
namespace,
|
|
@@ -31,9 +32,13 @@ function DiagnoseResourceButton({
|
|
|
31
32
|
const running = runningKeys.has(runTargetKey(kind, namespace, name));
|
|
32
33
|
const tooltip = running
|
|
33
34
|
? `${d.agentLabel} is investigating this resource — click to watch it live.`
|
|
34
|
-
:
|
|
35
|
-
?
|
|
36
|
-
|
|
35
|
+
: d.hosted
|
|
36
|
+
? problem
|
|
37
|
+
? `Diagnose with ${d.agentLabel} — reads this resource's spec, events & logs to find the root cause.`
|
|
38
|
+
: `Ask ${d.agentLabel} about this resource — reads its spec, events & logs.`
|
|
39
|
+
: problem
|
|
40
|
+
? `Diagnose with your own ${d.agentLabel} — runs locally, reads this resource's spec, events & logs to find the root cause.`
|
|
41
|
+
: `Ask your own ${d.agentLabel} about this resource — runs locally, reads its spec, events & logs.`;
|
|
37
42
|
// While an investigation is live, the button advertises it (and clicking focuses
|
|
38
43
|
// the existing run rather than starting a new one — openInvestigation dedups).
|
|
39
44
|
const showLabel = problem || running;
|
|
@@ -95,7 +100,11 @@ export function IssueDiagnoseButton({
|
|
|
95
100
|
if (!d.available) return null;
|
|
96
101
|
return (
|
|
97
102
|
<Tooltip
|
|
98
|
-
content={
|
|
103
|
+
content={
|
|
104
|
+
d.hosted
|
|
105
|
+
? `Sends this resource's context to ${d.agentLabel} to find the root cause`
|
|
106
|
+
: `Runs ${d.agentLabel} on your machine and sends it this resource's context to find the root cause`
|
|
107
|
+
}
|
|
99
108
|
position="left"
|
|
100
109
|
>
|
|
101
110
|
<button
|
|
@@ -119,12 +128,15 @@ export function GlobalDiagnoseButton() {
|
|
|
119
128
|
const { runningKeys } = useDiagnoseLayout();
|
|
120
129
|
if (!d.available) return null;
|
|
121
130
|
const runningCount = runningKeys.size;
|
|
131
|
+
const agentSuffix = d.hosted
|
|
132
|
+
? `powered by ${d.agentLabel}`
|
|
133
|
+
: `runs your own ${d.agentLabel} locally`;
|
|
122
134
|
return (
|
|
123
135
|
<Tooltip
|
|
124
136
|
content={
|
|
125
137
|
runningCount > 0
|
|
126
|
-
? `${runningCount} investigation${runningCount > 1 ? "s" : ""} running —
|
|
127
|
-
: `AI investigations —
|
|
138
|
+
? `${runningCount} investigation${runningCount > 1 ? "s" : ""} running — ${agentSuffix}`
|
|
139
|
+
: `AI investigations — ${agentSuffix}`
|
|
128
140
|
}
|
|
129
141
|
position="bottom"
|
|
130
142
|
>
|
|
@@ -517,8 +517,9 @@ export function SettingsDialog({ open, onClose }: SettingsDialogProps) {
|
|
|
517
517
|
<div className="mb-4">
|
|
518
518
|
<h3 className="text-base font-semibold text-theme-text-primary">AI diagnose</h3>
|
|
519
519
|
<p className="mt-0.5 text-xs text-theme-text-tertiary">
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
{diag.hosted
|
|
521
|
+
? `Investigate incidents with ${diag.agentLabel} — reading logs, events, and topology to explain what's wrong.`
|
|
522
|
+
: "Investigate incidents with an AI agent that runs on your own machine — reading logs, events, and topology to explain what's wrong. No Radar cloud, no API key."}
|
|
522
523
|
</p>
|
|
523
524
|
</div>
|
|
524
525
|
{aiAvailable ? (
|
|
@@ -526,6 +527,8 @@ export function SettingsDialog({ open, onClose }: SettingsDialogProps) {
|
|
|
526
527
|
<AISettingsSection
|
|
527
528
|
available={diag.available}
|
|
528
529
|
agents={diag.agents}
|
|
530
|
+
hosted={diag.hosted}
|
|
531
|
+
agentLabel={diag.agentLabel}
|
|
529
532
|
draft={aiDraft}
|
|
530
533
|
onChange={(patch) => {
|
|
531
534
|
setAiDraft((d) => ({ ...d, ...patch }))
|
|
@@ -533,21 +536,23 @@ export function SettingsDialog({ open, onClose }: SettingsDialogProps) {
|
|
|
533
536
|
}}
|
|
534
537
|
onHistoryCleared={diag.refreshRuns}
|
|
535
538
|
/>
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
<
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
539
|
+
{!diag.hosted && (
|
|
540
|
+
<div className="flex items-center justify-end gap-3">
|
|
541
|
+
{aiSaved && !aiDirty && (
|
|
542
|
+
<span className="flex items-center gap-1 text-xs text-green-600 dark:text-green-400/80">
|
|
543
|
+
<Check className="w-3 h-3" />
|
|
544
|
+
Saved
|
|
545
|
+
</span>
|
|
546
|
+
)}
|
|
547
|
+
<button
|
|
548
|
+
onClick={saveAi}
|
|
549
|
+
disabled={!aiDirty}
|
|
550
|
+
className="px-4 py-1.5 text-sm font-medium btn-brand rounded-md disabled:opacity-50 disabled:pointer-events-none"
|
|
551
|
+
>
|
|
552
|
+
Save
|
|
553
|
+
</button>
|
|
554
|
+
</div>
|
|
555
|
+
)}
|
|
551
556
|
</div>
|
|
552
557
|
) : (
|
|
553
558
|
<AIUnavailableNotice />
|