feat(client): getDefaultScope / setDefaultScope wrappers
Some checks failed
Security / Security check (push) Failing after 2s

Studio's upcoming default_scope editor in Settings calls
through these wrappers. Both return a record with the live
`scope` and the catalog-known publisher shortlist so the UI
can render a typeahead while letting operators paste private
publisher segments freely.

Bindings regenerated from fai_platform/proto.

dart analyze + dart test green (4 tests).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-29 00:19:24 +02:00
parent c90a88481c
commit 427bd6c0d9
4 changed files with 197 additions and 0 deletions

View file

@ -158,6 +158,35 @@ class HubClient {
return r.events;
}
/// Read the operator's `default_scope:` — the ordered list of
/// provider segments the bare-form capability resolver
/// consults when a flow names a capability without an explicit
/// `<provider>/` prefix. Also returns a sorted list of catalog-
/// known publisher segments so editors can offer a typeahead
/// shortlist (arbitrary entries are still allowed).
Future<({List<String> scope, List<String> knownProviders})>
getDefaultScope() async {
final r = await _admin.getDefaultScope(Empty());
return (
scope: List<String>.from(r.scope),
knownProviders: List<String>.from(r.knownProviders),
);
}
/// Replace the operator's `default_scope:`. The hub validates
/// the list (non-empty after trimming), persists to
/// `~/.fai/config.yaml`, and hot-swaps the in-memory copy
/// without a daemon restart. Returns the snapshot.
Future<({List<String> scope, List<String> knownProviders})>
setDefaultScope(List<String> scope) async {
final req = pb.SetDefaultScopeRequest()..scope.addAll(scope);
final r = await _admin.setDefaultScope(req);
return (
scope: List<String>.from(r.scope),
knownProviders: List<String>.from(r.knownProviders),
);
}
/// Server-streaming audit-log subscription. The hub first
/// replays up to [backfill] historical events (oldest-last so
/// the receiver sees them in chronological order), then keeps