export type DevModeConfig = boolean; export type PolicyMode = "allow" | "deny" | "audit-only" | "read-only"; export type Role = "admin" | "operator" | "viewer" | "automation" | "system"; export type BrowserEngine = "chromium" | "firefox" | "webkit"; export interface PolicyEntry { pattern: string; mode: PolicyMode; } export interface ElectronAppConfig { path?: string; port?: number; url?: string; args?: string[]; profileDir?: string; } export interface Config { mode: "session" | "attach"; session: string; attachPort: number; agentId: string; telemetry: boolean; browserPath: string; browserType: BrowserEngine; headless: boolean; extension: boolean; browserFlags: string[]; profileDir: string; cookies: boolean; syncDataAcrossBrowsers: boolean; apps?: Record; electron?: Record; role: Role; block: string[]; allow: string[]; policies: PolicyEntry[]; sessionTimeout: number; navigationTimeout: number; idleTimeout: number; actionabilityTimeoutMs: number; maxTabs: number; maxActionsPerMinute: number; refCacheTtlMs: number; downloadDir: string; pdfDir: string; snapshotDir: string; recordingDir: string; designDir: string; devMode: DevModeConfig; proxy?: string; } export declare const PLATFORM: NodeJS.Platform; export declare const GLOBAL_CONFIG_DIR: string; export declare const GLOBAL_CONFIG_PATH: string; export declare const DEFAULT_CONFIG: Config; export type OnConfigChange = (newConfig: Config) => void; export declare function onConfigChange(cb: OnConfigChange): void; /** * Migrates old sectioned config to new simplified flat format. */ export declare function migrateToSimple(sectioned: any): Config; export declare function validateConfigInternal(raw: Record): Config; /** * Priority: Global (user) → Built-in defaults * * Each field is individually merged from global config. * If a config file is broken JSON it is quarantined and defaults are used. */ export declare function findProjectDir(startDir?: string): string | undefined; /** * Returns the "write target" directory for configs. * Priority: Project config if it exists, otherwise global. */ export declare function getActiveConfigPath(): { dir: string; file: string; }; export declare function loadConfigSync(): Config; export declare function loadConfig(): Promise; /** Zero disk I/O after first load. Refreshed by fs.watch. */ export declare function getCachedConfig(): Config; /** Force re-read from disk on next getCachedConfig/loadConfig call. */ export declare function invalidateConfigCache(): void; /** Returns the resolved active directory (global). */ export declare function getActiveDirCached(): string; export declare function getOutputDir(subdir: "downloads" | "pdfs" | "snapshots" | "recordings" | "designs", config?: Config): string; /** * Helper to get download directory from config. */ export declare function getDownloadDir(config: Config): string; /** * Helper to get design output directory from config. */ export declare function getDesignDir(config: Config): string; export declare function getConfigMode(config: Config): "session" | "attach"; export declare function getConfigAttachPort(config: Config): number; export declare function getConfigAgentId(config: Config): string; export declare function getConfigTelemetry(config: Config): boolean; export declare function getConfigBrowserPath(config: Config): string; export declare function getConfigBrowserType(config: Config): BrowserEngine; export declare function getConfigHeadless(config: Config): boolean; export declare function getConfigExtension(config: Config): boolean; export declare function getConfigBrowserFlags(config: Config): string[]; export declare function getConfigProfileDir(config: Config): string; export declare function getConfigCookies(config: Config): boolean; export declare function getConfigSyncDataAcrossBrowsers(config: Config): boolean; export declare function getConfigRole(config: Config): Role; export declare function getConfigBlock(config: Config): string[]; export declare function getConfigAllow(config: Config): string[]; export declare function getConfigPolicies(config: Config): PolicyEntry[]; export declare function getConfigProxy(config: Config): string | undefined; export declare function getConfigMaxTabs(config: Config): number; export declare function getConfigMaxActionsPerMinute(config: Config): number; export declare function getConfigSessionTimeout(config: Config): number; export declare function getConfigNavigationTimeout(config: Config): number; export declare function getConfigIdleTimeout(config: Config): number; export declare function getConfigActionabilityTimeoutMs(config: Config): number; export declare function getConfigRefCacheTtl(config: Config): number; export declare function getConfigDevMode(config: Config): boolean; export declare function getConfigApps(config: Config): Record | undefined; export declare function getConfigElectron(config: Config): Record | undefined; export declare function getAppConfig(appName: string, config?: Config): ElectronAppConfig | null; export declare function getElectronAppConfig(appName: string, config?: Config): ElectronAppConfig | null; export declare function getAppNames(config?: Config): string[]; export declare function getElectronAppNames(config?: Config): string[]; export declare function getApps(config?: Config): Record; export declare function getElectronApps(config?: Config): Record; export declare function getConfigNavigationTimeoutMs(config: Config): number; export declare function getConfigRefCacheTtlMs(config: Config): number; export declare function getSystemDir(subdir: string): string; export declare function getSystemAppDir(appName: string): string; /** * Returns a directory inside the global ~/.weavetab-system/ folder. * Alias for consistency — identical to getSystemDir. */ export declare function getGlobalSystemDir(subdir: string): string; /** * Returns the canonical directory for persistent site profiles and learned workflow patterns. * Lives in ~/.weavetab-system/memory/sites/ — strictly machine-managed, never user-authored. * Separated from the legacy selector-memory dir (~/.weavetab-system/memory/) so existing * per-domain selector caches are not disrupted. */ export declare function getSystemMemorySitesDir(): string; export declare function saveConfig(config: Config): void; export declare function stopConfigWatcher(): void;