{"version":3,"sources":["../src/client/mem0.ts","../src/client/telemetry.ts","../src/client/config.ts","../src/client/utils.ts","../src/common/exceptions.ts","../src/client/mem0.types.ts","../src/client/index.ts"],"sourcesContent":["import axios from \"axios\";\nimport { v7 as uuidv7 } from \"uuid\";\nimport {\n  AllUsers,\n  PaginatedMemories,\n  ProjectOptions,\n  Memory,\n  MemoryHistory,\n  AddMemoryOptions,\n  SearchMemoryOptions,\n  GetAllMemoryOptions,\n  DeleteAllMemoryOptions,\n  DeleteMemoryOptions,\n  MemoryUpdateBody,\n  ProjectResponse,\n  PromptUpdatePayload,\n  Webhook,\n  WebhookCreatePayload,\n  WebhookUpdatePayload,\n  Message,\n  FeedbackPayload,\n  CreateMemoryExportPayload,\n  GetMemoryExportPayload,\n  ProfileEntityType,\n  ProfileResponse,\n  ProfileJobResponse,\n  ProfileJobStatus,\n  ProfileSettings,\n  ProfileSettingsResponse,\n} from \"./mem0.types\";\nimport {\n  captureClientEvent,\n  generateHash,\n  isTelemetryEnabled,\n  telemetry,\n} from \"./telemetry\";\nimport {\n  getOrCreateMem0UserId,\n  isMem0Aliased,\n  markMem0Aliased,\n  readMem0AnonIds,\n} from \"./config\";\nimport { camelToSnake, camelToSnakeKeys, snakeToCamelKeys } from \"./utils\";\nimport { createExceptionFromResponse, MemoryError } from \"../common/exceptions\";\n\n// Entity params that must be passed via filters - check both snake_case and camelCase\nconst ENTITY_PARAMS = [\n  \"user_id\",\n  \"agent_id\",\n  \"app_id\",\n  \"run_id\",\n  \"userId\",\n  \"agentId\",\n  \"appId\",\n  \"runId\",\n];\n\n/**\n * Validates that no top-level entity parameters are passed.\n * @throws Error if entity params are found at top level\n */\nfunction rejectTopLevelEntityParams(\n  options: Record<string, any> | undefined,\n  methodName: string,\n): void {\n  const invalidKeys = Object.keys(options ?? {}).filter((k) =>\n    ENTITY_PARAMS.includes(k),\n  );\n  if (invalidKeys.length > 0) {\n    throw new Error(\n      `Top-level entity parameters [${invalidKeys.join(\", \")}] are not supported in ${methodName}(). ` +\n        `Use filters: { user_id: \"...\" } instead.`,\n    );\n  }\n}\n\nfunction encodePathSegment(value: unknown): string {\n  return encodeURIComponent(String(value));\n}\n\nclass APIError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = \"APIError\";\n  }\n}\n\ninterface ClientOptions {\n  apiKey: string;\n  host?: string;\n  /** Max cached identities per process. Defaults to 50. */\n  identityCacheMax?: number;\n}\n\ninterface ClientIdentity {\n  telemetryId: string;\n  organizationId: string | number | null;\n  projectId: string | number | null;\n}\n\n// Shares one ping per (host, api key) across clients; FIFO-capped.\n// One collection for every generation; the operation is a body field.\nconst PROFILE_JOBS_PATH = \"/v2/profiles/jobs/\";\n\nconst IDENTITY_CACHE_MAX_DEFAULT = 50;\nconst identityByCredentials = new Map<string, Promise<ClientIdentity>>();\n\ndeclare const __MEM0_SDK_VERSION__: string | undefined;\n\n// Injected by tsup (see mem0-ts/tsup.config.ts `define`), the same mechanism\n// telemetry.ts already uses. A hardcoded literal goes stale at the next release\n// bump and then misreports the client version forever.\nconst SDK_VERSION =\n  typeof __MEM0_SDK_VERSION__ !== \"undefined\" ? __MEM0_SDK_VERSION__ : \"dev\";\n\nconst MAX_STACK_ENTRIES = 4;\nconst MAX_STACK_CHARS = 200;\n\n/**\n * Append our own entry and bound the result, dropping WHOLE entries.\n *\n * Neither cap cuts characters: slicing the joined string severs an identifier\n * and leaves a fragment the platform parses as a real client name. And the\n * reserved slot is ours. Pushing first and then trimming to four dropped exactly\n * the entry this exists to add whenever a caller already sent four, so we\n * vanished from our own stack while every caller claim survived.\n */\nfunction boundedStack(callerEntries: string[], own: string): string {\n  const kept: string[] = [];\n  let budget = MAX_STACK_CHARS - own.length;\n  for (const entry of callerEntries.slice(0, MAX_STACK_ENTRIES - 1)) {\n    const cost = entry.length + \", \".length;\n    if (cost > budget) break;\n    budget -= cost;\n    kept.push(entry);\n  }\n  return [...kept, own].join(\", \");\n}\n\n/**\n * Surface-identity headers.\n *\n * X-Mem0-Source and X-Application are SET-ONCE by contract: whichever layer is\n * outermost sets them and nothing below overwrites, so a plugin wrapping this\n * SDK keeps its own identity. X-Mem0-Client is APPEND-ONLY - every layer adds\n * itself, so the platform sees the whole stack and not just the last speaker.\n */\nfunction surfaceHeaders(): Record<string, string> {\n  const env: Record<string, string | undefined> =\n    typeof process !== \"undefined\" && process.env ? process.env : {};\n  const existing = (env.MEM0_CLIENT_STACK ?? \"\").trim();\n  const entries = existing\n    ? existing\n        .split(\",\")\n        .map((part) => part.trim())\n        .filter(Boolean)\n    : [];\n  const headers: Record<string, string> = {\n    \"X-Mem0-Client\": boundedStack(entries, `mem0-js/${SDK_VERSION}`),\n  };\n  const source = (env.MEM0_SOURCE ?? \"\").trim();\n  if (source) headers[\"X-Mem0-Source\"] = source;\n  const application = (env.MEM0_APPLICATION ?? \"\").trim();\n  if (application) headers[\"X-Application\"] = application;\n  return headers;\n}\n\nexport default class MemoryClient {\n  apiKey: string;\n  host: string;\n  private organizationId: string | number | null;\n  private projectId: string | number | null;\n  headers: Record<string, string>;\n  client: any;\n  telemetryId: string;\n  private initialized: Promise<void>;\n  private identityCacheMax: number;\n\n  _validateApiKey(): any {\n    if (!this.apiKey) {\n      throw new Error(\"Mem0 API key is required\");\n    }\n    if (typeof this.apiKey !== \"string\") {\n      throw new Error(\"Mem0 API key must be a string\");\n    }\n    if (this.apiKey.trim() === \"\") {\n      throw new Error(\"Mem0 API key cannot be empty\");\n    }\n  }\n\n  constructor(options: ClientOptions) {\n    this.apiKey = options.apiKey;\n    this.host = options.host || \"https://api.mem0.ai\";\n    this.organizationId = null;\n    this.projectId = null;\n    this.identityCacheMax =\n      options.identityCacheMax ?? IDENTITY_CACHE_MAX_DEFAULT;\n\n    this.headers = {\n      Authorization: `Token ${this.apiKey}`,\n      \"Content-Type\": \"application/json\",\n      ...surfaceHeaders(),\n    };\n\n    this.client = axios.create({\n      baseURL: this.host,\n      headers: { Authorization: `Token ${this.apiKey}` },\n      timeout: 60000,\n    });\n\n    this._validateApiKey();\n\n    this.telemetryId = \"\";\n\n    // Memory requests never wait on this; telemetry and _awaitIdentity do.\n    this.initialized = this._resolveIdentity();\n  }\n\n  // One ping per credential pair per process, shared via identityByCredentials.\n  private _resolveIdentity(): Promise<void> {\n    const credentials = `${this.host}\\u0000${this.apiKey}`;\n    let shared = identityByCredentials.get(credentials);\n    if (!shared) {\n      shared = this._initializeClient();\n      if (identityByCredentials.size >= this.identityCacheMax) {\n        identityByCredentials.delete(\n          identityByCredentials.keys().next().value!,\n        );\n      }\n      identityByCredentials.set(credentials, shared);\n      // A failed ping must not be cached, or the process never recovers.\n      shared.then((identity) => {\n        if (!identity.telemetryId) identityByCredentials.delete(credentials);\n      });\n    }\n    return shared.then((identity) => {\n      this.telemetryId = identity.telemetryId;\n      if (identity.organizationId != null)\n        this.organizationId = identity.organizationId;\n      if (identity.projectId != null) this.projectId = identity.projectId;\n    });\n  }\n\n  // Blocks until the ping has populated organizationId/projectId.\n  private async _awaitIdentity(): Promise<void> {\n    await this.initialized;\n  }\n\n  private async _initializeClient(): Promise<ClientIdentity> {\n    try {\n      await this.ping();\n\n      if (!this.telemetryId) {\n        this.telemetryId = generateHash(this.apiKey);\n      }\n\n      await this._maybeAliasAnonToEmail();\n\n      captureClientEvent(\"init\", this, {\n        client_type: \"MemoryClient\",\n      }).catch((error: any) => {\n        console.error(\"Failed to capture event:\", error);\n      });\n    } catch (error: any) {\n      console.error(\"Failed to initialize client:\", error);\n      await captureClientEvent(\"init_error\", this, {\n        error: error?.message || \"Unknown error\",\n        stack: error?.stack || \"No stack trace\",\n      });\n    }\n\n    return {\n      telemetryId: this.telemetryId,\n      organizationId: this.organizationId,\n      projectId: this.projectId,\n    };\n  }\n\n  private async _maybeAliasAnonToEmail(): Promise<void> {\n    if (!isTelemetryEnabled()) return;\n    try {\n      const email = this.telemetryId;\n      if (!email || !email.includes(\"@\")) return;\n      const sharedAnonId = await getOrCreateMem0UserId();\n      const anonIds = await readMem0AnonIds();\n      if (!anonIds && !sharedAnonId) return;\n      const candidates = [anonIds?.oss || sharedAnonId, anonIds?.cli].filter(\n        (id): id is string => !!id && id !== email,\n      );\n      const seen = new Set<string>();\n      for (const anonId of candidates) {\n        if (seen.has(anonId) || (await isMem0Aliased(anonId, email))) continue;\n        seen.add(anonId);\n        if (await telemetry.captureIdentify(anonId, email)) {\n          await markMem0Aliased(anonId, email);\n        }\n      }\n    } catch (error: any) {\n      console.error(\"Failed to alias telemetry identity:\", error);\n    }\n  }\n\n  private _captureEvent(methodName: string, args: any[]) {\n    // Deferred until ping() has resolved telemetryId, off the request path.\n    this.initialized\n      .then(() =>\n        captureClientEvent(methodName, this, {\n          success: true,\n          args_count: args.length,\n          keys: args.length > 0 ? args[0] : [],\n        }),\n      )\n      .catch((error: any) => {\n        console.error(\"Failed to capture event:\", error);\n      });\n  }\n\n  /** Fetch with no key conversion, for payloads carrying user-controlled property names. */\n  async _fetchRawJson(url: string, options: any): Promise<any> {\n    const response = await fetch(url, {\n      ...options,\n      headers: {\n        ...options.headers,\n        Authorization: `Token ${this.apiKey}`,\n        \"Mem0-User-ID\": this.telemetryId,\n      },\n    });\n    if (!response.ok) {\n      const errorData = await response.text();\n      throw createExceptionFromResponse(response.status, errorData);\n    }\n    return response.json();\n  }\n\n  async _fetchWithErrorHandling(url: string, options: any): Promise<any> {\n    return snakeToCamelKeys(await this._fetchRawJson(url, options));\n  }\n\n  _preparePayload(\n    messages: Array<Message>,\n    options: Record<string, any>,\n  ): object {\n    const payload: any = {};\n    payload.messages = messages;\n    return camelToSnakeKeys({ ...payload, ...options });\n  }\n\n  _prepareParams(options: Record<string, any>): object {\n    return Object.fromEntries(\n      Object.entries(options).filter(([_, v]) => v != null),\n    );\n  }\n\n  async ping(): Promise<void> {\n    try {\n      const response = await this._fetchWithErrorHandling(\n        `${this.host}/v1/ping/`,\n        {\n          method: \"GET\",\n          headers: {\n            Authorization: `Token ${this.apiKey}`,\n          },\n        },\n      );\n\n      if (!response || typeof response !== \"object\") {\n        throw new APIError(\"Invalid response format from ping endpoint\");\n      }\n\n      if (response.status !== \"ok\") {\n        throw new APIError(response.message || \"API Key is invalid\");\n      }\n\n      const { orgId, projectId, userEmail } = response;\n\n      if (orgId) this.organizationId = orgId;\n      if (projectId) this.projectId = projectId;\n      if (userEmail) this.telemetryId = userEmail;\n    } catch (error: any) {\n      // Pass through structured exceptions and APIError\n      if (error instanceof MemoryError || error instanceof APIError) {\n        throw error;\n      } else {\n        throw new APIError(\n          `Failed to ping server: ${error.message || \"Unknown error\"}`,\n        );\n      }\n    }\n  }\n\n  async add(\n    messages: Array<Message>,\n    options: AddMemoryOptions & Record<string, any> = {},\n  ): Promise<Array<Memory>> {\n    // Tightly scoped validation guard to resolve #5465\n    if (!messages || (Array.isArray(messages) && messages.length === 0)) {\n      throw new Error(\"Cannot process an empty messages payload.\");\n    }\n\n    const payload = this._preparePayload(messages, options);\n    const payloadKeys = Object.keys(payload);\n    this._captureEvent(\"add\", [payloadKeys]);\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v3/memories/add/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(payload),\n      },\n    );\n    return response;\n  }\n\n  async update(\n    memoryId: string,\n    {\n      text,\n      metadata,\n      timestamp,\n      expirationDate,\n    }: {\n      text?: string;\n      metadata?: Record<string, any>;\n      timestamp?: number | string;\n      expirationDate?: string | null;\n    },\n  ): Promise<Array<Memory>> {\n    if (\n      text === undefined &&\n      metadata === undefined &&\n      timestamp === undefined &&\n      expirationDate === undefined\n    ) {\n      throw new Error(\n        \"At least one of text, metadata, timestamp, or expirationDate must be provided for update.\",\n      );\n    }\n\n    const payload: Record<string, any> = {};\n    if (text !== undefined) payload.text = text;\n    if (metadata !== undefined) payload.metadata = metadata;\n    if (timestamp !== undefined) payload.timestamp = timestamp;\n    if (expirationDate !== undefined) payload.expiration_date = expirationDate;\n\n    const payloadKeys = Object.keys(payload);\n    this._captureEvent(\"update\", [payloadKeys]);\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/${encodePathSegment(memoryId)}/`,\n      {\n        method: \"PUT\",\n        headers: this.headers,\n        body: JSON.stringify(payload),\n      },\n    );\n    return response;\n  }\n\n  async get(memoryId: string): Promise<Memory> {\n    this._captureEvent(\"get\", []);\n    return this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/${encodePathSegment(memoryId)}/`,\n      {\n        headers: this.headers,\n      },\n    );\n  }\n\n  async getAll(options?: GetAllMemoryOptions): Promise<PaginatedMemories> {\n    // Reject top-level entity params - must use filters instead\n    rejectTopLevelEntityParams(options as Record<string, any>, \"getAll\");\n\n    const payloadKeys = Object.keys(options || {});\n    this._captureEvent(\"get_all\", [payloadKeys]);\n    const { page, pageSize, filters, ...rest } = options ?? {};\n    const body: Record<string, any> = {\n      ...camelToSnakeKeys(rest),\n      ...(filters && { filters }),\n    };\n\n    const queryParams: string[] = [];\n    if (page !== undefined) queryParams.push(`page=${page}`);\n    if (pageSize !== undefined) queryParams.push(`page_size=${pageSize}`);\n    const url = `${this.host}/v3/memories/${queryParams.length ? `?${queryParams.join(\"&\")}` : \"\"}`;\n\n    const response = await this._fetchWithErrorHandling(url, {\n      method: \"POST\",\n      headers: this.headers,\n      body: JSON.stringify(body),\n    });\n    return response;\n  }\n\n  async search(\n    query: string,\n    options?: SearchMemoryOptions,\n  ): Promise<{ results: Array<Memory> }> {\n    // Reject top-level entity params - must use filters instead\n    rejectTopLevelEntityParams(options as Record<string, any>, \"search\");\n\n    const payloadKeys = Object.keys(options || {});\n    this._captureEvent(\"search\", [payloadKeys]);\n    const { filters, ...rest } = options ?? {};\n    const payload: Record<string, any> = {\n      query,\n      output_format: \"v1.1\",\n      ...camelToSnakeKeys(rest),\n      ...(filters && { filters }),\n    };\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v3/memories/search/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(payload),\n      },\n    );\n    return response;\n  }\n\n  async delete(\n    memoryId: string,\n    options: DeleteMemoryOptions = {},\n  ): Promise<{ message: string }> {\n    this._captureEvent(\"delete\", [Object.keys(options || {})]);\n    const snakeOptions = camelToSnakeKeys(this._prepareParams(options));\n    // @ts-ignore\n    const query = new URLSearchParams(snakeOptions).toString();\n    return this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/${encodePathSegment(memoryId)}/${query ? `?${query}` : \"\"}`,\n      {\n        method: \"DELETE\",\n        headers: this.headers,\n      },\n    );\n  }\n\n  async deleteAll(\n    options: DeleteAllMemoryOptions = {},\n  ): Promise<{ message: string }> {\n    const payloadKeys = Object.keys(options || {});\n    this._captureEvent(\"delete_all\", [payloadKeys]);\n    const snakeOptions = camelToSnakeKeys(this._prepareParams(options));\n    // @ts-ignore\n    const params = new URLSearchParams(snakeOptions);\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/?${params}`,\n      {\n        method: \"DELETE\",\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async history(memoryId: string): Promise<Array<MemoryHistory>> {\n    this._captureEvent(\"history\", []);\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/memories/${encodePathSegment(memoryId)}/history/`,\n      {\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async users(options?: {\n    page?: number;\n    pageSize?: number;\n  }): Promise<AllUsers> {\n    this._captureEvent(\"users\", []);\n    let url = `${this.host}/v1/entities/`;\n    const params: string[] = [];\n    if (options?.page) params.push(`page=${options.page}`);\n    if (options?.pageSize) params.push(`page_size=${options.pageSize}`);\n    if (params.length) url += `?${params.join(\"&\")}`;\n    const response = await this._fetchWithErrorHandling(url, {\n      headers: this.headers,\n    });\n    return response;\n  }\n\n  /**\n   * @deprecated The method should not be used, use `deleteUsers` instead. This will be removed in version 2.2.0.\n   */\n  async deleteUser(data: {\n    entity_id: number;\n    entity_type: string;\n  }): Promise<{ message: string }> {\n    this._captureEvent(\"delete_user\", []);\n    if (!data.entity_type) {\n      data.entity_type = \"user\";\n    }\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/entities/${encodePathSegment(data.entity_type)}/${encodePathSegment(data.entity_id)}/`,\n      {\n        method: \"DELETE\",\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async deleteUsers(\n    params: {\n      userId?: string;\n      agentId?: string;\n      appId?: string;\n      runId?: string;\n    } = {},\n  ): Promise<{ message: string }> {\n    let to_delete: Array<{ type: string; name: string }> = [];\n    const { userId, agentId, appId, runId } = params;\n\n    if (userId) {\n      to_delete = [{ type: \"user\", name: userId }];\n    } else if (agentId) {\n      to_delete = [{ type: \"agent\", name: agentId }];\n    } else if (appId) {\n      to_delete = [{ type: \"app\", name: appId }];\n    } else if (runId) {\n      to_delete = [{ type: \"run\", name: runId }];\n    } else {\n      const entities = await this.users();\n      to_delete = entities.results.map((entity) => ({\n        type: entity.type,\n        name: entity.name,\n      }));\n    }\n\n    if (to_delete.length === 0) {\n      throw new Error(\"No entities to delete\");\n    }\n\n    for (const entity of to_delete) {\n      try {\n        // fetch() reuses the pooled connection; axios here defaulted to\n        // keepAlive: false, one handshake per entity.\n        await this._fetchWithErrorHandling(\n          `${this.host}/v2/entities/${encodePathSegment(entity.type)}/${encodePathSegment(entity.name)}/`,\n          {\n            method: \"DELETE\",\n            headers: this.headers,\n          },\n        );\n      } catch (error: any) {\n        throw new APIError(\n          `Failed to delete ${entity.type} ${entity.name}: ${error.message}`,\n        );\n      }\n    }\n\n    this._captureEvent(\"delete_users\", [\n      { userId, agentId, appId, runId, sync_type: \"sync\" },\n    ]);\n\n    return {\n      message:\n        userId || agentId || appId || runId\n          ? \"Entity deleted successfully.\"\n          : \"All users, agents, apps and runs deleted.\",\n    };\n  }\n\n  async batchUpdate(memories: Array<MemoryUpdateBody>): Promise<string> {\n    this._captureEvent(\"batch_update\", []);\n    const memoriesBody = memories.map((memory) => ({\n      memory_id: memory.memoryId,\n      text: memory.text,\n    }));\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/batch/`,\n      {\n        method: \"PUT\",\n        headers: this.headers,\n        body: JSON.stringify({ memories: memoriesBody }),\n      },\n    );\n    return response;\n  }\n\n  async batchDelete(memories: Array<string>): Promise<string> {\n    this._captureEvent(\"batch_delete\", []);\n    const memoriesBody = memories.map((memory) => ({\n      memory_id: memory,\n    }));\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/batch/`,\n      {\n        method: \"DELETE\",\n        headers: this.headers,\n        body: JSON.stringify({ memories: memoriesBody }),\n      },\n    );\n    return response;\n  }\n\n  async getProject(options: ProjectOptions): Promise<ProjectResponse> {\n    const payloadKeys = Object.keys(options || {});\n    this._captureEvent(\"get_project\", [payloadKeys]);\n    const { fields } = options;\n    await this._awaitIdentity();\n\n    if (!(this.organizationId && this.projectId)) {\n      throw new Error(\n        \"organizationId and projectId must be set to access instructions or categories\",\n      );\n    }\n\n    const params = new URLSearchParams();\n    fields?.forEach((field) => params.append(\"fields\", camelToSnake(field)));\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/orgs/organizations/${this.organizationId}/projects/${this.projectId}/?${params.toString()}`,\n      {\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async updateProject(\n    prompts: PromptUpdatePayload,\n  ): Promise<Record<string, any>> {\n    this._captureEvent(\"update_project\", []);\n    await this._awaitIdentity();\n    if (!(this.organizationId && this.projectId)) {\n      throw new Error(\n        \"organizationId and projectId must be set to update instructions or categories\",\n      );\n    }\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/orgs/organizations/${this.organizationId}/projects/${this.projectId}/`,\n      {\n        method: \"PATCH\",\n        headers: this.headers,\n        body: JSON.stringify(camelToSnakeKeys(prompts)),\n      },\n    );\n    return response;\n  }\n\n  // WebHooks\n  async getWebhooks(data?: { projectId?: string }): Promise<Array<Webhook>> {\n    this._captureEvent(\"get_webhooks\", []);\n    if (!data?.projectId) await this._awaitIdentity();\n    const project_id = data?.projectId || this.projectId;\n    if (!project_id) {\n      throw new Error(\"projectId must be set to access webhooks\");\n    }\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/webhooks/projects/${project_id}/`,\n      {\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async createWebhook(webhook: WebhookCreatePayload): Promise<Webhook> {\n    this._captureEvent(\"create_webhook\", []);\n    await this._awaitIdentity();\n    if (!this.projectId) {\n      throw new Error(\"projectId must be set to create a webhook\");\n    }\n    const body = {\n      name: webhook.name,\n      url: webhook.url,\n      event_types: webhook.eventTypes,\n    };\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/webhooks/projects/${this.projectId}/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(body),\n      },\n    );\n    return response;\n  }\n\n  async updateWebhook(\n    webhook: WebhookUpdatePayload,\n  ): Promise<{ message: string }> {\n    this._captureEvent(\"update_webhook\", []);\n    const body: Record<string, any> = {};\n    if (webhook.name != null) body.name = webhook.name;\n    if (webhook.url != null) body.url = webhook.url;\n    if (webhook.eventTypes != null) body.event_types = webhook.eventTypes;\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/webhooks/${webhook.webhookId}/`,\n      {\n        method: \"PUT\",\n        headers: this.headers,\n        body: JSON.stringify(body),\n      },\n    );\n    return response;\n  }\n\n  async deleteWebhook(data: {\n    webhookId: string;\n  }): Promise<{ message: string }> {\n    this._captureEvent(\"delete_webhook\", []);\n    const webhook_id = data.webhookId || data;\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/api/v1/webhooks/${webhook_id}/`,\n      {\n        method: \"DELETE\",\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  async feedback(data: FeedbackPayload): Promise<{ message: string }> {\n    const payloadKeys = Object.keys(data || {});\n    this._captureEvent(\"feedback\", [payloadKeys]);\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/feedback/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify(camelToSnakeKeys(data)),\n      },\n    );\n    return response;\n  }\n\n  /**\n   * Get the memory profile for a single user.\n   *\n   * Branch on `status`, not on an empty `profile`: generation is asynchronous,\n   * so a known user without a profile yet is a normal response.\n   */\n  async getProfile(data: { entityId: string }): Promise<ProfileResponse> {\n    this._captureEvent(\"get_profile\", []);\n    await this._awaitIdentity();\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v2/entities/user/${encodeURIComponent(data.entityId)}/profile/`,\n      {\n        headers: this.headers,\n      },\n    );\n    return response;\n  }\n\n  /**\n   * Generate or refresh the profile for one user, now.\n   *\n   * Profiles are otherwise built once a user crosses an internal message\n   * threshold, so a new user has none for its first few memories. Returns as\n   * soon as the work is queued: poll {@link getProfile} and branch on `status`.\n   *\n   * Pass `idempotencyKey` and reuse it to retry a lost request without starting\n   * (and being billed for) a second job.\n   */\n  async generateProfile(data: {\n    entityId: string;\n    idempotencyKey?: string;\n  }): Promise<ProfileJobResponse> {\n    this._captureEvent(\"generate_profile\", []);\n    await this._awaitIdentity();\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}${PROFILE_JOBS_PATH}`,\n      {\n        method: \"POST\",\n        headers: {\n          ...this.headers,\n          \"Idempotency-Key\": data.idempotencyKey ?? uuidv7(),\n        },\n        body: JSON.stringify({\n          operation: \"trigger\",\n          entity_type: \"user\",\n          entity_id: data.entityId,\n        }),\n      },\n    );\n    return response;\n  }\n\n  /** Get the profile settings for the current project. */\n  async getProfileSettings(): Promise<ProfileSettingsResponse> {\n    this._captureEvent(\"get_profile_settings\", []);\n    await this._awaitIdentity();\n\n    const raw = await this._fetchRawJson(`${this.host}/v2/profiles/settings/`, {\n      headers: this.headers,\n    });\n    return this._settingsWithVerbatimSchema(raw);\n  }\n\n  /**\n   * The envelope keys are ours; the schema's property names are the customer's.\n   *\n   * Each entity type carries its own schema, so every one has to be restored\n   * from the raw body — otherwise camel-casing rewrites the customer's field\n   * names and a profile comes back under keys they never chose.\n   */\n  private _settingsWithVerbatimSchema(raw: any): ProfileSettingsResponse {\n    const settings = snakeToCamelKeys(raw) as ProfileSettingsResponse;\n    if (!raw || typeof raw !== \"object\") {\n      return settings;\n    }\n\n    const rawEntities = raw.entities;\n    if (rawEntities && typeof rawEntities === \"object\") {\n      for (const [entityType, entitySettings] of Object.entries(rawEntities)) {\n        if (\n          entitySettings &&\n          typeof entitySettings === \"object\" &&\n          \"schema\" in entitySettings &&\n          settings.entities?.[entityType as ProfileEntityType]\n        ) {\n          settings.entities[entityType as ProfileEntityType]!.schema = (\n            entitySettings as Record<string, any>\n          ).schema;\n        }\n      }\n    }\n\n    return settings;\n  }\n\n  /**\n   * Update profile settings. Only the fields you pass are written.\n   *\n   * `schema` and `customInstructions` are per user and are nested under\n   * `entities` for the API; only `enabled` is project-wide. Sending them flat\n   * is rejected with `Unsupported settings`.\n   */\n  async updateProfileSettings(\n    settings: ProfileSettings,\n  ): Promise<ProfileSettingsResponse> {\n    const payloadKeys = Object.keys(settings || {});\n    this._captureEvent(\"update_profile_settings\", [payloadKeys]);\n    await this._awaitIdentity();\n\n    const { schema, customInstructions, enabled } = settings || {};\n\n    const body: Record<string, any> = {};\n    if (enabled !== undefined) {\n      body.enabled = enabled;\n    }\n\n    const entitySettings: Record<string, any> = {};\n    // The schema's property names are the customer's and must reach the API verbatim.\n    if (schema !== undefined) {\n      entitySettings.schema = schema;\n    }\n    if (customInstructions !== undefined) {\n      entitySettings.custom_instructions = customInstructions;\n    }\n    if (Object.keys(entitySettings).length > 0) {\n      body.entities = { user: entitySettings };\n    }\n\n    const raw = await this._fetchRawJson(`${this.host}/v2/profiles/settings/`, {\n      method: \"POST\",\n      headers: this.headers,\n      body: JSON.stringify(body),\n    });\n    return this._settingsWithVerbatimSchema(raw);\n  }\n\n  /**\n   * Generate profiles for a few real users, to check a schema.\n   *\n   * Real generations against real memories, and the results are kept: the\n   * profiles are written to those users and count toward usage.\n   */\n  async sampleProfiles(data?: {\n    limit?: number;\n    idempotencyKey?: string;\n  }): Promise<ProfileJobResponse> {\n    this._captureEvent(\"sample_profiles\", []);\n    await this._awaitIdentity();\n\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}${PROFILE_JOBS_PATH}`,\n      {\n        method: \"POST\",\n        headers: {\n          ...this.headers,\n          \"Idempotency-Key\": data?.idempotencyKey ?? uuidv7(),\n        },\n        body: JSON.stringify({\n          operation: \"sample\",\n          // Required: the API refuses a job that does not name an entity kind.\n          entity_type: \"user\",\n          ...this._prepareParams({ limit: data?.limit }),\n        }),\n      },\n    );\n    return response;\n  }\n\n  /**\n   * Read one generation job. Accepts the `statusUrl` from a create call, or a\n   * bare job id. Prefer `statusUrl` so a route change needs no client update.\n   */\n  async getProfileJob(jobIdOrStatusUrl: string): Promise<ProfileJobStatus> {\n    await this._awaitIdentity();\n\n    const path = jobIdOrStatusUrl.startsWith(\"/\")\n      ? jobIdOrStatusUrl\n      : `${PROFILE_JOBS_PATH}${jobIdOrStatusUrl}/`;\n    return this._fetchWithErrorHandling(`${this.host}${path}`, {\n      method: \"GET\",\n      headers: this.headers,\n    });\n  }\n\n  async createMemoryExport(\n    data: CreateMemoryExportPayload,\n  ): Promise<{ message: string; id: string }> {\n    this._captureEvent(\"create_memory_export\", []);\n\n    if (!data.filters || !data.schema) {\n      throw new Error(\"Missing filters or schema\");\n    }\n\n    // filters and schema are user-controlled blobs whose keys must reach the\n    // API verbatim; only the remaining SDK params (e.g. exportInstructions)\n    // get camel->snake conversion. See issue #5593.\n    const { filters, schema, ...rest } = data;\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/exports/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify({\n          ...camelToSnakeKeys(rest),\n          filters,\n          schema,\n        }),\n      },\n    );\n\n    return response;\n  }\n\n  async getMemoryExport(\n    data: GetMemoryExportPayload,\n  ): Promise<{ message: string; id: string }> {\n    this._captureEvent(\"get_memory_export\", []);\n\n    if (!data.memoryExportId && !data.filters) {\n      throw new Error(\"Missing memoryExportId or filters\");\n    }\n\n    const { filters, ...rest } = data;\n    const response = await this._fetchWithErrorHandling(\n      `${this.host}/v1/exports/get/`,\n      {\n        method: \"POST\",\n        headers: this.headers,\n        body: JSON.stringify({\n          ...camelToSnakeKeys(rest),\n          ...(filters && { filters }),\n        }),\n      },\n    );\n    return response;\n  }\n}\n\nexport { MemoryClient };\n","// @ts-nocheck\nimport type { TelemetryClient, TelemetryOptions } from \"./telemetry.types\";\n\n// __MEM0_SDK_VERSION__ is inlined by tsup/esbuild's `define` at build time from\n// package.json. In unbundled environments (ts-jest, jest globalSetup) the\n// identifier is not defined, so guard with typeof to fall back safely.\nlet version =\n  typeof __MEM0_SDK_VERSION__ !== \"undefined\" ? __MEM0_SDK_VERSION__ : \"dev\";\n\n// Safely check for process.env in different environments\nlet MEM0_TELEMETRY = true;\ntry {\n  MEM0_TELEMETRY = process?.env?.MEM0_TELEMETRY === \"false\" ? false : true;\n} catch (error) {}\nconst POSTHOG_API_KEY = \"phc_hgJkUVJFYtmaJqrvf6CYN67TIQ8yhXAkWzUn9AMU4yX\";\nconst POSTHOG_HOST = \"https://us.i.posthog.com/i/v0/e/\";\n\n// Simple hash function using random strings\nfunction generateHash(input: string): string {\n  const randomStr =\n    Math.random().toString(36).substring(2, 15) +\n    Math.random().toString(36).substring(2, 15);\n  return randomStr;\n}\n\nclass UnifiedTelemetry implements TelemetryClient {\n  private apiKey: string;\n  private host: string;\n\n  constructor(projectApiKey: string, host: string) {\n    this.apiKey = projectApiKey;\n    this.host = host;\n  }\n\n  async captureEvent(\n    distinctId: string,\n    eventName: string,\n    properties = {},\n  ): Promise<boolean> {\n    if (!MEM0_TELEMETRY) return false;\n\n    const eventProperties = {\n      client_version: version,\n      timestamp: new Date().toISOString(),\n      ...properties,\n      $process_person_profile: false,\n      $lib: \"posthog-node\",\n    };\n\n    const payload = {\n      api_key: this.apiKey,\n      distinct_id: distinctId,\n      event: eventName,\n      properties: eventProperties,\n    };\n\n    try {\n      const response = await fetch(this.host, {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify(payload),\n      });\n\n      if (!response.ok) {\n        console.error(\"Telemetry event capture failed:\", await response.text());\n        return false;\n      }\n      return true;\n    } catch (error) {\n      console.error(\"Telemetry event capture failed:\", error);\n      return false;\n    }\n  }\n\n  async captureIdentify(anonId: string, email: string): Promise<boolean> {\n    if (!MEM0_TELEMETRY) return false;\n    if (!anonId || !email || anonId === email) return false;\n\n    const payload = {\n      api_key: this.apiKey,\n      distinct_id: email,\n      event: \"$identify\",\n      properties: {\n        $anon_distinct_id: anonId,\n        client_source: \"typescript\",\n        $lib: \"posthog-node\",\n      },\n    };\n\n    try {\n      const response = await fetch(this.host, {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify(payload),\n      });\n\n      if (!response.ok) {\n        console.error(\n          \"Telemetry identify capture failed:\",\n          await response.text(),\n        );\n        return false;\n      }\n      return true;\n    } catch (error) {\n      console.error(\"Telemetry identify capture failed:\", error);\n      return false;\n    }\n  }\n\n  async shutdown() {\n    // No shutdown needed for direct API calls\n  }\n}\n\nfunction isTelemetryEnabled(): boolean {\n  return MEM0_TELEMETRY;\n}\n\nconst telemetry = new UnifiedTelemetry(POSTHOG_API_KEY, POSTHOG_HOST);\n\nasync function captureClientEvent(\n  eventName: string,\n  instance: any,\n  additionalData = {},\n) {\n  if (!instance.telemetryId) {\n    console.warn(\"No telemetry ID found for instance\");\n    return;\n  }\n\n  const eventData = {\n    function: `${instance.constructor.name}`,\n    method: eventName,\n    api_host: instance.host,\n    timestamp: new Date().toISOString(),\n    client_version: version,\n    keys: additionalData?.keys || [],\n    ...additionalData,\n  };\n\n  await telemetry.captureEvent(\n    instance.telemetryId,\n    `client.${eventName}`,\n    eventData,\n  );\n}\n\nexport { telemetry, captureClientEvent, generateHash, isTelemetryEnabled };\n","/**\n * Best-effort read/write of ~/.mem0/config.json from the TS SDK.\n *\n * Used to stitch PostHog identities: SDKs and CLIs persist anonymous\n * distinct_id values here, and the TS MemoryClient reads those on init to\n * fire $identify and merge them into the email identity.\n *\n * Node-only. Browsers (no `process.versions.node`) no-op.\n */\n\nexport interface Mem0AnonIds {\n  oss?: string;\n  cli?: string;\n  aliasedPairs: string[];\n}\n\ninterface NodeFs {\n  fs: typeof import(\"fs\");\n  path: typeof import(\"path\");\n  crypto: typeof import(\"crypto\");\n  configPath: string;\n}\n\nasync function getNodeFs(): Promise<NodeFs | null> {\n  if (typeof process === \"undefined\" || !process.versions?.node) return null;\n  try {\n    const [fs, path, os, crypto] = await Promise.all([\n      import(\"fs\"),\n      import(\"path\"),\n      import(\"os\"),\n      import(\"crypto\"),\n    ]);\n    const fsMod = (fs as any).default ?? fs;\n    const pathMod = (path as any).default ?? path;\n    const osMod = (os as any).default ?? os;\n    const cryptoMod = (crypto as any).default ?? crypto;\n    const dir = process.env.MEM0_DIR || pathMod.join(osMod.homedir(), \".mem0\");\n    return {\n      fs: fsMod,\n      path: pathMod,\n      crypto: cryptoMod,\n      configPath: pathMod.join(dir, \"config.json\"),\n    };\n  } catch {\n    return null;\n  }\n}\n\nfunction loadConfig(node: NodeFs): Record<string, any> | null {\n  try {\n    if (!node.fs.existsSync(node.configPath)) return null;\n    const parsed = JSON.parse(node.fs.readFileSync(node.configPath, \"utf8\"));\n    return parsed && typeof parsed === \"object\" ? parsed : null;\n  } catch {\n    return null;\n  }\n}\n\nfunction writeConfig(node: NodeFs, config: Record<string, any>): void {\n  node.fs.mkdirSync(node.path.dirname(node.configPath), { recursive: true });\n  node.fs.writeFileSync(node.configPath, JSON.stringify(config, null, 4));\n}\n\nfunction aliasPairMarker(node: NodeFs, anonId: string, email: string): string {\n  return node.crypto\n    .createHash(\"sha256\")\n    .update(`${anonId}\\0${email}`, \"utf8\")\n    .digest(\"hex\");\n}\n\nfunction randomUserId(node: NodeFs): string {\n  if (typeof node.crypto.randomUUID === \"function\") {\n    return node.crypto.randomUUID();\n  }\n  return (\n    Math.random().toString(36).substring(2, 15) +\n    Math.random().toString(36).substring(2, 15)\n  );\n}\n\nexport async function getOrCreateMem0UserId(): Promise<string | null> {\n  const node = await getNodeFs();\n  if (!node) return null;\n  try {\n    const config = loadConfig(node) ?? {};\n    if (typeof config.user_id === \"string\" && config.user_id) {\n      return config.user_id;\n    }\n    const userId = randomUserId(node);\n    config.user_id = userId;\n    writeConfig(node, config);\n    return userId;\n  } catch {\n    return null;\n  }\n}\n\nexport async function readMem0AnonIds(): Promise<Mem0AnonIds | null> {\n  const node = await getNodeFs();\n  if (!node) return null;\n  const config = loadConfig(node);\n  if (!config) return null;\n  const telemetry =\n    config.telemetry && typeof config.telemetry === \"object\"\n      ? config.telemetry\n      : {};\n  return {\n    oss: typeof config.user_id === \"string\" ? config.user_id : undefined,\n    cli:\n      typeof telemetry.anonymous_id === \"string\"\n        ? telemetry.anonymous_id\n        : undefined,\n    aliasedPairs: Array.isArray(telemetry.aliased_pairs)\n      ? telemetry.aliased_pairs.filter(\n          (item: unknown) => typeof item === \"string\",\n        )\n      : [],\n  };\n}\n\nexport async function isMem0Aliased(\n  anonId: string,\n  email: string,\n): Promise<boolean> {\n  if (!anonId || !email) return false;\n  const node = await getNodeFs();\n  if (!node) return false;\n  const config = loadConfig(node);\n  if (!config) return false;\n  const telemetry =\n    config.telemetry && typeof config.telemetry === \"object\"\n      ? config.telemetry\n      : {};\n  const aliasedPairs = Array.isArray(telemetry.aliased_pairs)\n    ? telemetry.aliased_pairs\n    : [];\n  return aliasedPairs.includes(aliasPairMarker(node, anonId, email));\n}\n\nexport async function markMem0Aliased(\n  anonId: string,\n  email: string,\n): Promise<void> {\n  const node = await getNodeFs();\n  if (!node) return;\n  try {\n    const config = loadConfig(node) ?? {};\n    const telemetry =\n      config.telemetry && typeof config.telemetry === \"object\"\n        ? config.telemetry\n        : {};\n    const aliasedPairs = Array.isArray(telemetry.aliased_pairs)\n      ? telemetry.aliased_pairs\n      : [];\n    const marker = aliasPairMarker(node, anonId, email);\n    if (!aliasedPairs.includes(marker)) {\n      aliasedPairs.push(marker);\n    }\n    telemetry.aliased_pairs = aliasedPairs;\n    config.telemetry = telemetry;\n    writeConfig(node, config);\n  } catch {\n    // Best-effort: read-only filesystems and unwritable paths just skip.\n  }\n}\n","/**\n * Converts a camelCase string to snake_case.\n */\nexport function camelToSnake(str: string): string {\n  // Skip all-uppercase keys (e.g. OR, AND, NOT — logical operators)\n  if (str === str.toUpperCase()) return str;\n  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);\n}\n\n/**\n * Converts a snake_case string to camelCase.\n */\nfunction snakeToCamel(str: string): string {\n  return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n}\n\n/**\n * Keys whose values are user-controlled, opaque blobs. Their nested keys must\n * be passed through verbatim — converting them would silently rewrite the\n * user's own keys and break round-trips (see issue #5055).\n *\n * The check runs against the source key, so a multi-word key must be listed in\n * both casings to be covered in both directions: the camelCase form for the\n * outbound `camelToSnakeKeys` path and the snake_case form for the inbound\n * `snakeToCamelKeys` path. `metadata` is spelled identically in both, so one\n * entry suffices; `structuredDataSchema` needs both.\n */\nconst OPAQUE_VALUE_KEYS = new Set([\n  \"metadata\",\n  \"structuredDataSchema\",\n  \"structured_data_schema\",\n  // Custom-category names are user-controlled keys (`[{ \"<name>\": \"<desc>\" }]`).\n  // Listed in both casings so they round-trip verbatim in both directions\n  // (see issue #5738; same class as `metadata`/`structuredDataSchema`).\n  \"customCategories\",\n  \"custom_categories\",\n  // A profile's keys come from the customer's own JSON Schema. The schema itself\n  // is handled in `updateProfileSettings`, so that `schema` is not opaque globally.\n  \"profile\",\n]);\n\n/**\n * Recursively converts all keys of an object from camelCase to snake_case.\n * Used for converting user-facing camelCase params to API snake_case payloads.\n * Values under {@link OPAQUE_VALUE_KEYS} (e.g. `metadata`) are left untouched.\n */\nexport function camelToSnakeKeys(obj: any): any {\n  if (obj === null || obj === undefined || typeof obj !== \"object\") return obj;\n  if (Array.isArray(obj)) return obj.map(camelToSnakeKeys);\n  if (obj instanceof Date) return obj;\n\n  return Object.fromEntries(\n    Object.entries(obj).map(([key, value]) => [\n      camelToSnake(key),\n      OPAQUE_VALUE_KEYS.has(key) ? value : camelToSnakeKeys(value),\n    ]),\n  );\n}\n\n/**\n * Recursively converts all keys of an object from snake_case to camelCase.\n * Used for converting API snake_case responses to user-facing camelCase.\n * Values under {@link OPAQUE_VALUE_KEYS} (e.g. `metadata`) are left untouched.\n */\nexport function snakeToCamelKeys(obj: any): any {\n  if (obj === null || obj === undefined || typeof obj !== \"object\") return obj;\n  if (Array.isArray(obj)) return obj.map(snakeToCamelKeys);\n  if (obj instanceof Date) return obj;\n\n  return Object.fromEntries(\n    Object.entries(obj).map(([key, value]) => [\n      snakeToCamel(key),\n      OPAQUE_VALUE_KEYS.has(key) ? value : snakeToCamelKeys(value),\n    ]),\n  );\n}\n","/**\n * Structured exception classes for mem0 TypeScript SDK.\n *\n * Provides specific, actionable exceptions with error codes, suggestions,\n * and debug information. Maps HTTP status codes to appropriate exception types.\n *\n * @example\n * ```typescript\n * import { RateLimitError, MemoryNotFoundError } from 'mem0ai'\n *\n * try {\n *   await client.get(memoryId)\n * } catch (e) {\n *   if (e instanceof MemoryNotFoundError) {\n *     console.log(e.suggestion) // \"The requested resource was not found\"\n *   } else if (e instanceof RateLimitError) {\n *     await sleep(e.debugInfo.retryAfter ?? 60)\n *   }\n * }\n * ```\n */\n\nexport interface MemoryErrorOptions {\n  details?: Record<string, unknown>;\n  suggestion?: string;\n  debugInfo?: Record<string, unknown>;\n}\n\n/**\n * Base exception for all memory-related errors.\n *\n * Every mem0 exception includes an error code for programmatic handling,\n * optional details, a user-friendly suggestion, and debug information.\n */\nexport class MemoryError extends Error {\n  readonly errorCode: string;\n  readonly details: Record<string, unknown>;\n  readonly suggestion?: string;\n  readonly debugInfo: Record<string, unknown>;\n\n  constructor(\n    message: string,\n    errorCode: string,\n    options: MemoryErrorOptions = {},\n  ) {\n    super(message);\n    this.name = \"MemoryError\";\n    this.errorCode = errorCode;\n    this.details = options.details ?? {};\n    this.suggestion = options.suggestion;\n    this.debugInfo = options.debugInfo ?? {};\n\n    // Fix prototype chain for instanceof checks\n    Object.setPrototypeOf(this, new.target.prototype);\n  }\n}\n\n/** Raised when authentication fails (401, 403). */\nexport class AuthenticationError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"AuthenticationError\";\n  }\n}\n\n/** Raised when rate limits are exceeded (429). */\nexport class RateLimitError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"RateLimitError\";\n  }\n}\n\n/** Raised when input validation fails (400, 409, 422). */\nexport class ValidationError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"ValidationError\";\n  }\n}\n\n/** Raised when a memory is not found (404). */\nexport class MemoryNotFoundError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"MemoryNotFoundError\";\n  }\n}\n\n/** Raised when network connectivity issues occur (408, 502, 503, 504). */\nexport class NetworkError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"NetworkError\";\n  }\n}\n\n/** Raised when client configuration is invalid. */\nexport class ConfigurationError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"ConfigurationError\";\n  }\n}\n\n/** Raised when memory quota is exceeded (413). */\nexport class MemoryQuotaExceededError extends MemoryError {\n  constructor(\n    message: string,\n    errorCode: string,\n    options?: MemoryErrorOptions,\n  ) {\n    super(message, errorCode, options);\n    this.name = \"MemoryQuotaExceededError\";\n  }\n}\n\n// ─── HTTP Status → Exception Mapping ─────────────────────\n\ntype MemoryErrorConstructor = new (\n  message: string,\n  errorCode: string,\n  options?: MemoryErrorOptions,\n) => MemoryError;\n\nexport const HTTP_STATUS_TO_EXCEPTION: Record<number, MemoryErrorConstructor> =\n  {\n    400: ValidationError,\n    401: AuthenticationError,\n    403: AuthenticationError,\n    404: MemoryNotFoundError,\n    408: NetworkError,\n    409: ValidationError,\n    413: MemoryQuotaExceededError,\n    422: ValidationError,\n    429: RateLimitError,\n    500: MemoryError,\n    502: NetworkError,\n    503: NetworkError,\n    504: NetworkError,\n  };\n\nconst HTTP_SUGGESTIONS: Record<number, string> = {\n  400: \"Please check your request parameters and try again\",\n  401: \"Please check your API key and authentication credentials\",\n  403: \"You don't have permission to perform this operation\",\n  404: \"The requested resource was not found\",\n  408: \"Request timed out. Please try again\",\n  409: \"Resource conflict. Please check your request\",\n  413: \"Request too large. Please reduce the size of your request\",\n  422: \"Invalid request data. Please check your input\",\n  429: \"Rate limit exceeded. Please wait before making more requests\",\n  500: \"Internal server error. Please try again later\",\n  502: \"Service temporarily unavailable. Please try again later\",\n  503: \"Service unavailable. Please try again later\",\n  504: \"Gateway timeout. Please try again later\",\n};\n\n/**\n * Create an appropriate exception based on HTTP response status code.\n *\n * @param statusCode - HTTP status code from the response\n * @param responseText - Response body text\n * @param options - Additional error context (details, debugInfo)\n * @returns An instance of the appropriate MemoryError subclass\n */\nexport function createExceptionFromResponse(\n  statusCode: number,\n  responseText: string,\n  options: Omit<MemoryErrorOptions, \"suggestion\"> = {},\n): MemoryError {\n  const ExceptionClass = HTTP_STATUS_TO_EXCEPTION[statusCode] ?? MemoryError;\n  const errorCode = `HTTP_${statusCode}`;\n  const suggestion = HTTP_SUGGESTIONS[statusCode] ?? \"Please try again later\";\n\n  return new ExceptionClass(\n    responseText || `HTTP ${statusCode} error`,\n    errorCode,\n    { ...options, suggestion },\n  );\n}\n","// ─── Entity Options (for add/delete — top-level identity) ───\nexport interface EntityOptions {\n  userId?: string;\n  agentId?: string;\n  appId?: string;\n  runId?: string;\n}\n\n// ─── Per-Method Options ─────────────────────────────────────\nexport interface AddMemoryOptions extends EntityOptions {\n  metadata?: Record<string, any>;\n  infer?: boolean;\n  customCategories?: custom_categories[];\n  customInstructions?: string;\n  agentCustomInstructions?: string;\n  timestamp?: number;\n  expirationDate?: string;\n  structuredDataSchema?: Record<string, any>;\n}\n\nexport interface SearchMemoryOptions {\n  filters?: Record<string, any>;\n  metadata?: Record<string, any>;\n  topK?: number;\n  threshold?: number;\n  rerank?: boolean;\n  latestOnly?: boolean;\n  fields?: string[];\n  categories?: string[];\n  showExpired?: boolean;\n  referenceDate?: string | number;\n  keywordSearch?: boolean;\n  /** Surface that produced the call, e.g. \"OPENCLAW\". Must be a value the\n   *  backend's EventSource enum knows, or it buckets into OTHERS. */\n  source?: string;\n}\n\nexport interface GetAllMemoryOptions {\n  filters?: Record<string, any>;\n  page?: number;\n  pageSize?: number;\n  startDate?: string;\n  endDate?: string;\n  latestOnly?: boolean;\n  categories?: string[];\n  showExpired?: boolean;\n}\n\nexport interface DeleteAllMemoryOptions extends EntityOptions {}\n\nexport interface DeleteMemoryOptions {\n  /**\n   * When `true`, also delete the older memories this one superseded (the v3\n   * linked chain), transitively — the delete-side counterpart of `latestOnly`.\n   * Off by default. Serialized as `delete_linked`.\n   */\n  deleteLinked?: boolean;\n}\n\n// ─── Project Options ────────────────────────────────────────\nexport interface ProjectOptions {\n  fields?: string[];\n}\n\nexport interface PromptUpdatePayload {\n  customInstructions?: string;\n  agentCustomInstructions?: string;\n  customCategories?: custom_categories[];\n  version?: string;\n  memoryDepth?: string | null;\n  usecaseSetting?: string | number;\n  multilingual?: boolean;\n  /**\n   * Toggle Memory Decay for this project. When `true`, search-time ranking\n   * boosts recently-used memories and gently dampens stale ones; when `false`,\n   * ranking is restored to the pre-decay behaviour. Off by default.\n   * See https://docs.mem0.ai/platform/features/memory-decay\n   */\n  decay?: boolean;\n  [key: string]: any;\n}\n\n// ─── Enums ──────────────────────────────────────────────────\nexport enum Feedback {\n  POSITIVE = \"POSITIVE\",\n  NEGATIVE = \"NEGATIVE\",\n  VERY_NEGATIVE = \"VERY_NEGATIVE\",\n}\n\n// ─── Message Types ──────────────────────────────────────────\nexport interface MultiModalMessages {\n  type: \"image_url\";\n  image_url: {\n    url: string;\n  };\n}\n\nexport interface Messages {\n  role: \"user\" | \"assistant\";\n  content: string | MultiModalMessages;\n}\n\nexport interface Message extends Messages {}\n\n// ─── Response Types (camelCase — converted from API snake_case) ─────\nexport interface MemoryData {\n  memory: string;\n}\n\nenum Event {\n  ADD = \"ADD\",\n  UPDATE = \"UPDATE\",\n  DELETE = \"DELETE\",\n  NOOP = \"NOOP\",\n}\n\nexport interface Memory {\n  id: string;\n  messages?: Array<Messages>;\n  event?: Event | string;\n  data?: MemoryData | null;\n  memory?: string;\n  userId?: string;\n  hash?: string;\n  categories?: Array<string>;\n  createdAt?: Date;\n  updatedAt?: Date;\n  // TODO: Review this response field for removal in a future breaking release.\n  // It is not a selectable memory type; TypeScript has no procedural-memory path.\n  memoryType?: string;\n  score?: number;\n  metadata?: any | null;\n  expirationDate?: string | null;\n  owner?: string | null;\n  agentId?: string | null;\n  appId?: string | null;\n  runId?: string | null;\n}\n\nexport interface MemoryHistory {\n  id: string;\n  memoryId: string;\n  input: Array<Messages>;\n  oldMemory: string | null;\n  newMemory: string | null;\n  userId: string;\n  categories: Array<string>;\n  event: Event | string;\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport interface MemoryUpdateBody {\n  memoryId: string;\n  text: string;\n}\n\nexport interface User {\n  id: string;\n  name: string;\n  createdAt: Date;\n  updatedAt: Date;\n  totalMemories: number;\n  owner: string;\n  type: string;\n}\n\nexport interface AllUsers {\n  count: number;\n  results: Array<User>;\n  next: any;\n  previous: any;\n}\n\nexport interface PaginatedMemories {\n  count: number;\n  next: string | null;\n  previous: string | null;\n  results: Array<Memory>;\n}\n\nexport interface ProjectResponse {\n  customInstructions?: string;\n  agentCustomInstructions?: string;\n  // The API returns category objects (`[{ \"<name>\": \"<description>\" }]`),\n  // not bare strings (see issue #5738).\n  customCategories?: custom_categories[];\n  [key: string]: any;\n}\n\ninterface custom_categories {\n  [key: string]: any;\n}\n\n// ─── Webhook Types ──────────────────────────────────────────\nexport enum WebhookEvent {\n  MEMORY_ADDED = \"memory_add\",\n  MEMORY_UPDATED = \"memory_update\",\n  MEMORY_DELETED = \"memory_delete\",\n  MEMORY_CATEGORIZED = \"memory_categorize\",\n}\n\nexport interface Webhook {\n  webhookId?: string;\n  name: string;\n  url: string;\n  project?: string;\n  createdAt?: Date;\n  updatedAt?: Date;\n  isActive?: boolean;\n  eventTypes?: WebhookEvent[];\n}\n\nexport interface WebhookCreatePayload {\n  name: string;\n  url: string;\n  eventTypes: WebhookEvent[];\n}\n\nexport interface WebhookUpdatePayload {\n  webhookId: string;\n  name?: string;\n  url?: string;\n  eventTypes?: WebhookEvent[];\n}\n\n// ─── Feedback & Export Types ────────────────────────────────\nexport interface FeedbackPayload {\n  memoryId: string;\n  feedback?: Feedback | null;\n  feedbackReason?: string | null;\n}\n\nexport interface CreateMemoryExportPayload {\n  schema: Record<string, any>;\n  filters: Record<string, any>;\n  exportInstructions?: string;\n}\n\nexport interface GetMemoryExportPayload {\n  filters?: Record<string, any>;\n  memoryExportId?: string;\n}\n\n// ─── Profile Types ──────────────────────────────────────────\n\n/** The entity kind that carries a profile. */\nexport type ProfileEntityType = \"user\";\n\n/**\n * `succeeded` is the only state in which `profile` is guaranteed to hold content.\n *\n * These are values, not keys, so the client does not camel-case them: the wire\n * spelling is what a comparison has to match.\n */\nexport type ProfileStatus =\n  | \"succeeded\"\n  | \"pending\"\n  | \"failed\"\n  | \"not_enabled\"\n  | \"insufficient_data\";\n\nexport interface ProfileResponse {\n  /** Shaped by the project's schema; keys are not camel-cased. */\n  profile: Record<string, any>;\n  status: ProfileStatus;\n  entityType: ProfileEntityType;\n  entityId: string;\n  updatedAt: string | null;\n  generationCount: number;\n  /** The last generation's failure reason, when `status` is `failed`. */\n  error?: string | null;\n}\n\n/** Every accepted generation. `statusUrl` is the server's own poll path. */\nexport interface ProfileJobResponse {\n  jobId: string;\n  status: string;\n  statusUrl: string;\n  operation: string;\n  entityType: ProfileEntityType;\n  /** Entities reserved against usage for this job. */\n  entityCountReserved?: number;\n  /** Null when the job has no associated event. */\n  eventId?: string | null;\n  replayed?: boolean;\n  /** Sample runs only: how many entities were picked. */\n  sampled?: number;\n  /** Sample runs only: the entity ids picked. Read each one with `getProfile`. */\n  entityIds?: string[];\n}\n\n/** The settings to write. `schema` and `customInstructions` apply to user profiles. */\nexport interface ProfileSettings {\n  /** Turn profile generation on or off. Project-wide. */\n  enabled?: boolean;\n  /** JSON Schema for the profile. Every property needs a `description`. */\n  schema?: Record<string, any> | null;\n  customInstructions?: string | null;\n}\n\n/** One entity type's stored configuration. */\nexport interface EntityProfileSettings {\n  /** The customer's JSON Schema, with its property names verbatim. */\n  schema?: Record<string, any> | null;\n  customInstructions?: string | null;\n  [key: string]: any;\n}\n\n/**\n * The settings as stored. `schema` and `customInstructions` are per entity\n * type and nest under `entities`; only `enabled` is project-wide.\n */\nexport interface ProfileSettingsResponse {\n  enabled?: boolean;\n  entities?: Partial<Record<ProfileEntityType, EntityProfileSettings>>;\n  capabilities?: Record<string, any>;\n  [key: string]: any;\n}\n\n/** `GET /v2/profiles/jobs/{id}/`. The job nests under `job`. */\nexport interface ProfileJobStatus {\n  job: {\n    id: string;\n    operation: string;\n    entityType: ProfileEntityType;\n    status: string;\n    /** Null until `enumerationComplete`. */\n    total: number | null;\n    enumerationComplete: boolean;\n    /** succeeded + failed + skipped. */\n    completed: number;\n    succeeded: number;\n    failed: number;\n    skipped: number;\n    [key: string]: any;\n  };\n}\n","import { MemoryClient } from \"./mem0\";\nimport type * as MemoryTypes from \"./mem0.types\";\n\n// Re-export all types from mem0.types\nexport type {\n  AddMemoryOptions,\n  SearchMemoryOptions,\n  GetAllMemoryOptions,\n  DeleteAllMemoryOptions,\n  ProjectOptions,\n  Memory,\n  MemoryHistory,\n  MemoryUpdateBody,\n  ProjectResponse,\n  PromptUpdatePayload,\n  Webhook,\n  WebhookCreatePayload,\n  WebhookUpdatePayload,\n  Messages,\n  Message,\n  AllUsers,\n  User,\n  FeedbackPayload,\n  CreateMemoryExportPayload,\n  GetMemoryExportPayload,\n  ProfileEntityType,\n  ProfileStatus,\n  ProfileResponse,\n  ProfileJobResponse,\n  ProfileJobStatus,\n  ProfileSettings,\n  ProfileSettingsResponse,\n  EntityProfileSettings,\n} from \"./mem0.types\";\n\n// Re-export enums as values (not type-only)\nexport { Feedback, WebhookEvent } from \"./mem0.types\";\n\n// Export the main client\nexport { MemoryClient };\nexport default MemoryClient;\n\n// Export structured exceptions\nexport {\n  MemoryError,\n  AuthenticationError,\n  RateLimitError,\n  ValidationError,\n  MemoryNotFoundError,\n  NetworkError,\n  ConfigurationError,\n  MemoryQuotaExceededError,\n  createExceptionFromResponse,\n} from \"../common/exceptions\";\n\nexport type { MemoryErrorOptions } from \"../common/exceptions\";\n"],"mappings":";AAAA,OAAO,WAAW;AAClB,SAAS,MAAM,cAAc;;;ACK7B,IAAI,UACF,OAA8C,UAAuB;AAGvE,IAAI,iBAAiB;AAVrB;AAWA,IAAI;AACF,qBAAiB,wCAAS,QAAT,mBAAc,oBAAmB,UAAU,QAAQ;AACtE,SAAS,OAAO;AAAC;AACjB,IAAM,kBAAkB;AACxB,IAAM,eAAe;AAGrB,SAAS,aAAa,OAAuB;AAC3C,QAAM,YACJ,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE,IAC1C,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,GAAG,EAAE;AAC5C,SAAO;AACT;AAEA,IAAM,mBAAN,MAAkD;AAAA,EAIhD,YAAY,eAAuB,MAAc;AAC/C,SAAK,SAAS;AACd,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,MAAM,aACJ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