/**
 * Shared state-I/O helpers for the CLI's `*_state.ts` files (T-SIC).
 *
 * Four helpers consolidate four patterns previously reimplemented across
 * webhooks_state, permissions_state, triggers_state, schedule_state
 * (full inventory + duplication shape in T-state-io-consolidate
 * pre-research §1 + §2):
 *
 *   - writeKeyedYamlList — atomic `mkdir + tmp + writeFile + rename` for
 *     a YAML file whose root is `{ <key>: [...items] }`. Empty-list
 *     branch emits the literal `${key}: []\n` (T-SIC L9 — byte-preserves
 *     the existing on-disk format; `yaml.stringify` emits the same bytes
 *     without a trailing newline, so we hand-craft to match).
 *   - readKeyedYamlList — read the same shape with ENOENT default +
 *     bespoke error label (T-SIC L4) + per-row TypeGuard predicate
 *     (T-SIC L3, drops invalid rows silently — matches the existing
 *     posture across all five sites).
 *   - appendJsonlEntry — `mkdir + appendFile` for JSON-line audit logs.
 *   - readJsonlEntries — read JSONL with ENOENT default + silent
 *     malformed-line skip (T-SIC L11 — schedule_state.readHistory's
 *     previous strict-throw is normalized to silent-skip to match
 *     permissions_state.readAuditEntries; verified no test relied on
 *     the throw).
 *
 * Imports from: node:fs/promises, node:path, yaml.
 * Imported by: webhooks_state.ts, permissions_state.ts, triggers_state.ts,
 *   schedule_state.ts + state_io.test.ts.
 */
/**
 * Atomic keyed-YAML-list write. The body is `{ [key]: [...items] }`
 * serialized via `yaml.stringify`, OR the literal `${key}: []\n` when
 * `items` is empty (T-SIC L9 — byte-preserves the existing on-disk
 * format).
 *
 * Atomicity contract: write to `${path}.tmp` first, then `rename` onto
 * `path`. The `tmp` file lives in the SAME directory so the rename
 * stays on one filesystem (POSIX atomicity guarantee). Concurrent CLI
 * invocations are not serialized here — callers MUST pass the FULL
 * desired list (per the existing JSDoc convention on writeWebhooksFile
 * et al.).
 */
export declare function writeKeyedYamlList<T>(path: string, key: string, items: readonly T[]): Promise<void>;
/**
 * Read a YAML mapping with a single list key.
 *
 * Returns `defaultValue` (default `[]`) on ENOENT, an empty root mapping,
 * or a missing key. Throws a `${label}`-prefixed error on malformed YAML,
 * the root not being a mapping, or the key not being a list. `predicate`
 * filters per-row to the validated `T` shape; rows that fail the
 * predicate are dropped silently (matches every existing call site's
 * posture — drift on a single row mustn't break the whole CLI verb).
 */
export declare function readKeyedYamlList<T>(path: string, key: string, label: string, predicate: (v: unknown) => v is T, defaultValue?: T[]): Promise<T[]>;
/** Append one JSON-encoded entry as a newline-terminated line. `mkdir -p` first. */
export declare function appendJsonlEntry(path: string, entry: unknown): Promise<void>;
/**
 * Read JSONL, skipping malformed lines silently. ENOENT → `[]`.
 *
 * T-SIC L11 NOTE: the previous `schedule_state.readHistory` posture was
 * `.map(line => JSON.parse(line))` which throws on the first malformed
 * line. This helper instead skips malformed lines (matches the previous
 * `permissions_state.readAuditEntries` posture). Verified no test relied
 * on the strict-throw; the user-facing improvement is that a single
 * corrupted line can't break the whole CLI verb.
 */
export declare function readJsonlEntries<T = unknown>(path: string): Promise<T[]>;
//# sourceMappingURL=state_io.d.ts.map