@@ -178,7 +178,7 @@ def __init__(self, options: Optional[CopilotClientOptions] = None):
178178 if use_logged_in_user is None :
179179 use_logged_in_user = False if github_token else True
180180
181- self .options : CopilotClientOptions = {
181+ self ._options : CopilotClientOptions = {
182182 "cli_path" : default_cli_path ,
183183 "cwd" : opts .get ("cwd" , os .getcwd ()),
184184 "port" : opts .get ("port" , 0 ),
@@ -189,13 +189,13 @@ def __init__(self, options: Optional[CopilotClientOptions] = None):
189189 "use_logged_in_user" : use_logged_in_user ,
190190 }
191191 if opts .get ("cli_args" ):
192- self .options ["cli_args" ] = opts ["cli_args" ]
192+ self ._options ["cli_args" ] = opts ["cli_args" ]
193193 if opts .get ("cli_url" ):
194- self .options ["cli_url" ] = opts ["cli_url" ]
194+ self ._options ["cli_url" ] = opts ["cli_url" ]
195195 if opts .get ("env" ):
196- self .options ["env" ] = opts ["env" ]
196+ self ._options ["env" ] = opts ["env" ]
197197 if github_token :
198- self .options ["github_token" ] = github_token
198+ self ._options ["github_token" ] = github_token
199199
200200 self ._process : Optional [subprocess .Popen ] = None
201201 self ._client : Optional [JsonRpcClient ] = None
@@ -448,7 +448,7 @@ async def create_session(self, config: SessionConfig) -> CopilotSession:
448448 ... })
449449 """
450450 if not self ._client :
451- if self .options ["auto_start" ]:
451+ if self ._options ["auto_start" ]:
452452 await self .start ()
453453 else :
454454 raise RuntimeError ("Client not connected. Call start() first." )
@@ -620,7 +620,7 @@ async def resume_session(self, session_id: str, config: ResumeSessionConfig) ->
620620 ... })
621621 """
622622 if not self ._client :
623- if self .options ["auto_start" ]:
623+ if self ._options ["auto_start" ]:
624624 await self .start ()
625625 else :
626626 raise RuntimeError ("Client not connected. Call start() first." )
@@ -1174,25 +1174,25 @@ async def _start_cli_server(self) -> None:
11741174 Raises:
11751175 RuntimeError: If the server fails to start or times out.
11761176 """
1177- cli_path = self .options ["cli_path" ]
1177+ cli_path = self ._options ["cli_path" ]
11781178
11791179 # Verify CLI exists
11801180 if not os .path .exists (cli_path ):
11811181 raise RuntimeError (f"Copilot CLI not found at { cli_path } " )
11821182
11831183 # Start with user-provided cli_args, then add SDK-managed args
1184- cli_args = self .options .get ("cli_args" ) or []
1184+ cli_args = self ._options .get ("cli_args" ) or []
11851185 args = list (cli_args ) + [
11861186 "--headless" ,
11871187 "--no-auto-update" ,
11881188 "--log-level" ,
1189- self .options ["log_level" ],
1189+ self ._options ["log_level" ],
11901190 ]
11911191
11921192 # Add auth-related flags
1193- if self .options .get ("github_token" ):
1193+ if self ._options .get ("github_token" ):
11941194 args .extend (["--auth-token-env" , "COPILOT_SDK_AUTH_TOKEN" ])
1195- if not self .options .get ("use_logged_in_user" , True ):
1195+ if not self ._options .get ("use_logged_in_user" , True ):
11961196 args .append ("--no-auto-login" )
11971197
11981198 # If cli_path is a .js file, run it with node
@@ -1203,21 +1203,21 @@ async def _start_cli_server(self) -> None:
12031203 args = [cli_path ] + args
12041204
12051205 # Get environment variables
1206- env = self .options .get ("env" )
1206+ env = self ._options .get ("env" )
12071207 if env is None :
12081208 env = dict (os .environ )
12091209 else :
12101210 env = dict (env )
12111211
12121212 # Set auth token in environment if provided
1213- if self .options .get ("github_token" ):
1214- env ["COPILOT_SDK_AUTH_TOKEN" ] = self .options ["github_token" ]
1213+ if self ._options .get ("github_token" ):
1214+ env ["COPILOT_SDK_AUTH_TOKEN" ] = self ._options ["github_token" ]
12151215
12161216 # On Windows, hide the console window to avoid distracting users in GUI apps
12171217 creationflags = subprocess .CREATE_NO_WINDOW if sys .platform == "win32" else 0
12181218
12191219 # Choose transport mode
1220- if self .options ["use_stdio" ]:
1220+ if self ._options ["use_stdio" ]:
12211221 args .append ("--stdio" )
12221222 # Use regular Popen with pipes (buffering=0 for unbuffered)
12231223 self ._process = subprocess .Popen (
@@ -1226,25 +1226,25 @@ async def _start_cli_server(self) -> None:
12261226 stdout = subprocess .PIPE ,
12271227 stderr = subprocess .PIPE ,
12281228 bufsize = 0 ,
1229- cwd = self .options ["cwd" ],
1229+ cwd = self ._options ["cwd" ],
12301230 env = env ,
12311231 creationflags = creationflags ,
12321232 )
12331233 else :
1234- if self .options ["port" ] > 0 :
1235- args .extend (["--port" , str (self .options ["port" ])])
1234+ if self ._options ["port" ] > 0 :
1235+ args .extend (["--port" , str (self ._options ["port" ])])
12361236 self ._process = subprocess .Popen (
12371237 args ,
12381238 stdin = subprocess .DEVNULL ,
12391239 stdout = subprocess .PIPE ,
12401240 stderr = subprocess .PIPE ,
1241- cwd = self .options ["cwd" ],
1241+ cwd = self ._options ["cwd" ],
12421242 env = env ,
12431243 creationflags = creationflags ,
12441244 )
12451245
12461246 # For stdio mode, we're ready immediately
1247- if self .options ["use_stdio" ]:
1247+ if self ._options ["use_stdio" ]:
12481248 return
12491249
12501250 # For TCP mode, wait for port announcement
@@ -1279,7 +1279,7 @@ async def _connect_to_server(self) -> None:
12791279 Raises:
12801280 RuntimeError: If the connection fails.
12811281 """
1282- if self .options ["use_stdio" ]:
1282+ if self ._options ["use_stdio" ]:
12831283 await self ._connect_via_stdio ()
12841284 else :
12851285 await self ._connect_via_tcp ()
0 commit comments