import type { RootConfiguration } from "../config/types.js"; import type { OperationId } from "./operations.js"; /** * Per-environment write gate. Throws `INPUT_INVALID` unless the * environment is configured to allow writes (via `allowWrite` in * `sitecoreai.cli.json`, an `SITECOREAI_ENV__ALLOW_WRITE=true` * env var, or the per-invocation `override` boolean — typically the * caller's `--allow-write` flag). * * Used by hygiene cleanups, workflow mutations, and any other * caller-of-record for tenant-side writes. Same gate, one source of * truth — see `feedback_destructive_ops_need_consent` for the broader * consent model these commands sit inside. * * MCP note: when an MCP write tool is invoked, the registry dispatch * has already cleared the host's write-confirmation UX, so the MCP * layer auto-elevates `allowWrite: true` before calling runners. That * means *this* gate is effectively a no-op for MCP callers — the * library can't tell elevation apart from a direct `--allow-write`. * `ensureMcpElevationAllowed` is the companion gate enforced at the * MCP tool boundary; together they let an env opt out of MCP-driven * writes via `denyMcpElevation` without changing CLI behaviour. */ export declare const ensureAllowWrite: (root: RootConfiguration, envName: string, override?: boolean, operation?: OperationId) => void; /** * MCP boundary gate. Throws `AUTH_DENIED` when the target environment * has opted out of MCP-elevated writes via `denyMcpElevation: true`. * Call this from every MCP write tool's handler (auth: "write") before * delegating to a destructive runner — `ensureAllowWrite` alone can't * see the elevation origin once it's been folded into `options.allowWrite`. * * The intent is per-environment risk control: a sandbox env keeps the * default (MCP elevation allowed); a production-shaped env can set * `denyMcpElevation: true` to require every destructive op originate * from a human CLI invocation. The flag doesn't affect direct CLI use. */ export declare const ensureMcpElevationAllowed: (root: RootConfiguration, envName: string) => void;