mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-12 18:22:48 +03:00
* 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>
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { ChatGptBrowserWorker } from "../../vendor/codex-chatgpt-web/adapters/chatgpt-web/browser-worker.ts";
|
|
import { TurnBroker } from "../../vendor/codex-chatgpt-web/adapters/chatgpt-web/turn-broker.ts";
|
|
import { chatGptTurnSessions } from "../../vendor/codex-chatgpt-web/adapters/chatgpt-web/turn-execution.ts";
|
|
import { connectionRuntimePaths } from "./storageState.ts";
|
|
import { stopChatGptWebCodexTunnelRuntime } from "./tunnelClient.ts";
|
|
|
|
const activeWorkers = new Set<ChatGptBrowserWorker>();
|
|
const activeBrokers = new Set<TurnBroker>();
|
|
|
|
export function trackChatGptWebCodexRuntime(
|
|
worker: ChatGptBrowserWorker,
|
|
brokerSocketPath: string
|
|
): void {
|
|
activeWorkers.add(worker);
|
|
activeBrokers.add(TurnBroker.forSocket(brokerSocketPath));
|
|
}
|
|
|
|
export function getChatGptWebCodexRuntimeCounts(): {
|
|
activeTurns: number;
|
|
waitingTurns: number;
|
|
browserWorkers: number;
|
|
brokers: number;
|
|
} {
|
|
return {
|
|
activeTurns: chatGptTurnSessions.activeCount(),
|
|
waitingTurns: chatGptTurnSessions.waitingCount(),
|
|
browserWorkers: activeWorkers.size,
|
|
brokers: activeBrokers.size,
|
|
};
|
|
}
|
|
|
|
export async function stopChatGptWebCodexRuntime(): Promise<void> {
|
|
chatGptTurnSessions.clear();
|
|
const workers = [...activeWorkers];
|
|
const brokers = [...activeBrokers];
|
|
activeWorkers.clear();
|
|
activeBrokers.clear();
|
|
await Promise.allSettled(workers.map((worker) => worker.close()));
|
|
await Promise.allSettled(brokers.map((broker) => broker.close()));
|
|
await stopChatGptWebCodexTunnelRuntime();
|
|
}
|
|
|
|
export function brokerSocketPathForConnection(connectionId: string): string {
|
|
return connectionRuntimePaths(connectionId).brokerSocketPath;
|
|
}
|