forked from ob-labs/memory-powermem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenclaw-plugin-sdk.d.ts
More file actions
64 lines (60 loc) · 2.31 KB
/
openclaw-plugin-sdk.d.ts
File metadata and controls
64 lines (60 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Minimal type declarations for openclaw plugin-sdk so the extension type-checks
* without installing openclaw (faster CI). Runtime resolves via openclaw's loader.
*/
declare module "openclaw/plugin-sdk/memory-core" {
type CommandChain = {
command: (name: string, description?: string) => CommandChain;
description: (desc: string) => CommandChain;
argument: (name: string, description?: string) => CommandChain;
option: (flags: string, description?: string, defaultValue?: string) => CommandChain;
action: (fn: (...args: unknown[]) => void | Promise<void>) => CommandChain;
};
export type OpenClawPluginCliContext = {
program: {
command: (name: string, description?: string) => CommandChain;
};
config: unknown;
logger: { info: (msg: string) => void; warn: (msg: string) => void; debug?: (msg: string) => void };
};
type ServiceContext = {
config: unknown;
workspaceDir?: string;
stateDir: string;
logger: { info: (msg: string) => void; warn: (msg: string) => void };
};
export type OpenClawPluginApi = {
/** Full gateway config (OpenClaw ≥ ~2026.3); used to derive LLM keys for memory plugins. */
config?: unknown;
runtime?: {
state?: { resolveStateDir?: (env?: NodeJS.ProcessEnv) => string };
modelAuth?: {
resolveApiKeyForProvider?: (params: {
provider: string;
cfg?: unknown;
}) => Promise<{ apiKey?: string }>;
};
};
pluginConfig?: Record<string, unknown>;
logger: { info: (msg: string) => void; warn: (msg: string) => void; debug?: (msg: string) => void };
registerTool: (tool: unknown, opts?: { name?: string; names?: string[] }) => void;
registerCli: (
registrar: (ctx: OpenClawPluginCliContext) => void | Promise<void>,
opts?: { commands?: string[] },
) => void;
on: (hookName: string, handler: (event: unknown) => unknown | Promise<unknown>) => void;
registerService: (service: {
id: string;
start: (ctx: ServiceContext) => void | Promise<void>;
stop?: (ctx: ServiceContext) => void;
}) => void;
};
}
declare module "openclaw/plugin-sdk" {
export type OpenClawPluginServiceContext = {
config: unknown;
workspaceDir?: string;
stateDir: string;
logger: { info: (msg: string) => void; warn: (msg: string) => void };
};
}