import { type BrowserActionInput, type BrowserControlResult } from '@xopcai/browser-control-contract'; import type { BrowserSetupView } from '@xopcai/gateway-contract'; import type { Config } from '../../config/schema.js'; import type { EndpointToolRuntime } from '../../endpoint-tools/index.js'; import type { BrowserSetup } from './types.js'; export declare const browserConfigRevision: (config: Config) => string; export interface BrowserSetupDeps { getConfig: () => Config; verificationOrigin?: () => string; saveConfig: (next: Config, expected: Config) => Promise<{ saved: boolean; error?: string; }>; endpoints: EndpointToolRuntime; canUseBrowser: (agentId: string) => boolean; canSwitchDriver?: (conversationId: string) => boolean; policyRevision?: (agentId: string) => string; prepare: () => Promise; release: (endpointId: string, sessionId: string) => Promise; open: (action: 'chrome' | 'folder' | 'both') => Promise; doctor: () => Promise<{ installed: boolean; needsRefresh?: boolean; extensionDir?: string; nativeHost?: { installed: boolean; }; }>; } /** Setup writes use host-authorized interactive turns or existing owner grants. */ export declare class BrowserSetupService { private readonly deps; private readonly preparing; private readonly preparationSettled; constructor(deps: BrowserSetupDeps); private scopeCurrent; cancelConversation(conversationId: string): Promise; private policyRevision; endpoints(): { endpointId: string; principalId: string; displayName: string; appVersion: string; }[]; owned(id: string, conversationId: string, agentId: string): BrowserSetup; view(setup: BrowserSetup): BrowserSetupView & Record; inspect(conversationId: string, agentId: string): Promise<{ sceneId: string; supportedConnection: string; configRevision: string; installation: { installed: boolean; needsRefresh: boolean; nativeHostInstalled: boolean; extensionDir: string | undefined; }; toolPermission: string; enabled: boolean; driverKind: "extension" | "playwright" | "cdp" | "remote"; sharedScope: string; endpoints: { endpointId: string; principalId: string; displayName: string; appVersion: string; }[]; setup: (BrowserSetupView & Record) | null; guidanceRefs: { section?: string | undefined; sceneId: string; path: string; resourceVersion: string; }[]; interaction: string; supportedActions: string[]; }>; command(command: string, args: Record, context: { conversationId: string; agentId: string; canConfigure?: boolean; }, dryRun?: boolean): Promise<(BrowserSetupView & Record) | { sceneId: string; supportedConnection: string; configRevision: string; installation: { installed: boolean; needsRefresh: boolean; nativeHostInstalled: boolean; extensionDir: string | undefined; }; toolPermission: string; enabled: boolean; driverKind: "extension" | "playwright" | "cdp" | "remote"; sharedScope: string; endpoints: { endpointId: string; principalId: string; displayName: string; appVersion: string; }[]; setup: (BrowserSetupView & Record) | null; guidanceRefs: { section?: string | undefined; sceneId: string; path: string; resourceVersion: string; }[]; interaction: string; supportedActions: string[]; } | { message: string; sceneId: string; supportedConnection: string; configRevision: string; installation: { installed: boolean; needsRefresh: boolean; nativeHostInstalled: boolean; extensionDir: string | undefined; }; toolPermission: string; enabled: boolean; driverKind: "extension" | "playwright" | "cdp" | "remote"; sharedScope: string; endpoints: { endpointId: string; principalId: string; displayName: string; appVersion: string; }[]; setup: (BrowserSetupView & Record) | null; guidanceRefs: { section?: string | undefined; sceneId: string; path: string; resourceVersion: string; }[]; interaction: string; supportedActions: string[]; dryRun: boolean; }>; approve(setup: BrowserSetup, principalId: string, revision: number): BrowserSetup; private revision; prepare(setup: BrowserSetup): Promise; recheck(setup: BrowserSetup): Promise; open(setup: BrowserSetup, action: 'chrome' | 'folder' | 'both'): Promise; begin(setup: BrowserSetup, endpointId: string, origin: string, revision: number): BrowserSetup; cancel(setup: BrowserSetup): BrowserSetup; release(setup: BrowserSetup): Promise; canRestoreSession(taskKey: string, sessionId: string): boolean; allowsVerificationUrl(taskKey: string, url: string): boolean; /** Called only by the real Agent browser tool, before its normal runtime/policy path. */ beforeAction(conversationId: string, agentId: string, input: BrowserActionInput): { setupId: string; attemptId: string; taskKey: string; input: BrowserActionInput; } | undefined; afterAction(setupId: string, attemptId: string, input: BrowserActionInput, result: BrowserControlResult): BrowserSetup | undefined; }