import { SmrtCollection, SmrtObject } from '@happyvertical/smrt-core'; /** * Lifecycle status of a proposal: * * - `pending` — awaiting review; surfaced in the queue. * - `approved` — a reviewer activated it; the override was written. * - `rejected` — a reviewer declined it; recorded as a signal and never * re-surfaced (the runner dedups against it by fingerprint). * - `superseded` — a newer proposal replaced it before review. */ export type DirectiveProposalStatus = 'pending' | 'approved' | 'rejected' | 'superseded'; /** * Structured evidence backing a proposal — the ids of the learning episodes and * feedback signals the reflection consolidated. Pure references so the proposal * stays auditable without duplicating payloads. */ export interface DirectiveEvidence { /** `_smrt_contexts` row ids of the episodes considered. */ episodeIds?: string[]; /** {@link Feedback} row ids considered. */ feedbackIds?: string[]; /** Free-form supporting notes (e.g. counts, aggregate metrics). */ notes?: string[]; [key: string]: unknown; } /** * A stable content fingerprint for `(personaId, promptKey, proposedInstructions)`. * * Used to dedup proposals so an already-reviewed rewrite — in particular a * rejected one — is never re-surfaced. Pure FNV-1a so it needs no crypto import * and stays identical across Node and browser bundles. */ export declare function computeDirectiveFingerprint(personaId: string, promptKey: string, proposedInstructions: string): string; /** * A pending, human-reviewable proposed edit to a persona's instructions. */ export declare class DirectiveProposal extends SmrtObject { /** Owning tenant (required — proposals always target a tenant's persona). */ tenantId: string; /** The persona whose instructions this proposal would rewrite. */ personaId: string; /** Canonical agent class the persona configures (denormalised for queries). */ agentClass: string; /** * The registered prompt key whose template the persona's instructions map to. * Activation writes/updates the tenant-scoped override for this key. */ promptKey: string; /** The proposed replacement instructions (the new prompt template). */ proposedInstructions: string; /** Snapshot of the instructions at proposal time (for a review diff). */ currentInstructions: string; /** Model-authored explanation for the proposed change. */ rationale: string; /** Structured evidence, stored as a JSON string (see {@link getEvidence}). */ evidence: string; /** Lifecycle status. */ status: DirectiveProposalStatus; /** * Content fingerprint for dedup / not-re-surfacing. Set from * {@link computeDirectiveFingerprint} at creation time. */ fingerprint: string; /** Aggregate confidence in the proposal, in `[0, 1]`. */ confidence: number; /** Id of the principal (autonomous reflection actor) that proposed it. */ proposedBy: string; /** The reviewer (user id) that approved/rejected it, once reviewed. */ reviewedBy: string | null; /** When the proposal was reviewed. */ reviewedAt: Date | null; /** Reviewer note attached on approve/reject. */ reviewNote: string | null; /** The `prompt_override` id written on activation (`null` until approved). */ activatedOverrideId: string | null; /** Parse {@link evidence}, tolerating malformed JSON. */ getEvidence(): DirectiveEvidence; /** Replace {@link evidence}. */ setEvidence(value: DirectiveEvidence): void; /** Whether the proposal is still awaiting review. */ isPending(): boolean; } /** * Collection for {@link DirectiveProposal} rows — the review queue. */ export declare class DirectiveProposalCollection extends SmrtCollection { static readonly _itemClass: typeof DirectiveProposal; /** * The review queue: pending proposals, oldest first. Optionally scoped to a * persona. */ pending(options?: { personaId?: string; limit?: number; }): Promise; /** * Existing proposals for a persona carrying a given fingerprint, in any * status — used to avoid re-surfacing an already-seen (e.g. rejected) rewrite. */ findByFingerprint(personaId: string, fingerprint: string): Promise; } export default DirectiveProposal; //# sourceMappingURL=directive-proposal.d.ts.map