Files
OmniRoute/open-sse/executors/chatgpt-web-codex/models.ts
Jan Leon a99c795a67 Add native ChatGPT Web provider for Codex clients (#8949)
* Bypass proxy compaction for native Codex context

* Add native ChatGPT Web provider pipeline

* Add managed browser and tunnel deployment

* Add ChatGPT Web setup and doctor UI

* Document and test ChatGPT Web integration

* fix(security): register chatgpt-web-codex-doctor in LOCAL_ONLY_API_PATTERNS

The diagnostic route under /api/providers/{id}/chatgpt-web-codex-doctor
was not registered in the spawn-capable route guard. Adding it for
parity with the existing /login pattern.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

* fix(providers): route chatgpt-web-codex admin routes through a service boundary

The provider CRUD/doctor routes imported chatgpt-web-codex helpers
(finalizeValidatedChatGptWebCodexSecrets, encode/decodeChatGptWebCodexSecrets,
getChatGptWebCodexDoctorStatus) directly from open-sse/executors/**, which
no-restricted-imports (EXECUTOR_IMPORT_RESTRICTION) forbids for src/app/**
files — executor implementations must stay behind an open-sse handler or
service boundary.

Add open-sse/services/chatgptWebCodexAdmin.ts as a thin re-export boundary
(mirroring the existing tokenRefresh.ts re-export pattern) and import from
there instead. No behavior change.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-08-11 09:53:39 -03:00

33 lines
1.3 KiB
TypeScript

export type ChatGptWebCodexEffort = "low" | "medium" | "high" | "xhigh" | "max";
export interface ChatGptWebCodexModelRoute {
id: string;
effort: ChatGptWebCodexEffort;
pro: boolean;
}
const ROUTES = new Map<string, ChatGptWebCodexModelRoute>([
["instant", { id: "instant", effort: "low", pro: false }],
["medium", { id: "medium", effort: "medium", pro: false }],
["high", { id: "high", effort: "high", pro: false }],
["extra-high", { id: "extra-high", effort: "xhigh", pro: false }],
["pro", { id: "pro", effort: "max", pro: true }],
]);
export function requireChatGptWebCodexRoute(model: string): ChatGptWebCodexModelRoute {
const normalized = model.replace(/^chatgpt-web-codex\//, "");
const route = ROUTES.get(normalized);
if (!route) throw new Error(`Unsupported ChatGPT Web (Codex) model: ${model}`);
return route;
}
export function reasoningEffortOf(body: Record<string, unknown>): string | undefined {
const reasoning = body.reasoning;
if (reasoning && typeof reasoning === "object" && !Array.isArray(reasoning)) {
const effort = (reasoning as Record<string, unknown>).effort;
return typeof effort === "string" ? effort : undefined;
}
const effort = body.reasoning_effort;
return typeof effort === "string" ? effort : undefined;
}