-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathruntime-api.d.ts
More file actions
101 lines (101 loc) · 2.95 KB
/
Copy pathruntime-api.d.ts
File metadata and controls
101 lines (101 loc) · 2.95 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
export interface OpenClawPluginApi {
rootDir?: string;
pluginConfig?: Record<string, unknown>;
config?: Record<string, unknown>;
logger: {
debug?: (msg: string) => void;
info: (msg: string) => void;
warn: (msg: string) => void;
error: (msg: string) => void;
};
runtime: {
state: {
resolveStateDir: () => string;
};
};
on: (hookName: string, handler: (...args: any[]) => any) => void;
getPluginConfig: (pluginId: string) => Record<string, unknown> | undefined;
resolvePath: (p: string) => string;
}
export type OpenClawPluginConfigSchema = Record<string, unknown>;
export type PluginHookMessageContext = {
sessionKey?: string;
runId?: string;
[key: string]: unknown;
};
export type PluginHookGatewayStartEvent = Record<string, never>;
export type PluginHookMessageReceivedEvent = {
content?: string;
[key: string]: unknown;
};
export type PluginHookMessageSendingEvent = {
to: string;
content: string;
metadata?: Record<string, unknown>;
};
export type PluginHookMessageSendingResult = {
content?: string;
cancel?: boolean;
};
export type PluginHookBeforePromptBuildEvent = {
prompt?: string;
messages?: unknown[];
[key: string]: unknown;
};
export type PluginHookBeforePromptBuildResult = {
prependContext?: string;
appendContext?: string;
prependSystemContext?: string;
appendSystemContext?: string;
};
export type PluginHookBeforeToolCallEvent = {
toolName: string;
params?: Record<string, unknown>;
};
export type PluginHookBeforeToolCallResult = {
block?: boolean;
blockReason?: string;
};
export type PluginHookAfterToolCallEvent = {
toolName: string;
params?: Record<string, unknown>;
result?: unknown;
error?: string;
durationMs?: number;
[key: string]: unknown;
};
export type PluginHookBeforeMessageWriteEvent = {
message: Record<string, unknown>;
};
export type PluginHookBeforeMessageWriteResult = {
block?: boolean;
message?: Record<string, unknown>;
};
export type PluginHookAgentEndEvent = {
messages?: unknown[];
success?: boolean;
error?: string;
durationMs?: number;
[key: string]: unknown;
};
export type PluginHookSessionEndEvent = {
sessionId?: string;
sessionKey?: string;
messageCount?: number;
durationMs?: number;
[key: string]: unknown;
};
type CompatiblePluginKind = "memory" | "context-engine";
type CompatiblePluginEntry = {
id: string;
name: string;
description: string;
kind?: CompatiblePluginKind;
configSchema?: OpenClawPluginConfigSchema;
register: (api: OpenClawPluginApi) => void | Promise<void>;
};
type DefinePluginEntryOptions = CompatiblePluginEntry & {
configSchema?: OpenClawPluginConfigSchema | (() => OpenClawPluginConfigSchema);
};
export declare function definePluginEntry({ id, name, description, kind, configSchema, register, }: DefinePluginEntryOptions): CompatiblePluginEntry;
export {};