feat(studio): HubService.invokePluginTheme + integration test

Wraps the new InvokePluginTheme RPC and ships an end-to-end
test that loads studio-theme-solarized into a fresh
HubFixture and asserts the light/dark schemes round-trip.

Signed-off-by: flemming-it <sf@flemming.it>
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-25 21:49:40 +02:00
parent efa9871a75
commit a5bcde6446
2 changed files with 112 additions and 0 deletions

View file

@ -396,6 +396,30 @@ class HubService {
return (state: state, text: r.text, sourcePath: r.sourcePath);
}
/// Invoke a Studio theme plugin's `theme` hook and unwrap
/// the result into Flutter-friendly `ColorScheme` slots.
///
/// Returns a record:
/// - `brightness`: echo of the input.
/// - `tokens`: 14 32-bit ARGB values in Material 3
/// order. Caller passes them to
/// `ColorScheme(...)` after deciding the
/// `brightness` enum.
///
/// Throws on hub-side errors (plugin not installed, plugin
/// declined the brightness, etc.) caller routes the
/// exception through `friendlyError` like every other RPC.
Future<({String brightness, List<int> tokens})> invokePluginTheme({
required String capability,
required String brightness,
}) async {
final r = await _client.invokePluginTheme(
capability: capability,
brightness: brightness,
);
return (brightness: r.brightness, tokens: r.tokens.toList());
}
/// Snapshot of every configured MCP server.
Future<List<McpClientInfo>> listMcpClients() async {
final r = await _client.listMcpClients();