/**
 * ContentBlock — ACP ContentBlock union type
 * Represents displayable content in messages, tool call results, etc.
 */
type ContentBlock = TextBlock | ImageBlock | AudioBlock | ResourceLinkBlock | ResourceBlock;
/** Text content — ACP TextContent */
interface TextBlock {
    type: 'text';
    text: string;
    annotations?: ContentAnnotations;
}
/** Image content — ACP ImageContent */
interface ImageBlock {
    type: 'image';
    data: string;
    mimeType: string;
    uri?: string;
    annotations?: ContentAnnotations;
}
/** Audio content — ACP AudioContent */
interface AudioBlock {
    type: 'audio';
    data: string;
    mimeType: string;
    annotations?: ContentAnnotations;
}
/** Resource link (file reference) — ACP ResourceLink */
interface ResourceLinkBlock {
    type: 'resource_link';
    uri: string;
    name: string;
    title?: string;
    description?: string;
    mimeType?: string;
    size?: number;
    annotations?: ContentAnnotations;
}
/** Embedded resource (inline file) — ACP EmbeddedResource */
interface ResourceBlock {
    type: 'resource';
    resource: TextResourceContents | BlobResourceContents;
    annotations?: ContentAnnotations;
}
interface TextResourceContents {
    uri: string;
    text: string;
    mimeType?: string | null;
}
interface BlobResourceContents {
    uri: string;
    blob: string;
    mimeType?: string | null;
}
interface ContentAnnotations {
    audience?: ('user' | 'assistant')[];
    priority?: number;
}
/** Tool call info — ACP ToolCall */
interface ToolCallInfo {
    toolCallId: string;
    title: string;
    kind?: ToolKind;
    status?: ToolCallStatus;
    rawInput?: unknown;
    rawOutput?: unknown;
    content?: ToolCallContent[];
    locations?: ToolCallLocation[];
}
type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
/** Content produced by a tool call — ACP ToolCallContent */
type ToolCallContent = {
    type: 'content';
    content: ContentBlock;
} | {
    type: 'diff';
    path: string;
    oldText?: string;
    newText: string;
} | {
    type: 'terminal';
    terminalId: string;
};
interface ToolCallLocation {
    path: string;
    line?: number | null;
}
type ProviderCategory = 'cli' | 'ide' | 'extension' | 'acp';
/**
 * Type of object exported by module.exports in provider.js.
 *
 * Each provider.js is fully independent and does not import other providers.
 * Helpers (_helpers/) can be optionally used.
 */
/**
 * Provider-configurable CDP target filter.
 * Used by DaemonCdpManager to select the correct page/tab to connect to.
 * Without this, the manager uses a hardcoded default filter.
 */
