/** * @license * Copyright 2026 Qwen * SPDX-License-Identifier: Apache-2.0 */ /** * The set of backends a live call can drive. One of them is the default * (what a bare session_create/handoff resolves to); the rest are named * targets the voice model selects via session_create's `backend` arg. * * Preflight policy: the DEFAULT backend's failure aborts daemon start * before the discovery file is claimed. An explicitly empty registry supports * direct voice, visual input, Memory, and Proactive without task delegation. * Secondary backends are best-effort AND off the ready path: their warm-up * starts once the default is ready, but the daemon never waits for it (a cold * package-runner install can take minutes). Until a warm-up settles the entry * reads 'starting'; a failure marks it unavailable with the last error, and * session_create naming it awaits that warm-up before reporting the error. */ import type { BackendAdaptor, BackendHandle } from './types.js'; export interface RegisteredBackend { readonly adaptor: BackendAdaptor; readonly isDefault: boolean; /** 'starting' until a secondary's background warm-up settles. */ status: 'starting' | 'ready' | 'unavailable'; lastError?: string; } export type RegistryLog = (message: string) => void; export type RegistryProgress = (event: { backend: string; stage: 'starting' | 'ready' | 'unavailable'; }) => void; export declare class BackendRegistry { private readonly entries; private readonly byName; /** In-flight secondary warm-ups by backend name; settled ones drop out. */ private readonly warmups; private closing; constructor(entries: ReadonlyArray<{ adaptor: BackendAdaptor; isDefault: boolean; }>); get hasBackends(): boolean; get defaultAdaptor(): BackendAdaptor; get defaultName(): string; names(): string[]; /** All registered backends, default first. */ all(): readonly RegisteredBackend[]; byAdaptorName(name: string): RegisteredBackend | undefined; /** * The adaptor that owns a backend handle. Handles are minted only by * registered adaptors, so an unknown name is an invariant violation — * throw rather than guess. */ adaptorFor(handle: BackendHandle): BackendAdaptor; preflight(log: RegistryLog, progress?: RegistryProgress): Promise; /** * Await a secondary backend's in-flight warm-up, resolving immediately when * none is pending. Only entries reading 'starting' have one; every other * status is already settled. */ whenReady(name: string): Promise; private warmUp; closeAll(log: RegistryLog): Promise; }