38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import type { ClawdbotPluginApi } from "../../src/plugins/types.js";
|
|
|
|
import { createMemoryGetTool, createMemorySearchTool } from "../../src/agents/tools/memory-tool.js";
|
|
import { registerMemoryCli } from "../../src/cli/memory-cli.js";
|
|
|
|
const memoryCorePlugin = {
|
|
id: "memory-core",
|
|
name: "Memory (Core)",
|
|
description: "File-backed memory search tools and CLI",
|
|
kind: "memory",
|
|
register(api: ClawdbotPluginApi) {
|
|
api.registerTool(
|
|
(ctx) => {
|
|
const memorySearchTool = createMemorySearchTool({
|
|
config: ctx.config,
|
|
agentSessionKey: ctx.sessionKey,
|
|
});
|
|
const memoryGetTool = createMemoryGetTool({
|
|
config: ctx.config,
|
|
agentSessionKey: ctx.sessionKey,
|
|
});
|
|
if (!memorySearchTool || !memoryGetTool) return null;
|
|
return [memorySearchTool, memoryGetTool];
|
|
},
|
|
{ names: ["memory_search", "memory_get"] },
|
|
);
|
|
|
|
api.registerCli(
|
|
({ program }) => {
|
|
registerMemoryCli(program);
|
|
},
|
|
{ commands: ["memory"] },
|
|
);
|
|
},
|
|
};
|
|
|
|
export default memoryCorePlugin;
|