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 { InboundMailHealthLike } from './channel-route-types.js'; import type { DistributedPeerAuth, DistributedRuntimeManager } from '../../runtime/remote/index.js'; import type { HomeGraphService, KnowledgeService, ProjectPlanningService } from '../../knowledge/index.js'; import { KnowledgeGraphqlService } 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 ClusterGroupVerbs } from './cluster-group-routes.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; /** Inbound mail's health. Absent means no mailbox, NOT a healthy one. */ readonly inboundMailHealth?: (() => InboundMailHealthLike | null) | undefined; readonly distributedRuntime: DistributedRuntimeManager; readonly watcherRegistry: WatcherRegistry; readonly voiceService: VoiceService; readonly webSearchService: WebSearchService; readonly mcpRegistry: import('../../mcp/registry.js').McpRegistry; readonly mcpConfigRoots: import('../../mcp/config.js').McpConfigRoots; readonly knowledgeService: KnowledgeService; readonly agentKnowledgeService: KnowledgeService; readonly homeGraphService: HomeGraphService; readonly projectPlanningService: ProjectPlanningService; readonly knowledgeGraphqlService: KnowledgeGraphqlService; readonly mediaProviders: MediaProviderRegistry; readonly multimodalService: MultimodalService; readonly artifactStore: ArtifactStore; readonly memoryRegistry: MemoryRegistry; /** Consolidation receipts + pending proposals for the memory.consolidation.receipts route. */ readonly memoryConsolidation?: { listReceipts(): readonly unknown[]; } | null | undefined; 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; 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 | 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; /** A surface that ran the turn in its own process reports the answer; see DaemonSurfaceDeliveryHelper. */ readonly completeSurfaceReplyFromSurface: (input: { readonly agentId: string; readonly sessionId?: string | undefined; readonly body: string; readonly status?: 'completed' | 'failed' | 'cancelled' | undefined; }) => Promise; readonly surfaceDeliveryEnabled: (surface: 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'telephony' | '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 | null | undefined; readonly trySpawnAgent: (input: Parameters[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; /** Supplied by the daemon facade after construction; these feed /status. */ private statusProviders; private clusterGroupVerbs; /** Wire receipts (update/crash announcements) and the cluster role into /status. */ setDaemonStatusProviders(providers: import('./router-route-contexts.js').DaemonStatusProviders): void; /** Wire the LAN group verbs (`/api/cluster/*`), see cluster-group-routes.ts. */ setClusterGroupVerbs(verbs: ClusterGroupVerbs): void; constructor(context: DaemonHttpRouterContext); dispose(): void; private getConfigValue; handleRequest(req: Request): Promise; private dispatchAuthedRequest; /** * 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; /** Knowledge route context for one surface, see router-knowledge-context.ts. */ private knowledgeRouteContext; private getHomeAssistantRoutes; private getHomeGraphRoutes; private getProjectPlanningRoutes; parseJsonBody(req: Request): Promise; parseOptionalJsonBody(req: Request): Promise; parseJsonText(rawBody: string): JsonRecord | Response; recordApiResponse(req: Request, path: string, response: Response, clientKind?: 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'telephony' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon'): Response; private handleLogin; private handleGitHubWebhook; handleSlackWebhook(req: Request): Promise; handleDiscordWebhook(req: Request): Promise; handleNtfyWebhook(req: Request): Promise; handleGenericWebhook(req: Request): Promise; } export {}; //# sourceMappingURL=router.d.ts.map