Objective
Apply the BackendAIClientRegistry / V2ClientRegistry pattern to app-proxy clients so that DeploymentChatClient and any future deployment-runtime domain clients are exposed via a single registry instead of being instantiated directly by the CLI.
Background
DeploymentChatClient was introduced in BA-5528 as a direct subclass of BackendAIAppProxyClient. The CLI builds a ClientConfig and instantiates the client manually with async with DeploymentChatClient(config). This diverges from the manager-side SDK where domain clients (SessionClient, VFolderClient, ...) are lazy-loaded via BackendAIClientRegistry / V2ClientRegistry and consumed by CLI helpers (create_v2_registry).
Once we add more app-proxy domain clients (custom containers, /generate, etc.), the current shape will not scale; consolidating on a registry now keeps the SDK surface symmetric across manager-side and app-proxy-side clients.
Approach
- Add BaseAppProxyDomainClient mirroring BaseDomainClient: stores _client: BackendAIAppProxyClient.
- Refactor DeploymentChatClient from a BackendAIAppProxyClient subclass to a BaseAppProxyDomainClient (composition over inheritance).
- Add AppProxyClientRegistry in client/v2/approxy_registry.py with the same shape as BackendAIClientRegistry: init, async create(), async close(), and @cached_property accessors for each app-proxy domain client (currently deployment_chat).
- Add create_appproxy_registry helper in cli/v2/helpers.py mirroring create_v2_registry.
- Switch the ./bai deployment chat CLI command to consume the registry instead of instantiating DeploymentChatClient directly.
- Update tests to inject BackendAIAppProxyClient into DeploymentChatClient via the new constructor signature.
Acceptance Criteria
- AppProxyClientRegistry exposes deployment_chat as @cached_property and follows the same lifecycle (create / close) as BackendAIClientRegistry.
- DeploymentChatClient no longer subclasses BackendAIAppProxyClient; it composes one via BaseAppProxyDomainClient.
- ./bai deployment chat keeps the same observable behavior (token resolution, model resolution, history persistence, 401/403 handling).
- pants lint, pants check, and existing DeploymentChatClient unit tests all pass.
JIRA Issue: BA-5961
Objective
Apply the BackendAIClientRegistry / V2ClientRegistry pattern to app-proxy clients so that DeploymentChatClient and any future deployment-runtime domain clients are exposed via a single registry instead of being instantiated directly by the CLI.
Background
DeploymentChatClient was introduced in BA-5528 as a direct subclass of BackendAIAppProxyClient. The CLI builds a ClientConfig and instantiates the client manually with
async with DeploymentChatClient(config). This diverges from the manager-side SDK where domain clients (SessionClient, VFolderClient, ...) are lazy-loaded via BackendAIClientRegistry / V2ClientRegistry and consumed by CLI helpers (create_v2_registry).Once we add more app-proxy domain clients (custom containers, /generate, etc.), the current shape will not scale; consolidating on a registry now keeps the SDK surface symmetric across manager-side and app-proxy-side clients.
Approach
Acceptance Criteria
JIRA Issue: BA-5961