# Provider Catalog Readiness Contract

This contract separates provider command availability from provider account
authentication. It applies to Session Setup and the Provider section in Host
Preferences.

## Availability Authority

Authenticated `GET /providers` is the only dashboard authority for provider
availability, model metadata, runtime support, and provider capabilities.
Availability is derived from the configured provider command and the Host
provider registry. The endpoint must not execute or await provider account
authentication checks.

An installed provider remains available in Session Setup when its account is
logged out, its authentication status is unknown, or its authentication check
is slow or fails. Provider startup and the dedicated authentication flow remain
responsible for reporting that login is required.

## Authentication Authority

Authenticated `GET /provider-auth/status?provider=<id>` owns explicit provider
account status. Login start, input, polling, cancellation, and runtime
authentication failure continue to use the provider-auth and session-start
flows. These results may provide login guidance, but they must not remove an
installed provider from `GET /providers` or Session Setup.

External authentication inspection is bounded. Claude `auth status` receives a
five-second process timeout and `SIGTERM`; timeout or inspection failure returns
an `unknown` authentication state from the dedicated endpoint.

## Dashboard States

`providerCatalogState.status` has five distinct values:

- `unknown`: no availability request has started;
- `pending`: the initial authoritative request is in flight;
- `ready`: the Host returned at least one runnable provider;
- `unavailable`: the Host successfully returned no runnable provider; and
- `request_failed`: the initial availability request failed.

The dashboard must not synthesize `commandAvailable:false` before Host
evidence. Initial `unknown` and `pending` states show `Checking providers...`.
`request_failed` shows an actionable Retry. Only `unavailable` may show
`No providers are currently available`.

`loadProviderCatalog()` owns one shared in-flight Promise. Concurrent callers
must receive that exact Promise and must not create duplicate requests. A
successful retry updates Session Setup without a route reload.

When usable provider data is cached, a background refresh keeps that data
visible. A refresh failure is local status information and must not replace
cached availability with `request_failed`.

## Host Preferences

The P022 Host Preferences loading contract remains in force. The Provider
section may show `Checking provider availability...`, a local failure, and
Retry while unrelated settings remain usable. Provider readiness must not
become a page-wide loading dependency.

## Transport Boundary

P039 changes application readiness and endpoint ownership. It does not repair
or classify Managed Tunnel availability. A Managed Endpoint returning an FRP
404 or losing its connector heartbeat is a P037 transport failure, even when
the missing provider response exposes the P039 request-failure UI.

Dashboard owner authentication remains required on both provider endpoints.
This contract removes provider-account-auth coupling, not dashboard
authorization.
