/**
 * Field library mutation helpers
 *
 * Pure, framework-free functions that add / edit / remove a reusable custom
 * field definition on a WorkspaceConfig. They return a new config object (the
 * input is never mutated) so the HTTP layer can persist the result through
 * `Workspace.writeConfig()`.
 *
 * Deliberately independent of SchemaRegistry / Zod entity validation: the
 * field library is *soft* metadata (it drives the picker + agent awareness),
 * not an enforced schema. Applying a field to an entry is an ordinary
 * frontmatter write elsewhere; nothing here touches entity validation.
 *
 * Identity is `key`, global across the workspace (one `phase` everywhere).
 * Editing options ripples to every entry using the field; existing entry
 * values are never touched (removal is non-destructive — orphaned values stay
 * on disk and simply stop being offered).
 */
import { type CustomFieldDef, type WorkspaceConfig } from './types.js';
/** A mutation that fails a precondition (not found, collision, bad shape). */
export declare class FieldLibraryError extends Error {
    /** Stable machine code so the route maps to a status without string-matching. */
    code: 'key_exists' | 'key_not_found' | 'invalid_field';
    constructor(message: string, 
    /** Stable machine code so the route maps to a status without string-matching. */
    code: 'key_exists' | 'key_not_found' | 'invalid_field');
}
/** Current field library (empty when none defined). */
export declare function getFieldLibrary(config: WorkspaceConfig): CustomFieldDef[];
/** Look up one definition by key. */
export declare function getFieldDef(config: WorkspaceConfig, key: string): CustomFieldDef | undefined;
/**
 * Validate a field definition's shape. Enforces the key shape and, for select
 * fields, a non-empty list of unique, non-empty options. Throws
 * FieldLibraryError on failure. Returns the parsed definition.
 */
export declare function validateFieldDef(input: unknown): CustomFieldDef;
/**
 * Add a new field definition. Returns a new WorkspaceConfig.
 * Rejects a key already used by another definition.
 */
export declare function addFieldDef(config: WorkspaceConfig, input: {
    key: string;
    label?: string;
    type?: 'select';
    options: string[];
    created_by?: string;
}): WorkspaceConfig;
/**
 * Update an existing definition's options and/or label. The key is the
 * identity and is not changed (renaming a key = add + remove, since it would
 * orphan existing usages). Returns a new WorkspaceConfig.
 */
export declare function updateFieldDef(config: WorkspaceConfig, key: string, patch: {
    options?: string[];
    label?: string;
}): WorkspaceConfig;
/**
 * Remove a definition from the library. Returns a new WorkspaceConfig.
 * Non-destructive to entries — any stored values stay in their frontmatter.
 */
export declare function removeFieldDef(config: WorkspaceConfig, key: string): WorkspaceConfig;
