@alfe.ai/openclaw-webhooks 0.0.10 → 0.0.12
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 +39 -9
- package/dist/plugin.d.cts +11 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.js +40 -9
- package/openclaw.plugin.json +0 -1
- package/package.json +1 -1
package/dist/plugin.cjs
CHANGED
|
@@ -13,6 +13,7 @@ let _alfe_ai_config = require("@alfe.ai/config");
|
|
|
13
13
|
* - Registers gateway RPC methods for webhook management
|
|
14
14
|
* - Exposes agent-callable tools for self-service CRUD
|
|
15
15
|
*/
|
|
16
|
+
const pkg = (0, require("node:module").createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
|
|
16
17
|
const WEBHOOKS_CAPABILITIES = ["webhooks.receive", "webhooks.manage"];
|
|
17
18
|
let daemonIpcClient = null;
|
|
18
19
|
let webhooksClient = null;
|
|
@@ -49,16 +50,17 @@ const plugin = {
|
|
|
49
50
|
id: "@alfe.ai/openclaw-webhooks",
|
|
50
51
|
name: "Alfe Webhooks Plugin",
|
|
51
52
|
description: "Receive and manage HTTP webhooks from external services",
|
|
52
|
-
version:
|
|
53
|
+
version: pkg.version,
|
|
53
54
|
activate(api) {
|
|
54
55
|
const log = api.logger;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
|
|
57
|
+
const startWebhooksService = () => {
|
|
58
|
+
if (globalThis.__alfeWebhooksPluginActivated === true) {
|
|
59
|
+
log.debug("Alfe Webhooks plugin already activated — skipping duplicate");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
globalThis.__alfeWebhooksPluginActivated = true;
|
|
63
|
+
log.info("Alfe Webhooks plugin activating...");
|
|
62
64
|
let alfeConfig = null;
|
|
63
65
|
try {
|
|
64
66
|
alfeConfig = (0, _alfe_ai_config.resolveConfig)();
|
|
@@ -94,7 +96,25 @@ const plugin = {
|
|
|
94
96
|
webhooksClient.start();
|
|
95
97
|
log.info("Webhooks service client started");
|
|
96
98
|
} else log.info("Webhooks service URL not configured — running without webhooks relay");
|
|
97
|
-
}
|
|
99
|
+
};
|
|
100
|
+
const stopWebhooksService = () => {
|
|
101
|
+
globalThis.__alfeWebhooksPluginActivated = false;
|
|
102
|
+
if (webhooksClient) {
|
|
103
|
+
webhooksClient.stop();
|
|
104
|
+
webhooksClient = null;
|
|
105
|
+
log.info("Webhooks service client stopped");
|
|
106
|
+
}
|
|
107
|
+
if (daemonIpcClient) {
|
|
108
|
+
try {
|
|
109
|
+
daemonIpcClient.stop();
|
|
110
|
+
log.info("Disconnected from Alfe daemon");
|
|
111
|
+
} catch (err) {
|
|
112
|
+
log.debug(`Error disconnecting from daemon: ${err.message}`);
|
|
113
|
+
}
|
|
114
|
+
daemonIpcClient = null;
|
|
115
|
+
}
|
|
116
|
+
log.info("Alfe Webhooks plugin deactivated");
|
|
117
|
+
};
|
|
98
118
|
if (typeof api.registerGatewayMethod === "function") {
|
|
99
119
|
api.registerGatewayMethod("webhooks.create", async (...args) => {
|
|
100
120
|
const params = args[0];
|
|
@@ -157,6 +177,16 @@ const plugin = {
|
|
|
157
177
|
});
|
|
158
178
|
log.info("Registered gateway RPC methods: webhooks.create, webhooks.list, webhooks.delete, webhooks.rotate, webhooks.deliveries");
|
|
159
179
|
}
|
|
180
|
+
if (api.registerService) api.registerService({
|
|
181
|
+
id: "alfe-webhooks-relay",
|
|
182
|
+
start: () => {
|
|
183
|
+
startWebhooksService();
|
|
184
|
+
},
|
|
185
|
+
stop: () => {
|
|
186
|
+
stopWebhooksService();
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
else if (!(globalThis.__alfeWebhooksPluginActivated === true)) startWebhooksService();
|
|
160
190
|
log.info("Alfe Webhooks plugin activated");
|
|
161
191
|
},
|
|
162
192
|
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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { WebhooksServiceClient } from "@alfe.ai/webhooks";
|
|
2
3
|
import { DEFAULT_SOCKET_PATH, resolveConfig } from "@alfe.ai/config";
|
|
3
4
|
//#region src/plugin.ts
|
|
@@ -13,6 +14,7 @@ import { DEFAULT_SOCKET_PATH, resolveConfig } from "@alfe.ai/config";
|
|
|
13
14
|
* - Registers gateway RPC methods for webhook management
|
|
14
15
|
* - Exposes agent-callable tools for self-service CRUD
|
|
15
16
|
*/
|
|
17
|
+
const pkg = createRequire(import.meta.url)("../package.json");
|
|
16
18
|
const WEBHOOKS_CAPABILITIES = ["webhooks.receive", "webhooks.manage"];
|
|
17
19
|
let daemonIpcClient = null;
|
|
18
20
|
let webhooksClient = null;
|
|
@@ -49,16 +51,17 @@ const plugin = {
|
|
|
49
51
|
id: "@alfe.ai/openclaw-webhooks",
|
|
50
52
|
name: "Alfe Webhooks Plugin",
|
|
51
53
|
description: "Receive and manage HTTP webhooks from external services",
|
|
52
|
-
version:
|
|
54
|
+
version: pkg.version,
|
|
53
55
|
activate(api) {
|
|
54
56
|
const log = api.logger;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
|
|
58
|
+
const startWebhooksService = () => {
|
|
59
|
+
if (globalThis.__alfeWebhooksPluginActivated === true) {
|
|
60
|
+
log.debug("Alfe Webhooks plugin already activated — skipping duplicate");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
globalThis.__alfeWebhooksPluginActivated = true;
|
|
64
|
+
log.info("Alfe Webhooks plugin activating...");
|
|
62
65
|
let alfeConfig = null;
|
|
63
66
|
try {
|
|
64
67
|
alfeConfig = resolveConfig();
|
|
@@ -94,7 +97,25 @@ const plugin = {
|
|
|
94
97
|
webhooksClient.start();
|
|
95
98
|
log.info("Webhooks service client started");
|
|
96
99
|
} else log.info("Webhooks service URL not configured — running without webhooks relay");
|
|
97
|
-
}
|
|
100
|
+
};
|
|
101
|
+
const stopWebhooksService = () => {
|
|
102
|
+
globalThis.__alfeWebhooksPluginActivated = false;
|
|
103
|
+
if (webhooksClient) {
|
|
104
|
+
webhooksClient.stop();
|
|
105
|
+
webhooksClient = null;
|
|
106
|
+
log.info("Webhooks service client stopped");
|
|
107
|
+
}
|
|
108
|
+
if (daemonIpcClient) {
|
|
109
|
+
try {
|
|
110
|
+
daemonIpcClient.stop();
|
|
111
|
+
log.info("Disconnected from Alfe daemon");
|
|
112
|
+
} catch (err) {
|
|
113
|
+
log.debug(`Error disconnecting from daemon: ${err.message}`);
|
|
114
|
+
}
|
|
115
|
+
daemonIpcClient = null;
|
|
116
|
+
}
|
|
117
|
+
log.info("Alfe Webhooks plugin deactivated");
|
|
118
|
+
};
|
|
98
119
|
if (typeof api.registerGatewayMethod === "function") {
|
|
99
120
|
api.registerGatewayMethod("webhooks.create", async (...args) => {
|
|
100
121
|
const params = args[0];
|
|
@@ -157,6 +178,16 @@ const plugin = {
|
|
|
157
178
|
});
|
|
158
179
|
log.info("Registered gateway RPC methods: webhooks.create, webhooks.list, webhooks.delete, webhooks.rotate, webhooks.deliveries");
|
|
159
180
|
}
|
|
181
|
+
if (api.registerService) api.registerService({
|
|
182
|
+
id: "alfe-webhooks-relay",
|
|
183
|
+
start: () => {
|
|
184
|
+
startWebhooksService();
|
|
185
|
+
},
|
|
186
|
+
stop: () => {
|
|
187
|
+
stopWebhooksService();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
else if (!(globalThis.__alfeWebhooksPluginActivated === true)) startWebhooksService();
|
|
160
191
|
log.info("Alfe Webhooks plugin activated");
|
|
161
192
|
},
|
|
162
193
|
deactivate(api) {
|
package/openclaw.plugin.json
CHANGED