MCPcopy Index your code
hub / github.com/github/copilot-sdk / set_foreground_session_id

Method set_foreground_session_id

python/copilot/client.py:3127–3151  ·  view source on GitHub ↗

Request the TUI to switch to displaying the specified session. This is only available when connecting to a server running in TUI+server mode (--ui-server). Args: session_id: The ID of the session to display in the TUI. Raises: Runti

(self, session_id: str)

Source from the content-addressed store, hash-verified

3125 return response.get("sessionId")
3126
3127 async def set_foreground_session_id(self, session_id: str) -> None:
3128 """
3129 Request the TUI to switch to displaying the specified session.
3130
3131 This is only available when connecting to a server running in TUI+server mode
3132 (--ui-server).
3133
3134 Args:
3135 session_id: The ID of the session to display in the TUI.
3136
3137 Raises:
3138 RuntimeError: If the client is not connected or the operation fails.
3139
3140 Example:
3141 >>> await client.set_foreground_session_id("session-123")
3142 """
3143 if not self._client:
3144 raise RuntimeError("Client not connected")
3145
3146 response = await self._client.request("session.setForeground", {"sessionId": session_id})
3147
3148 success = response.get("success", False)
3149 if not success:
3150 error = response.get("error", "Unknown error")
3151 raise RuntimeError(f"Failed to set foreground session: {error}")
3152
3153 @overload
3154 def on_lifecycle(self, handler: SessionLifecycleHandler, /) -> HandlerUnsubcribe:

Calls 2

requestMethod · 0.45
getMethod · 0.45