import { z } from 'zod'; /** * What a change was supposed to make true, captured while somebody still knows. * * An agent building a feature knows what it is for — which user does what, what should become true, * what the failure looks like. That knowledge lives in its context, and then the turn ends. Later, a * different turn or a different model drives the app and has to decide whether the feature works, * holding the DOM, the diff, and no intent. So it asserts what it can SEE rather than what was * MEANT, and what it can see is almost always weaker. That gap is where a false green comes from. * * ## Prose early, predicate late * * Fidelity is highest the moment the human asks and decays from there. Bindability — whether it can * be written as something checkable — is near zero then and rises as the code appears. So * `statement` is prose and mandatory, and `binding` is a predicate, optional, arriving later or * never. An intent that stays `declared` is not a failure: it names something the team meant that * nothing can currently prove. * * ## Amendments are append-only * * A long build changes its mind, so an intent must be amendable — and an amendable intent is also * how an agent could quietly rewrite what it meant to match what it can already prove. Keeping the * previous statement makes a NARROWING visible in the git diff. That is a PARTIAL defence and the * only one there is. */ export declare const INTENT_FILE_VERSION = 1; export declare const IntentState: { /** Prose only. Nothing yet says how it would be proved. */ readonly DECLARED: "declared"; /** A predicate exists that would prove it. */ readonly BOUND: "bound"; /** A verdict satisfied that predicate. */ readonly PROVED: "proved"; }; export type IntentState = (typeof IntentState)[keyof typeof IntentState]; /** Where the intent lives, so a later run can find the ones relevant to what it is touching. */ export declare const IntentSurfaceSchema: z.ZodObject<{ route: z.ZodOptional; flow: z.ZodOptional; files: z.ZodOptional>; }, "strip", z.ZodTypeAny, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }>; export type IntentSurface = z.infer; /** Which verdict discharged it, and how strongly. The grade is what makes a later weakening visible. */ export declare const IntentProofSchema: z.ZodObject<{ verdictId: z.ZodString; grade: z.ZodString; at: z.ZodNumber; }, "strip", z.ZodTypeAny, { at: number; grade: string; verdictId: string; }, { at: number; grade: string; verdictId: string; }>; export declare const IntentSchema: z.ZodObject<{ id: z.ZodString; /** The prose. Survives even when the binding rots, which is most of the point. */ statement: z.ZodString; state: z.ZodEnum<["declared", "bound", "proved"]>; declaredAt: z.ZodNumber; /** Left as `unknown`: core must not depend on the server's predicate vocabulary. */ binding: z.ZodOptional; surface: z.ZodOptional; flow: z.ZodOptional; files: z.ZodOptional>; }, "strip", z.ZodTypeAny, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }>>; provenBy: z.ZodOptional>; /** Every statement this intent previously carried, oldest first. Append-only, never rewritten. */ amended: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { state: "proved" | "declared" | "bound"; id: string; statement: string; declaredAt: number; surface?: { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; } | undefined; binding?: unknown; provenBy?: { at: number; grade: string; verdictId: string; } | undefined; amended?: { at: number; statement: string; }[] | undefined; }, { state: "proved" | "declared" | "bound"; id: string; statement: string; declaredAt: number; surface?: { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; } | undefined; binding?: unknown; provenBy?: { at: number; grade: string; verdictId: string; } | undefined; amended?: { at: number; statement: string; }[] | undefined; }>; export type Intent = z.infer; export declare const IntentFileSchema: z.ZodObject<{ version: z.ZodLiteral<1>; intents: z.ZodRecord; declaredAt: z.ZodNumber; /** Left as `unknown`: core must not depend on the server's predicate vocabulary. */ binding: z.ZodOptional; surface: z.ZodOptional; flow: z.ZodOptional; files: z.ZodOptional>; }, "strip", z.ZodTypeAny, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }, { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; }>>; provenBy: z.ZodOptional>; /** Every statement this intent previously carried, oldest first. Append-only, never rewritten. */ amended: z.ZodOptional, "many">>; }, "strip", z.ZodTypeAny, { state: "proved" | "declared" | "bound"; id: string; statement: string; declaredAt: number; surface?: { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; } | undefined; binding?: unknown; provenBy?: { at: number; grade: string; verdictId: string; } | undefined; amended?: { at: number; statement: string; }[] | undefined; }, { state: "proved" | "declared" | "bound"; id: string; statement: string; declaredAt: number; surface?: { route?: string | undefined; flow?: string | undefined; files?: string[] | undefined; } | undefined; binding?: unknown; provenBy?: { at: number; grade: string; verdictId: string; } | undefined; amended?: { at: number; statement: string; }[] | undefined; }>>; }, "strip", z.ZodTypeAny, { version: 1; intents: Record; }, { version: 1; intents: Record; }>; export type IntentFile = z.infer; export declare function emptyIntentFile(): IntentFile; export declare function declareIntent(input: { id: string; statement: string; now: number; surface?: IntentSurface; }): Intent; /** Attach the predicate that would prove it. Pure — returns a new intent. */ export declare function bindIntent(intent: Intent, binding: unknown): Intent; /** * Record that a verdict proved it. * * Refuses on an intent with no binding, and returns it unchanged rather than throwing: nothing could * have satisfied a predicate that does not exist, so a discharge there would be a claim with no * evidence — the shape this whole feature exists to stop. A throw would be the wrong shape too, * because discharge runs off the back of a verdict and must never be why one fails to return. */ export declare function dischargeIntent(intent: Intent, proof: { verdictId: string; grade: string; at: number; }): Intent; /** * Add or amend an intent, keeping the previous statement in its history. * * An amendment is recorded only when the statement actually changed — re-declaring the same intent * unchanged is what a re-run does, and filling the history with identical rows would bury the one * amendment somebody needs to see. */ export declare function upsertIntent(file: IntentFile, intent: Intent): IntentFile; /** Everything not yet proved — what an agent asking "am I done?" still owes. */ export declare function openIntents(file: IntentFile): Intent[]; /** Parse an intent file, failing soft to empty. Never throws — a cache must not take a daemon down. */ export declare function parseIntentFile(raw: unknown): IntentFile;