refactor(core): dedupe browser route signatures and cli watchdog schema

This commit is contained in:
Peter Steinberger
2026-02-18 14:15:20 +00:00
parent 1934eebbf0
commit 6a19654c4a
2 changed files with 25 additions and 42 deletions

View File

@@ -22,30 +22,7 @@ export type BrowserServerState = {
profiles: Map<string, ProfileRuntimeState>;
};
export type BrowserRouteContext = {
state: () => BrowserServerState;
forProfile: (profileName?: string) => ProfileContext;
listProfiles: () => Promise<ProfileStatus[]>;
// Legacy methods delegate to default profile for backward compatibility
ensureBrowserAvailable: () => Promise<void>;
ensureTabAvailable: (targetId?: string) => Promise<BrowserTab>;
isHttpReachable: (timeoutMs?: number) => Promise<boolean>;
isReachable: (timeoutMs?: number) => Promise<boolean>;
listTabs: () => Promise<BrowserTab[]>;
openTab: (url: string) => Promise<BrowserTab>;
focusTab: (targetId: string) => Promise<void>;
closeTab: (targetId: string) => Promise<void>;
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<void>;
ensureTabAvailable: (targetId?: string) => Promise<BrowserTab>;
isHttpReachable: (timeoutMs?: number) => Promise<boolean>;
@@ -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<ProfileStatus[]>;
// 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;