fix: openclaw plugin and fix the login section there (#4696)

Co-authored-by: Saket Aryan <saketaryan2002@gmail.com>
This commit is contained in:
Kartik
2026-04-04 22:21:46 +05:30
committed by GitHub
co-authored by Saket Aryan
parent c55447c1e4
commit 686d5e987d
33 changed files with 4282 additions and 1882 deletions
+10 -1
View File
@@ -4,6 +4,7 @@
* Platform (SaaS) backend — communicates with api.mem0.ai.
*/
import { PLUGIN_VERSION } from "../telemetry.ts";
import {
APIError,
type AddOptions,
@@ -25,6 +26,10 @@ export class PlatformBackend implements Backend {
this.headers = {
Authorization: `Token ${config.apiKey}`,
"Content-Type": "application/json",
"X-Mem0-Source": "OPENCLAW",
"X-Mem0-Client-Language": "node",
"X-Mem0-Client-Version": PLUGIN_VERSION,
"X-Mem0-Caller-Type": "plugin",
};
}
@@ -287,11 +292,15 @@ export class PlatformBackend implements Backend {
return result;
}
async ping(): Promise<Record<string, unknown>> {
return (await this._request("GET", "/v1/ping/")) as Record<string, unknown>;
}
async status(
_opts: { userId?: string; agentId?: string } = {},
): Promise<Record<string, unknown>> {
try {
await this._request("GET", "/v1/ping/");
await this.ping();
return { connected: true, backend: "platform", base_url: this.baseUrl };
} catch (e) {
return {