@alfe.ai/openclaw 0.0.26 → 0.0.27

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/index.d.cts CHANGED
@@ -91,7 +91,7 @@ declare function registerWithDaemon(client: IPCClient, log: {
91
91
  info(msg: string, ...args: unknown[]): void;
92
92
  warn(msg: string, ...args: unknown[]): void;
93
93
  error(msg: string, ...args: unknown[]): void;
94
- }): Promise<RegisterResult | null>;
94
+ }, pluginName?: string): Promise<RegisterResult | null>;
95
95
  //#endregion
96
96
  //#region ../../packages-internal/agent-client/dist/types.d.ts
97
97
  interface BaseClientOptions {
package/dist/index.d.ts CHANGED
@@ -91,7 +91,7 @@ declare function registerWithDaemon(client: IPCClient, log: {
91
91
  info(msg: string, ...args: unknown[]): void;
92
92
  warn(msg: string, ...args: unknown[]): void;
93
93
  error(msg: string, ...args: unknown[]): void;
94
- }): Promise<RegisterResult | null>;
94
+ }, pluginName?: string): Promise<RegisterResult | null>;
95
95
  //#endregion
96
96
  //#region ../../packages-internal/agent-client/dist/types.d.ts
97
97
  interface BaseClientOptions {
package/dist/plugin.d.cts CHANGED
@@ -17,6 +17,7 @@ interface PluginLogger {
17
17
  }
18
18
  interface PluginApi {
19
19
  logger: PluginLogger;
20
+ runtime?: unknown;
20
21
  config?: {
21
22
  plugins?: {
22
23
  entries?: Record<string, {
package/dist/plugin.d.ts CHANGED
@@ -17,6 +17,7 @@ interface PluginLogger {
17
17
  }
18
18
  interface PluginApi {
19
19
  logger: PluginLogger;
20
+ runtime?: unknown;
20
21
  config?: {
21
22
  plugins?: {
22
23
  entries?: Record<string, {
package/dist/plugin2.cjs CHANGED
@@ -2862,6 +2862,7 @@ var IPCClient = class extends node_events.EventEmitter {
2862
2862
  this.socket = null;
2863
2863
  }
2864
2864
  this._connected = false;
2865
+ this.removeAllListeners();
2865
2866
  }
2866
2867
  /**
2867
2868
  * Send a request to the daemon and wait for a response.
@@ -3044,10 +3045,10 @@ const OPENCLAW_CAPABILITIES = [
3044
3045
  *
3045
3046
  * @returns Registration result or null on failure
3046
3047
  */
3047
- async function registerWithDaemon(client, log) {
3048
+ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw") {
3048
3049
  const response = await client.request("register", {
3049
3050
  framework: "openclaw",
3050
- name: "@alfe.ai/openclaw",
3051
+ name: pluginName,
3051
3052
  version: PLUGIN_VERSION,
3052
3053
  protocolVersion: 1,
3053
3054
  capabilities: [...OPENCLAW_CAPABILITIES],
@@ -3179,8 +3180,7 @@ const plugin = {
3179
3180
  version: "0.1.0",
3180
3181
  activate(api) {
3181
3182
  const log = api.logger;
3182
- log.info("Alfe OpenClaw Plugin activating...");
3183
- const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
3183
+ const isGatewayMode = !!api.runtime;
3184
3184
  let cfg = null;
3185
3185
  try {
3186
3186
  cfg = (0, _alfe_ai_config.resolveConfig)();
@@ -3195,6 +3195,22 @@ const plugin = {
3195
3195
  for (const tool of tools) api.registerTool(tool);
3196
3196
  log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
3197
3197
  }
3198
+ if (!isGatewayMode) {
3199
+ log.debug("Management command context — skipping IPC connection init");
3200
+ return;
3201
+ }
3202
+ if (globalThis.__alfeOpenclawPluginActivated === true) {
3203
+ log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
3204
+ return;
3205
+ }
3206
+ globalThis.__alfeOpenclawPluginActivated = true;
3207
+ if (ipcClient) {
3208
+ log.warn("Stopping stale IPC client from prior activation");
3209
+ ipcClient.stop();
3210
+ ipcClient = null;
3211
+ }
3212
+ log.info("Alfe OpenClaw Plugin activating...");
3213
+ const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
3198
3214
  ipcClient = new IPCClient(socketPath);
3199
3215
  ipcClient.on("event", (event, payload) => {
3200
3216
  switch (event) {
@@ -3222,7 +3238,7 @@ const plugin = {
3222
3238
  const client = ipcClient;
3223
3239
  ipcClient.on("connected", () => {
3224
3240
  log.info("Connected to Alfe daemon — registering capabilities...");
3225
- registerWithDaemon(client, log).then((result) => {
3241
+ registerWithDaemon(client, log, plugin.id).then((result) => {
3226
3242
  if (!result) log.error("Failed to register with daemon — commands may not be routed");
3227
3243
  });
3228
3244
  });
@@ -3242,6 +3258,7 @@ const plugin = {
3242
3258
  ipcClient.stop();
3243
3259
  ipcClient = null;
3244
3260
  }
3261
+ globalThis.__alfeOpenclawPluginActivated = false;
3245
3262
  log.info("Alfe OpenClaw Plugin deactivated");
3246
3263
  }
3247
3264
  };
package/dist/plugin2.js CHANGED
@@ -2864,6 +2864,7 @@ var IPCClient = class extends EventEmitter {
2864
2864
  this.socket = null;
2865
2865
  }
2866
2866
  this._connected = false;
2867
+ this.removeAllListeners();
2867
2868
  }
2868
2869
  /**
2869
2870
  * Send a request to the daemon and wait for a response.
@@ -3046,10 +3047,10 @@ const OPENCLAW_CAPABILITIES = [
3046
3047
  *
3047
3048
  * @returns Registration result or null on failure
3048
3049
  */
3049
- async function registerWithDaemon(client, log) {
3050
+ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw") {
3050
3051
  const response = await client.request("register", {
3051
3052
  framework: "openclaw",
3052
- name: "@alfe.ai/openclaw",
3053
+ name: pluginName,
3053
3054
  version: PLUGIN_VERSION,
3054
3055
  protocolVersion: 1,
3055
3056
  capabilities: [...OPENCLAW_CAPABILITIES],
@@ -3181,8 +3182,7 @@ const plugin = {
3181
3182
  version: "0.1.0",
3182
3183
  activate(api) {
3183
3184
  const log = api.logger;
3184
- log.info("Alfe OpenClaw Plugin activating...");
3185
- const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
3185
+ const isGatewayMode = !!api.runtime;
3186
3186
  let cfg = null;
3187
3187
  try {
3188
3188
  cfg = resolveConfig();
@@ -3197,6 +3197,22 @@ const plugin = {
3197
3197
  for (const tool of tools) api.registerTool(tool);
3198
3198
  log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
3199
3199
  }
3200
+ if (!isGatewayMode) {
3201
+ log.debug("Management command context — skipping IPC connection init");
3202
+ return;
3203
+ }
3204
+ if (globalThis.__alfeOpenclawPluginActivated === true) {
3205
+ log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
3206
+ return;
3207
+ }
3208
+ globalThis.__alfeOpenclawPluginActivated = true;
3209
+ if (ipcClient) {
3210
+ log.warn("Stopping stale IPC client from prior activation");
3211
+ ipcClient.stop();
3212
+ ipcClient = null;
3213
+ }
3214
+ log.info("Alfe OpenClaw Plugin activating...");
3215
+ const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
3200
3216
  ipcClient = new IPCClient(socketPath);
3201
3217
  ipcClient.on("event", (event, payload) => {
3202
3218
  switch (event) {
@@ -3224,7 +3240,7 @@ const plugin = {
3224
3240
  const client = ipcClient;
3225
3241
  ipcClient.on("connected", () => {
3226
3242
  log.info("Connected to Alfe daemon — registering capabilities...");
3227
- registerWithDaemon(client, log).then((result) => {
3243
+ registerWithDaemon(client, log, plugin.id).then((result) => {
3228
3244
  if (!result) log.error("Failed to register with daemon — commands may not be routed");
3229
3245
  });
3230
3246
  });
@@ -3244,6 +3260,7 @@ const plugin = {
3244
3260
  ipcClient.stop();
3245
3261
  ipcClient = null;
3246
3262
  }
3263
+ globalThis.__alfeOpenclawPluginActivated = false;
3247
3264
  log.info("Alfe OpenClaw Plugin deactivated");
3248
3265
  }
3249
3266
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "OpenClaw plugin for Alfe — connects to local gateway daemon via IPC for integration management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",