feat(studio): trust pass — friendly errors + store clarity + MCP i18n

Second half of the May-2026 trust pass. Drops the wall of
gRPC trailers from every error surface and makes the Store
honest about what is and isn't installable.

Friendly errors:

- New `friendlyError(Object, AppLocalizations)` mapper turns
  GrpcError + arbitrary throwables into a localised headline,
  optional recovery hint, and a verbatim detail string kept
  behind a "Show details" expander. Duck-typed on `.code` /
  `.message` so Studio doesn't have to depend on package:grpc
  directly.
- `FaiErrorBox` gains an `error:` constructor that runs the
  mapper. Every call site that used to render
  `snap.error.toString()` (flows, welcome, store) switches to
  it.
- 9 .arb entries per locale cover the gRPC codes we actually
  emit (INVALID_ARGUMENT, NOT_FOUND, ALREADY_EXISTS,
  PERMISSION_DENIED, FAILED_PRECONDITION, INTERNAL,
  UNAVAILABLE, UNAUTHENTICATED) plus copy/details affordances.
- `test/friendly_error_test.dart` — 6 unit tests for the
  mapper. Covers the mapping table, locale-switching, and the
  non-gRPC fallback so future regressions show up in CI.

Capability discovery:

- New `HubService.allCapabilities()` reads the kind-aware
  capability list (wasm + builtin + federated) and returns a
  Dart-side `CapabilityInfo` value type. The flow page's
  missing-dependency check uses it so `system.approval` and
  federated MCP/n8n tools count as "available" — fixes the
  Run button staying disabled forever.
- `HubService.listModules()` filters to kind=wasm so the
  Modules page doesn't sprout synthetic "system" entries that
  the operator can't uninstall.

Store clarity:

- New "Installable only" filter, on by default. Roughly 2/3
  of seed entries currently carry `status: planned`; the
  default view stops being noise.
- Featured-strip cards for planned modules now show a
  "Coming soon" pill instead of an empty action area.
- Main-grid cards for non-installable modules dim to 60%
  opacity so the eye lands on actionable cards first.
- Detail-sheet "Nicht installierbar" tooltip → inline hint
  box. The reason is visible without hovering.

MCP localisation:

- `_kMcpSuggestions` no longer holds 11 hardcoded English
  description strings. The `description` field is replaced
  with a `resolveDescription(AppLocalizations)` lookup that
  switches on the suggestion `name` to read the matching
  `mcpSuggestion*Desc` .arb key. EN + DE shipped.
- New `FaiEnBadge` widget renders a small `[EN]` pill when
  the active locale isn't English. Used next to MCP /
  federated store entries' tagline + description because
  the server supplies them in English and we can't translate
  on the fly yet — the badge is the honest signal until the
  planned `studio.translate` plugin lands.

Plus housekeeping: removed the unused `_keepImport` lint
escape in the test and the dangling library doc-comment in
`format.dart`.

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 12:36:14 +02:00
parent 34f2b7b313
commit c11461b0f9
15 changed files with 1219 additions and 104 deletions

View file

@ -237,6 +237,71 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get buttonCopied => 'Copied';
@override
String get buttonShowDetails => 'Show details';
@override
String get buttonHideDetails => 'Hide details';
@override
String get storeInstallableOnly => 'Installable only';
@override
String get storePillComingSoon => 'Coming soon';
@override
String storeNotInstallableInline(String status) {
return 'This module is on the roadmap (status: $status). It has no installable bundle yet — follow the repository for updates.';
}
@override
String get mcpSuggestionDeepwikiDesc =>
'Public HTTPS — GitHub repo documentation search (AI-powered). No Node, no API key.';
@override
String get mcpSuggestionSemgrepDesc =>
'Public HTTPS — security scanning for code vulnerabilities. No Node, no API key.';
@override
String get mcpSuggestionFilesystemDesc =>
'Anthropic — read / write files in /tmp. Edit the path before saving.';
@override
String get mcpSuggestionFetchDesc =>
'Anthropic — fetch arbitrary HTTP(S) URLs as markdown.';
@override
String get mcpSuggestionGithubDesc =>
'Anthropic — issues, PRs, repo files. Needs a GitHub PAT in the env var.';
@override
String get mcpSuggestionPuppeteerDesc =>
'Anthropic — headless browser automation for screenshots / scraping.';
@override
String get mcpSuggestionPostgresDesc =>
'Anthropic — read-only SQL queries against a Postgres database. Edit the URL.';
@override
String get mcpSuggestionSqliteDesc =>
'Anthropic — query a local SQLite file. Edit the path.';
@override
String get mcpSuggestionBraveSearchDesc =>
'Anthropic — web search via Brave. API key required.';
@override
String get mcpSuggestionMemoryDesc =>
'Anthropic — persistent knowledge graph for an agent\'s memory.';
@override
String get mcpSuggestionTimeDesc =>
'Anthropic — current time + timezone conversion.';
@override
String get mcpServerEnLanguageBadge =>
'Server text in English — Studio shows it as supplied.';
@override
String get settingsTitle => 'Hub endpoint';
@ -1337,6 +1402,66 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get flowsNoOutputs => 'Flow completed with no declared outputs.';
@override
String get errGeneric => 'Something went wrong.';
@override
String get errInvalidArgument => 'Invalid input.';
@override
String get errInvalidArgumentHint => 'Check the form values and try again.';
@override
String get errNotFound => 'Not found.';
@override
String get errNotFoundHint =>
'The item you asked for isn\'t here — it may have been removed or never existed.';
@override
String get errAlreadyExists => 'Already exists.';
@override
String get errPermissionDenied => 'Permission denied.';
@override
String get errPermissionDeniedHint =>
'The hub\'s operator policy blocks this action. Check `~/.fai/config.yaml`.';
@override
String get errFailedPrecondition => 'Setup issue blocked this.';
@override
String get errFailedPreconditionHint =>
'The hub couldn\'t proceed because something it needs isn\'t ready. The detail below explains what.';
@override
String get errInternal => 'Unexpected internal error.';
@override
String get errInternalHint =>
'Check the hub logs at `~/.fai/logs/`. If this repeats, please report it.';
@override
String get errUnavailable => 'Hub not reachable.';
@override
String get errUnavailableHint =>
'Make sure `fai serve` (or `fai daemon start`) is running and the daemon endpoint matches Studio\'s settings.';
@override
String get errUnauthenticated => 'Authentication required.';
@override
String get errUnauthenticatedHint =>
'Set `FAI_REGISTRY_TOKEN` or sign in through Settings before retrying.';
@override
String get errCopyDetail => 'Copy detail';
@override
String get errDetailCopied => 'Detail copied to clipboard.';
@override
String get flowsOutputUnknown => 'Output payload variant not recognised.';