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.

Structs§

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

Constants§

CACHE_TTL 🔒
How long a fetched document (or a failed fetch) is reused before asking again.
DISCOVERY_PATH
Path of the discovery document under the relay REST base.
FETCH_TIMEOUT 🔒

Statics§

CACHE 🔒

Functions§

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.
fetch 🔒
keep_last_good 🔒
A fresh document replaces the cached one; a failed fetch keeps it.
parse
Parse and check a discovery document. None for anything srv shouldn’t act on: another format version, a missing field, or a URL that isn’t https/wss (plain http/ws only when the relay itself is plain http, i.e. a local dev relay).
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.