feat: add elicitation handling to App
This commit is contained in:
parent
6c809bdab6
commit
124c781253
1 changed files with 22 additions and 0 deletions
|
|
@ -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>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue