Skip to main content

Module github_connect

Module github_connect 

Source
Expand description

Connect with GitHub, desktop side.

The person’s grant to the AgentMux App is made, refreshed and ended through the broker (muxbus::github_broker), which holds the App’s client secret. This module is what the service-OAuth flow (oauth_client) and the token path (oauth_tokens) lean on for a GitHub account:

  • a brokered account is one made through the broker; its context says so (broker: true) and carries the GitHub user’s numeric id and login;
  • signed out of AgentMux Cloud there is no broker, so a connect falls back to the device flow with the App’s client id, and the account is not brokered: GitHub won’t refresh its token without the secret, so it asks to be connected again when the 8 hours are up.

Structs§

GithubConnection
What the broker says about this AgentMux account’s GitHub connection (github.connection).

Constants§

PROVIDER
The provider whose grant is brokered.

Functions§

client_id_override
The AgentMux App’s public client id, for a build that doesn’t ship one yet (and for a developer’s own App). A shipped id replaces this when the App is registered.
connection_of
The broker’s word on this account’s GitHub connection, for Connectors.
display_name_for
The label an account shows for who is connected.
grant_is_gone
Whether a connection answer says the grant is gone: revoked on GitHub, blocked, or never made (or ended from another install). Only a clear answer counts; a failure to ask says nothing.
grant_json
A grant as a GitHub-shaped token response, so the flow’s last step stores it like any other: the expiry in seconds from now, the numeric id and login, and the marker that the account is brokered. A grant already expired (or about to) is one second from now, never 0: the blob reads 0 as “doesn’t expire”, so it would never be refreshed.
identity_in
The id and login in a token response made by grant_json.
is_brokered
Whether account was connected through the broker.
owner_of
Who a brokered account is: the GitHub user’s numeric id and login, as recorded at connect.
refresh_blob
A new blob for a brokered account’s refresh token. GitHub’s refresh tokens are single use, so the caller must store what this returns before anything else.
refresh_error_for
What the desktop does about a broker failure during a refresh: the grant is gone (connect again) or it was only a bad moment (try later).
revoke_before_delete
Before a brokered account is deleted: end its grant through the broker, so it doesn’t live on at GitHub. { outcome: "revoked" | "failed", detail? } for the delete’s result, or None when this isn’t a brokered account.
stamp_context
What the account’s context records about who is connected, and how.
sync_connection
connection_of, and the brokered accounts whose grant is gone ask to be connected again (the account’s card shows “Reconnect needed”): a grant revoked on GitHub shows as revoked. Nothing is cleared here: an account that works again is made valid by the refresh that proves it.
user_of_token
Who a GitHub token belongs to (GET /user), for a grant the device flow made.
workflows_allowed
Whether the person let agent change CI workflows: the account’s per-agent opt-in (workflows_agents, a list of agent slugs). Off for every agent until it is set.