/** * Shared Setup Utilities * * Provider-agnostic setup operations used during workspace creation and resume. * Handles installing sudocode, configuring model credentials, * installing agents, setting up Tailscale, and running user setup scripts. * * Used by both CodespacesProvider and CoderProvider. * * @see s-4ge4 - Service Registry & Workspace Manifest spec * @see s-9cl3 - Unified Workspace Provider Architecture */ import type { SetupConfig, ExecFn } from './types.js'; import type { ResolvedService } from '../services/registry.js'; export type { ExecFn }; /** * Which setup path was taken by setupTailscale. * - 'already-running': Tailscale binary exists and daemon is running (tier 1) * - 'started-daemon': Tailscale binary exists but daemon was not running (tier 2) * - 'installed': Tailscale was not installed; full install performed (tier 3) */ export type TailscaleTier = 'already-running' | 'started-daemon' | 'installed'; export interface TailscaleSetupResult { tier: TailscaleTier; hostname: string; } interface TailscaleConfig { authKey?: string; controlServer?: string; stateDir?: string; mode?: 'userspace' | 'kernel'; } /** * Install sudocode globally and initialize it. * * Unconditional prerequisite for every workspace — runs during create() * regardless of whether SetupConfig is provided. * * Ensures Node.js >= 18 is available first, since default workspace * images may ship with an older version. * * @param workspaceName - The workspace name/identifier * @param exec - Function to execute commands in the workspace * @param workspaceDir - Optional directory to run `sudocode init` in */ export declare function installSudocode(workspaceName: string, exec: ExecFn, workspaceDir?: string): Promise; /** * Apply optional one-time setup configuration to a newly created workspace. * * Executes the following steps in order: * 1. Configure credentials (Anthropic/Claude) * 2. Install services from registry * 3. Configure Tailscale (if specified) * 4. Run user setup script * * @param workspaceName - The workspace name/identifier * @param exec - Function to execute commands in the workspace * @param setup - Setup configuration * @param workspaceDir - Optional working directory for service installs */ export declare function applySetupConfig(workspaceName: string, exec: ExecFn, setup: SetupConfig, workspaceDir?: string): Promise; /** Default state directory — on a volume that persists across workspace stop/start. */ export declare const DEFAULT_STATE_DIR = "/workspaces/.tailscale"; /** * Set up Tailscale in a workspace using progressive detection. * * Tier 1 (already-running): Binary exists and daemon is running — just `tailscale up`. * Tier 2 (started-daemon): Binary exists but daemon not running — start daemon, then join. * Tier 3 (installed): Not installed — remove broken apt repos, install, start daemon, join. * * Users who bake Tailscale into their devcontainer image get the fastest path (tier 1 or 2). * The default workspace image gets the full install (tier 3). * * @param workspaceName - Workspace name (also used as tailnet hostname) * @param exec - Function to execute commands in the workspace * @param config - Tailscale auth key and optional control server URL */ export declare function setupTailscale(workspaceName: string, exec: ExecFn, config: TailscaleConfig): Promise; /** * Start resolved services that are not already running. * Checks each service using its `check` command, starts if not running. * Only services with a `start` command are started (tools are install-only). * * @returns List of ports for services that were started (newly or already running). */ export declare function startServices(name: string, exec: ExecFn, services: ResolvedService[], workDir?: string): Promise; //# sourceMappingURL=setup.d.ts.map