interface CdpTargetFilter {
    /** URL must include this string (e.g. 'workbench.html') */
    urlIncludes?: string;
    /** URL must NOT include any of these strings */
    urlExcludes?: string[];
    /** Page title regex pattern for titles to EXCLUDE (e.g. 'Debug Console|Output') */
    titleExcludes?: string;
}
interface ProviderModule {
    /** Unique identifier (e.g. 'cline', 'cursor', 'gemini-cli') */
    type: string;
    /** Display name (e.g. 'Cline', 'Cursor') */
    name: string;
    /** Category: determines execution method */
    category: ProviderCategory;
    /** Alias list — allows users to invoke by alternate names (e.g. ['claude', 'claude-code']) */
    aliases?: string[];
    /** CDP ports [primary, secondary] (IDE category only) */
    cdpPorts?: [number, number];
    /** CDP target filter — controls which page/tab to connect to (IDE category only) */
    targetFilter?: CdpTargetFilter;
    /** CLI command (e.g. 'cursor', 'code') */
    cli?: string;
    /** Display icon */
    icon?: string;
    /** Display name (short name) */
    displayName?: string;
    /** Install instructions (shown when command is missing) */
    install?: string;
    /** Custom version detection command (e.g. 'cursor --version', 'claude -v') */
    versionCommand?: string;
    /** Versions tested by provider maintainer (informational) */
    testedVersions?: string[];
    /** Per-OS process names — used by launch.ts to detect/kill IDE processes */
    processNames?: {
        darwin?: string;
        win32?: string[];
        linux?: string[];
        [key: string]: string | string[] | undefined;
    };
    /** Per-OS install paths — used by detector.ts to detect IDE installation */
    paths?: {
        darwin?: string[];
        win32?: string[];
        linux?: string[];
        [key: string]: string[] | undefined;
    };
    extensionId?: string;
    extensionIdPattern?: RegExp;
    binary?: string;
    spawn?: {
        command: string;
        args?: string[];
        shell?: boolean;
        env?: Record<string, string>;
    };
    patterns?: {
        prompt?: RegExp[];
        generating?: RegExp[];
        approval?: RegExp[];
        ready?: RegExp[];
    };
    cleanOutput?: (raw: string, lastUserInput?: string) => string;
    resume?: ProviderResumeCapability;
    scripts?: ProviderScripts;
    vscodeCommands?: {
        focusPanel?: string;
        openPanel?: string;
        [key: string]: string | undefined;
    };
    inputMethod?: 'cdp-type-and-send' | 'script';
    inputSelector?: string;
    /** webview iframe match text (must be contained in body) */
    webviewMatchText?: string;
    os?: {
        [platform: string]: Partial<Pick<ProviderModule, 'scripts' | 'inputMethod' | 'inputSelector'>>;
    };
    /** Key: semver range string (e.g. '< 1.107.0', '>= 2.0.0') */
    versions?: {
        [versionRange: string]: Partial<Pick<ProviderModule, 'scripts'>> & {
            /**
             * Load scripts from a subdirectory instead of scripts.js root.
             * Path is relative to the provider directory (e.g. 'scripts/legacy').
             * The subdirectory should contain its own scripts.js or individual .js files.
             */
            __dir?: string;
        };
    };
    overrides?: Array<{
        when: {
            os?: string;
            version?: string;
        };
        scripts?: Partial<ProviderScripts>;
        /** Load scripts from a subdirectory for this OS+version combination */
        __dir?: string;
    }>;
    settings?: Record<string, ProviderSettingDef>;
    /** Static options used when agent does not provide configOptions */
    staticConfigOptions?: Array<{
        category: 'model' | 'mode' | 'thought_level' | 'other';
        configId: string;
        defaultValue?: string;
        options: Array<{
            value: string;
            name: string;
            description?: string;
            group?: string;
        }>;
    }>;
    /** Function to convert selected config values to spawn args (applied via process restart when config/* not supported) */
    spawnArgBuilder?: (config: Record<string, string>) => string[];
    /** ACP agent auth methods (multiple supported — in priority order) */
    auth?: AcpAuthMethod[];
}
interface ProviderResumeCapability {
    supported: boolean;
    stopStrategy?: 'command' | 'ctrl_c';
    stopCommand?: string;
    shutdownGraceMs?: number;
    resumeArgs?: string[];
}
/** ACP auth method — based on ACP official spec */
type AcpAuthMethod = AcpAuthEnvVar | AcpAuthAgent | AcpAuthTerminal;
/** Environment variable-based auth (API keys etc) */
interface AcpAuthEnvVar {
    type: 'env_var';
    id: string;
    name: string;
    vars: Array<{
        name: string;
        label?: string;
        secret?: boolean;
        optional?: boolean;
    }>;
    link?: string;
}
/** Agent self-auth (OAuth, browser-based etc) */
interface AcpAuthAgent {
    type: 'agent';
    id: string;
    name: string;
    description?: string;
}
/** Terminal command-based auth (runs setup command) */
interface AcpAuthTerminal {
    type: 'terminal';
    id: string;
    name: string;
    description?: string;
    args?: string[];
    env?: Record<string, string>;
}
/**
 * CDP script functions.
 * Each function takes a params object and returns a JS code string for CDP evaluate.
 * The JS execution result must conform to the Output Contract.
 *
 * Custom scripts can be added via index signature in addition to built-in scripts.
 * All scripts can receive params: Record<string, any>,
 * backward compatible with legacy single-argument style (e.g. sendMessage(text)).
 */
