feat: updateSystemAi + testSystemAi RPCs (v0.5.0)

`HubClient.updateSystemAi(...)` persists a new System-AI config
to ~/.fai/config.yaml AND hot-reloads the live hub state in one
round-trip; returns the resulting SystemAiStatus so the UI
refreshes without a second call.

`HubClient.testSystemAi()` probes the configured provider with
a tiny ping and returns the same error-kind taxonomy as askAi.
Studio's "Test connection" button uses this.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-07 13:41:10 +02:00
parent f0db42264f
commit 8798119903
5 changed files with 203 additions and 1 deletions

View file

@ -199,6 +199,32 @@ class HubClient {
return _admin.askAi(pb.AskAiRequest(prompt: prompt));
}
/// Persist a new System-AI configuration. Validates +
/// writes back to ~/.fai/config.yaml + hot-reloads the live
/// hub state in one call. Returns the resulting status so
/// the UI can refresh in one round-trip.
Future<SystemAiStatusResponse> updateSystemAi({
required String provider,
required String endpoint,
required String model,
required String apiKeyEnv,
required String privacyMode,
}) {
return _admin.updateSystemAi(pb.UpdateSystemAiRequest(
provider: provider,
endpoint: endpoint,
model: model,
apiKeyEnv: apiKeyEnv,
privacyMode: privacyMode,
));
}
/// Probe the configured provider with a tiny ping. Same
/// error-kind taxonomy as [askAi].
Future<AskAiResponse> testSystemAi() {
return _admin.testSystemAi(Empty());
}
/// Search the hub's bundled store index. All filters are
/// optional; an empty query returns the first [limit] entries
/// the index ships with.