+ {/* Wordmark uses the same purple→blue gradient as the H glass logo
+ so the login surface visually matches the app icon (window
+ tray icon, taskbar, dock). */}
+
Heicode
{
data?: {
token?: string
refreshToken?: string
- user?: { id?: string; email?: string; channelId?: string }
+ user?: {
+ id?: string
+ email?: string
+ channelId?: string
+ // mcp-server may return either `name` or `display_name` depending on
+ // version; try both. role lets the UI badge admin/root.
+ name?: string
+ display_name?: string
+ role?: string
+ }
}
} = {}
try { mgrJson = (await mgrRes.json()) as typeof mgrJson } catch { /* */ }
@@ -270,6 +292,10 @@ async function handleLoginWithCredentials(req: Request): Promise {
}
const mcpUserId = mgrJson.data?.user?.id
const mcpChannelId = mgrJson.data?.user?.channelId
+ const mcpEmail = mgrJson.data?.user?.email
+ const mcpDisplayName =
+ mgrJson.data?.user?.display_name || mgrJson.data?.user?.name
+ const mcpRole = mgrJson.data?.user?.role
// Decode JWT exp claims (no signature verification — we already trust the
// platform we just authenticated against). Used downstream to know when to
@@ -289,6 +315,9 @@ async function handleLoginWithCredentials(req: Request): Promise {
managerLoginUrl: managerBase,
...(mcpUserId !== undefined && { userId: mcpUserId }),
...(mcpChannelId !== undefined && { channelId: mcpChannelId }),
+ ...(mcpEmail && { email: mcpEmail }),
+ ...(mcpDisplayName && { displayName: mcpDisplayName }),
+ ...(mcpRole && { role: mcpRole }),
}
// ── Step 2: POST /api/user/session/from-agnet ─────────
diff --git a/cc-haha/src/server/types/provider.ts b/cc-haha/src/server/types/provider.ts
index 1748f2b..542d825 100644
--- a/cc-haha/src/server/types/provider.ts
+++ b/cc-haha/src/server/types/provider.ts
@@ -39,6 +39,12 @@ export const McpAuthSchema = z.object({
userId: z.string().optional(),
/** Manager-side channelId for this user. */
channelId: z.string().optional(),
+ /** Email captured from /api/auth/login response (used for header user pill). */
+ email: z.string().optional(),
+ /** Human-readable display name from /api/auth/login response (header user pill). */
+ displayName: z.string().optional(),
+ /** Role string returned by Manager (e.g. 'user'/'admin'/'root'). */
+ role: z.string().optional(),
})
export type McpAuth = z.infer