@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
51 lines • 2.36 kB
TypeScript
export declare const DEFAULT_HTTP_IDLE_TIMEOUT_MS = 300000;
export declare const HTTP_IDLE_TIMEOUT_CHOICES: readonly [{
readonly label: "30 sec";
readonly timeoutMs: 30000;
}, {
readonly label: "1 min";
readonly timeoutMs: 60000;
}, {
readonly label: "2 min";
readonly timeoutMs: 120000;
}, {
readonly label: "5 min";
readonly timeoutMs: 300000;
}, {
readonly label: "disabled";
readonly timeoutMs: 0;
}];
/** Facts the global-install decision reads; injected so the decision is testable per runtime. */
export interface UndiciGlobalsInstallInput {
/** `process.versions`; a `bun` entry means this process IS Bun. */
readonly versions: Readonly<Record<string, string | undefined>>;
/** `globalThis.fetch` at the time of the call. */
readonly currentFetch: unknown;
/** `globalThis.fetch` captured when this module loaded. */
readonly originalFetch: unknown;
/** `globalThis.fetch` left behind by the previous install, if any. */
readonly installedFetch: unknown;
}
/**
* Whether `configureHttpDispatcher` may replace the global `fetch` (and the
* WebSocket/Headers/Request/Response constructors) with the bundled Undici
* implementation.
*
* Bun keeps its native fetch: the distributed CLI inlines npm undici, and its
* fetch running on Bun 1.3.x answers with the response headers but never
* delivers a streamed body, so every SSE model response stalls after the
* headers (#1890). Bun's own fetch honors HTTP_PROXY / HTTPS_PROXY / NO_PROXY,
* which `applyHttpProxySettings` sets, and stream stalls stay bounded by the
* agent-level idle and stream-start guards derived from the same
* `httpIdleTimeoutMs` setting.
*
* Node installs the globals so fetch and the dispatcher share one undici
* implementation (see the call site); a caller that deliberately replaced
* `fetch` after module load keeps its override.
*/
export declare function shouldInstallUndiciGlobals(input: UndiciGlobalsInstallInput): boolean;
export declare function parseHttpIdleTimeoutMs(value: unknown): number | undefined;
export declare function formatHttpIdleTimeoutMs(timeoutMs: number): string;
export declare function applyHttpProxySettings(httpProxy: string | undefined): void;
export declare function configureHttpDispatcher(timeoutMs?: number): void;
//# sourceMappingURL=http-dispatcher.d.ts.map