Skip to content

feat(api): include providerName in GET /api/connections#10

Merged
matoushavlena merged 2 commits intomainfrom
feat/connections-include-provider-name
Apr 18, 2026
Merged

feat(api): include providerName in GET /api/connections#10
matoushavlena merged 2 commits intomainfrom
feat/connections-include-provider-name

Conversation

@matoushavlena
Copy link
Copy Markdown

Summary

Fold the app-registry display name into the /api/connections response so external callers (e.g. the Humr agent platform) don't have to make a second request to /api/apps just to render "Google Drive" next to the user's email.

Why

The existing connection.label field is the user's identityextractLabel() in connection-service.ts derives it from metadata.email | username | name. It is not the app's display name. When callers render label as the card title, the result is a duplicated email on both lines (see kagenti/humr#187 for the before-screenshot).

The display name ("Google Drive", "Gmail", "GitHub") already lives in the static apps registry. Joining on the server is a one-line map.

What

+import { apps } from "@/lib/apps/registry";
 ...
+const providerName = new Map(apps.map((a) => [a.id, a.name]));
 const connections = await listConnections(auth.accountId);
-return NextResponse.json(connections);
+const enriched = connections.map((c) => ({
+  ...c,
+  providerName: providerName.get(c.provider) ?? null,
+}));
+return NextResponse.json(enriched);

Compatibility

Pure additive — no field removed, no type change. Existing consumers (OneCLI dashboard, Humr) keep working. When the provider id isn't in the registry (unlikely, but possible if a connection is orphaned after an app is removed), providerName is null so callers can fall back.

Test plan

  • Smoke: GET /api/connections returns rows with providerName populated for registry-backed providers.
  • Regression: existing clients ignoring the new field continue to work unchanged.

Fold the app-registry display name into the connections list so
callers don't have to fetch /api/apps just to render "Google Drive"
alongside the user's email. The existing `connection.label` field
is the user's *identity* (email/username from metadata via
extractLabel), not the app's display name — rendering it as a card
title produces the duplicate-email UX that the Humr platform hit
(see kagenti/humr#187).

Pure additive: existing consumers ignore the new field; when the
provider id isn't in the registry, `providerName` is `null` so
callers can fall back.

Signed-off-by: Matous Havlena <havlenma@gmail.com>
The local map variable shadowed the response field it populates. Renaming
makes intent clearer at a glance per review feedback.

Signed-off-by: Matous Havlena <havlenma@gmail.com>
@matoushavlena matoushavlena merged commit baf37fb into main Apr 18, 2026
2 checks passed
matoushavlena added a commit to kagenti/humr that referenced this pull request Apr 18, 2026
…rName

Closes the "email on both title and subtitle" bug surfaced at #187:
the Connections page and the Edit Agent Secrets Apps group were showing
the user's email in both fields because OneCLI's connection.label is the
user's identity (extracted from metadata.email|username|name), not the
app's display name.

OneCLI 0.0.14 ships a new providerName field on every /api/connections
row, sourced from the app registry (kagenti/onecli#10). Consume it:

  label: c.providerName?.trim() || c.label?.trim() || c.provider

identity falls back to OneCLI's label when metadata is thin, so the
subtitle remains useful for providers that don't expose rich metadata.

Bumps Helm OneCLI image to 0.0.14 and drops the now-unused listApps port
method plus its tests. 28 api-server unit tests pass.

Signed-off-by: Matous Havlena <havlenma@gmail.com>
matoushavlena added a commit to kagenti/humr that referenced this pull request Apr 18, 2026
* fix(api-server): render connection app name via onecli 0.0.14 providerName

Closes the "email on both title and subtitle" bug surfaced at #187:
the Connections page and the Edit Agent Secrets Apps group were showing
the user's email in both fields because OneCLI's connection.label is the
user's identity (extracted from metadata.email|username|name), not the
app's display name.

OneCLI 0.0.14 ships a new providerName field on every /api/connections
row, sourced from the app registry (kagenti/onecli#10). Consume it:

  label: c.providerName?.trim() || c.label?.trim() || c.provider

identity falls back to OneCLI's label when metadata is thin, so the
subtitle remains useful for providers that don't expose rich metadata.

Bumps Helm OneCLI image to 0.0.14 and drops the now-unused listApps port
method plus its tests. 28 api-server unit tests pass.

Signed-off-by: Matous Havlena <havlenma@gmail.com>

* fix(ui): include appsChanged in Edit Agent Secrets Save gate

The Save button's canSave condition only watched credsChanged and
envChanged, so toggling an app checkbox (the whole reason this
dialog has an Apps group) never unlocked the button.

save() already handled appsChanged correctly on its own; the bug
was purely in the enablement gate. Lift appsChanged into a
useMemo so both canSave and the "Nothing to save" title can see it.

Signed-off-by: Matous Havlena <havlenma@gmail.com>

---------

Signed-off-by: Matous Havlena <havlenma@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants