openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
58 lines • 3.08 kB
TypeScript
import http from "node:http";
import https from "node:https";
import { type ProxyEnvSnapshot } from "./env.js";
import { type ProxyConnectOptions } from "./proxy-socket.js";
import { type ProxylineTlsOptions } from "./shared.js";
import type { ProxylineSurface, ProxyResolver } from "./types.js";
export type NodeHttpRequestOptions = http.RequestOptions & https.RequestOptions & {
agent?: http.Agent | false;
};
type NodeHttpMethod = typeof http.request;
type NodeAgentFactory = (options: NodeHttpRequestOptions) => http.Agent;
type NodeAgentOptions = http.AgentOptions & https.AgentOptions;
type ResolveProxyConnectOptions = (proxyUrl: string) => ProxyConnectOptions;
declare const pendingRequestSymbol: unique symbol;
type NodeAgentRequestOptions = http.RequestOptions & https.RequestOptions & {
secureEndpoint?: boolean;
[pendingRequestSymbol]?: http.ClientRequest;
};
type NodeProxyAgentOptions = NodeAgentOptions & {
defaultProtocol?: "http" | "https";
getProxyForUrl: (url: string, surface?: ProxylineSurface, request?: http.ClientRequest) => string;
proxyTls?: ProxylineTlsOptions;
resolveProxyConnectOptions?: ResolveProxyConnectOptions;
};
export declare const CALLER_AGENT_TLS_OPTION_KEYS: readonly ["ca", "cert", "ciphers", "clientCertEngine", "crl", "dhparam", "ecdhCurve", "honorCipherOrder", "key", "maxVersion", "minVersion", "passphrase", "pfx", "rejectUnauthorized", "secureOptions", "secureProtocol", "sessionIdContext"];
export type NodeHttpStackSnapshot = {
httpRequest: typeof http.request;
httpGet: typeof http.get;
httpGlobalAgent: typeof http.globalAgent;
httpsRequest: typeof https.request;
httpsGet: typeof https.get;
httpsGlobalAgent: typeof https.globalAgent;
};
export declare function bindNodeHttpMethod<TMethod extends NodeHttpMethod>(originalMethod: TMethod, createAgent: NodeAgentFactory): TMethod;
export declare class ProxylineNodeProxyAgent extends http.Agent {
#private;
readonly options: NodeAgentOptions;
constructor(options: NodeProxyAgentOptions);
get defaultPort(): number;
set defaultPort(value: number);
get protocol(): string;
set protocol(_value: string);
getProxyForUrl(url: string, request?: http.ClientRequest): string;
addRequest(req: http.ClientRequest, options: NodeAgentRequestOptions): void;
destroy(): void;
}
export declare function createNodeProxyAgent(resolver: ProxyResolver, proxyCa: string | undefined, defaultProtocol?: "http" | "https"): ProxylineNodeProxyAgent;
export declare function createDirectNodeAgent(): ProxylineNodeProxyAgent;
export type AmbientNodeProxyAgentOptions = {
env?: ProxyEnvSnapshot;
protocol?: "http" | "https";
proxyTls?: ProxylineTlsOptions;
resolveProxyConnectOptions?: ResolveProxyConnectOptions;
};
export declare function hasAmbientNodeProxyConfigured(options?: AmbientNodeProxyAgentOptions): boolean;
export declare function createAmbientNodeProxyAgent(options?: AmbientNodeProxyAgentOptions): ProxylineNodeProxyAgent | undefined;
export {};
//# sourceMappingURL=node-http.d.ts.map