@alfe.ai/openclaw-chat 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/index.d.ts CHANGED
@@ -16,6 +16,8 @@ interface ChatMessage {
16
16
  role: 'user' | 'assistant';
17
17
  content: string;
18
18
  timestamp: number;
19
+ senderId?: string;
20
+ senderName?: string;
19
21
  }
20
22
  interface SessionData {
21
23
  sessionId: string;
package/dist/plugin2.js CHANGED
@@ -28,7 +28,7 @@ function createAlfeChannelPlugin() {
28
28
  id: CHANNEL_ID,
29
29
  label: "Alfe",
30
30
  selectionLabel: "Alfe (Web & Mobile)",
31
- detailLabel: "Alfe Chat",
31
+ detailLabel: "Alfe",
32
32
  docsPath: "/channels/alfe",
33
33
  docsLabel: "alfe",
34
34
  blurb: "Alfe native chat — web widget and mobile app conversations.",
@@ -246,13 +246,15 @@ async function createSession(sessionId, agentId, channel, tenantId, userId) {
246
246
  cleanupOldSessions();
247
247
  return session;
248
248
  }
249
- async function addMessage(sessionId, role, content) {
249
+ async function addMessage(sessionId, role, content, senderId, senderName) {
250
250
  const session = await getSession(sessionId);
251
251
  if (!session) return;
252
252
  session.messages.push({
253
253
  role,
254
254
  content,
255
- timestamp: Date.now()
255
+ timestamp: Date.now(),
256
+ ...senderId ? { senderId } : {},
257
+ ...senderName ? { senderName } : {}
256
258
  });
257
259
  await saveSession(session);
258
260
  }
@@ -335,16 +337,16 @@ async function handleAgentRequest(request, log) {
335
337
  chatClient?.sendResponse(request.id, false, { message: "OpenClaw SDK not available — cannot dispatch" });
336
338
  return;
337
339
  }
338
- const { message, sessionKey: legacySessionKey, userId, conversationId, tenantId, clientType } = request.params;
340
+ const { message, sessionKey: legacySessionKey, userId, conversationId, conversationType, tenantId, clientType, displayName } = request.params;
339
341
  if (!message) {
340
342
  chatClient?.sendResponse(request.id, false, { message: "Missing message" });
341
343
  return;
342
344
  }
343
- const senderId = userId ?? `anon-${legacySessionKey.slice(0, 12)}`;
345
+ const senderId = displayName ?? userId ?? "anon";
344
346
  const cfg = runtime.config.loadConfig();
345
347
  const sessionId = conversationId ?? legacySessionKey;
346
348
  if (!await getSession(sessionId)) await createSession(sessionId, "", "alfe", tenantId, userId);
347
- await addMessage(sessionId, "user", message);
349
+ await addMessage(sessionId, "user", message, userId ?? senderId, displayName ?? senderId);
348
350
  let resolvedOpenClawKey = null;
349
351
  const unsubscribe = runtime.events.onAgentEvent((evt) => {
350
352
  if (!evt.sessionKey) return;
@@ -360,16 +362,21 @@ async function handleAgentRequest(request, log) {
360
362
  });
361
363
  });
362
364
  try {
363
- const conversationLabel = userId ? `Chat with ${userId}` : `Alfe chat`;
365
+ const shortConvId = conversationId?.slice(-8) ?? "";
366
+ const userLabel = displayName ?? userId ?? senderId;
367
+ const conversationLabel = conversationType === "group" ? shortConvId ? `[Alfe] Group (${shortConvId})` : "[Alfe] Group" : shortConvId ? `[Alfe] ${userLabel} (${shortConvId})` : `[Alfe] ${userLabel}`;
364
368
  resolvedOpenClawKey = (await dispatchInbound({
365
369
  cfg,
366
370
  runtime: { channel: runtime.channel },
367
371
  channel: "alfe",
368
372
  channelLabel: "Alfe",
369
373
  accountId: "default",
370
- peer: {
374
+ peer: conversationType === "group" ? {
375
+ kind: "group",
376
+ id: conversationId ?? senderId
377
+ } : {
371
378
  kind: "direct",
372
- id: senderId
379
+ id: conversationId ? `${senderId}:conv:${conversationId}` : senderId
373
380
  },
374
381
  senderId,
375
382
  senderAddress: `user:${senderId}`,
@@ -381,7 +388,8 @@ async function handleAgentRequest(request, log) {
381
388
  extraContext: {
382
389
  ...tenantId ? { TenantId: tenantId } : {},
383
390
  ...clientType ? { ClientType: clientType } : {},
384
- ...conversationId ? { ConversationId: conversationId } : {}
391
+ ...conversationId ? { ConversationId: conversationId } : {},
392
+ ...displayName ? { SenderName: displayName } : {}
385
393
  },
386
394
  deliver: async (payload) => {
387
395
  const responseText = payload.text ?? "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-chat",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "OpenClaw chat plugin for Alfe — web widget and mobile app channels",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",