From bcf8b141831aa0798798a45bc92a0cce57ed7b04 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 2 Aug 2026 08:54:58 -0700 Subject: [PATCH] fix(app): render stored keys from legacy-safe method labels --- .../components/dialog-connect-provider.tsx | 28 ++++++++++++------- packages/app/src/utils/server-compat.ts | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/app/src/components/dialog-connect-provider.tsx b/packages/app/src/components/dialog-connect-provider.tsx index dfb36db66157..407c930fd55b 100644 --- a/packages/app/src/components/dialog-connect-provider.tsx +++ b/packages/app/src/components/dialog-connect-provider.tsx @@ -427,20 +427,28 @@ function ProviderConnection(props: { const loading = createMemo(() => integration.loading) const methods = createMemo(() => { const values = integration.latest?.methods.filter( - (method): method is ConnectMethod => method.type === "key" || method.type === "oauth", + (method): method is ConnectMethod => + (method.type === "key" || method.type === "oauth") && !(method.label ?? "").startsWith("Stored API key "), ) return values?.length ? values : fallback() }) const storedKeys = createMemo(() => - (integration.latest?.connections?.filter((c) => c.type === "credential") ?? []) as Array<{ - type: "credential" - id: string - label: string - displayPrefix?: string - displaySuffix?: string - createdAt?: number - cooldownUntil?: number - }>, + (integration.latest?.methods ?? []).flatMap((method) => { + if (method.type !== "key") return [] + const match = (method.label ?? "").match(/^Stored API key (\d+) \(([^.]+)\.\.\.([^)]+)\)$/) + if (!match) return [] + return [ + { + type: "credential" as const, + id: `${props.provider}:${Number(match[1]) - 1}`, + label: `Workspace ${match[1]}`, + displayPrefix: match[2], + displaySuffix: match[3], + createdAt: undefined, + cooldownUntil: undefined, + }, + ] + }), ) const [store, setStore] = createStore({ methodIndex: undefined as undefined | number, diff --git a/packages/app/src/utils/server-compat.ts b/packages/app/src/utils/server-compat.ts index 339dbf7f8b24..0199e8803ca6 100644 --- a/packages/app/src/utils/server-compat.ts +++ b/packages/app/src/utils/server-compat.ts @@ -406,7 +406,7 @@ function createV1Api(input: CompatibleInput): CompatibleApi { displaySuffix: match[3], } }) - const methods = authMethods.filter((_, index) => !stored[index]).map((method, index) => + const methods = authMethods.map((method, index) => method.type === "api" ? { type: "key" as const, label: method.label } : { type: "oauth" as const, id: String(index), label: method.label, prompts: method.prompts },