import { type ComputerAction, type ComputerCommand, type ComputerModelBinding, type ComputerObservation, type ComputerReceipt, type ComputerTarget, type ComputerApp, type ComputerWindow } from '@xopcai/computer-control-contract'; import { type ComputerConfig } from './config.js'; export interface DriverObservation { target: ComputerTarget; summary: string; focusedEditableRef?: string; stateDigest: string; image: Uint8Array; mimeType: 'image/png' | 'image/jpeg'; imageWidth: number; imageHeight: number; } export interface ComputerDriver { discover(query: string, signal: AbortSignal): Promise>; validateAction?(action: ComputerAction): void; resolveTarget(appId: string, signal: AbortSignal, options: { prepare: boolean; windowRef?: string; }): Promise; observe(target: ComputerTarget, signal: AbortSignal): Promise; perform(target: ComputerTarget, action: ComputerAction, signal: AbortSignal): Promise; /** Must finish only after no further input can be dispatched. */ stop(): Promise; } export type ComputerApproval = { kind: 'session'; id: string; appId: string; appName: string; mode: 'observe' | 'control'; prepare: boolean; model: ComputerModelBinding; } | { kind: 'action'; id: string; target: ComputerTarget; action: ComputerAction; }; export interface ComputerBrokerHost { requestApproval(request: ComputerApproval, signal: AbortSignal): Promise; isVisible(): boolean; onStateChange?(): void; } type Status = 'pending_authorization' | 'ready' | 'running' | 'pending_action' | 'paused' | 'stopped'; export interface BrokerResult { status: Status; sessionId: string; brokerEpoch: string; generation: number; grantId?: string; observation?: ComputerObservation; receipt?: ComputerReceipt; errorCode?: string; apps?: ComputerApp[]; windows?: ComputerWindow[]; frame?: { bytes: Uint8Array; mimeType: 'image/png' | 'image/jpeg'; }; } /** Main-process-only authority. Never expose this object or its approval hook to a renderer. */ export declare class ComputerBroker { private readonly driver; private readonly host; private readonly now; readonly epoch: `${string}-${string}-${string}-${string}-${string}`; private session?; private busy; private stopping?; private discovery?; private readonly apps; private readonly config; private readonly timer; constructor(driver: ComputerDriver, host: ComputerBrokerHost, config?: Partial, now?: () => number); private expired; private result; private active; /** Settings-only app catalog. It never returns window contents or task-bound refs. */ listAppsForSettings(): Promise>; command(raw: ComputerCommand): Promise; private discover; private open; private observe; private act; stop(): Promise; cancel(command: ComputerCommand): Promise; snapshot(): { status: Status | 'idle'; errorCode?: string; appId?: string; }; dispose(): Promise; } export {};