import type { ProgressHandle } from "./render/progress.js"; import type { VanaNetworkName } from "../core/network.js"; import { type ResolvedNode } from "../pdpp/host.js"; import { runOwnerBindingExchange } from "../personal-server/local/owner-binding.js"; import { type OwnerSecretStore } from "../personal-server/local/owner-secret.js"; import { startLocalServer, type PublicMarker, type RunningServer } from "../personal-server/local/server.js"; import { startDetachedServer } from "../personal-server/local/detach.js"; import { type DataDirResolution } from "../personal-server/local/data-dir.js"; import { type FrpcResolution } from "../personal-server/local/frpc.js"; import { signServerRegistration } from "../personal-server/local/registration.js"; import { type VanaCredentials } from "./auth.js"; export interface ServerStartIo { /** A line for a person; silent in --json mode. */ say(line: string): void; /** One machine-readable state change; only in --json mode. */ event(event: Record): void; /** Ask before a one-time install; never called with --no-input or --yes. */ confirm(message: string): Promise; /** A spinner line for waits; absent (or a no-op) outside a terminal. */ progress?: ProgressHandle; } export interface ServerStartDeps { findRunningServers: (fetchImpl?: typeof fetch) => Promise; loadCredentials: () => VanaCredentials | null; saveCredentials: (credentials: VanaCredentials) => Promise; secrets: OwnerSecretStore; exchange: typeof runOwnerBindingExchange; openBrowser: (url: string) => void; findNode: (range: string) => Promise; installNode: (logPath: string) => Promise; runtimeInstalled: () => boolean; ensureRuntime: (node: ResolvedNode, logPath: string) => Promise; choosePort: (requested?: number) => Promise; start: typeof startLocalServer; resolveFrpc: () => Promise; installFrpc: (logPath: string) => Promise; signRegistration: typeof signServerRegistration; readPublicMarker: (dataDir: string) => PublicMarker | null; writePublicMarker: (dataDir: string, marker: PublicMarker) => Promise; /** The owner's own data dir, moved there from an older layout if needed. */ resolveDataDir: (network: VanaNetworkName, owner: string, running: RunningServer[]) => Promise; /** The pid of a vana-started server running from a data dir. */ serverPidIn: (dataDir: string) => number | null; startDetached: typeof startDetachedServer; /** * Whether the running server, if it is the one this CLI runs for the * network, charges builder reads: false when an older CLI started it * without payment in its config, null when that cannot be told. */ runningServerCharges: (network: VanaNetworkName, identity: string | null) => boolean | null; /** * Resolves when the person asks the server to stop: Ctrl+C, or the SIGTERM * `vana server stop` sends. Called once per start, before the server runs. */ stopRequested: () => Promise; /** Claim the data dir for the life of this process (acquireDataDirLock). */ lockDataDir: (dataDir: string) => Promise<() => Promise>; /** Waits between restarts of a server that exited on its own. */ sleep: (ms: number) => Promise; now: () => number; } /** * Waits before each restart of a server that exited on its own. A server * that crashes again within {@link STABLE_RUN_MS} of starting counts as one * more rapid failure; once the waits run out the supervisor gives up. */ export declare const RESTART_DELAYS_MS: number[]; /** A server that ran this long before exiting starts the count over. */ export declare const STABLE_RUN_MS = 60000; export declare function defaultServerStartDeps(): ServerStartDeps; /** * True or false only for the server this CLI runs for the network, matched * by the key address its health reports; null for Desktop's server or when * the config cannot be read, since neither proves payment is off. */ export declare function runningServerCharges(network: VanaNetworkName, identity: string | null): boolean | null; /** * `vana server start`: run a Personal Server owned by the signed-in account, * in the foreground, when no server of theirs is already running. */ export declare function runServerStart(options: { network: VanaNetworkName; port?: number; noInput?: boolean; yes?: boolean; /** Stay local: no tunnel, no registration, nothing apps can reach. */ local?: boolean; /** Start in the background and return once it answers. */ detach?: boolean; }, io: ServerStartIo, deps?: ServerStartDeps): Promise; //# sourceMappingURL=server-start.d.ts.map