interface ProviderScripts {
    readChat?: (params?: Record<string, any>) => string;
    sendMessage?: (params?: Record<string, any>) => string;
    listSessions?: (params?: Record<string, any>) => string;
    switchSession?: (params?: Record<string, any>) => string;
    newSession?: (params?: Record<string, any>) => string;
    focusEditor?: (params?: Record<string, any>) => string;
    openPanel?: (params?: Record<string, any>) => string;
    /** List available models → { models: string[], current: string } */
    listModels?: (params?: Record<string, any>) => string;
    /** Change model → { success: boolean } */
    setModel?: (params?: Record<string, any>) => string;
    /** List available modes → { modes: string[], current: string } */
    listModes?: (params?: Record<string, any>) => string;
    /** Change mode → { success: boolean } */
    setMode?: (params?: Record<string, any>) => string;
    /** params: { action: 'approve'|'reject'|'custom', button?: string } */
    resolveAction?: (params?: Record<string, any>) => string;
    webviewResolveAction?: (params?: Record<string, any>) => string;
    listNotifications?: (params?: Record<string, any>) => string;
    dismissNotification?: (params?: Record<string, any>) => string;
    [scriptName: string]: ((params?: Record<string, any>) => string) | undefined;
}
/**
 * ProviderLoader.resolve() result: Final provider with OS/version overrides applied
 */
interface ResolvedProvider extends ProviderModule {
    /** OS applied during resolve */
    _resolvedOs?: string;
    /** Version applied during resolve */
    _resolvedVersion?: string;
    /** Warning when detected version is not in compatibility matrix */
    _versionWarning?: string;
}
/** Setting variable definition declared by provider */
interface ProviderSettingDef {
    type: 'boolean' | 'number' | 'string' | 'select';
    default: any;
    /** true = controllable from dashboard UI */
    public: boolean;
    /** UI label */
    label?: string;
    /** UI description */
    description?: string;
    /** Minimum value for number type */
    min?: number;
    /** Maximum value for number type */
    max?: number;
    /** Options for select type */
    options?: string[];
}
/** Public settings schema (for dashboard transmission) */
interface ProviderSettingSchema extends ProviderSettingDef {
    key: string;
}

/**
 * ProviderInstance — Provider runtime lifecycle
 *
 * provider.js = static config/scripts
 * ProviderInstance = runtime status management + lifecycle
 *
 * Daemon only collects via ProviderInstance.getState(),
 * Each Instance manages its own status.
 */

type ProviderStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
interface ProviderRuntimeWriteOwner {
    clientId: string;
    ownerType: 'agent' | 'user';
}
interface ProviderRuntimeClient {
    clientId: string;
    type: 'daemon' | 'web' | 'local-terminal';
    readOnly: boolean;
}
interface ProviderRuntimeInfo {
    runtimeId: string;
    runtimeKey?: string;
    displayName?: string;
    workspaceLabel?: string;
    writeOwner?: ProviderRuntimeWriteOwner | null;
    attachedClients?: ProviderRuntimeClient[];
}
interface ActiveChatData {
    id: string;
    title: string;
    status: string;
    messages: ChatMessage[];
    activeModal: {
        message: string;
        buttons: string[];
    } | null;
    terminalHistory?: string;
    inputContent?: string;
}
/** Standardized error reasons across all provider categories */
type ProviderErrorReason = 'not_installed' | 'auth_failed' | 'spawn_error' | 'init_failed' | 'crash' | 'timeout' | 'cdp_error' | 'disconnected';
/** Common fields shared by all provider categories */
interface ProviderStateBase {
    /** Provider type (e.g. 'gemini-cli', 'cursor', 'cline') */
    type: string;
    /** Provider Display name */
    name: string;
    /** current status */
    status: ProviderStatus;
    /** chat data */
    activeChat: ActiveChatData | null;
    /** Workspace — project path or name (all categories) */
    workspace?: string | null;
    /** Runtime info (real-time detection) */
    currentModel?: string;
    currentPlan?: string;
    /** Error details (when status === 'error') */
    errorMessage?: string;
    errorReason?: ProviderErrorReason;
    /** meta */
    instanceId: string;
    lastUpdated: number;
    settings: Record<string, any>;
    /** Event queue (cleared after daemon collects) */
    pendingEvents: ProviderEvent[];
    runtime?: ProviderRuntimeInfo;
    resume?: ProviderResumeCapability;
}
/** IDE provider state */
interface IdeProviderState extends ProviderStateBase {
    category: 'ide';
    cdpConnected: boolean;
    /** IDE child Extension Instance status */
    extensions: ProviderState[];
    currentAutoApprove?: string;
}
/** CLI provider state */
interface CliProviderState extends ProviderStateBase {
    category: 'cli';
    /** terminal = PTY stream, chat = parsed conversation */
    mode: 'terminal' | 'chat';
}
/** ACP provider state */
interface AcpProviderState extends ProviderStateBase {
    category: 'acp';
    mode: 'chat';
    /** ACP config options (model/mode selection) */
    acpConfigOptions?: AcpConfigOption[];
    /** ACP available modes */
    acpModes?: AcpMode[];
}
/** Extension provider state */
interface ExtensionProviderState extends ProviderStateBase {
    category: 'extension';
    agentStreams?: any[];
}
/** Discriminated union — switch on `.category` */
type ProviderState = IdeProviderState | CliProviderState | AcpProviderState | ExtensionProviderState;
interface ProviderEvent {
    event: string;
    timestamp: number;
    [key: string]: any;
}
interface InstanceContext {
    /** CDP connection (IDE/Extension) */
    cdp?: {
        isConnected: boolean;
        evaluate(script: string, timeout?: number): Promise<unknown>;
        evaluateInWebviewFrame?(expression: string, matchFn?: (bodyPreview: string) => boolean): Promise<string | null>;
        discoverAgentWebviews?(): Promise<any[]>;
    };
    /** Server log transmit */
    serverConn?: {
        sendMessage(type: string, data: any): void;
    };
    /** P2P PTY output transmit */
    onPtyData?: (data: string) => void;
    /** Provider configvalue (resolved) */
    settings: Record<string, any>;
}
interface ProviderInstance {
    /** Provider type */
    readonly type: string;
    /** Provider category */
    readonly category: 'cli' | 'ide' | 'extension' | 'acp';
    /** initialize */
    init(context: InstanceContext): Promise<void>;
    /** Tick — periodic status refresh (IDE: readChat, Extension: stream collection) */
    onTick(): Promise<void>;
    /** Return current status */
    getState(): ProviderState;
    /** Receive event (external → Instance) */
    onEvent(event: string, data?: any): void;
    /** Update settings at runtime (called when user changes settings from dashboard) */
    updateSettings?(newSettings: Record<string, any>): void;
    /** cleanup */
    dispose(): void;
}

/**
 * Recent workspace activity — quick "pick up where you left off" (daemon-local).
 */

interface WorkspaceActivityEntry {
    path: string;
    lastUsedAt: number;
    /** `active` legacy — same meaning as default */
    kind?: 'ide' | 'cli' | 'acp' | 'default' | 'active';
    /** IDE id or CLI/ACP provider type */
    agentType?: string;
}
declare function getWorkspaceActivity(config: ADHDevConfig, limit?: number): WorkspaceActivityEntry[];

/**
 * ADHDev Launcher — Configuration
 *
 * Manages launcher config, server connection tokens, and user preferences.
 */

