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; /** The run the proving check landed in, so a reader links proof and run by id, not by time. */ runId: z.ZodOptional; }, "strip", z.ZodTypeAny, { at: number; grade: string; verdictId: string; runId?: string | undefined; }, { at: number; grade: string; verdictId: string; runId?: string | undefined; }>; 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; }, "strip", z.ZodTypeAny, { at: number; grade: string; verdictId: string; runId?: string | undefined; }, { at: number; grade: string; verdictId: string; runId?: string | undefined; }>>; /** 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; runId?: string | undefined; } | 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; runId?: string | undefined; } | 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; }, "strip", z.ZodTypeAny, { at: number; grade: string; verdictId: string; runId?: string | undefined; }, { at: number; grade: string; verdictId: string; runId?: string | undefined; }>>; /** 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; runId?: string | undefined; } | 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; runId?: string | undefined; } | 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: z.infer): Intent; /** * What declaring an intent that may already exist should leave stored. * * Declaring is what a re-run does — a flow re-saved, a feature's intents declared again in a later * session — and it replaced the record outright, so a proved rule lost its check and its proof every * time somebody said it again. Same words: nothing about the promise changed, so nothing is * discarded. Different words: the check usually survives a rewording, the proof cannot, because it * was evidence for words that are gone. The amendment itself is recorded by `upsertIntent`. */ export declare function redeclareIntent(existing: Intent | undefined, fresh: Intent): 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; /** * The next version of an intent, carrying the previous wording into its history when it changed. * * One rule for every store that keeps intents, so a flat ledger and a sharded one cannot keep two * different histories of the same promise. */ export declare function amendIntent(previous: Intent | undefined, next: Intent): Intent; /** * Is this a description of what was DONE rather than a statement of what must be TRUE? * * An intent is the business rule a teammate reads in six months. A step label is a log line, and a * ledger full of them buries the rules behind "click button \"Cancel\"" and inflates what is owed. */ export declare function isActionLabel(statement: string): boolean; /** 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;