/** * AGT-03 pre-execution command gate — **config schema** portion. * * Mirrors the `CmdGateConfig` struct + defaults + env-resolve logic from * `edge-client/src/session/cmd_gate.rs`. The runtime **decision** logic * (`GateDecision`, `evaluate`) lives in `src/session/cmd-gate.ts` (Phase 2) * and imports the types defined here. * * This split mirrors the Rust layout where `config/settings.rs` references * `session::cmd_gate::CmdGateConfig` for the schema, while the `evaluate` * decision function lives in the same Rust file but is purely session-side. * In TS we separate config (here) from session logic to keep the dependency * graph clean: `config/` must not import from `session/`. */ /** * Gate enforcement mode. Serialized as lowercase in TOML (mirrors Rust's * `#[serde(rename_all = "lowercase")]`). * * - `off` — Legacy: never gate, never inspect. * - `warn` — Gate: every decision is Allow or RequireApproval; denylist hits * are surfaced for approval but never auto-denied. * - `block` — Strict (default): denylist hits → Deny; always_approve hits → * RequireApproval; everything else → Allow. */ export type CmdGateMode = 'off' | 'warn' | 'block'; /** * Configurable gate policy. Field names EXACTLY match the Rust struct. */ export interface CmdGateConfig { readonly mode: CmdGateMode; /** Tools that are always safe (read-only introspection). */ readonly allowlist: readonly string[]; /** Tool names that require operator approval (mutating/exec-class). */ readonly always_approve: readonly string[]; /** Substring patterns that force Deny (block) or RequireApproval (warn). */ readonly denylist: readonly string[]; /** Seconds to wait for operator approval before aborting pi. */ readonly timeout_s: number; } /** Default allowlist — read-only introspection tools. */ export declare function defaultAllowlist(): string[]; /** Default always-approve list — mutating/exec-class tools. */ export declare function defaultAlwaysApprove(): string[]; /** Default denylist — destructive substring patterns. */ export declare function defaultDenylist(): string[]; /** Default timeout for operator approval (seconds). */ export declare const DEFAULT_CMD_GATE_TIMEOUT_S = 60; /** Construct the default CmdGateConfig (safe defaults: block mode). */ export declare function defaultCmdGateConfig(): CmdGateConfig; /** * Parse a comma-separated string into a trimmed, non-empty string list. * Mirrors Rust's `parse_csv`. */ export declare function parseCsv(raw: string): string[]; /** * Resolve the gate config from env overrides. Env wins over the config value. * * Env names (mirrors Rust exactly): * - `EDGE_CMD_GATE_MODE` = `off` | `warn` | `block` * - `EDGE_CMD_GATE_TIMEOUT_S` = seconds * - `EDGE_CMD_GATE_ALLOWLIST` = comma-separated tool names (replaces) * - `EDGE_CMD_GATE_APPROVE` = comma-separated tool names (replaces) * - `EDGE_CMD_GATE_DENYLIST` = comma-separated patterns (replaces) */ export declare function resolveCmdGateConfig(env: Record, config: CmdGateConfig): CmdGateConfig;