mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
Add plugin lifecycle hooks infrastructure: - before_agent_start: inject context before agent loop - agent_end: analyze conversation after completion - 13 hook types total (message, tool, session, gateway hooks) Memory plugin implementation: - LanceDB vector storage with OpenAI embeddings - kind: "memory" to integrate with upstream slot system - Auto-recall: injects <relevant-memories> when context found - Auto-capture: stores preferences, decisions, entities - Rule-based capture filtering with 0.95 similarity dedup - Tools: memory_recall, memory_store, memory_forget - CLI: clawdbot ltm list|search|stats Plugin infrastructure: - api.on() method for hook registration - Global hook runner singleton for cross-module access - Priority ordering and error catching Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
24 lines
591 B
TypeScript
24 lines
591 B
TypeScript
import type { PluginRegistry } from "../../../plugins/registry.js";
|
|
|
|
export const createTestRegistry = (overrides: Partial<PluginRegistry> = {}): PluginRegistry => {
|
|
const base: PluginRegistry = {
|
|
plugins: [],
|
|
tools: [],
|
|
hooks: [],
|
|
typedHooks: [],
|
|
channels: [],
|
|
providers: [],
|
|
gatewayHandlers: {},
|
|
httpHandlers: [],
|
|
cliRegistrars: [],
|
|
services: [],
|
|
diagnostics: [],
|
|
};
|
|
const merged = { ...base, ...overrides };
|
|
return {
|
|
...merged,
|
|
gatewayHandlers: merged.gatewayHandlers ?? {},
|
|
httpHandlers: merged.httpHandlers ?? [],
|
|
};
|
|
};
|