From b8bcae4b14be5d43697a6a447f9fc76686cadefa Mon Sep 17 00:00:00 2001 From: flemming-it Date: Sun, 24 May 2026 22:07:16 +0200 Subject: [PATCH] feat(hub-client): forward locale to FetchModuleDocs Hub now accepts a locale field on FetchModuleDocsRequest so README..md (e.g. README.de.md) gets tried before the generic README.md. SDK passes it via an optional named param; empty string keeps the previous behaviour. Signed-off-by: flemming-it --- lib/src/generated/fai/v1/hub.pb.dart | 17 +++++++++++++++++ lib/src/generated/fai/v1/hub.pbjson.dart | 4 +++- lib/src/hub_client.dart | 9 +++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/src/generated/fai/v1/hub.pb.dart b/lib/src/generated/fai/v1/hub.pb.dart index dda413a..3341919 100644 --- a/lib/src/generated/fai/v1/hub.pb.dart +++ b/lib/src/generated/fai/v1/hub.pb.dart @@ -1911,11 +1911,15 @@ class UninstallModuleResponse extends $pb.GeneratedMessage { class FetchModuleDocsRequest extends $pb.GeneratedMessage { factory FetchModuleDocsRequest({ $core.String? name, + $core.String? locale, }) { final $result = create(); if (name != null) { $result.name = name; } + if (locale != null) { + $result.locale = locale; + } return $result; } FetchModuleDocsRequest._() : super(); @@ -1924,6 +1928,7 @@ class FetchModuleDocsRequest extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'FetchModuleDocsRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'fai.v1'), createEmptyInstance: create) ..aOS(1, _omitFieldNames ? '' : 'name') + ..aOS(2, _omitFieldNames ? '' : 'locale') ..hasRequiredFields = false ; @@ -1954,6 +1959,18 @@ class FetchModuleDocsRequest extends $pb.GeneratedMessage { $core.bool hasName() => $_has(0); @$pb.TagNumber(1) void clearName() => $_clearField(1); + + /// Preferred locale code (e.g. "de", "en"). When set, the hub + /// first tries `README..md` before falling back to the + /// generic `README.md`. Empty string = no locale preference. + @$pb.TagNumber(2) + $core.String get locale => $_getSZ(1); + @$pb.TagNumber(2) + set locale($core.String v) { $_setString(1, v); } + @$pb.TagNumber(2) + $core.bool hasLocale() => $_has(1); + @$pb.TagNumber(2) + void clearLocale() => $_clearField(2); } class FetchModuleDocsResponse extends $pb.GeneratedMessage { diff --git a/lib/src/generated/fai/v1/hub.pbjson.dart b/lib/src/generated/fai/v1/hub.pbjson.dart index 7c991e3..48b8631 100644 --- a/lib/src/generated/fai/v1/hub.pbjson.dart +++ b/lib/src/generated/fai/v1/hub.pbjson.dart @@ -508,12 +508,14 @@ const FetchModuleDocsRequest$json = { '1': 'FetchModuleDocsRequest', '2': [ {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + {'1': 'locale', '3': 2, '4': 1, '5': 9, '10': 'locale'}, ], }; /// Descriptor for `FetchModuleDocsRequest`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List fetchModuleDocsRequestDescriptor = $convert.base64Decode( - 'ChZGZXRjaE1vZHVsZURvY3NSZXF1ZXN0EhIKBG5hbWUYASABKAlSBG5hbWU='); + 'ChZGZXRjaE1vZHVsZURvY3NSZXF1ZXN0EhIKBG5hbWUYASABKAlSBG5hbWUSFgoGbG9jYWxlGA' + 'IgASgJUgZsb2NhbGU='); @$core.Deprecated('Use fetchModuleDocsResponseDescriptor instead') const FetchModuleDocsResponse$json = { diff --git a/lib/src/hub_client.dart b/lib/src/hub_client.dart index feddd92..82d84a7 100644 --- a/lib/src/hub_client.dart +++ b/lib/src/hub_client.dart @@ -240,8 +240,13 @@ class HubClient { /// when set, so Studio doesn't have to handle credentials. /// Errors come back inside [FetchModuleDocsResponse.errorKind] /// (not as exceptions) so the UI can render fallbacks. - Future fetchModuleDocs(String name) { - return _admin.fetchModuleDocs(pb.FetchModuleDocsRequest(name: name)); + Future fetchModuleDocs( + String name, { + String locale = '', + }) { + return _admin.fetchModuleDocs( + pb.FetchModuleDocsRequest(name: name, locale: locale), + ); } /// List every configured MCP server with the last-discovery