From 9f2ef1cf87251ce12f6b6432c48c6e7d2017b6b5 Mon Sep 17 00:00:00 2001 From: amankumarsingh77 Date: Mon, 27 Jul 2026 00:48:45 +0530 Subject: refactor(cdp): make session.call generic over the command table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit call/callOnTarget/callBrowser now take a known method and return its decoded result type. The session is where unknown ends; transport keeps returning unknown. Removes the casts in session.ts and target-factory.ts, including the session's own internal Target.*/Browser.* calls, which now decode through the same path as the public call methods. Also completes two params-schema gaps in commands.ts surfaced by this migration: Target.createTarget was missing openerId and Runtime.evaluate was missing userGesture, both real CDP fields src/cdp/ already sends. tsc is red project-wide (6 errors, all in src/domains/) — the sanctioned state between Tasks 4 and 7. Co-Authored-By: Claude Opus 5 (1M context) --- src/cdp/commands.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/cdp/commands.ts') diff --git a/src/cdp/commands.ts b/src/cdp/commands.ts index 123b9f6..d7faa34 100644 --- a/src/cdp/commands.ts +++ b/src/cdp/commands.ts @@ -57,6 +57,7 @@ export const COMMANDS = { newWindow: Type.Optional(Type.Boolean()), background: Type.Optional(Type.Boolean()), windowId: Type.Optional(Type.Number()), + openerId: Type.Optional(Type.String()), }), Type.Object({ targetId: Type.String() }), ), @@ -129,7 +130,12 @@ export const COMMANDS = { // --- Runtime --- "Runtime.evaluate": cmd( Type.Object( - { expression: Type.String(), returnByValue: Type.Optional(Type.Boolean()), awaitPromise: Type.Optional(Type.Boolean()) }, + { + expression: Type.String(), + returnByValue: Type.Optional(Type.Boolean()), + awaitPromise: Type.Optional(Type.Boolean()), + userGesture: Type.Optional(Type.Boolean()), + }, { additionalProperties: true }, ), Type.Object({ result: RemoteObject, exceptionDetails: Type.Optional(ExceptionDetails) }), -- cgit v1.2.3