import type { ConfigManager } from '../../config/manager.js';
import type { ServiceRegistry } from '../../config/service-registry.js';
import type { UserAuthManager } from '../../security/user-auth.js';
import type { AgentManager } from '../../tools/agent/index.js';
import { type AutomationManager } from '../../automation/index.js';
import type { ApprovalBroker, ControlPlaneGateway, SharedSessionBroker } from '../../control-plane/index.js';
import type { GatewayMethodCatalog } from '../../control-plane/index.js';
import type { ProviderRegistry } from '../../providers/registry.js';
import type { RouteBindingManager, ChannelPolicyManager, ChannelPluginRegistry, SurfaceRegistry } from '../../channels/index.js';
import type { WatcherRegistry } from '../../watchers/index.js';
import type { DistributedPeerAuth, DistributedRuntimeManager } from '../../runtime/remote/index.js';
import type { HomeGraphService, KnowledgeGraphqlService, KnowledgeService, ProjectPlanningService } from '../../knowledge/index.js';
import type { VoiceService } from '../../voice/index.js';
import type { WebSearchService } from '../../web-search/index.js';
import type { ArtifactStore } from '../../artifacts/index.js';
import type { MediaProviderRegistry } from '../../media/index.js';
import type { MultimodalService } from '../../multimodal/index.js';
import type { IntegrationHelperService } from '../../runtime/integration/helpers.js';
import type { DomainDispatch, RuntimeStore } from '../../runtime/store/index.js';
import type { RuntimeEventBus } from '../../runtime/events/index.js';
import type { DaemonBatchManager } from '../../batch/index.js';
import type { MemoryEmbeddingProviderRegistry, MemoryRegistry } from '../../state/index.js';
import type { GenericWebhookAdapterContext, SurfaceAdapterContext } from '../../adapters/index.js';
import type { PlatformServiceManager } from '../service-manager.js';
import type { JsonRecord } from '../helpers.js';
import type { CompanionChatManager } from '../../companion/companion-chat-manager.js';
interface DaemonHttpRouterContext {
    readonly configManager: ConfigManager;
    readonly serviceRegistry: ServiceRegistry;
    readonly userAuth: UserAuthManager;
    readonly agentManager: AgentManager;
    readonly automationManager: AutomationManager;
    readonly approvalBroker: ApprovalBroker;
    readonly controlPlaneGateway: ControlPlaneGateway;
    readonly gatewayMethods: GatewayMethodCatalog;
    readonly providerRegistry: ProviderRegistry;
    readonly sessionBroker: SharedSessionBroker;
    readonly routeBindings: RouteBindingManager;
    readonly channelPolicy: ChannelPolicyManager;
    readonly channelPlugins: ChannelPluginRegistry;
    readonly surfaceRegistry: SurfaceRegistry;
    readonly distributedRuntime: DistributedRuntimeManager;
    readonly watcherRegistry: WatcherRegistry;
    readonly voiceService: VoiceService;
    readonly webSearchService: WebSearchService;
    readonly knowledgeService: KnowledgeService;
    readonly homeGraphService: HomeGraphService;
    readonly projectPlanningService: ProjectPlanningService;
    readonly knowledgeGraphqlService: KnowledgeGraphqlService;
    readonly mediaProviders: MediaProviderRegistry;
    readonly multimodalService: MultimodalService;
    readonly artifactStore: ArtifactStore;
    readonly memoryRegistry: MemoryRegistry;
    readonly memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry;
    readonly platformServiceManager: PlatformServiceManager;
    readonly integrationHelpers: IntegrationHelperService | null;
    readonly runtimeBus: RuntimeEventBus;
    readonly runtimeStore: RuntimeStore | null;
    readonly runtimeDispatch: DomainDispatch | null;
    readonly batchManager?: DaemonBatchManager | null | undefined;
    readonly githubWebhookSecret: string | null;
    readonly authToken: () => string | null;
    readonly buildSurfaceAdapterContext: () => SurfaceAdapterContext;
    readonly buildGenericWebhookAdapterContext: () => GenericWebhookAdapterContext;
    readonly checkAuth: (req: Request) => boolean;
    readonly extractAuthToken: (req: Request) => string;
    readonly requireAuthenticatedSession: (req: Request) => {
        username: string;
        roles: readonly string[];
    } | null;
    readonly requireAdmin: (req: Request) => Response | null;
    readonly requireRemotePeer: (req: Request, scope?: string) => Promise<DistributedPeerAuth | Response>;
    readonly describeAuthenticatedPrincipal: (token: string) => {
        principalId: string;
        principalKind: 'user' | 'bot' | 'service' | 'token';
        admin: boolean;
        scopes: readonly string[];
    } | null;
    readonly invokeGatewayMethodCall: (input: {
        readonly authToken: string;
        readonly methodId: string;
        readonly query?: Record<string, unknown> | undefined;
        readonly body?: unknown | undefined;
        readonly context?: {
            readonly principalId?: string | undefined;
            readonly principalKind?: 'user' | 'bot' | 'service' | 'token' | 'remote-peer' | undefined;
            readonly admin?: boolean | undefined;
            readonly scopes?: readonly string[] | undefined;
            readonly clientKind?: string | undefined;
        };
    }) => Promise<{
        status: number;
        ok: boolean;
        body: unknown;
    }>;
    readonly queueSurfaceReplyFromBinding: (binding: import('../../automation/routes.js').AutomationRouteBinding | undefined, input: {
        readonly agentId: string;
        readonly task: string;
        readonly agentTask?: string;
        readonly workflowChainId?: string;
        readonly sessionId?: string;
    }) => void;
    readonly surfaceDeliveryEnabled: (surface: 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix') => boolean;
    readonly syncSpawnedAgentTask: (record: import('../../tools/agent/index.js').AgentRecord, sessionId?: string) => void;
    readonly syncFinishedAgentTask: (record: import('../../tools/agent/index.js').AgentRecord) => void;
    /**
     * WorkspaceSwapManager instance for delegating POST /config runtime.workingDir
     * requests. Null in embedded/test contexts that don't support live workspace swaps.
     */
    readonly swapManager: import('./system-route-types.js').WorkspaceSwapManagerLike | null;
    /**
     * Optional companion chat manager. When present, companion chat routes
     * (/api/companion/chat/...) are enabled. Injected by the daemon facade
     * when the companion feature is active.
     */
    readonly companionChatManager?: CompanionChatManager | null | undefined;
    /** Resolve the current provider/model for companion-chat session creation. */
    readonly resolveDefaultProviderModel?: (() => {
        provider: string;
        model: string;
    } | null) | undefined;
    /**
     * SecretsManager instance used to resolve provider API keys stored as secrets
     * rather than env vars. Threaded into ModelRouteContext so that
     * resolveSecretKeys() can return the correct configuredVia='secrets' tier.
     * Without this, the production router always passes undefined and the secrets
     * tier is permanently dead on live code paths.
     */
    readonly secretsManager?: Pick<import('../../config/secrets.js').SecretsManager, 'get' | 'set' | 'getGlobalHome'> | null | undefined;
    readonly trySpawnAgent: (input: Parameters<AgentManager['spawn']>[0], logLabel?: string, sessionId?: string) => import('../../tools/agent/index.js').AgentRecord | Response;
}
export declare class DaemonHttpRouter {
    private readonly context;
    private readonly telemetryApi;
    private homeAssistantRoutes;
    private homeGraphRoutes;
    private projectPlanningRoutes;
    constructor(context: DaemonHttpRouterContext);
    dispose(): void;
    private getConfigValue;
    handleRequest(req: Request): Promise<Response>;
    /**
     * Dispatches routes that are exempt from the auth gate: login, remote-peer
     * handshake, webhooks, and the control-plane web UI. Extracted from
     * handleRequest to eliminate the 8-entry inline if-chain (m2/m3).
     */
    private dispatchPreAuthRoutes;
    dispatchApiRoutes(req: Request): Promise<Response | null>;
    private getHomeAssistantRoutes;
    private getHomeGraphRoutes;
    private getProjectPlanningRoutes;
    parseJsonBody(req: Request): Promise<JsonRecord | Response>;
    parseOptionalJsonBody(req: Request): Promise<JsonRecord | null | Response>;
    parseJsonText(rawBody: string): JsonRecord | Response;
    recordApiResponse(req: Request, path: string, response: Response, clientKind?: 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon'): Response;
    private handleLogin;
    private handleGitHubWebhook;
    handleSlackWebhook(req: Request): Promise<Response>;
    handleDiscordWebhook(req: Request): Promise<Response>;
    handleNtfyWebhook(req: Request): Promise<Response>;
    handleGenericWebhook(req: Request): Promise<Response>;
}
export {};
//# sourceMappingURL=router.d.ts.map