mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 20:52:15 +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>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
/* Adapted from miuuyy/codex-chatgpt-web commit 55592fca0ba19a27f1b769cec8fff61ff340a785 (MIT). */
|
|
export class AsyncEventQueue<T> implements AsyncIterable<T> {
|
|
private readonly buffered: T[] = [];
|
|
private readonly waiters: Array<(result: IteratorResult<T>) => void> = [];
|
|
private closed = false;
|
|
|
|
constructor(private readonly maxBuffered = 10_000) {}
|
|
|
|
push(value: T): void {
|
|
if (this.closed) return;
|
|
const waiter = this.waiters.shift();
|
|
if (waiter) {
|
|
waiter({ value, done: false });
|
|
return;
|
|
}
|
|
if (this.buffered.length >= this.maxBuffered) throw new Error("Adapter event backlog exceeded");
|
|
this.buffered.push(value);
|
|
}
|
|
|
|
close(): void {
|
|
if (this.closed) return;
|
|
this.closed = true;
|
|
while (this.waiters.length > 0) this.waiters.shift()!({ value: undefined, done: true });
|
|
}
|
|
|
|
async collect(): Promise<T[]> {
|
|
const values: T[] = [];
|
|
for await (const value of this) values.push(value);
|
|
return values;
|
|
}
|
|
|
|
[Symbol.asyncIterator](): AsyncIterator<T> {
|
|
return {
|
|
next: () => {
|
|
const value = this.buffered.shift();
|
|
if (value !== undefined) return Promise.resolve({ value, done: false });
|
|
if (this.closed) return Promise.resolve({ value: undefined, done: true });
|
|
return new Promise((resolve) => this.waiters.push(resolve));
|
|
},
|
|
return: () => {
|
|
this.close();
|
|
return Promise.resolve({ value: undefined, done: true });
|
|
},
|
|
};
|
|
}
|
|
}
|