Add proactive token refresh lead times for providers and implement Codex proxy management

This commit is contained in:
decolua
2026-04-14 11:41:06 +07:00
parent 4bff21cb80
commit 04cdb75839
14 changed files with 232 additions and 27 deletions

View File

@@ -865,7 +865,7 @@ export default function ProviderDetailPage() {
<h2 className="text-lg font-semibold">Connections</h2>
<div className="flex items-center gap-4">
{/* Thinking config */}
{thinkingConfig && (
{/* {thinkingConfig && (
<div className="flex items-center gap-2">
<span className="text-xs text-text-muted font-medium">Thinking</span>
<select
@@ -878,7 +878,7 @@ export default function ProviderDetailPage() {
))}
</select>
</div>
)}
)} */}
{/* Round Robin toggle */}
<div className="flex items-center gap-2">
<span className="text-xs text-text-muted font-medium">Round Robin</span>

View File

@@ -7,6 +7,7 @@ import {
pollForToken
} from "@/lib/oauth/providers";
import { createProviderConnection } from "@/models";
import { startCodexProxy, stopCodexProxy } from "@/lib/oauth/utils/server";
/**
* Dynamic OAuth API Route
@@ -30,6 +31,26 @@ export async function GET(request, { params }) {
return NextResponse.json(authData);
}
if (action === "start-proxy") {
if (provider !== "codex") {
return NextResponse.json({ error: "Proxy only supported for codex" }, { status: 400 });
}
const appPort = searchParams.get("app_port");
if (!appPort) {
return NextResponse.json({ error: "Missing app_port" }, { status: 400 });
}
const result = await startCodexProxy(Number(appPort));
return NextResponse.json(result);
}
if (action === "stop-proxy") {
if (provider !== "codex") {
return NextResponse.json({ error: "Proxy only supported for codex" }, { status: 400 });
}
stopCodexProxy();
return NextResponse.json({ success: true });
}
if (action === "device-code") {
const providerData = getProvider(provider);
if (providerData.flowType !== "device_code") {