/** * Weavetab — tools/automation.ts * browser_automation: Persistent injected scripts that run independently inside the browser. * The agent does NOT wait for results in a loop — scripts run at browser speed. * Weavetab by fy2ne * * Design (anti-pattern #5 safe): * - automationRegistry (server-side Map) is the SINGLE source of truth for script metadata. * - Page-side uses closure state for loop lifecycle — no window.__wt_automations registry. * - Stop signal uses a minimal window boolean per automation (same pattern as __wt_stop_requested in server.ts). * - Result mailbox uses a window array per automation (single-purpose, not a registry map). */ import CDP from "chrome-remote-interface"; import type { Config } from "../config/loader.js"; export interface AutomationOptions { action: "start" | "stop" | "list" | "poll"; id?: string; script?: string; persistent?: boolean; onResult?: "notify_agent" | "store" | "ignore"; } interface AutomationScript { id: string; script: string; persistent: boolean; onResult: "notify_agent" | "store" | "ignore"; startedAt: string; active: boolean; } export declare function browserAutomation(session: CDP.Client, options: AutomationOptions, _config: Config): Promise<{ success: boolean; automations?: AutomationScript[]; results?: any[]; error?: string; }>; export {};