blob: 3316633263cd15986af26325fbf25ba8e2b50b28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import type { BrowserClient } from "../client";
import type { CdpMethod, ParamsOf, ResultOf } from "../cdp/commands";
import { type Result, err } from "../util/result";
import type { ToolErr } from "../util/tool";
export const cdpCall = async <M extends CdpMethod>(
client: BrowserClient,
method: M,
params: ParamsOf<M>,
): Promise<Result<ResultOf<M>, ToolErr>> => {
const r = await client.session().call(method, params);
if (!r.success) return err({ kind: "cdp_error", message: r.error.message, details: { method } });
return r;
};
|