import { z } from 'zod'; export { EvidenceBriefSchema, hasAllFourBriefSections, parseEvidenceBrief, safeParseEvidenceBrief } from './crystallization-brief-schema.js'; export type { EvidenceBrief } from './crystallization-brief-schema.js'; /** * CrystallizationEvent — spec §4.5 / §4.7 / §5. * * M5 scope: the crystallization_event table + the 4-section * evidence_brief projection (spec §4.7 / §10 RL-7). Every * user-facing recommendation is gated on the brief being complete; * the schema below enforces the 4-section shape at parse time. * * Hard rules enforced at the boundary (and re-asserted in the * service layer): * * 1. The 4 brief sections (what_happened / why_it_matters / * what_learned / what_action) are ALL required. A partial * brief is a hard parse error (`MISSING_BRIEF_SECTION`), * and `parseCrystallizationEvent` will throw. * 2. The trigger enum mirrors spec §4.5 exactly: * user_explicit | llm_suggested | success_default_prompt | * similar_task_recurrence. * 3. The event's own lifecycle_status is ORTHOGONAL to the * created/updated loop_release.lifecycle_status — the same * asset can have many crystallization events over its life. * 4. source_trace_pointers are stable ids (the workflow trace * id space), not path strings — the column is JSON-array of * strings. * 5. The brief section guard is implemented as a `.refine(...)` * on the input schema — the canonical 4 keys must be present * with non-empty values (the spec mandates 1-2 sentences per * section; an empty string would be a degenerate brief). * * Out of scope (deferred to later slices): * - cross-event aggregation (loop crystallized N times). * - brief rewrite-on-update semantics (M8 dogfood). */ export declare const CrystallizationTriggerSchema: z.ZodEnum<{ user_explicit: "user_explicit"; llm_suggested: "llm_suggested"; success_default_prompt: "success_default_prompt"; similar_task_recurrence: "similar_task_recurrence"; }>; export type CrystallizationTrigger = z.infer; export declare const CRYSTALLIZATION_TRIGGERS: readonly CrystallizationTrigger[]; export declare const CrystallizationEventStatusSchema: z.ZodEnum<{ candidate: "candidate"; stable: "stable"; retired: "retired"; }>; export type CrystallizationEventStatus = z.infer; /** * Zod schema for the create payload (CrystallizationEventInput). * * Re-validates the evidence_brief inline; calling code may ALSO call * `EvidenceBriefSchema.parse` separately if it builds the brief out * of band. The CrystallizationEvent input schema wires the same * guard so a brief cannot sneak through via a partial-input path. */ export declare const CrystallizationEventInputSchema: z.ZodObject<{ trigger: z.ZodEnum<{ user_explicit: "user_explicit"; llm_suggested: "llm_suggested"; success_default_prompt: "success_default_prompt"; similar_task_recurrence: "similar_task_recurrence"; }>; evidence_brief: z.ZodObject<{ what_happened: z.ZodString; why_it_matters: z.ZodString; what_learned: z.ZodString; what_action: z.ZodString; }, z.core.$strict>; evidence_bullets: z.ZodDefault>; source_trace_pointers: z.ZodDefault>; evaluator_summary: z.ZodDefault; user_decision_summary: z.ZodDefault; created_loop_release_id: z.ZodOptional; updated_loop_release_id: z.ZodOptional; created_bee_release_id: z.ZodOptional; updated_bee_release_id: z.ZodOptional; lifecycle_status: z.ZodDefault>; }, z.core.$strip>; export type CrystallizationEventInput = z.input; /** * Full persisted row schema. Adds `id` (the event id) and stamps * `schema_version` to the fixed literal `peaks.crystallization/1`. * * Brief section guard is INHERITED from `EvidenceBriefSchema.refine` * because `EvidenceBriefSchema` is embedded; the service layer still * re-asserts the guard so a hand-crafted row cannot bypass Zod at * the store boundary. */ export declare const CrystallizationEventSchema: z.ZodObject<{ trigger: z.ZodEnum<{ user_explicit: "user_explicit"; llm_suggested: "llm_suggested"; success_default_prompt: "success_default_prompt"; similar_task_recurrence: "similar_task_recurrence"; }>; evidence_brief: z.ZodObject<{ what_happened: z.ZodString; why_it_matters: z.ZodString; what_learned: z.ZodString; what_action: z.ZodString; }, z.core.$strict>; evidence_bullets: z.ZodDefault>; source_trace_pointers: z.ZodDefault>; evaluator_summary: z.ZodDefault; user_decision_summary: z.ZodDefault; created_loop_release_id: z.ZodOptional; updated_loop_release_id: z.ZodOptional; created_bee_release_id: z.ZodOptional; updated_bee_release_id: z.ZodOptional; lifecycle_status: z.ZodDefault>; id: z.ZodString; schema_version: z.ZodDefault>; created_at: z.ZodString; }, z.core.$strip>; export type CrystallizationEvent = z.infer; /** * Convenience: strict-parse an unknown payload into a * CrystallizationEvent row. Throws ZodError on failure — including * when the brief is missing a section (the `.refine` guard fires). * * Use this at every parse boundary (CLI input, store insertion). */ export declare function parseCrystallizationEvent(input: unknown): CrystallizationEvent; /** * Safe-parse twin of parseCrystallizationEvent. Returns a Result-like * envelope so callers (CLI / tests) can render findings without * try/catch noise. The `code` field is `MISSING_BRIEF_SECTION` when * the brief refine guard trips OR when ANY brief-section key is * missing (spec §10 RL-7) — distinguishes brief failures from * generic validation errors. */ export declare function safeParseCrystallizationEvent(input: unknown): { ok: true; row: CrystallizationEvent; } | { ok: false; code?: 'MISSING_BRIEF_SECTION'; findings: Array<{ path: string; message: string; }>; };