merge: 对齐 Webterm 后台模式配置

This commit is contained in:
pikastech
2026-07-21 15:14:49 +02:00
2 changed files with 12 additions and 4 deletions
+4
View File
@@ -54,9 +54,13 @@ browserPerformance:
label: 断开后台连接
receive-only:
label: 只接收数据
low-frequency:
label: 低频绘制
live:
label: 实时渲染
deferredOutputMaxBytes: 524288
lowFrequencyRenderIntervalMs: 10000
lowFrequencyRenderJitterMs: 2000
dashboardSampleWindowSeconds: 60
dashboardRefreshIntervalMs: 1000
+8 -4
View File
@@ -66,9 +66,11 @@ interface BrowserOutputPolicy {
interface BrowserPerformance {
animationsEnabled: boolean;
defaultBackgroundMode: "disconnect" | "receive-only" | "live";
backgroundModes: Array<{ id: "disconnect" | "receive-only" | "live"; label: string }>;
defaultBackgroundMode: "disconnect" | "receive-only" | "low-frequency" | "live";
backgroundModes: Array<{ id: "disconnect" | "receive-only" | "low-frequency" | "live"; label: string }>;
deferredOutputMaxBytes: number;
lowFrequencyRenderIntervalMs: number;
lowFrequencyRenderJitterMs: number;
dashboardSampleWindowSeconds: number;
dashboardRefreshIntervalMs: number;
}
@@ -881,10 +883,10 @@ function parseBrowserOutputPolicy(record: Record<string, unknown>, path: string)
}
function parseBrowserPerformance(record: Record<string, unknown>, path: string): BrowserPerformance {
const allowedModes = ["disconnect", "receive-only", "live"] as const;
const allowedModes = ["disconnect", "receive-only", "low-frequency", "live"] as const;
const defaultBackgroundMode = stringField(record, "defaultBackgroundMode", path);
if (!allowedModes.includes(defaultBackgroundMode as typeof allowedModes[number])) {
throw new Error(`${path}.defaultBackgroundMode must be disconnect, receive-only or live`);
throw new Error(`${path}.defaultBackgroundMode must reference a supported mode`);
}
const modesRecord = recordField(record, "backgroundModes", path);
const backgroundModes = allowedModes.map((id) => ({
@@ -898,6 +900,8 @@ function parseBrowserPerformance(record: Record<string, unknown>, path: string):
defaultBackgroundMode: defaultBackgroundMode as BrowserPerformance["defaultBackgroundMode"],
backgroundModes,
deferredOutputMaxBytes: positiveIntegerField(record, "deferredOutputMaxBytes", path),
lowFrequencyRenderIntervalMs: positiveIntegerField(record, "lowFrequencyRenderIntervalMs", path),
lowFrequencyRenderJitterMs: integerField(record, "lowFrequencyRenderJitterMs", path),
dashboardSampleWindowSeconds: positiveIntegerField(record, "dashboardSampleWindowSeconds", path),
dashboardRefreshIntervalMs: positiveIntegerField(record, "dashboardRefreshIntervalMs", path),
};