import type { InternalAuthOptions } from '../types/auth.js'; import type { ProcessTransportOptions } from '../core/process-transport.js'; import type { QueryTransportProvider } from '../core/transport.js'; import type { DaemonGetModelsParams, DaemonValidateByokModelParams } from './protocol.js'; import type { BYOKProviderInfo, ByokConfigCheckResult, ByokConfigInfo, ByokConfigReference, CheckByokConfigInput, CreateByokConfigInput, DeleteByokConfigInput, UpdateByokConfigInput } from '../protocol/control.js'; import type { AccountInfo, ModelInfo, UsageInfo } from '../protocol/common.js'; import type { PluginDetails } from '../types/plugins.js'; export type DaemonState = 'ready' | 'stopping' | 'stopped' | 'failed'; export type SessionRuntimeState = 'pending' | 'ready' | 'inactive' | 'failed'; export interface DaemonSessionInfo { localSessionId: string; title: string; cwd?: string; state: SessionRuntimeState; createdAt: string; updatedAt: string; } export interface StartDaemonOptions { auth: InternalAuthOptions; /** Idle Worker timeout in milliseconds. Set to 0 to disable reclamation. */ workerIdleTimeoutMs?: number; /** * Budget for the `daemon.initialize` round trip; defaults to 30s. * * The CLI lands the in-band credentials while handling initialize — token * exchange, user info, a possible host callback for the first token, and the * account tier prefill — so the wall time follows the host's network and the * CLI's own startup cost. Raise this when either is slow; initialize only * resolves once that work is complete. */ initializeTimeoutMs?: number; cwd?: string; pathToQoderCLIExecutable?: string; proxy?: string; env?: Record; } export interface Daemon { readonly state: DaemonState; listSessions(): Promise; renameSession(localSessionId: string, title: string): Promise; deleteSession(localSessionId: string): Promise; /** * Account-level queries, answered from the credentials the daemon was * started with — never from a Session's. They require a daemon that accepted * `StartDaemonOptions.auth` and reported `daemon_queries_v1`; otherwise they * reject. * * Unlike the per-`Query` equivalents these do not swallow failures into * `null`: capability is already negotiated here, so a rejection is a real * error (`DaemonRpcError` carries the daemon's code and retryable flag). */ getModels(options?: DaemonGetModelsParams): Promise; getByokConfig(): Promise; validateByokModel(input: DaemonValidateByokModelParams): Promise; listByokConfigs(): Promise; createByokConfig(input: CreateByokConfigInput): Promise; updateByokConfig(input: UpdateByokConfigInput): Promise; deleteByokConfig(target: DeleteByokConfigInput): Promise; checkByokConfig(input: CheckByokConfigInput): Promise; listPlugins(): Promise; getUsageInfo(): Promise; accountInfo(): Promise; stop(): Promise; } interface InternalDaemonRuntime { /** Local CLI launch context for feedback that bypasses the daemon. */ readonly hostActionLaunch: { proxy?: string; cliPath?: string; env?: Record; cwd?: string; }; readonly auth: InternalAuthOptions; readonly transportProvider: QueryTransportProvider; } export declare function getDaemonRuntime(daemon: Daemon): InternalDaemonRuntime | undefined; export declare function startDaemon(options: StartDaemonOptions): Promise; export {};