import type { HookDispatcher } from '../hooks/dispatcher.js';
import type { RuntimeEventBus } from './events/index.js';
import type { RuntimeServices } from './services.js';
interface DaemonService {
    enable(config: {
        daemon: boolean;
    }, token?: string): boolean;
    start(): Promise<void>;
    stop(): Promise<void>;
    listRecentControlPlaneEvents(limit: number): readonly import('../control-plane/gateway.js').ControlPlaneRecentEvent[];
}
interface HttpListenerService {
    enable(config: {
        httpListener: boolean;
    }, token?: string): boolean;
    start(): Promise<void>;
    stop(): Promise<void>;
}
interface ServiceFactories {
    createDaemonServer?: (runtimeBus: RuntimeEventBus, userAuth: RuntimeServices['localUserAuthManager'], runtimeServices: RuntimeServices) => DaemonService;
    createHttpListener?: (hookDispatcher: HookDispatcher, userAuth: RuntimeServices['localUserAuthManager'], configManager: RuntimeServices['configManager']) => HttpListenerService;
    startupTimeoutMs?: number;
    probeDaemonPortInUse?: (host: string, port: number) => Promise<boolean>;
    probeHttpListenerPortInUse?: (host: string, port: number) => Promise<boolean>;
    /**
     * Shared bearer token the daemon should accept on inbound HTTP requests.
     * When set, `daemon.enable()` registers this token and requests carrying
     * `Authorization: Bearer <token>` authenticate without a login session.
     * Surfaces that generate companion-app pairing tokens should pass the token
     * here so the embedded daemon accepts scanned QR credentials.
     */
    sharedDaemonToken?: string;
    /**
     * Shared bearer token for the HTTP listener (webhook-style surfaces).
     * Independent from `sharedDaemonToken`; different surfaces may issue
     * different tokens, or both may share the same bearer.
     */
    sharedHttpListenerToken?: string;
}
export interface HostServicesHandle {
    readonly daemonServer: DaemonService | null;
    readonly httpListener: HttpListenerService | null;
    listRecentControlPlaneEvents(limit: number): readonly import('../control-plane/gateway.js').ControlPlaneRecentEvent[];
    stop(): Promise<void>;
}
export interface HostServicesConfig {
    get(key: 'danger.daemon' | 'danger.httpListener' | 'controlPlane.host' | 'controlPlane.port' | 'httpListener.host' | 'httpListener.port'): boolean | string | number;
}
export declare function startHostServices(config: HostServicesConfig, runtimeBus: RuntimeEventBus, hookDispatcher: HookDispatcher, factories: ServiceFactories | undefined, runtimeServices: RuntimeServices): Promise<HostServicesHandle>;
export type ExternalServicesHandle = HostServicesHandle;
export type ExternalServicesConfig = HostServicesConfig;
export declare const startExternalServices: typeof startHostServices;
export {};
//# sourceMappingURL=bootstrap-services.d.ts.map