@@ -383,13 +383,25 @@ def client_type(self) -> ClientType:
383383
384384 This is separate from host_type. For example, a unified host can support both
385385 workspace and account client types.
386+
387+ Returns ClientType.ACCOUNT or ClientType.WORKSPACE based on the configuration.
388+
389+ For unified hosts, account_id must be set. If workspace_id is also set,
390+ returns WORKSPACE, otherwise returns ACCOUNT.
386391 """
387- # If workspace_id is set, this is a workspace client
388- if self .workspace_id :
392+ host_type = self .host_type
393+
394+ if host_type == HostType .ACCOUNTS :
395+ return ClientType .ACCOUNT
396+
397+ if host_type == HostType .WORKSPACE :
389398 return ClientType .WORKSPACE
390399
391- # If account_id is set and no workspace_id, this is an account client
392- if self .account_id :
400+ if host_type == HostType .UNIFIED :
401+ if not self .account_id :
402+ raise ValueError ("Unified host requires account_id to be set" )
403+ if self .workspace_id :
404+ return ClientType .WORKSPACE
393405 return ClientType .ACCOUNT
394406
395407 # Default to workspace for backward compatibility
@@ -463,9 +475,7 @@ def oidc_endpoints(self) -> Optional[OidcEndpoints]:
463475 # Handle unified hosts
464476 if self .host_type == HostType .UNIFIED :
465477 if not self .account_id :
466- raise ValueError (
467- "Unified host requires account_id to be set for OAuth endpoints"
468- )
478+ raise ValueError ("Unified host requires account_id to be set for OAuth endpoints" )
469479 return get_unified_endpoints (self .host , self .account_id )
470480
471481 # Handle traditional account hosts
0 commit comments