mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:10:51 +00:00
refactor: hide gateway helper internals
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export const GATEWAY_STARTUP_UNAVAILABLE_REASON = "startup-sidecars";
|
||||
export const GATEWAY_STARTUP_RETRY_AFTER_MS = 500;
|
||||
export const GATEWAY_STARTUP_RETRY_MIN_MS = 100;
|
||||
export const GATEWAY_STARTUP_RETRY_MAX_MS = 2_000;
|
||||
const GATEWAY_STARTUP_RETRY_MIN_MS = 100;
|
||||
const GATEWAY_STARTUP_RETRY_MAX_MS = 2_000;
|
||||
|
||||
export type GatewayStartupUnavailableDetails = {
|
||||
reason: typeof GATEWAY_STARTUP_UNAVAILABLE_REASON;
|
||||
@@ -11,7 +11,7 @@ export function gatewayStartupUnavailableDetails(): GatewayStartupUnavailableDet
|
||||
return { reason: GATEWAY_STARTUP_UNAVAILABLE_REASON };
|
||||
}
|
||||
|
||||
export function isGatewayStartupUnavailableDetails(
|
||||
function isGatewayStartupUnavailableDetails(
|
||||
details: unknown,
|
||||
): details is GatewayStartupUnavailableDetails {
|
||||
return (
|
||||
|
||||
@@ -76,9 +76,7 @@ function notifyWaiters(runId: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function readTerminalSnapshotFromDedupeEntry(
|
||||
entry: DedupeEntry,
|
||||
): AgentWaitTerminalSnapshot | null {
|
||||
function readTerminalSnapshotFromDedupeEntry(entry: DedupeEntry): AgentWaitTerminalSnapshot | null {
|
||||
const payload = entry.payload as
|
||||
| {
|
||||
status?: unknown;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const DEFAULT_MAX_PREAUTH_CONNECTIONS_PER_IP = 32;
|
||||
const UNKNOWN_CLIENT_IP_BUDGET_KEY = "__openclaw_unknown_client_ip__";
|
||||
|
||||
export function getMaxPreauthConnectionsPerIpFromEnv(env: NodeJS.ProcessEnv = process.env): number {
|
||||
function getMaxPreauthConnectionsPerIpFromEnv(env: NodeJS.ProcessEnv = process.env): number {
|
||||
const configured =
|
||||
env.OPENCLAW_MAX_PREAUTH_CONNECTIONS_PER_IP ||
|
||||
(env.VITEST && env.OPENCLAW_TEST_MAX_PREAUTH_CONNECTIONS_PER_IP);
|
||||
|
||||
@@ -336,7 +336,7 @@ export function resolveDeviceSignaturePayloadVersion(params: {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function resolveAuthProvidedKind(
|
||||
function resolveAuthProvidedKind(
|
||||
connectAuth: HandshakeConnectAuth | null | undefined,
|
||||
): AuthProvidedKind {
|
||||
return connectAuth?.password
|
||||
|
||||
@@ -81,12 +81,12 @@ function buildPaginatedSessionHistory(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveMessageSeq(message: SessionHistoryMessage | undefined): number | undefined {
|
||||
function resolveMessageSeq(message: SessionHistoryMessage | undefined): number | undefined {
|
||||
const seq = message?.__openclaw?.seq;
|
||||
return typeof seq === "number" && Number.isFinite(seq) && seq > 0 ? seq : undefined;
|
||||
}
|
||||
|
||||
export function paginateSessionMessages(
|
||||
function paginateSessionMessages(
|
||||
messages: SessionHistoryMessage[],
|
||||
limit: number | undefined,
|
||||
cursor: string | undefined,
|
||||
|
||||
Reference in New Issue
Block a user