import type { SupportedPlatform } from "./types.js"; /** * POSIX single-quote escape for embedding untrusted content inside a * single-quoted shell string. Pattern: close quote, escaped literal quote, * reopen quote. Universal across POSIX shells (sh, bash, dash, zsh). * * escapeSingleQuotesPosix("a'b") → "a'\\''b" * * The zod schema already forbids `'` in cwd, so today this function is a * no-op on legitimate input. v1.9.1 defense-in-depth: even if a future * feature relaxes the schema, the Linux tmux / gnome-terminal / konsole / * xterm paths stay safe because they escape before embedding. */ export declare function escapeSingleQuotesPosix(raw: string): string; /** * PowerShell single-quote escape — doubles each single quote inside a * single-quoted PowerShell string literal. PowerShell's own rule: * 'it''s' → it's * * Today the zod schema forbids `'` in cwd so this is also a no-op on * legitimate input. v1.9.1 defense-in-depth for the Windows powershell * driver's `Set-Location -LiteralPath ''` path. */ export declare function escapeSingleQuotesPowershell(raw: string): string; /** * Generate a short random suffix for tmux session names. * 4 hex chars = 2 bytes = 65,536 values. Used ONLY for the tmux session * name, never for the agent's relay identity. */ export declare function tmuxSessionSuffix(): string; /** Driver names accepted for RELAY_TERMINAL_APP override (v1.9). */ export declare const TERMINAL_APP_ALLOWLIST: ReadonlySet; /** * Platform-scoped allowlists — used by v1.9.1 to reject cross-platform * overrides (e.g., RELAY_TERMINAL_APP=gnome-terminal on macOS would silently * fall through in v1.9.0; now returns null with a warning, same as "unknown" * values). */ export declare const TERMINAL_APP_BY_PLATFORM: Record>; /** * Gate the RELAY_TERMINAL_APP env var against the platform's allowlist. * Returns the normalized value, or null if unset / invalid / cross-platform. * Invalid values fall through to auto-detect; caller may log a warning. * * v1.9.1 change: platform-aware. A Linux driver name on macOS returns null. * This makes the override semantics match operator intuition. */ export declare function resolveTerminalOverride(raw: string | undefined, platform: SupportedPlatform): string | null; /** * Normalize a CWD path for the target platform. * * The zod schema validates a POSIX-style path. On Windows, we normalize * forward slashes to backslashes (lexical only — does not relax the * allowlist; forbidden characters remain forbidden). * * v1.9.1 adds platform-aware rejection: * - POSIX (darwin, linux): a drive-letter prefix (C:\ / D:/ etc.) is a * Windows path and has no meaning here — reject it rather than let it * silently break the spawn. * - Windows (win32): the cwd must be absolute in Windows semantics (drive * letter OR forward-slash-anchored). Non-absolute Windows paths are * rejected. * * We do NOT `path.resolve()` here — the input is already an absolute path * per the schema, and resolve() would read process.cwd() which is a * spawn-host concern, not a target-agent concern. */ export declare function normalizeCwd(rawCwd: string, platform: SupportedPlatform): string; export declare function isValidTokenShape(raw: string | undefined | null): raw is string; /** * v2.1.4 (I10): validate a brief_file_path input — absolute, allowlist-matched, * exists, readable, <=10KB. Zod has already done the regex+char check at the * MCP boundary; this helper adds the filesystem-side invariants that cannot * be expressed in a Zod schema. * * Throws typed Error on any failure. Returns the canonical (as-passed) path * string on success — we deliberately do NOT realpath-resolve here; the * literal string is what spawn-agent.sh will embed into the KICKSTART * prompt, and keeping that equal to what the caller typed is the right UX. * * Size cap: 10240 bytes. Briefs larger than that should live in a repo * path the agent reads with its own Read tool at session start; 10KB is * enough for task scope + key constraints. */ export declare const BRIEF_FILE_MAX_BYTES = 10240; export declare function validateBriefPath(raw: string): { path: string; }; export declare function buildChildEnv(name: string, role: string, capabilities: string[], platform: SupportedPlatform, parentEnv?: NodeJS.ProcessEnv, /** * v2.2.0: window title the child terminal should advertise to the relay on * register. Defaults to the agent name when omitted. Flows through the * hook's register_agent call so the dashboard click-to-focus driver can * look up the live window by title. */ terminalTitle?: string | null): Record; //# sourceMappingURL=validation.d.ts.map