/**
 * SchemaRegistry
 *
 * Builds and caches merged Zod schemas from workspace config schema_extensions.
 * Supports additive extensions to existing entity types and fully custom new types.
 */
import { z } from 'zod';
import { FieldDefinition, SchemaExtension } from './types.js';
import { type DateRole } from './validation.js';
/**
 * Whether a Zod field is system-managed (`.meta({ internal: true })`) and so
 * must NOT be surfaced as a user/agent-editable field or seeded with an empty
 * default. The single source of truth for "this field is set by the system,
 * not by people" — consulted by `describeZodObject` (which feeds the
 * `/api/schema/:type/fields` endpoint, the property panel, and the agent's
 * `get_entity_schema`) and by the graph create/changeType field seeders.
 */
export declare function isInternalField(schema: z.ZodTypeAny): boolean;
/**
 * Per-field descriptor used by the `get_entity_schema` agent tool and the
 * `/api/schema/:entityType/fields` HTTP endpoint. Optional members are only
 * set when the underlying Zod node carries that information.
 */
export interface SchemaFieldDescriptor {
    type: string;
    optional: boolean;
    description: string;
    enum?: string[];
    default?: unknown;
    itemType?: string;
    itemEnum?: string[];
    /** Date vocabulary metadata (only on `date` / `start_date`). `role`
     *  distinguishes the primary date from a range start; `label` is the
     *  type-specific display name (e.g. "Due date" on a task). */
    role?: DateRole;
    label?: string;
    /** Reference-target type (e.g. `assignee` → `person`). Marks a wikilink
     *  field that must resolve to a specific entity type. Pickers scope to it;
     *  the write-path validator in entity-mutations.ts enforces it. */
    refType?: string;
}
/**
 * Walk a Zod object schema and emit per-field descriptors. Surfaces enums,
 * array element types, string formats (url/email/datetime), defaults, and
 * descriptions — the metadata the agent needs to write valid frontmatter
 * without memorizing schemas.
 */
export declare function describeZodObject(schema: z.ZodTypeAny): Record<string, SchemaFieldDescriptor>;
/**
 * Built-in reference fields that must resolve to a specific entity type,
 * keyed by entity type → field → required target type. Derived once from the
 * `refType` `.meta()` markers on the built-in schemas (today: `task.assignee`
 * → `person`). The write-path validator in entity-mutations.ts reads this to
 * reject a wikilink that resolves to the wrong type. Extension fields aren't
 * scanned here — only the built-in Zod schemas carry `refType` markers.
 */
export declare function builtinRefTypeFields(entityType: string): Record<string, string>;
export declare class SchemaRegistry {
    private extensions;
    private schemaCache;
    private fieldDefsCache;
    constructor(extensions?: Record<string, SchemaExtension>);
    private build;
    /**
     * Get the Zod schema for an entity type (built-in + extensions, or custom).
     * Falls back to the built-in schema, then EntityBaseSchema.
     */
    getSchema(entityType: string): z.ZodTypeAny;
    /**
     * Get the declared field definitions for an entity type.
     * For extended built-in types: returns additional_fields only.
     * For custom types: returns all fields.
     * For types with no extension: returns [].
     */
    getFieldDefs(entityType: string): FieldDefinition[];
    /**
     * Get the body template for an entity type.
     * Workspace extension body_template overrides built-in defaults.
     * Returns null for types with no template (e.g., note, dataset).
     */
    getBodyTemplate(entityType: string): string | null;
    /**
     * Get field metadata for an entity type by introspecting the Zod schema.
     * Returns field name, inferred type, required status, and description.
     * Enum values, defaults, and array element metadata are surfaced when
     * present so the agent can write valid frontmatter without memorizing
     * schemas.
     */
    getFieldMetadata(entityType: string): Array<{
        name: string;
        type: string;
        required: boolean;
        description?: string;
        enum?: string[];
        default?: unknown;
        itemType?: string;
        itemEnum?: string[];
        role?: DateRole;
        label?: string;
        refType?: string;
    }>;
    /**
     * The custom display label for an entity type, if one is defined in the
     * workspace's schema extensions (e.g. a custom type "client" labelled
     * "Client Account"). Returns undefined for built-in types and unlabelled
     * extensions — callers fall back to title-casing the type key.
     */
    getCustomTypeLabel(type: string): string | undefined;
    /**
     * Get all entity type names: built-in types + custom extension types.
     */
    getAllTypes(): string[];
    /**
     * Return a formatted prompt section describing the workspace's schema extensions.
     * Returns "" when no extensions are defined.
     */
    toPromptSection(): string;
}
