feat: add elicitation handling to App

This commit is contained in:
Alex Andru 2025-06-19 17:22:44 +02:00
commit 124c781253

View file

@ -71,6 +71,9 @@ import {
initializeInspectorConfig, initializeInspectorConfig,
saveInspectorConfig, saveInspectorConfig,
} from "./utils/configUtils"; } from "./utils/configUtils";
import ElicitationModal, {
ElicitationRequest,
} from "./components/ElicitationModal";
const CONFIG_LOCAL_STORAGE_KEY = "inspectorConfig_v1"; const CONFIG_LOCAL_STORAGE_KEY = "inspectorConfig_v1";
@ -124,6 +127,8 @@ const App = () => {
} }
> >
>([]); >([]);
const [pendingElicitationRequest, setPendingElicitationRequest] =
useState<ElicitationRequest | null>(null);
const [isAuthDebuggerVisible, setIsAuthDebuggerVisible] = useState(false); const [isAuthDebuggerVisible, setIsAuthDebuggerVisible] = useState(false);
// Auth debugger state // Auth debugger state
@ -200,6 +205,14 @@ const App = () => {
{ id: nextRequestId.current++, request, resolve, reject }, { id: nextRequestId.current++, request, resolve, reject },
]); ]);
}, },
onElicitationRequest: (request, resolve) => {
setPendingElicitationRequest({
id: nextRequestId.current++,
message: request.params.message,
requestedSchema: request.params.requestedSchema,
resolve,
});
},
getRoots: () => rootsRef.current, getRoots: () => rootsRef.current,
}); });
@ -586,6 +599,10 @@ const App = () => {
setStdErrNotifications([]); setStdErrNotifications([]);
}; };
const handleCloseElicitationModal = () => {
setPendingElicitationRequest(null);
};
// Helper component for rendering the AuthDebugger // Helper component for rendering the AuthDebugger
const AuthDebuggerWrapper = () => ( const AuthDebuggerWrapper = () => (
<TabsContent value="auth"> <TabsContent value="auth">
@ -938,6 +955,11 @@ const App = () => {
</div> </div>
</div> </div>
</div> </div>
<ElicitationModal
request={pendingElicitationRequest}
onClose={handleCloseElicitationModal}
/>
</div> </div>
); );
}; };