Skip to main content

Module connect

Module connect 

Source
Expand description

Google connect, connect_status and cancel: an agent connects a Google account itself (docs/specs/SPEC_GOOGLE_PHASE_B_AGENTMUXS_OWN_CLIENT_2026_11_01.md §7, §9, D3). It runs the same flow as the Accounts panel’s Connect (oauth_client::start), so the two can’t drift, except that the consent page is not opened in the system browser: the agent opens it in a Browser pane it drives (the account picker, the unverified-app screen, the scope boxes), and stops for the person only at a password, a second factor or an administrator’s block.

  • POST /api/v1/google/connect: start the flow; answers the consent URL and the origins its pane may stay on.
  • POST /api/v1/google/connect/status: where the flow is (waiting for the person, connected, failed); it may wait a few seconds for a change.
  • POST /api/v1/google/connect/cancel: end a flow that waits.

The token never reaches the agent: it goes from Google to the keychain inside srv. A session belongs to the agent that started it. Every connect is recorded under that agent, in the account’s log once the account exists.

Structs§

ConnectBody 🔒
SessionBody 🔒
StartSlot 🔒
An agent’s place for one connect, held while it starts; the session in owners takes over after.

Constants§

GOOGLE_ORIGINS 🔒
The sites a consent pane stays on, beside the page’s own loopback callback.
MAX_STATUS_WAIT_SECS 🔒
The most connect_status waits for a change in one call.
POLL_EVERY 🔒
How often a waiting call looks at the session again.
RECORD_POLL_EVERY 🔒
How often the task that records a connect looks at its flow.
URL_WAIT 🔒
How long connect waits for the flow to produce its consent URL.

Functions§

connected_services 🔒
What each service of the new account can be used for, as Google status shows it.
handle_google_connect 🔒
POST /api/v1/google/connect.
handle_google_connect_cancel 🔒
POST /api/v1/google/connect/cancel.
handle_google_connect_status 🔒
POST /api/v1/google/connect/status.
owners 🔒
The agent that started each flow, by session id: only it may ask after it or cancel it.
owns 🔒
pane_origins 🔒
The origins a consent pane may stay on: Google’s, and the loopback address Google redirects to when the person has consented (read from the URL’s redirect_uri).
parse_services 🔒
record_connect 🔒
Records the connect under the agent that did it, in the account’s log the person reads.
record_when_connected 🔒
Records the connect under the agent that started it once its account is committed, whether or not the agent asks again; the task ends with the flow (success, failure, cancel or timeout).
start_connect 🔒
starting 🔒
The agents whose connect is starting (the keychain read and the flow’s first answer are awaits), so two overlapping requests from one agent can’t both pass the one-waiting-connect check.
status_answer 🔒
union_scopes 🔒
The scopes a connect asks for: the services named at level, plus every scope the account already holds (D3: always the union, whether or not Google carries earlier grants over on an installed app).
url_ready 🔒
Whether a flow has its consent URL (or has ended): not the pending status, and not the empty URL start answers before the flow’s task has built the real one.
wait_for 🔒
The session’s status once done holds for it, or the last one seen after wait.
waiting_session_of 🔒
Whether this agent already has a connect that hasn’t ended.