import { LearningMemoryRecord, LearningSemanticSearch, SmrtClassOptions } from '@happyvertical/smrt-core'; import { Feedback, FeedbackSignalType } from '@happyvertical/smrt-personas'; /** The minimal persona shape chat feedback needs to route the signal. */ export interface ChatFeedbackPersona { /** Persona id — required (a signal always judges a specific persona). */ id?: string | null; /** Owning tenant. */ tenantId?: string | null; /** Canonical agent class the persona configures (denormalised onto the row). */ agentClass?: string; /** Learning memory partition key. */ memoryScope?: string; } /** * Options for {@link captureChatFeedback}. */ export interface CaptureChatFeedbackOptions { /** Database handle. */ db: SmrtClassOptions['db']; /** The persona the signal judges. */ persona: ChatFeedbackPersona; /** The kind of signal. */ signalType: FeedbackSignalType; /** Correlation-id of the conversation turn this signal judges. */ correlationId: string; /** What {@link correlationId} names. Default `'chat_message'`. */ correlationType?: string; /** Learning episode scope the signal reinforces (matches recall/capture). */ scope: string; /** Learning episode key the signal reinforces. */ key: string; /** The user id that authored the signal (null for autonomous). */ actorId?: string | null; /** Numeric rating for a `rating` signal. */ rating?: number | null; /** Corrected value for a `correction` signal. */ correction?: string | null; /** Freeform note. */ comment?: string | null; /** Structured metadata persisted on the row. */ metadata?: Record; /** Apply the signal to memory immediately. Default `true`. */ reinforce?: boolean; /** Optional embedding search wired into the reinforced memory. */ semanticSearch?: LearningSemanticSearch; /** Neutral point of a `rating` scale (see `FeedbackOutcomeOptions`). Default 0. */ ratingNeutral?: number; } /** The outcome of capturing chat feedback. */ export interface ChatFeedbackResult { /** The persisted feedback row. */ feedback: Feedback; /** The memory record the signal reinforced, or `null` when it carried none. */ reinforced: LearningMemoryRecord | null; } /** * Capture one in-chat feedback signal as a {@link Feedback} row and (by default) * reinforce the persona's learning memory from it. * * @throws when the persona has no id (a signal must name a persisted persona). */ export declare function captureChatFeedback(options: CaptureChatFeedbackOptions): Promise; /** Shared options for the signal-typed convenience wrappers. */ export type ChatFeedbackBase = Omit; /** * Accept an applied change — reinforces the judged strategy as a success. */ export declare function acceptAppliedChange(options: ChatFeedbackBase): Promise; /** * Reject an applied change — decays the judged strategy toward the failure floor * so it stops being recalled. */ export declare function rejectAppliedChange(options: ChatFeedbackBase & { comment?: string | null; }): Promise; /** * Record an inline correction — decays the wrong strategy AND supersedes its * stored value with the corrected one, so the next recall returns the fix. */ export declare function correctResponse(options: ChatFeedbackBase & { correction: string; comment?: string | null; }): Promise; /** * Record a numeric rating for a response (scale is caller-defined; pass * `ratingNeutral` for a mid-point). */ export declare function rateResponse(options: ChatFeedbackBase & { rating: number; }): Promise; /** Thumbs-up — a `+1` rating (reinforces as a success against neutral 0). */ export declare function thumbsUp(options: ChatFeedbackBase): Promise; /** Thumbs-down — a `-1` rating (decays as a failure against neutral 0). */ export declare function thumbsDown(options: ChatFeedbackBase): Promise; //# sourceMappingURL=chat-feedback.d.ts.map