diff --git a/src/browser/server-context.types.ts b/src/browser/server-context.types.ts index d9360b84916..b9dc634fe93 100644 --- a/src/browser/server-context.types.ts +++ b/src/browser/server-context.types.ts @@ -22,30 +22,7 @@ export type BrowserServerState = { profiles: Map; }; -export type BrowserRouteContext = { - state: () => BrowserServerState; - forProfile: (profileName?: string) => ProfileContext; - listProfiles: () => Promise; - // Legacy methods delegate to default profile for backward compatibility - ensureBrowserAvailable: () => Promise; - ensureTabAvailable: (targetId?: string) => Promise; - isHttpReachable: (timeoutMs?: number) => Promise; - isReachable: (timeoutMs?: number) => Promise; - listTabs: () => Promise; - openTab: (url: string) => Promise; - focusTab: (targetId: string) => Promise; - closeTab: (targetId: string) => Promise; - stopRunningBrowser: () => Promise<{ stopped: boolean }>; - resetProfile: () => Promise<{ - moved: boolean; - from: string; - to?: string; - }>; - mapTabError: (err: unknown) => { status: number; message: string } | null; -}; - -export type ProfileContext = { - profile: ResolvedBrowserProfile; +type BrowserProfileActions = { ensureBrowserAvailable: () => Promise; ensureTabAvailable: (targetId?: string) => Promise; isHttpReachable: (timeoutMs?: number) => Promise; @@ -58,6 +35,18 @@ export type ProfileContext = { resetProfile: () => Promise<{ moved: boolean; from: string; to?: string }>; }; +export type BrowserRouteContext = { + state: () => BrowserServerState; + forProfile: (profileName?: string) => ProfileContext; + listProfiles: () => Promise; + // Legacy methods delegate to default profile for backward compatibility + mapTabError: (err: unknown) => { status: number; message: string } | null; +} & BrowserProfileActions; + +export type ProfileContext = { + profile: ResolvedBrowserProfile; +} & BrowserProfileActions; + export type ProfileStatus = { name: string; cdpPort: number; diff --git a/src/config/zod-schema.core.ts b/src/config/zod-schema.core.ts index dbcbf80652f..4431a51c790 100644 --- a/src/config/zod-schema.core.ts +++ b/src/config/zod-schema.core.ts @@ -248,6 +248,16 @@ export const HumanDelaySchema = z }) .strict(); +const CliBackendWatchdogModeSchema = z + .object({ + noOutputTimeoutMs: z.number().int().min(1000).optional(), + noOutputTimeoutRatio: z.number().min(0.05).max(0.95).optional(), + minMs: z.number().int().min(1000).optional(), + maxMs: z.number().int().min(1000).optional(), + }) + .strict() + .optional(); + export const CliBackendSchema = z .object({ command: z.string(), @@ -279,24 +289,8 @@ export const CliBackendSchema = z .object({ watchdog: z .object({ - fresh: z - .object({ - noOutputTimeoutMs: z.number().int().min(1000).optional(), - noOutputTimeoutRatio: z.number().min(0.05).max(0.95).optional(), - minMs: z.number().int().min(1000).optional(), - maxMs: z.number().int().min(1000).optional(), - }) - .strict() - .optional(), - resume: z - .object({ - noOutputTimeoutMs: z.number().int().min(1000).optional(), - noOutputTimeoutRatio: z.number().min(0.05).max(0.95).optional(), - minMs: z.number().int().min(1000).optional(), - maxMs: z.number().int().min(1000).optional(), - }) - .strict() - .optional(), + fresh: CliBackendWatchdogModeSchema, + resume: CliBackendWatchdogModeSchema, }) .strict() .optional(),