/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { ExtensionUpdateState } from '../ui/state/extensions.js';
import { type Extension } from '../config/extension.js';
import { type ExtensionUpdateInfo } from '../config/extensions/update.js';
import { type GeminiCLIExtension } from '@vybestack/llxprt-code-core';
export type ExtensionAutoUpdateInstallMode = 'immediate' | 'on-restart' | 'manual';
export type ExtensionAutoUpdateNotificationLevel = 'silent' | 'toast' | 'dialog';
export interface ExtensionAutoUpdateSettings {
    enabled?: boolean;
    checkIntervalHours?: number;
    installMode?: ExtensionAutoUpdateInstallMode;
    notificationLevel?: ExtensionAutoUpdateNotificationLevel;
    perExtension?: Record<string, ExtensionAutoUpdatePerExtensionSetting>;
}
export interface ExtensionAutoUpdatePerExtensionSetting {
    enabled?: boolean;
    installMode?: ExtensionAutoUpdateInstallMode;
    notificationLevel?: ExtensionAutoUpdateNotificationLevel;
    checkIntervalHours?: number;
}
export interface ExtensionUpdateHistoryEntry {
    lastCheck?: number;
    lastUpdate?: number;
    lastError?: string;
    failureCount?: number;
    pendingInstall?: boolean;
    state?: ExtensionUpdateState;
}
type ExtensionUpdateStateFile = Record<string, ExtensionUpdateHistoryEntry>;
export interface ExtensionAutoUpdateStateStore {
    read(): Promise<ExtensionUpdateStateFile>;
    write(state: ExtensionUpdateStateFile): Promise<void>;
}
interface ExtensionAutoUpdaterOptions {
    settings?: ExtensionAutoUpdateSettings;
    workspaceDir?: string;
    notify?: (message: string, level: 'info' | 'warn' | 'error') => void;
    stateStore?: ExtensionAutoUpdateStateStore;
    extensionLoader?: () => Promise<Extension[]>;
    updateExecutor?: (extension: GeminiCLIExtension, cwd: string, currentState: ExtensionUpdateState, setExtensionUpdateState: (updateState: ExtensionUpdateState) => void) => Promise<ExtensionUpdateInfo | undefined>;
    updateChecker?: (extension: GeminiCLIExtension, setExtensionUpdateState: (updateState: ExtensionUpdateState) => void) => Promise<void>;
    now?: () => number;
}
export declare class ExtensionAutoUpdater {
    private readonly settings;
    private readonly workspaceDir;
    private readonly notify?;
    private readonly stateStore;
    private readonly extensionLoader;
    private readonly updateExecutor;
    private readonly updateChecker;
    private readonly now;
    private intervalHandle;
    private isChecking;
    private disposed;
    constructor(options?: ExtensionAutoUpdaterOptions);
    /**
     * Starts the background auto-update loop.
     * Returns a cleanup function that stops scheduling additional checks.
     */
    start(): () => void;
    stop(): void;
    checkNow(): Promise<void>;
    private runCycle;
    private getEffectiveSettingsForExtension;
    private applyPendingInstalls;
    private processExtension;
    private handleUpdateAvailable;
    private performUpdate;
    private notifyWithLevel;
}
export {};