interface ADHDevConfig {
    serverUrl: string;
    apiToken: string | null;
    connectionToken: string | null;
    selectedIde: string | null;
    configuredIdes: string[];
    installedExtensions: string[];
    autoConnect: boolean;
    /**
     * @deprecated Not read at runtime. Notification preferences are now managed by:
     * - Web UI layer: useNotificationPrefs (localStorage)
     * - Daemon layer: per-provider settings (approvalAlert, longGeneratingAlert)
     * Kept for backward config compat — will be removed in v0.7+.
     */
    notifications: boolean;
    userEmail: string | null;
    userName: string | null;
    setupCompleted: boolean;
    setupDate: string | null;
    configuredCLIs: string[];
    enabledIdes: string[];
    recentCliWorkspaces: string[];
    /** Saved workspaces for IDE/CLI/ACP launch (daemon-local) */
    workspaces?: WorkspaceEntry[];
    /** Default workspace id (from workspaces[]) — never used implicitly for launch */
    defaultWorkspaceId?: string | null;
    /** Recently used workspaces (IDE / CLI / ACP / default) for quick resume */
    recentWorkspaceActivity?: WorkspaceActivityEntry[];
    machineNickname: string | null;
    /**
     * Stable local machine ID (prefix: `mach_`) — generated locally on first run.
     * Used as daemon instance key (`daemon_<machineId>`) and in status reports.
     * NOT the same as the server-side D1 `machines.id` — see `registeredMachineId`.
     */
    machineId?: string;
    machineSecret?: string | null;
    /**
     * Server-side D1 `machines.id` — the row ID assigned when daemon registers via
     * `POST /cli/complete`. Corresponds to `machineId` in server DO context
     * (`DaemonConnection.machineId`, `StatusContext.machineId`).
     *
     * Naming differs from server-side `machineId` to avoid confusion with the local
     * `config.machineId` (mach_ prefix) which is a different value.
     *
     * @deprecated Legacy bridge field — will be removed after 2026-04-06.
     * Modern auth flow uses `machineSecret` (adm_) to identify machines.
     */
    registeredMachineId?: string;
    cliHistory: CliHistoryEntry[];
    providerSettings: Record<string, Record<string, any>>;
    ideSettings: Record<string, {
        extensions?: Record<string, {
            enabled: boolean;
        }>;
    }>;
    disableUpstream?: boolean;
    providerDir?: string;
}
interface CliHistoryEntry {
    category?: 'ide' | 'cli' | 'acp';
    cliType: string;
    dir: string;
    cliArgs?: string[];
    workspace?: string;
    newWindow?: boolean;
    model?: string;
    timestamp: number;
    label?: string;
}
/**
 * Load configuration from disk
 */
declare function loadConfig(): ADHDevConfig;
/**
 * Save configuration to disk
 */
declare function saveConfig(config: ADHDevConfig): void;
/**
 * Update specific config fields
 */
declare function updateConfig(updates: Partial<ADHDevConfig>): ADHDevConfig;
/**
 * Mark setup as completed
 */
declare function markSetupComplete(ideId: string | string[], extensions: string[]): ADHDevConfig;
/**
 * Check if setup has been completed before
 */
declare function isSetupComplete(): boolean;
/**
 * Reset configuration
 */
declare function resetConfig(): void;
/**
 * Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
 */
declare function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void;

/**
 * Saved workspaces — shared by IDE launch, CLI, ACP (daemon-local).
 */

interface WorkspaceEntry {
    id: string;
    path: string;
    label?: string;
    addedAt: number;
}
declare function getWorkspaceState(config: ADHDevConfig): {
    workspaces: WorkspaceEntry[];
    defaultWorkspaceId: string | null;
    defaultWorkspacePath: string | null;
};

/**
 * ADHDev Shared Types — Cross-package type definitions
 *
 * Types used across daemon-core, web-core, and downstream consumers.
 * Import via: import type { ... } from '@adhdev/daemon-core/types'
 *
 * IMPORTANT: This file must remain runtime-free (types only).
 */

