/**
 * Sandbox environment for routine job execution.
 *
 * Creates an overlay HOME directory per job with symlinked allowed
 * directories and agent-specific config files (permissions, settings).
 * The spawned agent process sees only the overlay, limiting filesystem
 * access to explicitly allowed paths.
 */
import type { JobConfig } from './scheduling/routines.js';
import type { AgentId } from './types.js';
/**
 * Absolute path to this host's `gh` config directory (`hosts.yml` + `config.yml`),
 * or null when the host has never run `gh auth login`. Prefer `GH_CONFIG_DIR` when
 * the parent already pinned one; otherwise `$XDG_CONFIG_HOME/gh` or `~/.config/gh`.
 */
export declare function resolveHostGhConfigDir(): string | null;
/** True when this host holds usable GitHub CLI auth (hosts.yml or a token env). */
export declare function hostHasGhAuth(): boolean;
/** Build a restricted environment for a sandboxed process, setting HOME to the overlay. */
export declare function buildSpawnEnv(overlayHome: string, extraEnv?: Record<string, string>): Record<string, string>;
/**
 * Get the overlay HOME directory path for a named job.
 *
 * The job name originates from routine YAML (`name:` field or file basename),
 * which can arrive from a synced user/system config repo. `safeJoin` contains
 * it to a single segment beneath the routines dir so a crafted name such as
 * `../../../..` cannot steer `prepareJobHome`/`cleanJobHome` (which does a
 * recursive `rmSync`) at a path outside `~/.agents/routines`.
 */
export declare function getJobHomePath(name: string): string;
/** Create a fresh overlay HOME for a job, including agent config and allowed-dir symlinks. */
export declare function prepareJobHome(config: JobConfig, version?: string): string;
/** Link only the selected harness login into the disposable routine HOME. */
export declare function linkVersionAuth(overlayHome: string, agent: AgentId, version?: string): void;
/**
 * Link this host's `gh` config directory into the disposable overlay so
 * `$HOME/.config/gh` resolves even when `GH_CONFIG_DIR` is unset. Mirrors
 * `generateCursorConfig`: same-host credentials, never copied to another box.
 */
export declare function linkHostGhConfig(overlayHome: string): void;
/**
 * Refuse to launch a sandboxed child when THIS host holds GitHub auth but the
 * spawn env would hide it. The RUSH-2860 failure mode was silent: the monitor
 * fire recorded `ok` (spawn succeeded) while every `gh` call inside the child
 * failed. Prefer forwarding (buildSpawnEnv / linkHostGhConfig); this assert is
 * the regression tripwire — if forwarding ever regresses, fail loud at spawn
 * instead of recording a hollow success. No-ops when the host has no gh auth
 * (jobs that do not need GitHub still run).
 */
export declare function assertSandboxForwardsHostGhAuth(spawnEnv: Record<string, string>): void;
/** Link this host's Cursor login and CLI config into the disposable overlay. */
export declare function generateCursorConfig(overlayHome: string): void;
/** Remove a job's overlay HOME directory entirely. */
export declare function cleanJobHome(name: string): void;
/** Symlink allowed directories into the overlay HOME, skipping paths outside the real HOME. */
export declare function symlinkAllowedDirs(overlayHome: string, dirs: string[]): void;
/** Generate a Claude settings.json in the overlay with scoped permissions from the job config. */
export declare function generateClaudeConfig(overlayHome: string, config: JobConfig): void;
/** Generate a Codex config.toml in the overlay with model and approval-mode settings. */
export declare function generateCodexConfig(overlayHome: string, config: JobConfig): void;
