fetchHubAiConfig method

Future<HubAiConfig> fetchHubAiConfig()

Fetches the Hub's default AI configuration (provider/model, never a key), so a browser embedder can offer "use the Hub default". Returns a HubAiConfig with available == false when the Hub has none configured.

Implementation

Future<HubAiConfig> fetchHubAiConfig() {
  _ensureConnected();
  final id = newId();
  final completer = Completer<HubAiConfig>();
  _pendingAiConfigs[id] = completer;
  _connection!.send(ControlFrame(AiConfigRequest(requestId: id)));
  return _rpcTimeout(completer.future, () => _pendingAiConfigs.remove(id));
}