From 931576443dcb990761cb7e68e354465145f9292d Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Mon, 27 Jul 2026 23:10:18 +0530 Subject: refactor(profile): drop CDP casts in favour of the typed boundary Co-Authored-By: Claude Opus 5 (1M context) --- src/profile/bind.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/profile/bind.ts') diff --git a/src/profile/bind.ts b/src/profile/bind.ts index 5fbac6f..abdc5cc 100644 --- a/src/profile/bind.ts +++ b/src/profile/bind.ts @@ -20,6 +20,7 @@ import type { BrowserClient } from "../client"; import { attachTo } from "../cdp/attach"; +import type { ResultOf } from "../cdp/commands"; import { type CdpError, cdpError } from "../cdp/errors"; import { getWindowId } from "../cdp/window"; import { type Result, err, ok } from "../util/result"; @@ -31,18 +32,12 @@ import type { ProfilePin } from "./store"; const SEED_DEADLINE_MS = 15_000; const SEED_POLL_MS = 500; -type PageTarget = { - readonly targetId: string; - readonly type: string; - readonly url: string; - readonly browserContextId?: string; -}; +type PageTarget = ResultOf<"Target.getTargets">["targetInfos"][number]; const pageTargets = async (client: BrowserClient): Promise> => { const r = await client.session().callBrowser("Target.getTargets"); if (!r.success) return []; - const data = r.data as { targetInfos: ReadonlyArray }; - return data.targetInfos.filter((t) => t.type === "page"); + return r.data.targetInfos.filter((t) => t.type === "page"); }; const manualFallbackHint = (pin: ProfilePin): string => -- cgit v1.2.3