import type { MemoryDisclosurePolicy, MemoryDurability, MemoryExplicitness, MemoryKind, MemoryRecord, MemorySensitivity, MemorySearchResult, MemorySignal, MemoryStatus } from '../../agent/memory/types.js'; export interface UpsertMemoryRecordInput { id?: string; providerId: string; kind: MemoryKind; userId?: string; sourceAgentId: string; workspaceId?: string; sessionKey?: string; projectId?: string; content: string; canonicalKey?: string; source?: MemoryRecord['source']; confidence?: number; tags?: string[]; status?: MemoryStatus; sensitivity?: MemorySensitivity; explicitness?: MemoryExplicitness; durability?: MemoryDurability; importance?: number; disclosurePolicy?: MemoryDisclosurePolicy; evidence?: MemoryRecord['evidence']; validFrom?: string; validTo?: string; reviewAfter?: string; expiresAt?: string; supersedesRecordId?: string; conflictGroupId?: string; nowMs?: number; } export interface ListMemoryRecordsOptions { providerId?: string; userId?: string; sourceAgentId?: string; workspaceId?: string; projectId?: string; /** Include unscoped records plus records visible to this session. */ visibleToSessionKey?: string; /** Return only records that are not scoped to a session. */ unscopedSessionOnly?: boolean; /** Include unscoped records plus records visible to this project. */ visibleToProjectId?: string; /** Return only records that are not scoped to a project. */ unscopedProjectOnly?: boolean; /** Include global records plus records visible to this workspace. */ visibleToWorkspaceId?: string; /** Return only records that are not scoped to a workspace. */ unscopedWorkspaceOnly?: boolean; kind?: MemoryKind; status?: MemoryStatus; canonicalKey?: string; limit?: number; offset?: number; } export interface SearchMemoryRecordsOptions { query: string; userId?: string; sourceAgentId?: string; workspaceId?: string; projectId?: string; /** Include unscoped records plus records visible to this session. */ visibleToSessionKey?: string; /** Return only records that are not scoped to a session. */ unscopedSessionOnly?: boolean; /** Include unscoped records plus records visible to this project. */ visibleToProjectId?: string; /** Return only records that are not scoped to a project. */ unscopedProjectOnly?: boolean; visibleToWorkspaceId?: string; unscopedWorkspaceOnly?: boolean; providerId?: string; kinds?: MemoryKind[]; statuses?: MemoryStatus[]; maxResults?: number; minScore?: number; } export interface AppendMemorySignalInput { signal: MemorySignal; providerId?: string; userId?: string; sourceAgentId?: string; workspaceId?: string; sessionKey?: string; nowMs?: number; } export interface MemorySignalRowPayload { signalId: string; source: string; recordId?: string; providerId?: string; userId?: string; sourceAgentId?: string; workspaceId?: string; sessionKey?: string; score?: number; content?: string; metadata: Record; createdAt: string; } export type MemoryFeedbackRating = 'helpful' | 'not_helpful' | 'mixed' | 'irrelevant' | 'incorrect' | 'outdated' | 'sensitive'; export interface MemoryFeedback { feedbackId: string; traceId: string; turnId: string; level: 'response' | 'record'; recordId?: string; rating: MemoryFeedbackRating; score?: number; reasonCode?: string; note?: string; source: 'user' | 'evaluator' | 'system'; createdAt: string; updatedAt: string; } export interface AppendMemoryTraceEventInput { traceId?: string; sessionKey?: string; turnId?: string; phase: 'search' | 'read' | 'write' | 'update' | 'delete' | 'sync' | 'inject' | 'test' | 'understanding'; providerId: string; sourceAgentId?: string; request?: unknown; resultCount?: number; selectedRecordIds?: string[]; skippedReason?: string; error?: string; durationMs?: number; nowMs?: number; } export interface SetMemoryTurnFeedbackInput { turnId: string; rating: MemoryFeedbackRating; score?: number; reasonCode?: string; note?: string; source?: MemoryFeedback['source']; records?: Array<{ recordId: string; rating: MemoryFeedbackRating; reasonCode?: string; note?: string; }>; nowMs?: number; } export interface MemoryTraceEventPayload { traceId: string; sessionKey?: string; turnId?: string; phase: string; providerId: string; request: unknown; resultCount?: number; selectedRecordIds: string[]; skippedReason?: string; error?: string; feedback: MemoryFeedback[]; durationMs: number; createdAt: string; } export interface MemoryRecallFeedbackSummary { recordId: string; helpful: number; notHelpful: number; mixed: number; irrelevant: number; total: number; averageScore: number | null; lastFeedbackAt?: string; } export declare function upsertMemoryRecord(input: UpsertMemoryRecordInput): MemoryRecord; export declare function getMemoryRecord(recordId: string): MemoryRecord | null; export declare function hasUnresolvedMemoryConflict(conflictGroupId: string): boolean; export declare function listMemoryRecords(options?: ListMemoryRecordsOptions): MemoryRecord[]; export declare function searchMemoryRecords(options: SearchMemoryRecordsOptions): MemorySearchResult[]; export declare function deleteMemoryRecord(recordId: string): boolean; /** Change lifecycle status without reconstructing or weakening the record's provenance. */ export declare function setMemoryRecordStatus(recordId: string, status: MemoryStatus, nowMs?: number): boolean; export declare function markMemoryRecordsConflicted(recordIds: string[], conflictGroupId: string): number; export declare function appendMemorySignal(input: AppendMemorySignalInput): string; export declare function listMemorySignals(options?: { recordId?: string; providerId?: string; userId?: string; sourceAgentId?: string; workspaceId?: string; limit?: number; }): MemorySignalRowPayload[]; export declare function getMemoryProviderState(providerId: string, scopeKey: string): unknown | null; export declare function setMemoryProviderState(providerId: string, scopeKey: string, state: unknown): void; export declare function appendMemoryTraceEvent(input: AppendMemoryTraceEventInput): string; export declare function listMemoryTraceEvents(options?: { providerId?: string; userId?: string; sourceAgentId?: string; sessionKey?: string; phase?: string; limit?: number; }): MemoryTraceEventPayload[]; export declare function setMemoryTurnFeedback(input: SetMemoryTurnFeedbackInput): MemoryTraceEventPayload | null; export declare function getMemoryTurnFeedback(turnId: string): MemoryTraceEventPayload | null; export declare function summarizeMemoryRecallFeedback(options?: { recordId?: string; providerId?: string; sourceAgentId?: string; sessionKey?: string; limit?: number; }): MemoryRecallFeedbackSummary[];