@skyhook-io/radar-app 1.13.2 → 1.13.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyhook-io/radar-app",
3
- "version": "1.13.2",
3
+ "version": "1.13.3",
4
4
  "description": "Radar's full web UI as a reusable React component. Used by Radar's own binary and by external consumers like Radar Cloud.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,6 +13,8 @@ export interface AgentInfo {
13
13
  profiles?: ExecutionProfile[];
14
14
  consentSurfaces?: Partial<Record<ExecutionProfile, string>>;
15
15
  hosted?: boolean;
16
+ /** Hosted backends opt in only when they implement assessment-bound, tool-free explanations. */
17
+ assessmentExplanations?: boolean;
16
18
  }
17
19
 
18
20
  export interface AgentsResponse {
@@ -8,7 +8,10 @@ import {
8
8
  prefersReducedMotion,
9
9
  useDisclosureReveal,
10
10
  } from "./useDisclosureReveal";
11
- import { investigationExplanation } from "./investigationExplanation";
11
+ import {
12
+ investigationExplanation,
13
+ supportsAssessmentExplanation,
14
+ } from "./investigationExplanation";
12
15
  import {
13
16
  initialInvestigationPane,
14
17
  investigationEvidenceShouldMarkUnread,
@@ -160,8 +163,17 @@ export function InvestigationView({
160
163
  const { kind, namespace, name } = run;
161
164
  // Apply is off for hosted agents (read-only server-side). Keyed on the selected
162
165
  // agent, which matches run.agent unless a deployment mixes hosted + local agents.
163
- const { refreshRuns, openInvestigation, startError, dismissError, hosted } =
164
- useDiagnose();
166
+ const {
167
+ refreshRuns,
168
+ openInvestigation,
169
+ startError,
170
+ dismissError,
171
+ hosted,
172
+ agents,
173
+ } = useDiagnose();
174
+ const explanationEnabled = supportsAssessmentExplanation(
175
+ agents.find((agent) => agent.name === run.agent),
176
+ );
165
177
  // Investigate again means look again, so it asks for a new session explicitly and only
166
178
  // carries the issue forward — being handed the previous answer is the one
167
179
  // thing someone clicking this doesn't want.
@@ -754,15 +766,14 @@ export function InvestigationView({
754
766
  const sequence = assessment.resultSequence;
755
767
  if (!sequence || !assessment.diagnosis?.rootCause) return undefined;
756
768
  const saved = investigationExplanation(turns, sequence);
757
- // This intent is implemented by the local run manager; hosted continuation
758
- // alone does not imply support for assessment-bound explanation turns.
759
- if ((readOnly || hosted) && saved.status === "idle") return undefined;
769
+ if ((readOnly || !explanationEnabled) && saved.status === "idle")
770
+ return undefined;
760
771
  const state =
761
772
  explanationRequest?.sequence === sequence ? explanationRequest : saved;
762
773
  return {
763
774
  ...state,
764
775
  onGenerate:
765
- !hosted && !interactionsBlocked
776
+ explanationEnabled && !interactionsBlocked
766
777
  ? () => askExplanation(sequence)
767
778
  : undefined,
768
779
  openRequest:
@@ -1,5 +1,9 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { investigationExplanation } from "./investigationExplanation";
2
+ import {
3
+ investigationExplanation,
4
+ supportsAssessmentExplanation,
5
+ } from "./investigationExplanation";
6
+ import type { AgentInfo } from "../../api/diagnose";
3
7
  import type { Turn } from "./parts";
4
8
 
5
9
  const turn = (overrides: Partial<Turn> = {}): Turn => ({
@@ -10,6 +14,31 @@ const turn = (overrides: Partial<Turn> = {}): Turn => ({
10
14
  ...overrides,
11
15
  });
12
16
  describe("assessment-local explanation", () => {
17
+ it("requires explicit hosted support without enabling mutations or changing local support", () => {
18
+ const agent: AgentInfo = {
19
+ name: "hub",
20
+ label: "Managed agent",
21
+ path: "",
22
+ version: "",
23
+ supported: true,
24
+ present: true,
25
+ hosted: true,
26
+ };
27
+ expect(supportsAssessmentExplanation(undefined)).toBe(false);
28
+ expect(supportsAssessmentExplanation(agent)).toBe(false);
29
+ expect(
30
+ supportsAssessmentExplanation({
31
+ ...agent,
32
+ assessmentExplanations: false,
33
+ }),
34
+ ).toBe(false);
35
+ expect(
36
+ supportsAssessmentExplanation({ ...agent, assessmentExplanations: true }),
37
+ ).toBe(true);
38
+ expect(supportsAssessmentExplanation({ ...agent, hosted: false })).toBe(
39
+ true,
40
+ );
41
+ });
13
42
  it("does not mistake an ordinary answer for an explanation", () => {
14
43
  expect(
15
44
  investigationExplanation([turn({ question: "Explain simply" })], 2),
@@ -1,4 +1,11 @@
1
1
  import type { AssessmentExplanation, Turn } from "./parts";
2
+ import type { AgentInfo } from "../../api/diagnose";
3
+
4
+ export function supportsAssessmentExplanation(
5
+ agent: AgentInfo | undefined,
6
+ ): boolean {
7
+ return !!agent && (!agent.hosted || agent.assessmentExplanations === true);
8
+ }
2
9
 
3
10
  export function investigationExplanation(
4
11
  turns: readonly Turn[],