import type { LearningRefusal } from "@opengeni/sdk/learning-refusal"; import { BrainCircuitIcon } from "lucide-react"; import { createContext, useContext, type ReactNode } from "react"; import { cn } from "../lib/cn"; import { useOpenGeniText } from "../messages/runtime"; import { useEntranceAnimation } from "./entrance"; import { learningRefusalBody, learningRefusalPlace, learningRefusalPlaceLabel, learningRefusalTitle, type LearningRefusalPlace, } from "./learning-refusal-copy"; export type LearningRefusalActions = { /** Opens the place where the person can make the change themselves. */ onOpen?: ((place: LearningRefusalPlace) => void) | undefined; }; const LearningRefusalActionsContext = createContext({}); export function LearningRefusalActionsProvider({ children, ...actions }: LearningRefusalActions & { children: ReactNode }) { return ( {children} ); } /** * A change the agent tried to save to Skills, workspace instructions, or * Knowledge was refused. It stays outside the folded work row so the person * learns their request was not kept, says why in plain words, and links to * where they can still make it. Calm by design: nothing broke. */ export function LearningRefusalRow({ refusal }: { refusal: LearningRefusal }) { const t = useOpenGeniText(); const enter = useEntranceAnimation(); const { onOpen } = useContext(LearningRefusalActionsContext); const place = learningRefusalPlace(refusal); return (

{learningRefusalTitle(t, refusal)}

{learningRefusalBody(t, refusal)}

{place && onOpen ? ( ) : null}
); }