import type { AutomationRouteBinding } from '../automation/routes.js'; import type { RouteBindingManager } from '../channels/index.js'; import type { CompanionChatManager } from '../companion/companion-chat-manager.js'; import type { CompanionChatSession, CompanionChatTurnEvent } from '../companion/companion-chat-types.js'; import type { ConfigManager } from '../config/manager.js'; import type { HomeGraphAskInput, HomeGraphAskResult, HomeGraphSpaceInput } from '../knowledge/home-graph/types.js'; /** * The narrow read surface the Home Assistant turn consults to ground itself in * the pre-registered home-graph knowledge space (HomeGraphService.ask). Kept * structural + optional so a runtime without a home graph degrades to today's * ungrounded behavior rather than failing. */ export interface HomeGraphGroundingReader { ask(input: HomeGraphAskInput): Promise; } export declare const HOME_ASSISTANT_DEFAULT_REMOTE_SESSION_TTL_MS: number; type JsonRecord = Record; interface RouteBindingsLike { readonly start: RouteBindingManager['start']; readonly upsertBinding: RouteBindingManager['upsertBinding']; readonly patchBinding: RouteBindingManager['patchBinding']; } interface ConfigReader { get(key: string): unknown; } export interface HomeAssistantChatInput { readonly text: string; readonly messageId: string; readonly conversationId: string; readonly surfaceId: string; readonly channelId: string; readonly threadId?: string | undefined; readonly userId?: string | undefined; readonly displayName?: string | undefined; readonly title: string; readonly providerId?: string | undefined; readonly modelId?: string | undefined; readonly tools?: readonly string[] | undefined; readonly context?: JsonRecord | undefined; /** * Optional grounding reference, the pre-registered home-graph knowledge * space / Home Assistant installation this turn should consult. When present * (and a home-graph reader is wired), the turn queries that space and folds * the retrieved grounding into its system prompt, closing the * index-then-query loop the HA integration already opens by registering and * refreshing the graph. */ readonly grounding?: HomeGraphSpaceInput | undefined; readonly remoteSessionTtlMs: number; } export interface HomeAssistantChatResolution { readonly binding: AutomationRouteBinding; readonly session: CompanionChatSession; readonly newSession: boolean; readonly sessionExpired: boolean; } export interface HomeAssistantChatPostResult extends HomeAssistantChatResolution { readonly messageId: string; readonly assistantMessageId?: string | undefined; readonly response?: string | undefined; readonly error?: string | undefined; } export interface HomeAssistantChatRuntime { readonly configManager: Pick | ConfigReader; readonly routeBindings: RouteBindingsLike; readonly chatManager: CompanionChatManager; readonly resolveDefaultProviderModel?: (() => { provider: string; model: string; } | null) | undefined; /** Optional home-graph reader used to ground a turn against its pre-registered space. */ readonly homeGraph?: HomeGraphGroundingReader | undefined; } export declare function postHomeAssistantChatMessage(runtime: HomeAssistantChatRuntime, input: HomeAssistantChatInput, options?: { readonly wait?: boolean; readonly timeoutMs?: number | undefined; readonly clientId?: string; /** In-process tap for the turn's incremental events, forwarded to the chat * manager so a caller (the SSE route) can stream deltas while awaiting the reply. */ readonly onTurnEvent?: ((event: CompanionChatTurnEvent) => void) | undefined; }): Promise; export declare function resolveHomeAssistantChatSession(runtime: HomeAssistantChatRuntime, input: HomeAssistantChatInput): Promise; export declare function readHomeAssistantRemoteSessionTtlMs(configManager: ConfigReader, value: unknown): number; export declare function buildHomeAssistantSystemPrompt(input: HomeAssistantChatInput, grounding?: string | undefined): string; export {}; //# sourceMappingURL=homeassistant-chat.d.ts.map