/** Agent stream snapshot carried by flattened UI entries. */
interface AgentSessionStream {
    sessionId?: string;
    instanceId?: string;
    parentSessionId?: string | null;
    agentType: string;
    agentName: string;
    extensionId: string;
    transport?: SessionTransport;
    status: string;
    title?: string;
    messages: ChatMessage[];
    inputContent: string;
    model?: string;
    activeModal: {
        message: string;
        buttons: string[];
    } | null;
}
type SessionTransport = 'cdp-page' | 'cdp-webview' | 'pty' | 'acp';
type SessionKind = 'workspace' | 'agent';
type SessionCapability = 'read_chat' | 'send_message' | 'new_session' | 'list_sessions' | 'switch_session' | 'resolve_action' | 'terminal_io' | 'resize_terminal' | 'change_model' | 'set_mode' | 'set_thought_level';
interface SessionEntry {
    id: string;
    parentId: string | null;
    providerType: string;
    providerName: string;
    kind: SessionKind;
    transport: SessionTransport;
    status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
    title: string;
    workspace: string | null;
    runtimeKey?: string;
    runtimeDisplayName?: string;
    runtimeWorkspaceLabel?: string;
    runtimeWriteOwner?: {
        clientId: string;
        ownerType: 'agent' | 'user';
    } | null;
    runtimeAttachedClients?: {
        clientId: string;
        type: 'daemon' | 'web' | 'local-terminal';
        readOnly: boolean;
    }[];
    resume?: ProviderResumeCapability;
    activeChat: ActiveChatData | null;
    capabilities: SessionCapability[];
    cdpConnected?: boolean;
    currentModel?: string;
    currentPlan?: string;
    currentAutoApprove?: string;
    acpConfigOptions?: AcpConfigOption[];
    acpModes?: AcpMode[];
    errorMessage?: string;
    errorReason?: ProviderErrorReason;
}
/** Available provider information */
interface AvailableProviderInfo {
    type: string;
    name: string;
    category: 'ide' | 'extension' | 'cli' | 'acp';
    displayName: string;
    icon: string;
}
/** ACP config option (model/mode/thought_level selection) */
interface AcpConfigOption {
    category: 'model' | 'mode' | 'thought_level' | 'other';
    configId: string;
    currentValue?: string;
    options: {
        value: string;
        name: string;
        description?: string;
        group?: string;
    }[];
}
/** ACP mode */
interface AcpMode {
    id: string;
    name: string;
    description?: string;
}
/** Machine hardware/OS info (reported by daemon, displayed by web) */
interface MachineInfo {
    hostname: string;
    platform: string;
    arch: string;
    cpus: number;
    totalMem: number;
    freeMem: number;
    /** macOS: reclaimable-inclusive; prefer for UI used% */
    availableMem?: number;
    loadavg: number[];
    uptime: number;
    release: string;
}
/** Detected IDE on a machine */
interface DetectedIdeInfo {
    type: string;
    id?: string;
    name: string;
    running: boolean;
    path?: string;
}
/** Workspace recent activity */
interface WorkspaceActivity {
    path: string;
    lastUsedAt: number;
    kind?: string;
    agentType?: string;
}
interface StatusReportPayload {
    /** Daemon instance ID */
    instanceId: string;
    /** Daemon version */
    version: string;
    /** Daemon mode flag */
    daemonMode: boolean;
    /** Machine info */
    machine: MachineInfo;
    /** Machine nickname (user-set) */
    machineNickname?: string | null;
    /** Timestamp */
    timestamp: number;
    /** Detected IDEs on this machine */
    detectedIdes: DetectedIdeInfo[];
    /** P2P state */
    p2p?: {
        available: boolean;
        state: string;
        peers: number;
        screenshotActive?: boolean;
    };
    /** Canonical daemon runtime sessions */
    sessions: SessionEntry[];
    /** Saved workspaces */
    workspaces?: WorkspaceEntry[];
    defaultWorkspaceId?: string | null;
    defaultWorkspacePath?: string | null;
    workspaceActivity?: WorkspaceActivity[];
}

/**
 * ADHDev Daemon Core — Shared Types
 *
 * Shared types referenced by daemon-core, daemon-standalone, and web-core.
 * When modifying this file, also update interface contracts in AGENT_PROTOCOL.md.
 */

/** Full status response from /api/v1/status and WS events */
interface StatusResponse extends StatusReportPayload {
    /** For standalone API compat */
    id: string;
    type: string;
    platform: string;
    hostname: string;
    /** User display name from config */
    userName?: string;
    /** Available providers */
    availableProviders: ProviderInfo[];
    /** System info (legacy compat) */
    system?: SystemInfo;
}
interface ChatMessage {
    role: string;
    /** Plain text (legacy) or rich content blocks (ACP standard) */
    content: string | ContentBlock[];
    kind?: string;
    id?: string;
    index?: number;
    timestamp?: number;
    receivedAt?: number;
    /** Tool calls associated with this message */
    toolCalls?: ToolCallInfo[];
    /** Optional: fiber metadata */
    _type?: string;
    _sub?: string;
    /** Meta information for thought/terminal logs etc */
    meta?: {
        label?: string;
        isRunning?: boolean;
    } | Record<string, any>;
    /** Sender name for shared sessions */
    senderName?: string;
}

