refactor: split Codex app-server modules

This commit is contained in:
Peter Steinberger
2026-04-10 22:43:06 +01:00
parent e9684c22c1
commit 8d72aafdbb
19 changed files with 981 additions and 657 deletions

View File

@@ -0,0 +1,21 @@
import type { CodexAppServerStartOptions } from "./config.js";
import type { JsonValue } from "./protocol.js";
import { getSharedCodexAppServerClient } from "./shared-client.js";
import { withTimeout } from "./timeout.js";
export async function requestCodexAppServerJson<T = JsonValue | undefined>(params: {
method: string;
requestParams?: JsonValue;
timeoutMs?: number;
startOptions?: CodexAppServerStartOptions;
}): Promise<T> {
const timeoutMs = params.timeoutMs ?? 60_000;
return await withTimeout(
(async () => {
const client = await getSharedCodexAppServerClient({ startOptions: params.startOptions });
return await client.request<T>(params.method, params.requestParams);
})(),
timeoutMs,
`codex app-server ${params.method} timed out`,
);
}