mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 22:40:58 +00:00
* fix(canvas): prevent snapshot disconnects on proxied gateways (cherry picked from commit 2a3c9f746a65f3301c0cfe58ebe6596fed06230f) * fix(canvas): accept url alias for present and navigate (cherry picked from commit 674ee86a0b776cbb738add1920a4031246125312) --------- Co-authored-by: Nimrod Gutman <nimrod.g@singular.net>
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
// Keep server maxPayload aligned with gateway client maxPayload so high-res canvas snapshots
|
|
// don't get disconnected mid-invoke with "Max payload size exceeded".
|
|
export const MAX_PAYLOAD_BYTES = 25 * 1024 * 1024;
|
|
export const MAX_BUFFERED_BYTES = 50 * 1024 * 1024; // per-connection send buffer limit (2x max payload)
|
|
|
|
const DEFAULT_MAX_CHAT_HISTORY_MESSAGES_BYTES = 6 * 1024 * 1024; // keep history responses comfortably under client WS limits
|
|
let maxChatHistoryMessagesBytes = DEFAULT_MAX_CHAT_HISTORY_MESSAGES_BYTES;
|
|
|
|
export const getMaxChatHistoryMessagesBytes = () => maxChatHistoryMessagesBytes;
|
|
|
|
export const __setMaxChatHistoryMessagesBytesForTest = (value?: number) => {
|
|
if (!process.env.VITEST && process.env.NODE_ENV !== "test") {
|
|
return;
|
|
}
|
|
if (value === undefined) {
|
|
maxChatHistoryMessagesBytes = DEFAULT_MAX_CHAT_HISTORY_MESSAGES_BYTES;
|
|
return;
|
|
}
|
|
if (Number.isFinite(value) && value > 0) {
|
|
maxChatHistoryMessagesBytes = value;
|
|
}
|
|
};
|
|
export const DEFAULT_HANDSHAKE_TIMEOUT_MS = 10_000;
|
|
export const getHandshakeTimeoutMs = () => {
|
|
if (process.env.VITEST && process.env.OPENCLAW_TEST_HANDSHAKE_TIMEOUT_MS) {
|
|
const parsed = Number(process.env.OPENCLAW_TEST_HANDSHAKE_TIMEOUT_MS);
|
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
return parsed;
|
|
}
|
|
}
|
|
return DEFAULT_HANDSHAKE_TIMEOUT_MS;
|
|
};
|
|
export const TICK_INTERVAL_MS = 30_000;
|
|
export const HEALTH_REFRESH_INTERVAL_MS = 60_000;
|
|
export const DEDUPE_TTL_MS = 5 * 60_000;
|
|
export const DEDUPE_MAX = 1000;
|