Skip to main content

Module discovery

Module discovery 

Source
Expand description

AgentMux Cloud settings discovery (docs/specs/SPEC_CLOUD_SETTINGS_DISCOVERY_2026_09_27.md).

The cloud publishes where its sign-in and relay live at {relay REST base}/.well-known/agentmux-cloud.json. srv reads it so the desktop follows the cloud instead of compiled-in values: a new Cognito user pool means a new client id, and installed builds would otherwise keep the old one. The relay REST base (relay::rest_base_url) stays the root of trust; everything else comes from the document it serves, with today’s compiled values as the fallback.

The desktop follows a document only to hosts that are AgentMux’s own: every host it names (api, ws, console, cognito.domain) must be on the list for the base it was fetched from ([HostRule]).

Structs§

CloudSettings
What the cloud publishes. Only the fields srv uses; others are ignored.
CognitoSettings

Constants§

DIRECT_IDENTITY_PROVIDERS
The providers a sign-in may go straight to (Cognito’s identity_provider). Nothing else reaches the authorize URL.
DISCOVERY_PATH
Path of the discovery document under the relay REST base.
PRODUCTION_HOSTS
The hosts a document fetched from the production relay may name: exact names, not a suffix, so a sub-name nobody listed is never trusted.
STAGING_HOSTS
The names that exist under staging.agentmux.ai, for a document fetched from the staging relay. The lists hold only names that exist.

Functions§

check_identity_provider
Check a requested sign-in provider: one of DIRECT_IDENTITY_PROVIDERS, and one the cloud publishes when it publishes a list. None (email, or Cognito’s own page) is always fine.
client_id_superseded
Was a stored sign-in issued to a Cognito client the cloud no longer publishes? Then it belongs to a user pool the cloud has left, and neither its tokens nor a refresh will work. false when that can’t be told: no document, or a credential saved without its client id.
cloud_settings
The cloud’s published settings, or None when it publishes none (an older relay, a network failure with no earlier copy). Cached for five minutes; a failed fetch keeps the last good copy and also waits five minutes before trying again, so an unreachable relay doesn’t turn every caller into a request.
parse
Parse and check a discovery document. None for anything srv shouldn’t act on: another format version, a missing field, a URL that isn’t https/wss (plain http/ws only when the relay itself is plain http, i.e. a local dev relay), or a host that is not AgentMux’s own (see [HostRule]).
resolve_login
The Cognito domain and client id to sign in with: the published ones when the cloud has a document, else what the caller supplied (the build’s compiled values). Both of a pair come from the same source, never mixed.
ws_url
Where the cloud subscriber connects: the published WebSocket URL, else the compiled one.