export type PrincipleApplicationLevel = 'effect' | 'presence'; export type PrincipleApplicationKind = 'rule_blocked' | 'auto_correct_applied' | 'self_reported' | 'prompt_injected'; export interface PrincipleApplicationInput { principleId: string; activationId?: string; ruleId?: string; channel: 'code_tool_hook' | 'prompt'; level: PrincipleApplicationLevel; kind: PrincipleApplicationKind; sessionId?: string; toolName?: string; filePath?: string; digest?: string; } /** * Record one application event. Returns true when a row was written (or * deduped), false on failure — callers must surface the reason (rc-9). */ export declare function recordPrincipleApplication(workspaceDir: string, input: PrincipleApplicationInput): boolean; /** * Align activation ids with the actually-injected principle subset (PRI-531 * review fix). Budget truncation can drop principles from the tail of the * full list — pairing by raw index would attach the wrong activation_id to a * presence row (rc-6-adjacent data pairing). */ export declare function alignActivationIds(principles: ReadonlyArray<{ principleId: string; activationId?: string; }>, injectedIds: ReadonlySet): string[]; /** * Filter a candidate list down to the actually-injected subset, deduped by * principleId in first-occurrence order (PRI-537). Callers derive every * paired field (principleId/activationId/artifactId) from this single list, * so index alignment cannot drift between them. Supersedes per-field helpers * like alignActivationIds for new call sites. */ export declare function alignInjectedPrinciples(principles: ReadonlyArray, injectedIds: ReadonlySet): T[]; /** * Presence rows for a prompt injection event — one per principle, deduped per * session×principle by the partial unique index (restarts included). * Returns the number of NEW rows written (0 when all were already present). * Failures are warned via the optional logger (rc-9) — never thrown. */ export declare function recordInjectionPresence(workspaceDir: string, principleIds: readonly string[], sessionId: string | undefined, activationIds?: readonly string[], logger?: { warn?: (message: string) => void; info?: (message: string) => void; }): number; export declare function recordSelfReportFromText(workspaceDir: string, text: unknown, sessionId: string | undefined, logger?: { warn?: (message: string) => void; info?: (message: string) => void; }): number; /** Test hook: close cached connections and reset the retention sweep clock. */ export declare function clearPrincipleApplicationLedgerCache(): void;