@jeanmemory/node
Version:
Node.js SDK for Jean Memory - Power your Next.js and other Node.js backends with a perfect memory
138 lines • 3.96 kB
TypeScript
/**
* Jean Memory Node.js SDK Client
* Main client for interacting with Jean Memory API
*/
import { JeanMemoryAuth } from './auth';
import { Memory, MemorySearchOptions, MemoryListOptions, ClientConfig, ContextResponse, OAuthContextParams } from './types';
export declare class JeanMemoryError extends Error {
statusCode?: number | undefined;
constructor(message: string, statusCode?: number | undefined);
}
export declare class JeanMemoryClient {
private apiKey;
private apiBase;
private userAgent;
constructor(config: ClientConfig);
/**
* Make authenticated HTTP request to Jean Memory API
*/
private makeRequest;
/**
* Handle HTTP response and error cases
*/
private handleResponse;
/**
* Store a new memory
*/
storeMemory(content: string, context?: Record<string, any>): Promise<Memory>;
/**
* Retrieve memories based on search query
*/
retrieveMemories(query: string, options?: MemorySearchOptions): Promise<Memory[]>;
/**
* Get formatted context for a query (legacy method)
*/
getContextLegacy(query: string): Promise<string>;
/**
* Get or create auto test user for this API key
*/
private getTestUserToken;
/**
* Get context from Jean Memory with OAuth support and backward compatibility
* @overload
* @param params Object with user_token and message for OAuth flow
* @returns ContextResponse with enhanced metadata
*/
getContext(params: OAuthContextParams): Promise<ContextResponse>;
/**
* @overload
* @param query Simple string query for backward compatibility
* @returns Plain string response
*/
getContext(query: string): Promise<string>;
/**
* List all memories with pagination
*/
listMemories(options?: MemoryListOptions): Promise<{
memories: Memory[];
total: number;
hasNext: boolean;
hasPrev: boolean;
}>;
/**
* Delete a specific memory
*/
deleteMemory(memoryId: string): Promise<void>;
/**
* Stream memories (for large result sets)
*/
streamMemories(query: string): Promise<ReadableStream<Memory>>;
/**
* Check API health and authentication
*/
healthCheck(): Promise<{
status: string;
authenticated: boolean;
version?: string;
}>;
/**
* Get current user information
*/
getCurrentUser(): Promise<{
user_id: string;
email: string;
name?: string;
created_at: string;
}>;
/**
* Direct tool access namespace with OAuth support
*/
tools: {
add_memory: (params: {
user_token?: string;
content: string;
} | string) => Promise<{
content: Array<{
type: string;
text: string;
}>;
} | undefined>;
search_memory: (params: {
user_token?: string;
query: string;
} | string) => Promise<{
content: Array<{
type: string;
text: string;
}>;
} | undefined>;
deep_memory_query: (params: {
user_token?: string;
query: string;
} | string) => Promise<{
content: Array<{
type: string;
text: string;
}>;
} | undefined>;
store_document: (params: {
user_token?: string;
title: string;
content: string;
document_type?: string;
}) => Promise<{
content: Array<{
type: string;
text: string;
}>;
} | undefined>;
};
/**
* Get authentication helper for OAuth flows
*/
createAuth(config?: {
oauthBase?: string;
redirectPort?: number;
}): JeanMemoryAuth;
}
//# sourceMappingURL=client.d.ts.map