/** * EXT-199 — Working directory resolution, containment, and out-of-project boundary checks * for shell commands. * * ## Out-of-Project Security Boundary (Ruling, Andrew, 2026-09-27) * "The project" is defined strictly as the session's startup work directory, captured once * and realpath-resolved ({@link getStartupWorkDir}). It is never a moved or dynamic value. * * An execution directory is considered OUTSIDE the project if its canonical (realpath) * location is not contained within the canonical startup work directory. * All escape vectors count as outside the project: * - Traversal with `..` that climbs out of the project root * - Absolute paths targeting locations elsewhere on the filesystem * - Symlinks located within the project tree whose targets resolve outside it * * Rung behaviour for out-of-project commands: * - `manual`, `write`, `assisted`: ALWAYS requires an explicit confirmation dialog from the * human, even when an allow rule or standing grant would otherwise approve the command. * - `auto`: ALWAYS requires the same confirmation dialog (rater-based auto-handling is EXT-200). * - `bypass`: runs without prompting. * * Inside the project, commands follow the normal flow for their rung. * * ## Grant Rule Inside the Project * A grant or allow-rule keyed on a command string (e.g. `pnpm test`) applies in EVERY subdirectory * of the project. When `cwd` is within the project root, a standing grant for `pnpm test` * approves `pnpm test` with `cwd: packages/app` without prompting. * However, that same grant will NOT auto-approve the command when `cwd` points outside the project; * the out-of-project prompt requirement outranks standing grants across all non-bypass rungs. * * @module */ /** * Checks whether `target` is within `parent` (or identical to it), accounting for * directory boundaries and platform path resolution. */ export declare function isPathInside(target: string, parent: string): boolean; export type ShellCwdResult = { kind: 'resolved'; cwd: string; isOutsideProject: boolean; startupWorkDir: string; } | { kind: 'refused'; message: string; }; /** * Resolves and validates a working directory for shell command execution. * * @param requestedCwd The requested working directory argument from the tool call. * @param baseDir The base directory to resolve relative paths against. Defaults to * `getCurrentWorkDir()`, and in the agent, `getShellWorkDir()`. * Never resolves against `process.cwd()`. */ export declare function resolveShellCwd(requestedCwd?: string, baseDir?: string): ShellCwdResult;