UNPKG

@emdashcodes/mem0-claude-code

Version:

The Memory Layer For Your AI Apps - Fork with Claude Code LLM provider support

274 lines (271 loc) 7.46 kB
interface Common { project_id?: string | null; org_id?: string | null; } interface MemoryOptions { api_version?: API_VERSION | string; version?: API_VERSION | string; user_id?: string; agent_id?: string; app_id?: string; run_id?: string; metadata?: Record<string, any>; filters?: Record<string, any>; org_name?: string | null; project_name?: string | null; org_id?: string | number | null; project_id?: string | number | null; infer?: boolean; page?: number; page_size?: number; includes?: string; excludes?: string; enable_graph?: boolean; start_date?: string; end_date?: string; custom_categories?: custom_categories[]; custom_instructions?: string; timestamp?: number; output_format?: string | OutputFormat; async_mode?: boolean; filter_memories?: boolean; immutable?: boolean; structured_data_schema?: Record<string, any>; } interface ProjectOptions { fields?: string[]; } declare enum OutputFormat { V1 = "v1.0", V1_1 = "v1.1" } declare enum API_VERSION { V1 = "v1", V2 = "v2" } declare enum Feedback { POSITIVE = "POSITIVE", NEGATIVE = "NEGATIVE", VERY_NEGATIVE = "VERY_NEGATIVE" } interface MultiModalMessages { type: "image_url"; image_url: { url: string; }; } interface Messages { role: "user" | "assistant"; content: string | MultiModalMessages; } interface Message extends Messages { } interface MemoryHistory { id: string; memory_id: string; input: Array<Messages>; old_memory: string | null; new_memory: string | null; user_id: string; categories: Array<string>; event: Event | string; created_at: Date; updated_at: Date; } interface SearchOptions extends MemoryOptions { api_version?: API_VERSION | string; limit?: number; enable_graph?: boolean; threshold?: number; top_k?: number; only_metadata_based_search?: boolean; keyword_search?: boolean; fields?: string[]; categories?: string[]; rerank?: boolean; } declare enum Event { ADD = "ADD", UPDATE = "UPDATE", DELETE = "DELETE", NOOP = "NOOP" } interface MemoryData { memory: string; } interface Memory { id: string; messages?: Array<Messages>; event?: Event | string; data?: MemoryData | null; memory?: string; user_id?: string; hash?: string; categories?: Array<string>; created_at?: Date; updated_at?: Date; memory_type?: string; score?: number; metadata?: any | null; owner?: string | null; agent_id?: string | null; app_id?: string | null; run_id?: string | null; } interface MemoryUpdateBody { memoryId: string; text: string; } interface User { id: string; name: string; created_at: Date; updated_at: Date; total_memories: number; owner: string; type: string; } interface AllUsers { count: number; results: Array<User>; next: any; previous: any; } interface ProjectResponse { custom_instructions?: string; custom_categories?: string[]; [key: string]: any; } interface custom_categories { [key: string]: any; } interface PromptUpdatePayload { custom_instructions?: string; custom_categories?: custom_categories[]; [key: string]: any; } declare enum WebhookEvent { MEMORY_ADDED = "memory_add", MEMORY_UPDATED = "memory_update", MEMORY_DELETED = "memory_delete" } interface Webhook { webhook_id?: string; name: string; url: string; project?: string; created_at?: Date; updated_at?: Date; is_active?: boolean; event_types?: WebhookEvent[]; } interface WebhookPayload { eventTypes: WebhookEvent[]; projectId: string; webhookId: string; name: string; url: string; } interface FeedbackPayload { memory_id: string; feedback?: Feedback | null; feedback_reason?: string | null; } interface CreateMemoryExportPayload extends Common { schema: Record<string, any>; filters: Record<string, any>; export_instructions?: string; } interface GetMemoryExportPayload extends Common { filters?: Record<string, any>; memory_export_id?: string; } interface ClientOptions { apiKey: string; host?: string; organizationName?: string; projectName?: string; organizationId?: string; projectId?: string; } declare class MemoryClient { apiKey: string; host: string; organizationName: string | null; projectName: string | null; organizationId: string | number | null; projectId: string | number | null; headers: Record<string, string>; client: any; telemetryId: string; _validateApiKey(): any; _validateOrgProject(): void; constructor(options: ClientOptions); private _initializeClient; private _captureEvent; _fetchWithErrorHandling(url: string, options: any): Promise<any>; _preparePayload(messages: Array<Message>, options: MemoryOptions): object; _prepareParams(options: MemoryOptions): object; ping(): Promise<void>; add(messages: Array<Message>, options?: MemoryOptions): Promise<Array<Memory>>; update(memoryId: string, { text, metadata }: { text?: string; metadata?: Record<string, any>; }): Promise<Array<Memory>>; get(memoryId: string): Promise<Memory>; getAll(options?: SearchOptions): Promise<Array<Memory>>; search(query: string, options?: SearchOptions): Promise<Array<Memory>>; delete(memoryId: string): Promise<{ message: string; }>; deleteAll(options?: MemoryOptions): Promise<{ message: string; }>; history(memoryId: string): Promise<Array<MemoryHistory>>; users(): Promise<AllUsers>; /** * @deprecated The method should not be used, use `deleteUsers` instead. This will be removed in version 2.2.0. */ deleteUser(data: { entity_id: number; entity_type: string; }): Promise<{ message: string; }>; deleteUsers(params?: { user_id?: string; agent_id?: string; app_id?: string; run_id?: string; }): Promise<{ message: string; }>; batchUpdate(memories: Array<MemoryUpdateBody>): Promise<string>; batchDelete(memories: Array<string>): Promise<string>; getProject(options: ProjectOptions): Promise<ProjectResponse>; updateProject(prompts: PromptUpdatePayload): Promise<Record<string, any>>; getWebhooks(data?: { projectId?: string; }): Promise<Array<Webhook>>; createWebhook(webhook: WebhookPayload): Promise<Webhook>; updateWebhook(webhook: WebhookPayload): Promise<{ message: string; }>; deleteWebhook(data: { webhookId: string; }): Promise<{ message: string; }>; feedback(data: FeedbackPayload): Promise<{ message: string; }>; createMemoryExport(data: CreateMemoryExportPayload): Promise<{ message: string; id: string; }>; getMemoryExport(data: GetMemoryExportPayload): Promise<{ message: string; id: string; }>; } export { type AllUsers, Feedback, type FeedbackPayload, type Memory, MemoryClient, type MemoryHistory, type MemoryOptions, type MemoryUpdateBody, type Message, type Messages, type ProjectOptions, type ProjectResponse, type PromptUpdatePayload, type SearchOptions, type User, type Webhook, type WebhookPayload, MemoryClient as default };