Merge remote-tracking branch 'origin/master' into fix/2784-temporal-pac
This commit is contained in:
@@ -49,14 +49,19 @@ browserOutputPolicy:
|
||||
browserPerformance:
|
||||
animationsEnabled: true
|
||||
defaultBackgroundMode: receive-only
|
||||
defaultMobileTerminalPercent: 40
|
||||
backgroundModes:
|
||||
disconnect:
|
||||
label: 断开后台连接
|
||||
receive-only:
|
||||
label: 只接收数据
|
||||
low-frequency:
|
||||
label: 低频绘制
|
||||
live:
|
||||
label: 实时渲染
|
||||
deferredOutputMaxBytes: 524288
|
||||
lowFrequencyRenderIntervalMs: 10000
|
||||
lowFrequencyRenderJitterMs: 2000
|
||||
dashboardSampleWindowSeconds: 60
|
||||
dashboardRefreshIntervalMs: 1000
|
||||
|
||||
|
||||
@@ -66,9 +66,12 @@ 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";
|
||||
defaultMobileTerminalPercent: number;
|
||||
backgroundModes: Array<{ id: "disconnect" | "receive-only" | "low-frequency" | "live"; label: string }>;
|
||||
deferredOutputMaxBytes: number;
|
||||
lowFrequencyRenderIntervalMs: number;
|
||||
lowFrequencyRenderJitterMs: number;
|
||||
dashboardSampleWindowSeconds: number;
|
||||
dashboardRefreshIntervalMs: number;
|
||||
}
|
||||
@@ -477,6 +480,7 @@ function renderCompose(target: WebtermTarget): string {
|
||||
...target.runtime.environment,
|
||||
WEBTERM_DATA_DOMAIN: target.runtime.runtimeDataDomain,
|
||||
WEBTERM_DATABASE_URL: "${WEBTERM_DATABASE_URL}",
|
||||
AUTO_RESUME_CLI_PROMPT: target.runtime.autoResumePrompt.prompt,
|
||||
AUTO_START_SESSIONS_JSON: JSON.stringify(target.runtime.autoStartSessions.map((session) => ({
|
||||
...session,
|
||||
command: resumeCommandWithPrompt(session, target.runtime.autoResumePrompt),
|
||||
@@ -881,10 +885,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) => ({
|
||||
@@ -896,8 +900,11 @@ function parseBrowserPerformance(record: Record<string, unknown>, path: string):
|
||||
return {
|
||||
animationsEnabled: booleanField(record, "animationsEnabled", path),
|
||||
defaultBackgroundMode: defaultBackgroundMode as BrowserPerformance["defaultBackgroundMode"],
|
||||
defaultMobileTerminalPercent: integerInRangeField(record, "defaultMobileTerminalPercent", path, 20, 70),
|
||||
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),
|
||||
};
|
||||
@@ -909,6 +916,12 @@ function positiveIntegerField(record: Record<string, unknown>, key: string, path
|
||||
return value;
|
||||
}
|
||||
|
||||
function integerInRangeField(record: Record<string, unknown>, key: string, path: string, min: number, max: number): number {
|
||||
const value = integerField(record, key, path);
|
||||
if (value < min || value > max) throw new Error(`${path}.${key} must be from ${min} to ${max}`);
|
||||
return value;
|
||||
}
|
||||
|
||||
function parseLiteral<T extends string>(value: string, expected: T, path: string): T {
|
||||
if (value !== expected) throw new Error(`${path} must be ${expected}`);
|
||||
return expected;
|
||||
|
||||
Reference in New Issue
Block a user