import { z } from 'zod';
export declare const projectContextEntryKinds: readonly ["definition", "context"];
export declare const PROJECT_CONTEXT_FILE_VERSION = 2;
export type AiProjectContextTypedObjectRef = {
    type: 'explore';
    name: string;
} | {
    type: 'field';
    explore: string;
    fieldId: string;
};
export type AiProjectContextObjectRef = string | AiProjectContextTypedObjectRef;
export declare const aiProjectContextTypedObjectRefSchema: z.ZodType<AiProjectContextTypedObjectRef>;
export declare const aiProjectContextObjectRefSchema: z.ZodType<AiProjectContextObjectRef>;
export declare const serializeAiProjectContextObjectRef: (ref: AiProjectContextObjectRef) => string;
export declare const formatAiProjectContextObjectRef: (ref: AiProjectContextObjectRef) => string;
export declare const projectContextEntrySchema: z.ZodObject<{
    id: z.ZodString;
    kind: z.ZodEnum<["definition", "context"]>;
    content: z.ZodString;
    terms: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
    objects: z.ZodDefault<z.ZodArray<z.ZodType<AiProjectContextObjectRef, z.ZodTypeDef, AiProjectContextObjectRef>, "many">>;
}, "strip", z.ZodTypeAny, {
    id: string;
    kind: "definition" | "context";
    content: string;
    terms: string[];
    objects: AiProjectContextObjectRef[];
}, {
    id: string;
    kind: "definition" | "context";
    content: string;
    terms?: string[] | undefined;
    objects?: AiProjectContextObjectRef[] | undefined;
}>;
export type ProjectContextEntry = z.infer<typeof projectContextEntrySchema>;
export type ProjectContextWritebackEntry = {
    op: 'create' | 'update';
    id: string | null;
    kind: ProjectContextEntry['kind'];
    content: string;
    terms: string[];
    objects: AiProjectContextTypedObjectRef[];
};
/**
 * Apply a judge-emitted entry to the current file entries, by id. A create with
 * no id derives a stable id from the first term/content (suffixed on collision);
 * an explicit id that already exists updates in place (dedup backstop).
 */
export declare const mergeProjectContextEntry: (existing: ProjectContextEntry[], judgeEntry: ProjectContextWritebackEntry) => {
    entries: ProjectContextEntry[];
    entryId: string;
    op: "create" | "update";
};
export declare const PROJECT_CONTEXT_FILE_HEADER: string;
export declare const serializeProjectContextFile: (entries: ProjectContextEntry[]) => string;
/**
 * Load project_context YAML contents. Accepts the canonical `{ version, entries }`
 * shape and a legacy bare-array file. Invalid files throw with schema-backed
 * errors, and `id` is derived when absent.
 */
export declare const loadProjectContextFile: (yamlContents: string) => ProjectContextEntry[];
/**
 * Apply a judge-emitted entry and return the new file contents, the entry id,
 * and whether it created or updated. For a canonical `{ version, entries }`
 * file this edits the parsed YAML document in place — appending the new entry
 * (or replacing the one matching `id`) — so the resulting diff is just the
 * touched entry, with comments, quoting and key order in the rest of the file
 * preserved. Empty or legacy (bare-array) files fall back to a fresh canonical
 * serialization.
 */
export declare const applyProjectContextWriteback: (existingContent: string, judgeEntry: ProjectContextWritebackEntry) => {
    content: string;
    entryId: string;
    op: "create" | "update";
    upgradesFileToV2: boolean;
};
//# sourceMappingURL=projectContext.d.ts.map