interface ExtensionInfo {
    id: string;
    type: string;
    name: string;
    isMonitored?: boolean;
    agentStatus?: string;
}
interface CommandResult {
    success: boolean;
    data?: any;
    error?: string;
}
interface ProviderConfig {
    id: string;
    type: 'ide' | 'extension' | 'cli' | 'acp';
    name: string;
    /** CDP port detection */
    cdpDetect?: {
        processName?: string;
        portFlag?: string;
    };
    /** Capabilities */
    capabilities?: string[];
}
type DaemonEvent = {
    type: 'status';
    data: StatusResponse;
} | {
    type: 'chat_update';
    data: {
        ideId: string;
        messages: ChatMessage[];
    };
} | {
    type: 'screenshot';
    data: {
        ideId: string;
        base64: string;
    };
} | {
    type: 'action_log';
    data: {
        ideId: string;
        text: string;
        timestamp: number;
    };
} | {
    type: 'error';
    data: {
        message: string;
    };
};
interface SystemInfo {
    cpus: number;
    totalMem: number;
    freeMem: number;
    /** macOS: reclaimable-inclusive; prefer for UI used% (see host-memory.ts) */
    availableMem?: number;
    loadavg: number[];
    uptime: number;
    arch: string;
}
interface DetectedIde {
    id: string;
    type: string;
    name: string;
    installed: boolean;
    running: boolean;
}
interface ProviderInfo {
    type: string;
    icon: string;
    displayName: string;
    category: string;
}
/** Flattened agent entry from /api/v1/agents */
interface AgentEntry {
    ideId: string;
    type: string;
    name: string;
    status: string;
    source: 'native' | 'extension';
}

type ManagedStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
declare function normalizeManagedStatus(status?: string | null, opts?: {
    activeModal?: {
        buttons?: unknown[] | null;
    } | null;
}): ManagedStatus;
declare function isManagedStatusWorking(status?: string | null): boolean;
declare function isManagedStatusWaiting(status?: string | null, opts?: {
    activeModal?: {
        buttons?: unknown[] | null;
    } | null;
}): boolean;
declare function normalizeActiveChatData<T extends ActiveChatData | null | undefined>(activeChat: T): T;

export { saveConfig as $, type AvailableProviderInfo as A, type ProviderInfo as B, type CommandResult as C, type DaemonEvent as D, type ExtensionInfo as E, type ProviderStatus as F, type SessionCapability as G, type SessionKind as H, type InstanceContext as I, type SystemInfo as J, type WorkspaceEntry as K, addCliHistory as L, type MachineInfo as M, getWorkspaceActivity as N, getWorkspaceState as O, type ProviderCategory as P, isManagedStatusWaiting as Q, type ResolvedProvider as R, type StatusResponse as S, isManagedStatusWorking as T, isSetupComplete as U, loadConfig as V, type WorkspaceActivity as W, markSetupComplete as X, normalizeActiveChatData as Y, normalizeManagedStatus as Z, resetConfig as _, type SessionEntry as a, updateConfig as a0, type ProviderModule as b, type ProviderSettingSchema as c, type CdpTargetFilter as d, type ProviderInstance as e, type ProviderState as f, type ProviderEvent as g, type SessionTransport as h, type StatusReportPayload as i, type ProviderResumeCapability as j, type AcpProviderState as k, type ContentBlock as l, type AcpConfigOption as m, type AcpMode as n, type ActiveChatData as o, type AgentEntry as p, type AgentSessionStream as q, type ChatMessage as r, type CliProviderState as s, type DetectedIde as t, type DetectedIdeInfo as u, type ExtensionProviderState as v, type IdeProviderState as w, type ManagedStatus as x, type ProviderConfig as y, type ProviderErrorReason as z };
