Skip to main content

Module connectivity

Module connectivity 

Source
Expand description

Whether each service AgentMux depends on can be reached (docs/specs/SPEC_OFFLINE_RESILIENCE_2026_10_20.md §4.1).

Inputs. Code that already makes requests reports what happened (report, report_http, report_ws_connect, observe_claude_frame): any HTTP response means the service is reachable, whatever its status; a transport failure (DNS, connect, reset, TLS, timeout) means it isn’t. While a service is believed down, and only then, probe checks it on its own with capped backoff, so recovery shows even when nothing else is calling.

States (tracker): offline after [tracker::OFFLINE_AFTER] transport failures in a row or a failed probe; degraded while some fail and some answer; online on an answer. The internet counts as offline only when two services are and none answers.

Outputs. The connectivity:changed event on every change and connectivity.status for a window that opens later; both carry a rising revision, since they can arrive out of order.

Modules§

endpoint
A model API address as the status names it: the same address written two ways is one service, and a service’s id and label never carry a credential or a query.
netchange
The OS’s network-change notifications, so a switch of Wi-Fi, a VPN coming up or a cable pulled shows at once, not at the next probe of a service already believed down (up to a minute) or at the next failed request.
probe
The active probe: while a service is believed down, check it on a capped backoff (tracker::PROBE_FIRST_MS doubling to tracker::PROBE_MAX_MS), so its recovery shows even when nothing else is calling. An online service is never probed on a timer, only once when the OS reports a network change (netchange).
tracker
The reachability state machine and the probe schedule, with no I/O and no clock of its own: every call takes now_ms, so tests drive time.

Structs§

ConnectivityStatus
connectivity:changed’s payload and connectivity.status’s answer.
ModelApi
A model vendor’s API: where to probe it, and its name in the status bar.
ServiceStatus
One service’s reachability.

Enums§

Outcome
What one request, or probe, found.
Reachability
Whether a service can be reached.
Service
A service AgentMux depends on.

Constants§

EVENT_CONNECTIVITY_CHANGED
The WebSocket event carrying a changed ConnectivityStatus.

Statics§

ANTHROPIC
The API Claude Code calls. Only the persistent controller, which only Claude uses, reports today; another provider adds its own.
GOOGLE
The API Gemini CLI calls.
OPENAI
The API Codex calls.
TRACKED_MODEL_APIS
The model APIs whose state srv tracks from startup: each is listed as Reachability::Unknown and probed at once, so a window can tell “not checked yet” from “answers” before any agent has made a request.

Functions§

claude_frame_outcome
What a Claude CLI stdout frame says about the API, if anything: an api_retry with no HTTP status is a failed connection, one with a status was answered, and so was a reply from a model; a turn’s error result the failure classifier calls Network is a failed connection. A <synthetic> message is the CLI’s own (its “API Error” text), not the API’s.
endpoint_meta
What a pane keeps in its block meta (agent:api_endpoint) when its model API is not at srv’s own address: its service id, so the pane reads its own state, and the address.
http_outcome
The outcome a reqwest send() result says, or None for a request that was never sent (it couldn’t be built).
install
Where changes go, and the start of the probe driver. Call once at startup; reports before it are kept, just not sent.
model_api_of
The model API a provider’s CLI calls, from its first vendor, if srv tracks it.
observe_claude_frame
Reads one Claude CLI stdout frame (persistent::stdout_reader).
observe_provider_turn
What a finished turn of provider says about its model API: a clean turn, or a failure the API itself returned (limit, auth, overload), reached it; a network failure did not. Any other failure says nothing.
report
What a request to service found.
report_http
Reports a reqwest send() result.
report_ws_connect
Reports a WebSocket connect: None when it succeeded.
service_for
The service a pane’s calls to api go to, given the address its CLI was started with (None, empty or unreadable: the CLI’s default). The same address srv itself would call is just api.
service_for_env
service_for with the address read from the environment a pane’s CLI was started with. A pane with a proxy of its own has no address of its own in the status: the probe goes out the way srv does, which may not be the way that CLI does, so it could call a working address offline.
status
The current state, for connectivity.status.
track
Starts tracking service now: listed as not checked yet and probed at once, as the TRACKED_MODEL_APIS are at startup. For a pane’s own address, when its CLI starts.
ws_connect_outcome
The outcome of a WebSocket connect: an HTTP answer to the handshake, even a refusal, means the server was reached.