diff --git a/config/platform-infra/webterm.yaml b/config/platform-infra/webterm.yaml index 695bd1ad..db632607 100644 --- a/config/platform-infra/webterm.yaml +++ b/config/platform-infra/webterm.yaml @@ -54,9 +54,13 @@ browserPerformance: label: 断开后台连接 receive-only: label: 只接收数据 + low-frequency: + label: 低频绘制 live: label: 实时渲染 deferredOutputMaxBytes: 524288 + lowFrequencyRenderIntervalMs: 10000 + lowFrequencyRenderJitterMs: 2000 dashboardSampleWindowSeconds: 60 dashboardRefreshIntervalMs: 1000 diff --git a/scripts/src/platform-infra-webterm.ts b/scripts/src/platform-infra-webterm.ts index 99dd54db..d49a14a8 100644 --- a/scripts/src/platform-infra-webterm.ts +++ b/scripts/src/platform-infra-webterm.ts @@ -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, path: string) } function parseBrowserPerformance(record: Record, 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, 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), };