Skip to content

ccproxy.plugins.copilot.manager

ccproxy.plugins.copilot.manager

Copilot token manager implementation.

CopilotTokenManager

CopilotTokenManager(
    storage=None,
    *,
    config=None,
    http_client=None,
    hook_manager=None,
    detection_service=None,
)

Bases: BaseTokenManager[CopilotCredentials]

Manager for GitHub Copilot credential lifecycle.

Source code in ccproxy/plugins/copilot/manager.py
def __init__(
    self,
    storage: TokenStorage[CopilotCredentials] | None = None,
    *,
    config: CopilotOAuthConfig | None = None,
    http_client: httpx.AsyncClient | None = None,
    hook_manager: Any | None = None,
    detection_service: Any | None = None,
) -> None:
    storage = storage or CopilotOAuthStorage()
    super().__init__(storage)
    self.config = config or CopilotOAuthConfig()
    self._client = CopilotOAuthClient(
        self.config,
        storage
        if isinstance(storage, CopilotOAuthStorage)
        else CopilotOAuthStorage(),
        http_client=http_client,
        hook_manager=hook_manager,
        detection_service=detection_service,
    )
    self._profile_cache: StandardProfileFields | None = None

create async classmethod

create(
    storage=None,
    *,
    config=None,
    http_client=None,
    hook_manager=None,
    detection_service=None,
)

Async factory for parity with other managers.

Source code in ccproxy/plugins/copilot/manager.py
@classmethod
async def create(
    cls,
    storage: TokenStorage[CopilotCredentials] | None = None,
    *,
    config: CopilotOAuthConfig | None = None,
    http_client: httpx.AsyncClient | None = None,
    hook_manager: Any | None = None,
    detection_service: Any | None = None,
) -> CopilotTokenManager:
    """Async factory for parity with other managers."""
    return cls(
        storage=storage,
        config=config,
        http_client=http_client,
        hook_manager=hook_manager,
        detection_service=detection_service,
    )