import type { Runner } from "../internals/proc.js"; export type Platform = "windows" | "darwin" | "linux"; export type GpuVendor = "nvidia" | "apple" | "amd" | "none"; export type AccelBackend = "cuda" | "mps" | "rocm" | "cpu"; export type EnvShell = "posix" | "powershell"; export interface GpuInfo { vendor: GpuVendor; backend: AccelBackend; /** Total VRAM in GB; 0 when unknown or no discrete GPU. */ vramGb: number; name?: string; } export interface VdiInfo { isVdi: boolean; /** The signal that matched, or why none did. */ reason: string; kind?: "citrix" | "workspaces" | "res" | "rdp" | "generic"; } export interface CertEntry { subject: string; /** PEM-encoded certificate (BEGIN/END CERTIFICATE). */ pem: string; } /** * OS-specific behaviour behind one interface. Only the adapter matching the host * is `verified` (smoke-tested on real metal); the others are implemented and * unit-tested against captured fixture output but flagged unverified. Every * method that shells out does so through the injected {@link Runner}. */ export interface HostAdapter { readonly platform: Platform; readonly verified: boolean; /** Corporate root CAs whose subject contains `pattern`, from the OS trust store. */ trustStoreCerts(pattern: string): Promise; /** Public CA certificates from the OS trusted-root stores; read-only and deduplicated. */ trustStoreRoots(): Promise; /** The argv that would restrict `path` to the current user (icacls/chmod). Not executed here. */ lockDownFileArgv(path: string): string[]; /** The argv that creates a directory symlink/junction at `linkPath` → `targetPath`. */ symlinkDirArgv(linkPath: string, targetPath: string): string[]; cpuPhysicalCores(): Promise; totalRamGb(): Promise; gpu(): Promise; detectVdi(): VdiInfo; /** Local, non-synced scratch root for caches/SQLite on this host. */ scratchDir(user: string): string; /** Shell profile file(s) where env exports belong. */ shellProfilePaths(): string[]; envShell(): EnvShell; /** * argv that persists a user-level env var SESSION-INDEPENDENTLY — i.e. where * GUI-launched apps (Kiro, Claude Desktop, an IDE) inherit it, not just new * shells. On Windows that is the per-user registry environment * (`HKCU\Environment`), written with `setx` — which ships on every supported * image and works under Constrained Language Mode, unlike a pwsh-only * `[Environment]::SetEnvironmentVariable`. On POSIX the durable seam is already * the shell-profile `envblock`, so this returns `[]` (the caller emits no exec). * A local mutation only — never contacts a remote. */ persistentEnvArgv(key: string, value: string): string[]; /** * Absolute path to npm's `npm-cli.js` relative to the running Node binary, used * to compose the doc'd npm self-heal (`node install -g npm`). * `undefined` when it cannot be located (npm not installed alongside Node). */ npmCliPath(): string | undefined; /** * argv for a read-only TLS reachability probe of `url`. Exit 0 = handshake OK; * a non-zero exit = TLS/proxy failure; a spawn error (tool absent) lets the * caller `skip`. Never mutates; the URL is a trusted module constant. */ tlsProbeArgv(url: string): string[]; } /** Construction shape shared by the concrete adapters. */ export type AdapterFactory = (run: Runner, env: NodeJS.ProcessEnv) => HostAdapter; /** Wrap raw base64 DER into a PEM certificate block with 64-char lines. */ export declare function derBase64ToPem(base64: string): string; /** Deduplicate certificate entries by their PEM bytes while preserving first-seen order. */ export declare function dedupeCertEntries(entries: readonly CertEntry[]): CertEntry[]; /** Validate a CA subject-match pattern (used in shell commands). Conservative allowlist. */ export declare function safeCaPattern(pattern: string): string; /** * Cross-platform, env-based VDI signals shared by every host adapter, checked * before the per-OS heuristics: * - `AIH_VDI_KIND=` lets fleet imaging pin the * platform deterministically — the only reliable way to flag Amazon WorkSpaces * or AVD, which expose no dependable env marker (this is what finally wires the * `workspaces` kind into a reachable code path); * - `AIH_FORCE_VDI=1` forces a generic VDI (back-compat; now honored on Windows * too, which previously ignored it); * - VMware / Omnissa Horizon exports `ViewClient_*` into the session, a genuine * env-detectable marker. * Returns undefined when nothing matches, so the caller's OS-specific heuristics run. */ export declare function vdiFromEnv(env: NodeJS.ProcessEnv): VdiInfo | undefined;