feat: add console observation command

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BB-fat
2026-07-07 11:08:12 +08:00
co-authored by Cursor
parent ce29ddaa53
commit 7f5093d97a
23 changed files with 1538 additions and 44 deletions
+13 -5
View File
@@ -1,7 +1,9 @@
import { OVERLAY_AUTOMATION_BYPASS } from "@/lib/overlay-bridge";
import type { SessionManager } from "@/session-manager/manager";
import type { Transport } from "@/transport/transport";
import type {
ClickParams,
ConsoleParams,
EvaluateParams,
FillParams,
GetHtmlParams,
@@ -11,17 +13,19 @@ import type {
PressParams,
ProtocolFrame,
ReloadParams,
RequestHelpParams,
RequestFrame,
RequestHelpParams,
ResponseFrame,
RpcError,
SelectParams,
ScreenshotParams,
SelectParams,
SnapshotParams,
WaitForNavigationParams,
} from "@/transport/types";
import { isRequestFrame } from "@/transport/types";
import { handleConsole } from "./console";
import { handleEvaluate } from "./evaluate";
import { defaultWatchTabNavigation, handleRequestHelp } from "./human-loop";
import { handleClick, handleFill, handlePress, handleSelect } from "./interaction";
import {
handleNavigate,
@@ -42,16 +46,15 @@ import {
type SessionStartParams,
type SessionStopParams,
} from "./session";
import { OVERLAY_AUTOMATION_BYPASS } from "@/lib/overlay-bridge";
import { chromeTabsApi } from "./shared";
import {
type BorrowConfirmationApprover,
handleTabBorrow,
handleTabClose,
handleTabCreate,
handleTabList,
handleTabReturn,
handleTabSelect,
type BorrowConfirmationApprover,
type TabBorrowParams,
type TabCloseParams,
type TabCreateParams,
@@ -59,7 +62,6 @@ import {
type TabReturnParams,
type TabSelectParams,
} from "./tabs";
import { defaultWatchTabNavigation, handleRequestHelp } from "./human-loop";
import { handleWaitForNavigation } from "./waits";
export interface DispatcherDeps {
@@ -277,6 +279,12 @@ export class ToolDispatcher {
? { cdp: this.cdp, tabsApi: chromeTabsCaptureApi, captureApi: chromeTabsCaptureApi }
: undefined,
);
case "tool.console":
return handleConsole(
this.sessions,
req.params as ConsoleParams,
this.cdp ? { cdp: this.cdp, tabsApi: chromeTabsApi } : undefined,
);
case "tool.snapshot":
return handleSnapshot(
this.sessions,