@alfe.ai/openclaw-webhooks 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin.cjs +37 -8
- package/dist/plugin.d.cts +11 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.js +37 -8
- package/package.json +1 -1
package/dist/plugin.cjs
CHANGED
|
@@ -52,13 +52,14 @@ const plugin = {
|
|
|
52
52
|
version: "0.1.0",
|
|
53
53
|
activate(api) {
|
|
54
54
|
const log = api.logger;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
|
|
56
|
+
const startWebhooksService = () => {
|
|
57
|
+
if (globalThis.__alfeWebhooksPluginActivated === true) {
|
|
58
|
+
log.debug("Alfe Webhooks plugin already activated — skipping duplicate");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
globalThis.__alfeWebhooksPluginActivated = true;
|
|
62
|
+
log.info("Alfe Webhooks plugin activating...");
|
|
62
63
|
let alfeConfig = null;
|
|
63
64
|
try {
|
|
64
65
|
alfeConfig = (0, _alfe_ai_config.resolveConfig)();
|
|
@@ -94,7 +95,25 @@ const plugin = {
|
|
|
94
95
|
webhooksClient.start();
|
|
95
96
|
log.info("Webhooks service client started");
|
|
96
97
|
} else log.info("Webhooks service URL not configured — running without webhooks relay");
|
|
97
|
-
}
|
|
98
|
+
};
|
|
99
|
+
const stopWebhooksService = () => {
|
|
100
|
+
globalThis.__alfeWebhooksPluginActivated = false;
|
|
101
|
+
if (webhooksClient) {
|
|
102
|
+
webhooksClient.stop();
|
|
103
|
+
webhooksClient = null;
|
|
104
|
+
log.info("Webhooks service client stopped");
|
|
105
|
+
}
|
|
106
|
+
if (daemonIpcClient) {
|
|
107
|
+
try {
|
|
108
|
+
daemonIpcClient.stop();
|
|
109
|
+
log.info("Disconnected from Alfe daemon");
|
|
110
|
+
} catch (err) {
|
|
111
|
+
log.debug(`Error disconnecting from daemon: ${err.message}`);
|
|
112
|
+
}
|
|
113
|
+
daemonIpcClient = null;
|
|
114
|
+
}
|
|
115
|
+
log.info("Alfe Webhooks plugin deactivated");
|
|
116
|
+
};
|
|
98
117
|
if (typeof api.registerGatewayMethod === "function") {
|
|
99
118
|
api.registerGatewayMethod("webhooks.create", async (...args) => {
|
|
100
119
|
const params = args[0];
|
|
@@ -157,6 +176,16 @@ const plugin = {
|
|
|
157
176
|
});
|
|
158
177
|
log.info("Registered gateway RPC methods: webhooks.create, webhooks.list, webhooks.delete, webhooks.rotate, webhooks.deliveries");
|
|
159
178
|
}
|
|
179
|
+
if (api.registerService) api.registerService({
|
|
180
|
+
id: "alfe-webhooks-relay",
|
|
181
|
+
start: () => {
|
|
182
|
+
startWebhooksService();
|
|
183
|
+
},
|
|
184
|
+
stop: () => {
|
|
185
|
+
stopWebhooksService();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
else if (!(globalThis.__alfeWebhooksPluginActivated === true)) startWebhooksService();
|
|
160
189
|
log.info("Alfe Webhooks plugin activated");
|
|
161
190
|
},
|
|
162
191
|
deactivate(api) {
|
package/dist/plugin.d.cts
CHANGED
|
@@ -26,11 +26,22 @@ interface OpenClawConfig {
|
|
|
26
26
|
};
|
|
27
27
|
[key: string]: unknown;
|
|
28
28
|
}
|
|
29
|
+
interface PluginServiceContext {
|
|
30
|
+
config: Record<string, unknown>;
|
|
31
|
+
workspaceDir?: string;
|
|
32
|
+
stateDir: string;
|
|
33
|
+
logger: Logger;
|
|
34
|
+
}
|
|
29
35
|
interface OpenClawPluginApi {
|
|
30
36
|
logger: Logger;
|
|
31
37
|
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
32
38
|
config?: OpenClawConfig;
|
|
33
39
|
registerGatewayMethod?(name: string, handler: (...args: unknown[]) => Promise<unknown>): void;
|
|
40
|
+
registerService?(service: {
|
|
41
|
+
id: string;
|
|
42
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
43
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
44
|
+
}): void;
|
|
34
45
|
on(event: string, handler: (...args: unknown[]) => void | Promise<void>, options?: {
|
|
35
46
|
priority?: number;
|
|
36
47
|
}): void;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -26,11 +26,22 @@ interface OpenClawConfig {
|
|
|
26
26
|
};
|
|
27
27
|
[key: string]: unknown;
|
|
28
28
|
}
|
|
29
|
+
interface PluginServiceContext {
|
|
30
|
+
config: Record<string, unknown>;
|
|
31
|
+
workspaceDir?: string;
|
|
32
|
+
stateDir: string;
|
|
33
|
+
logger: Logger;
|
|
34
|
+
}
|
|
29
35
|
interface OpenClawPluginApi {
|
|
30
36
|
logger: Logger;
|
|
31
37
|
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
32
38
|
config?: OpenClawConfig;
|
|
33
39
|
registerGatewayMethod?(name: string, handler: (...args: unknown[]) => Promise<unknown>): void;
|
|
40
|
+
registerService?(service: {
|
|
41
|
+
id: string;
|
|
42
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
43
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
44
|
+
}): void;
|
|
34
45
|
on(event: string, handler: (...args: unknown[]) => void | Promise<void>, options?: {
|
|
35
46
|
priority?: number;
|
|
36
47
|
}): void;
|
package/dist/plugin.js
CHANGED
|
@@ -52,13 +52,14 @@ const plugin = {
|
|
|
52
52
|
version: "0.1.0",
|
|
53
53
|
activate(api) {
|
|
54
54
|
const log = api.logger;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
|
|
56
|
+
const startWebhooksService = () => {
|
|
57
|
+
if (globalThis.__alfeWebhooksPluginActivated === true) {
|
|
58
|
+
log.debug("Alfe Webhooks plugin already activated — skipping duplicate");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
globalThis.__alfeWebhooksPluginActivated = true;
|
|
62
|
+
log.info("Alfe Webhooks plugin activating...");
|
|
62
63
|
let alfeConfig = null;
|
|
63
64
|
try {
|
|
64
65
|
alfeConfig = resolveConfig();
|
|
@@ -94,7 +95,25 @@ const plugin = {
|
|
|
94
95
|
webhooksClient.start();
|
|
95
96
|
log.info("Webhooks service client started");
|
|
96
97
|
} else log.info("Webhooks service URL not configured — running without webhooks relay");
|
|
97
|
-
}
|
|
98
|
+
};
|
|
99
|
+
const stopWebhooksService = () => {
|
|
100
|
+
globalThis.__alfeWebhooksPluginActivated = false;
|
|
101
|
+
if (webhooksClient) {
|
|
102
|
+
webhooksClient.stop();
|
|
103
|
+
webhooksClient = null;
|
|
104
|
+
log.info("Webhooks service client stopped");
|
|
105
|
+
}
|
|
106
|
+
if (daemonIpcClient) {
|
|
107
|
+
try {
|
|
108
|
+
daemonIpcClient.stop();
|
|
109
|
+
log.info("Disconnected from Alfe daemon");
|
|
110
|
+
} catch (err) {
|
|
111
|
+
log.debug(`Error disconnecting from daemon: ${err.message}`);
|
|
112
|
+
}
|
|
113
|
+
daemonIpcClient = null;
|
|
114
|
+
}
|
|
115
|
+
log.info("Alfe Webhooks plugin deactivated");
|
|
116
|
+
};
|
|
98
117
|
if (typeof api.registerGatewayMethod === "function") {
|
|
99
118
|
api.registerGatewayMethod("webhooks.create", async (...args) => {
|
|
100
119
|
const params = args[0];
|
|
@@ -157,6 +176,16 @@ const plugin = {
|
|
|
157
176
|
});
|
|
158
177
|
log.info("Registered gateway RPC methods: webhooks.create, webhooks.list, webhooks.delete, webhooks.rotate, webhooks.deliveries");
|
|
159
178
|
}
|
|
179
|
+
if (api.registerService) api.registerService({
|
|
180
|
+
id: "alfe-webhooks-relay",
|
|
181
|
+
start: () => {
|
|
182
|
+
startWebhooksService();
|
|
183
|
+
},
|
|
184
|
+
stop: () => {
|
|
185
|
+
stopWebhooksService();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
else if (!(globalThis.__alfeWebhooksPluginActivated === true)) startWebhooksService();
|
|
160
189
|
log.info("Alfe Webhooks plugin activated");
|
|
161
190
|
},
|
|
162
191
|
deactivate(api) {
|