@alfe.ai/openclaw-chat 0.1.3 → 0.1.4

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.cts CHANGED
@@ -288,7 +288,7 @@ interface PluginApi {
288
288
  execute: (toolCallId: string, params: Record<string, unknown>) => Promise<unknown>;
289
289
  }): void;
290
290
  registerGatewayMethod?(name: string, handler: (...args: unknown[]) => Promise<unknown>): void;
291
- registerService?(service: {
291
+ registerService(service: {
292
292
  id: string;
293
293
  start: (ctx: PluginServiceContext) => void | Promise<void>;
294
294
  stop?: (ctx: PluginServiceContext) => void | Promise<void>;
package/dist/plugin.d.ts CHANGED
@@ -288,7 +288,7 @@ interface PluginApi {
288
288
  execute: (toolCallId: string, params: Record<string, unknown>) => Promise<unknown>;
289
289
  }): void;
290
290
  registerGatewayMethod?(name: string, handler: (...args: unknown[]) => Promise<unknown>): void;
291
- registerService?(service: {
291
+ registerService(service: {
292
292
  id: string;
293
293
  start: (ctx: PluginServiceContext) => void | Promise<void>;
294
294
  stop?: (ctx: PluginServiceContext) => void | Promise<void>;
package/dist/plugin2.cjs CHANGED
@@ -898,7 +898,6 @@ const plugin = {
898
898
  version: pkg.version,
899
899
  activate(api) {
900
900
  const log = api.logger;
901
- const alreadyActivated = globalThis.__alfeChatPluginActivated === true;
902
901
  const alfeChannel = createAlfeChannelPlugin({
903
902
  getChatClient: () => chatClient,
904
903
  listSessions,
@@ -961,26 +960,6 @@ const plugin = {
961
960
  log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
962
961
  }
963
962
  }).catch(() => {});
964
- api.on("session_start", async (...eventArgs) => {
965
- if (!pluginRuntime) return;
966
- const key = eventArgs[0].sessionKey;
967
- if (!key || isAlfeSessionKey(key)) return;
968
- log.info(`Chat session starting: ${key}`);
969
- await createSession(key, "", "alfe");
970
- }, { priority: 50 });
971
- api.on("message_received", async (...eventArgs) => {
972
- if (!pluginRuntime) return;
973
- const event = eventArgs[0];
974
- const ctx = eventArgs[1];
975
- if (!ctx.conversationId || ctx.channelId === "alfe") return;
976
- await addMessage(ctx.conversationId, "user", event.content, event.from);
977
- });
978
- api.on("session_end", (...eventArgs) => {
979
- if (!pluginRuntime) return;
980
- const key = eventArgs[0].sessionKey;
981
- if (!key || !isAlfeSessionKey(key)) return;
982
- log.info(`Chat session ending: ${key}`);
983
- });
984
963
  };
985
964
  const stopChatService = async () => {
986
965
  globalThis.__alfeChatPluginActivated = false;
@@ -1034,7 +1013,27 @@ const plugin = {
1034
1013
  });
1035
1014
  log.info("Registered gateway RPC methods: sessions.list, sessions.get");
1036
1015
  }
1037
- if (api.registerService) api.registerService({
1016
+ api.on("session_start", async (...eventArgs) => {
1017
+ if (!pluginRuntime) return;
1018
+ const key = eventArgs[0].sessionKey;
1019
+ if (!key || isAlfeSessionKey(key)) return;
1020
+ log.info(`Chat session starting: ${key}`);
1021
+ await createSession(key, "", "alfe");
1022
+ }, { priority: 50 });
1023
+ api.on("message_received", async (...eventArgs) => {
1024
+ if (!pluginRuntime) return;
1025
+ const event = eventArgs[0];
1026
+ const ctx = eventArgs[1];
1027
+ if (!ctx.conversationId || ctx.channelId === "alfe") return;
1028
+ await addMessage(ctx.conversationId, "user", event.content, event.from);
1029
+ });
1030
+ api.on("session_end", (...eventArgs) => {
1031
+ if (!pluginRuntime) return;
1032
+ const key = eventArgs[0].sessionKey;
1033
+ if (!key || !isAlfeSessionKey(key)) return;
1034
+ log.info(`Chat session ending: ${key}`);
1035
+ });
1036
+ api.registerService({
1038
1037
  id: "alfe-chat-relay",
1039
1038
  start: () => {
1040
1039
  startChatService();
@@ -1043,7 +1042,6 @@ const plugin = {
1043
1042
  await stopChatService();
1044
1043
  }
1045
1044
  });
1046
- else if (!alreadyActivated) startChatService();
1047
1045
  log.info("Chat plugin registered");
1048
1046
  },
1049
1047
  async deactivate(api) {
package/dist/plugin2.js CHANGED
@@ -898,7 +898,6 @@ const plugin = {
898
898
  version: pkg.version,
899
899
  activate(api) {
900
900
  const log = api.logger;
901
- const alreadyActivated = globalThis.__alfeChatPluginActivated === true;
902
901
  const alfeChannel = createAlfeChannelPlugin({
903
902
  getChatClient: () => chatClient,
904
903
  listSessions,
@@ -961,26 +960,6 @@ const plugin = {
961
960
  log.info(`Registered ${String(a2aTools.length)} agent-to-agent tools`);
962
961
  }
963
962
  }).catch(() => {});
964
- api.on("session_start", async (...eventArgs) => {
965
- if (!pluginRuntime) return;
966
- const key = eventArgs[0].sessionKey;
967
- if (!key || isAlfeSessionKey(key)) return;
968
- log.info(`Chat session starting: ${key}`);
969
- await createSession(key, "", "alfe");
970
- }, { priority: 50 });
971
- api.on("message_received", async (...eventArgs) => {
972
- if (!pluginRuntime) return;
973
- const event = eventArgs[0];
974
- const ctx = eventArgs[1];
975
- if (!ctx.conversationId || ctx.channelId === "alfe") return;
976
- await addMessage(ctx.conversationId, "user", event.content, event.from);
977
- });
978
- api.on("session_end", (...eventArgs) => {
979
- if (!pluginRuntime) return;
980
- const key = eventArgs[0].sessionKey;
981
- if (!key || !isAlfeSessionKey(key)) return;
982
- log.info(`Chat session ending: ${key}`);
983
- });
984
963
  };
985
964
  const stopChatService = async () => {
986
965
  globalThis.__alfeChatPluginActivated = false;
@@ -1034,7 +1013,27 @@ const plugin = {
1034
1013
  });
1035
1014
  log.info("Registered gateway RPC methods: sessions.list, sessions.get");
1036
1015
  }
1037
- if (api.registerService) api.registerService({
1016
+ api.on("session_start", async (...eventArgs) => {
1017
+ if (!pluginRuntime) return;
1018
+ const key = eventArgs[0].sessionKey;
1019
+ if (!key || isAlfeSessionKey(key)) return;
1020
+ log.info(`Chat session starting: ${key}`);
1021
+ await createSession(key, "", "alfe");
1022
+ }, { priority: 50 });
1023
+ api.on("message_received", async (...eventArgs) => {
1024
+ if (!pluginRuntime) return;
1025
+ const event = eventArgs[0];
1026
+ const ctx = eventArgs[1];
1027
+ if (!ctx.conversationId || ctx.channelId === "alfe") return;
1028
+ await addMessage(ctx.conversationId, "user", event.content, event.from);
1029
+ });
1030
+ api.on("session_end", (...eventArgs) => {
1031
+ if (!pluginRuntime) return;
1032
+ const key = eventArgs[0].sessionKey;
1033
+ if (!key || !isAlfeSessionKey(key)) return;
1034
+ log.info(`Chat session ending: ${key}`);
1035
+ });
1036
+ api.registerService({
1038
1037
  id: "alfe-chat-relay",
1039
1038
  start: () => {
1040
1039
  startChatService();
@@ -1043,7 +1042,6 @@ const plugin = {
1043
1042
  await stopChatService();
1044
1043
  }
1045
1044
  });
1046
- else if (!alreadyActivated) startChatService();
1047
1045
  log.info("Chat plugin registered");
1048
1046
  },
1049
1047
  async deactivate(api) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-chat",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "OpenClaw chat plugin for Alfe — web widget and mobile app channels",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",