555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
42 lines
1.9 KiB
TypeScript
42 lines
1.9 KiB
TypeScript
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
import type { Mem0Config, Mem0Provider, AddOptions, SearchOptions } from "../types.ts";
|
|
import type { Backend } from "../backend/base.ts";
|
|
|
|
import { createMemorySearchTool } from "./memory-search.ts";
|
|
import { createMemoryAddTool } from "./memory-add.ts";
|
|
import { createMemoryGetTool } from "./memory-get.ts";
|
|
import { createMemoryListTool } from "./memory-list.ts";
|
|
import { createMemoryUpdateTool } from "./memory-update.ts";
|
|
import { createMemoryDeleteTool } from "./memory-delete.ts";
|
|
import { createMemoryEventListTool } from "./memory-event-list.ts";
|
|
import { createMemoryEventStatusTool } from "./memory-event-status.ts";
|
|
|
|
export interface ToolDeps {
|
|
api: OpenClawPluginApi;
|
|
provider: Mem0Provider;
|
|
cfg: Mem0Config;
|
|
backend?: Backend;
|
|
resolveUserId: (opts: { agentId?: string; userId?: string }) => string;
|
|
effectiveUserId: (sessionKey?: string) => string;
|
|
agentUserId: (id: string) => string;
|
|
buildAddOptions: (userIdOverride?: string, runId?: string, sessionKey?: string) => AddOptions;
|
|
buildSearchOptions: (userIdOverride?: string, limit?: number, runId?: string, sessionKey?: string) => SearchOptions;
|
|
getCurrentSessionId: () => string | undefined;
|
|
skillsActive: boolean;
|
|
captureToolEvent: (toolName: string, properties: Record<string, unknown>) => void;
|
|
}
|
|
|
|
export function registerAllTools(deps: ToolDeps): void {
|
|
const { api } = deps;
|
|
const nonOptional = { optional: false };
|
|
|
|
api.registerTool(createMemorySearchTool(deps), nonOptional);
|
|
api.registerTool(createMemoryAddTool(deps), nonOptional);
|
|
api.registerTool(createMemoryGetTool(deps), nonOptional);
|
|
api.registerTool(createMemoryListTool(deps), nonOptional);
|
|
api.registerTool(createMemoryUpdateTool(deps), nonOptional);
|
|
api.registerTool(createMemoryDeleteTool(deps), nonOptional);
|
|
api.registerTool(createMemoryEventListTool(deps), nonOptional);
|
|
api.registerTool(createMemoryEventStatusTool(deps), nonOptional);
|
|
}
|