import { CONFIG_INIT_SCRIPT, INSTALL_SCRIPT, PROBE_SCRIPT, SHELL_SCRIPT_DIGESTS, START_SCRIPT, STATUS_SCRIPT } from "./generated/shell-scripts.js"; import { type InstallVersionResolver } from "./install-version.js"; import { type SshCommandResult } from "./adapters/ssh-exec.js"; export { CONFIG_INIT_SCRIPT, INSTALL_SCRIPT, PROBE_SCRIPT, SHELL_SCRIPT_DIGESTS, START_SCRIPT, STATUS_SCRIPT }; export declare const ROUTEKIT_PACKAGE = "@velum-labs/routekit"; /** * Asked before starting. `routekit start` is not reliably idempotent against a * daemon that came up with different effective listener options than the ones * it was asked for, so a running daemon is queried rather than restarted. */ export type RemoteProbe = { os: string; arch: string; node?: string; npm?: string; npmPrefix?: string; npmPrefixWritable: boolean; routekit?: string; supervisor: "systemd" | "launchd" | "none"; configExists: boolean; daemonRunning: boolean; }; export type RemoteGateway = { url: string; port?: number; pid?: number; version?: string; supervisor?: string; alreadyRunning: boolean; }; export type ProvisionStepId = "probe" | "install" | "config" | "start"; /** * `blocked` is a successful provision that stopped short of a running daemon, * which is the expected state of a host that has no provider credential yet. */ export type ProvisionStepStatus = "done" | "skipped" | "planned" | "blocked"; export type ProvisionStep = { id: ProvisionStepId; status: ProvisionStepStatus; detail: string; }; export type RemoteRunner = (argv: readonly string[], options: { timeoutMs: number; }) => Promise; export type ProvisionInput = { host: string; version: string; force?: boolean; dryRun?: boolean; run?: RemoteRunner; resolveVersion?: InstallVersionResolver; /** Fires before a step's remote work begins, for live progress. */ onStepStart?: (id: ProvisionStepId) => void; onStep?: (step: ProvisionStep) => void; }; export type ProvisionResult = { probe: RemoteProbe; steps: ProvisionStep[]; targetVersion: string; installedVersion?: string; gateway?: RemoteGateway; /** Set when the daemon could not start yet; carries the remote's reason. */ blocked?: string; /** Digests of the inlined shell programs that would run (or did run). */ scriptDigests?: typeof SHELL_SCRIPT_DIGESTS; }; /** * A version accepted for `npm install -g @`. Deliberately * narrow: dist-tags other than `latest`, ranges, and URLs are all rejected so * the specifier can never carry shell or npm-protocol meaning. */ export declare function validateInstallVersion(version: string): string; export declare function installSpecifier(version: string): string; /** Derive a remote registry name from an SSH destination. */ export declare function remoteNameFromSshHost(sshHost: string): string | undefined; export declare function parseProbe(stdout: string): RemoteProbe; /** The major version of a `vX.Y.Z` string, or undefined when unparseable. */ export declare function nodeMajor(version: string | undefined): number | undefined; /** The message from a remote `--json` failure payload, when there is one. */ export declare function remoteErrorMessage(stdout: string): string | undefined; export declare function probeRemoteHost(input: { host: string; run?: RemoteRunner; }): Promise; /** * Reject hosts the installer cannot bootstrap. Missing or old Node.js, and a * non-writable npm prefix, are no longer fatal: the inlined installer prefers * system npm when usable and otherwise downloads a pinned private Node runtime. */ export declare function assertInstallable(probe: RemoteProbe, host: string): void; /** * Bring `host` to a running RouteKit daemon. Every step is idempotent: an * up-to-date install, an existing canonical config, and an already-running * daemon are all reported as skipped rather than replayed. */ export declare function provisionRemoteHost(input: ProvisionInput): Promise;