/**
 * Headless `--set <key>=<value>` action — non-secret field updates from
 * scripts/CI, with the same validation + agent propagation pipeline the Ink
 * TUI uses.
 *
 * Design:
 *  - Find the FieldDef in CATALOG by `key` (env-var style, e.g. WIGOLO_SEARCH).
 *  - Refuse `kind === 'masked'` / `secret: true` fields with a clear error —
 *    secrets leak via shell history; the dedicated secret-store path stays in
 *    charge of those.
 *  - Run the field's `validate()` (if any). Invalid input returns a
 *    description-grade message; no write happens.
 *  - Hydrate a fresh SettingsStore from the on-disk config, stage the value,
 *    and run the same `propagation.save()` flow used by the interactive shell.
 *  - Surface saved keys, propagated agents, and propagation failures so a
 *    script wrapper can react to a partial fan-out.
 */
import type { CategoryDef } from '../schema/types.js';
import type { SettingsStore } from '../state/settings-store.js';
import type { AgentTarget } from '../state/agent-targets.js';
import type { SaveResult, SecretStore, WritableFs } from '../state/propagation.js';
export type HeadlessSetStatus = 'ok' | 'unknown_key' | 'secret_rejected' | 'validation_failed' | 'persist_failed';
export interface HeadlessSetResult {
    status: HeadlessSetStatus;
    /** Human-readable line for stdout (status='ok') or stderr (everything else). */
    message: string;
    /** Settings keys that landed in config.json. Empty unless status='ok'. */
    saved: string[];
    /** Agent IDs whose env block was updated. Empty unless status='ok'. */
    propagated: string[];
    /** Per-agent failures (best-effort propagation). */
    failed: Array<{
        agentId: string;
        reason: string;
    }>;
}
export interface ApplyHeadlessSetOpts {
    /** Raw `key=value` payload after the `--set` flag. */
    key: string;
    value: string;
    /** Path to the on-disk config.json that should be mutated. */
    configPath: string;
    /** Catalog used to resolve `key` → FieldDef. */
    catalog: ReadonlyArray<CategoryDef>;
    /** Detected agent targets — failures are reported but do not abort the save. */
    agents: ReadonlyArray<AgentTarget>;
    /** Secret store passthrough — only invoked for misclassified fields (defence in depth). */
    secretStore: SecretStore;
    /** Override for tests; defaults to `createSettingsStore(persisted.settings)`. */
    storeFactory?: (initial: Readonly<Record<string, unknown>>) => SettingsStore;
    /** Override for tests; defaults to `readPersistedConfig(configPath).settings`. */
    readSettings?: (configPath: string) => Readonly<Record<string, unknown>>;
    /** Override for tests; defaults to `propagation.save()`. */
    save?: (opts: {
        store: SettingsStore;
        catalog: ReadonlyArray<CategoryDef>;
        configPath: string;
        agents: ReadonlyArray<AgentTarget>;
        secretStore: SecretStore;
        fs?: WritableFs;
    }) => Promise<SaveResult>;
    /** Override for tests; defaults to the real fs. */
    fs?: WritableFs;
}
export declare function applyHeadlessSet(opts: ApplyHeadlessSetOpts): Promise<HeadlessSetResult>;
//# sourceMappingURL=headless-set.d.ts.map