@alfe.ai/openclaw-webhooks 0.0.3 → 0.0.5

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.d.ts CHANGED
@@ -41,7 +41,7 @@ declare const plugin: {
41
41
  name: string;
42
42
  description: string;
43
43
  version: string;
44
- activate(api: OpenClawPluginApi): Promise<void>;
44
+ activate(api: OpenClawPluginApi): void;
45
45
  deactivate(api: OpenClawPluginApi): void;
46
46
  };
47
47
  //#endregion
package/dist/plugin.js CHANGED
@@ -50,46 +50,50 @@ const plugin = {
50
50
  name: "Alfe Webhooks Plugin",
51
51
  description: "Receive and manage HTTP webhooks from external services",
52
52
  version: "0.1.0",
53
- async activate(api) {
54
- if (globalThis.__alfeWebhooksPluginActivated) {
55
- api.logger.debug("Alfe Webhooks plugin already activated, skipping re-init");
56
- return;
57
- }
58
- globalThis.__alfeWebhooksPluginActivated = true;
53
+ activate(api) {
59
54
  const log = api.logger;
60
- log.info("Alfe Webhooks plugin activating...");
61
- const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
62
- let alfeConfig = null;
63
- try {
64
- alfeConfig = await resolveConfig();
65
- } catch {
66
- log.info("Could not resolve Alfe config — daemon IPC and webhooks WS auth unavailable");
67
- }
68
- daemonIpcClient = await connectToDaemon(pluginConfig.daemonSocket ?? alfeConfig?.socketPath ?? DEFAULT_SOCKET_PATH, log);
69
- const webhooksWsUrl = pluginConfig.webhooksWsUrl;
70
- const apiKey = alfeConfig?.apiKey;
71
- if (webhooksWsUrl && apiKey) {
72
- log.info(`Connecting to webhooks service: ${webhooksWsUrl}`);
73
- webhooksClient = new WebhooksServiceClient({
74
- wsUrl: webhooksWsUrl,
75
- apiKey,
76
- onWebhook: (delivery) => {
77
- log.info(`Webhook received: ${delivery.name} (${delivery.webhookId}) provider=${delivery.provider}`);
78
- if (daemonIpcClient) daemonIpcClient.request("event.emit", {
79
- event: "webhook.received",
80
- payload: delivery
81
- }).catch((err) => {
82
- log.debug(`Failed to emit webhook event to daemon: ${err.message}`);
83
- });
84
- },
85
- onConnectionChange: (connected) => {
86
- log.info(`Webhooks service connection: ${connected ? "connected" : "disconnected"}`);
87
- },
88
- logger: log
55
+ const alreadyActivated = globalThis.__alfeWebhooksPluginActivated === true;
56
+ globalThis.__alfeWebhooksPluginActivated = true;
57
+ if (alreadyActivated) log.debug("Alfe Webhooks plugin re-registering gateway methods");
58
+ else log.info("Alfe Webhooks plugin activating...");
59
+ if (!alreadyActivated) {
60
+ const pluginConfig = (api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw-webhooks"]?.config ?? {};
61
+ let alfeConfig = null;
62
+ try {
63
+ alfeConfig = resolveConfig();
64
+ } catch {
65
+ log.info("Could not resolve Alfe config — daemon IPC and webhooks WS auth unavailable");
66
+ }
67
+ connectToDaemon(pluginConfig.daemonSocket ?? alfeConfig?.socketPath ?? DEFAULT_SOCKET_PATH, log).then((client) => {
68
+ daemonIpcClient = client;
69
+ }).catch((err) => {
70
+ log.debug(`Daemon connect failed: ${err.message}`);
89
71
  });
90
- webhooksClient.start();
91
- log.info("Webhooks service client started");
92
- } else log.info("Webhooks service URL not configured — running without webhooks relay");
72
+ const webhooksWsUrl = pluginConfig.webhooksWsUrl;
73
+ const apiKey = alfeConfig?.apiKey;
74
+ if (webhooksWsUrl && apiKey) {
75
+ log.info(`Connecting to webhooks service: ${webhooksWsUrl}`);
76
+ webhooksClient = new WebhooksServiceClient({
77
+ wsUrl: webhooksWsUrl,
78
+ apiKey,
79
+ onWebhook: (delivery) => {
80
+ log.info(`Webhook received: ${delivery.name} (${delivery.webhookId}) provider=${delivery.provider}`);
81
+ if (daemonIpcClient) daemonIpcClient.request("event.emit", {
82
+ event: "webhook.received",
83
+ payload: delivery
84
+ }).catch((err) => {
85
+ log.debug(`Failed to emit webhook event to daemon: ${err.message}`);
86
+ });
87
+ },
88
+ onConnectionChange: (connected) => {
89
+ log.info(`Webhooks service connection: ${connected ? "connected" : "disconnected"}`);
90
+ },
91
+ logger: log
92
+ });
93
+ webhooksClient.start();
94
+ log.info("Webhooks service client started");
95
+ } else log.info("Webhooks service URL not configured — running without webhooks relay");
96
+ }
93
97
  if (typeof api.registerGatewayMethod === "function") {
94
98
  api.registerGatewayMethod("webhooks.create", async (...args) => {
95
99
  const params = args[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-webhooks",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "OpenClaw webhooks plugin for Alfe — receive and manage external webhooks",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "ws": "^8.18.0",
29
- "@alfe.ai/config": "0.0.5",
29
+ "@alfe.ai/config": "0.0.6",
30
30
  "@alfe.ai/webhooks": "^0.0.1"
31
31
  },
32
32
  "license": "UNLICENSED",