@@ -57,6 +57,12 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
5757import { AddProviderInstanceDialog } from "./AddProviderInstanceDialog" ;
5858import { ProviderInstanceCard } from "./ProviderInstanceCard" ;
5959import { DRIVER_OPTIONS , getDriverOption } from "./providerDriverMeta" ;
60+ import {
61+ getProviderSummary ,
62+ getProviderVersionLabel ,
63+ PROVIDER_STATUS_STYLES ,
64+ type ProviderStatusKey ,
65+ } from "./providerStatus" ;
6066import { buildProviderInstanceUpdatePatch } from "./SettingsPanels.logic" ;
6167import {
6268 SettingResetButton ,
@@ -68,6 +74,7 @@ import {
6874import {
6975 buildProviderEnvironmentOptions ,
7076 classifyProviderEnvironmentAccess ,
77+ type ProviderOperateAccess ,
7178 resolveSelectedProviderEnvironmentId ,
7279} from "./ProviderSettingsPanel.logic" ;
7380
@@ -154,22 +161,18 @@ function EnvironmentUnavailableRow({
154161 accessKind,
155162} : {
156163 readonly environment : EnvironmentPresentation ;
157- readonly accessKind : "loading" | "read-only" | " unavailable" | "error" ;
164+ readonly accessKind : "loading" | "unavailable" | "error" ;
158165} ) {
159166 const title =
160167 accessKind === "loading"
161168 ? "Loading provider settings"
162- : accessKind === "read-only"
163- ? "Provider settings are read only"
164- : accessKind === "error"
165- ? "Could not connect to this device"
166- : "Provider settings are unavailable" ;
169+ : accessKind === "error"
170+ ? "Could not connect to this device"
171+ : "Provider settings are unavailable" ;
167172 const description =
168173 accessKind === "loading"
169174 ? `Waiting for ${ environment . label } 's configuration.`
170- : accessKind === "read-only"
171- ? `This session can view ${ environment . label } , but it cannot change provider configuration.`
172- : connectionStatusText ( environment . connection ) ;
175+ : connectionStatusText ( environment . connection ) ;
173176 return (
174177 < SettingsSection title = "Providers" >
175178 < SettingsRow
@@ -188,7 +191,7 @@ function EnvironmentUnavailableRow({
188191}
189192
190193export function ProviderSettingsPanel ( ) {
191- const { environments } = useEnvironments ( ) ;
194+ const { environments, isReady } = useEnvironments ( ) ;
192195 const primaryEnvironmentId = usePrimaryEnvironmentId ( ) ;
193196 const options = useMemo (
194197 ( ) => buildProviderEnvironmentOptions ( environments , primaryEnvironmentId ) ,
@@ -219,9 +222,15 @@ export function ProviderSettingsPanel() {
219222 { showDeviceList ? (
220223 < SettingsSection title = "Devices" >
221224 { options . length === 0 ? (
225+ // The catalog hydrates asynchronously, so an empty list before it is
226+ // ready means "not loaded yet", not "nothing is connected".
222227 < SettingsRow
223- title = "No connected devices"
224- description = "Connect an execution environment before configuring providers."
228+ title = { isReady ? "No connected devices" : "Loading devices" }
229+ description = {
230+ isReady
231+ ? "Connect an execution environment before configuring providers."
232+ : "Reading connected execution environments."
233+ }
225234 />
226235 ) : (
227236 < div className = "grid gap-1 sm:grid-cols-2" >
@@ -291,18 +300,25 @@ function SelectedEnvironmentProviderSettings({
291300 // Remote connection brokers request the standard client scopes, which include
292301 // orchestration:operate. The environment RPC layer remains authoritative if a
293302 // custom remote credential grants less access.
294- const canOperate = isPrimary
295- ? window . desktopBridge
296- ? true
297- : primarySessionState . data ?. authenticated
298- ? ( primarySessionState . data . scopes ?? [ ] ) . includes ( AuthOrchestrationOperateScope )
299- : null
300- : true ;
303+ const operateAccess : ProviderOperateAccess = ! isPrimary
304+ ? "granted"
305+ : window . desktopBridge
306+ ? "granted"
307+ : primarySessionState . isPending
308+ ? "pending"
309+ : primarySessionState . data ?. authenticated
310+ ? ( primarySessionState . data . scopes ?? [ ] ) . includes ( AuthOrchestrationOperateScope )
311+ ? "granted"
312+ : "denied"
313+ : "denied" ;
301314 const access = classifyProviderEnvironmentAccess ( {
302315 connectionPhase : environment . connection . phase ,
303316 hasServerConfig : environment . serverConfig !== null ,
304- canOperate ,
317+ operateAccess ,
305318 } ) ;
319+ if ( access . kind === "read-only" ) {
320+ return < ReadOnlyProviderSettings environment = { environment } /> ;
321+ }
306322 if ( access . kind !== "editable" ) {
307323 return < EnvironmentUnavailableRow environment = { environment } accessKind = { access . kind } /> ;
308324 }
@@ -314,6 +330,55 @@ function SelectedEnvironmentProviderSettings({
314330 ) ;
315331}
316332
333+ /**
334+ * Connected devices this session may read but not reconfigure. The provider
335+ * catalogue is still worth showing — knowing which providers a box has and
336+ * whether they are authenticated is most of the value — so render each one as
337+ * a status row and omit every mutation control.
338+ */
339+ function ReadOnlyProviderSettings ( {
340+ environment,
341+ } : {
342+ readonly environment : EnvironmentPresentation ;
343+ } ) {
344+ const providers = environment . serverConfig ?. providers ?? EMPTY_SERVER_PROVIDERS ;
345+ return (
346+ < SettingsSection title = "Providers" >
347+ < SettingsRow
348+ title = "Read only"
349+ description = { `This session can view ${ environment . label } , but it cannot change provider configuration.` }
350+ />
351+ { providers . map ( ( provider ) => {
352+ const driverOption = getDriverOption ( provider . driver ) ;
353+ const summary = getProviderSummary ( provider ) ;
354+ const versionLabel = getProviderVersionLabel ( provider . version ) ;
355+ return (
356+ < SettingsRow
357+ key = { provider . instanceId }
358+ title = {
359+ < span className = "inline-flex items-center gap-2" >
360+ < span
361+ className = { cn (
362+ "size-2 rounded-full" ,
363+ PROVIDER_STATUS_STYLES [ provider . status as ProviderStatusKey ] . dot ,
364+ ) }
365+ aria-hidden
366+ />
367+ { driverOption ?. label ?? String ( provider . driver ) }
368+ { versionLabel ? (
369+ < code className = "text-[11px] text-muted-foreground" > { versionLabel } </ code >
370+ ) : null }
371+ </ span >
372+ }
373+ description = { summary . detail ?? summary . headline }
374+ status = { summary . detail ? summary . headline : null }
375+ />
376+ ) ;
377+ } ) }
378+ </ SettingsSection >
379+ ) ;
380+ }
381+
317382export function EnvironmentProviderSettings ( {
318383 environmentId,
319384 environmentLabel,
0 commit comments