fix(zed): harden OAuth lifecycle and live model support
- executors/zed.js: use exact wire values (anthropic, open_ai, google, x_ai) and strip incompatible Vertex safetySettings on the Google path - shared/zedAuth.js: robust callback query parsing, reject garbage PKCS#1 v1.5 decryptions, and thread proxyOptions when fetching LLM tokens - oauth: preserve systemId across authorize/register/exchange lifecycle, renew proxy idle timeout on reuse, and ignore non-callback localhost requests - shared/OAuthModal.js: track owned proxy in flowRef and stop at most once - api/providers/[id]/models: add connection-scoped live Zed model resolver - registry: unhide provider in dashboard - tests: add unit coverage for wire format, native auth, and live models
This commit is contained in:
1 parent
725e2c1187
commit
ef18175226
13 files changed
+866
-105
No files matched your search
@@ -309,13 +309,13 @@ export async function POST(request, { params }) {
|
||||
let ok = false;
|
||||
if (provider === "trae") ok = registerTraeSession({ state });
|
||||
else if (provider === "windsurf") ok = registerWindsurfSession({ state });
|
||||
else if (provider === "zed") ok = registerZedSession({ state, codeVerifier: body?.codeVerifier });
|
||||
else if (provider === "zed") ok = registerZedSession({ state, codeVerifier: body?.codeVerifier, systemId: body?.systemId });
|
||||
else return NextResponse.json({ error: "register-session only supported for trae/windsurf/zed" }, { status: 400 });
|
||||
return NextResponse.json({ success: ok });
|
||||
}
|
||||
|
||||
if (action === "exchange") {
|
||||
const { code, redirectUri, codeVerifier, state, meta } = body;
|
||||
const { code, redirectUri, codeVerifier, state, meta, systemId } = body;
|
||||
|
||||
// Xiaomi MiMo: no token exchange needed — the callback already decrypted the sk.
|
||||
// Just read the session result and create the connection.
|
||||
@@ -459,8 +459,13 @@ export async function POST(request, { params }) {
|
||||
return NextResponse.json({ error: "Missing required fields" }, { status: 400 });
|
||||
}
|
||||
|
||||
// Exchange code for tokens (meta carries provider-specific params, e.g. gitlab clientId/baseUrl)
|
||||
const tokenData = await exchangeTokens(provider, code, redirectUri, codeVerifier, state, meta);
|
||||
// Exchange code for tokens (meta carries provider-specific params, e.g. gitlab clientId/baseUrl).
|
||||
// systemId (Zed) is merged into meta so the login attempt's own id is
|
||||
// used instead of a freshly prepared one. Ignored by other providers.
|
||||
const tokenData = await exchangeTokens(provider, code, redirectUri, codeVerifier, state, {
|
||||
...(meta || {}),
|
||||
...(systemId ? { systemId } : {}),
|
||||
});
|
||||
|
||||
// Save to database
|
||||
const connection = await createProviderConnection({
|
||||
|
||||
Reference in new issue
Block a user