openclaw-mobile 1.1.0 → 1.1.1

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/index.ts CHANGED
@@ -677,14 +677,15 @@ async function handleInbound(ctx: any, accountId: string, msg: any) {
677
677
  peer: { kind: "direct", id: senderId },
678
678
  });
679
679
 
680
- const routingSessionKey = msg._connSessionKey ? String(msg._connSessionKey) : null;
681
680
  let sessionKey: string;
681
+ const appSessionKey = msg.sessionKey ? String(msg.sessionKey) : null;
682
+ const routingSessionKey = msg._connSessionKey ? String(msg._connSessionKey) : appSessionKey;
682
683
 
683
- if (routingSessionKey) {
684
+ if (appSessionKey) {
684
685
  const mainKey = route.mainSessionKey as string;
685
686
  const colonIdx = mainKey.lastIndexOf(':');
686
687
  const agentPrefix = colonIdx > 0 ? mainKey.substring(0, colonIdx + 1) : '';
687
- sessionKey = `${agentPrefix}mobile-${routingSessionKey}`;
688
+ sessionKey = `${agentPrefix}mobile-${appSessionKey}`;
688
689
  } else {
689
690
  sessionKey = route.mainSessionKey;
690
691
  }
@@ -754,6 +755,7 @@ async function handleInbound(ctx: any, accountId: string, msg: any) {
754
755
 
755
756
  // Since routingSessionKey maps 1:1 to the App's session ID:
756
757
  const sessionE2E = routingSessionKey ? relayState.e2eSessions.get(routingSessionKey) : undefined;
758
+ const replySessionKey = appSessionKey ?? sessionKey;
757
759
 
758
760
  for (const chunk of chunks.length > 0 ? chunks : [replyText]) {
759
761
  if (!chunk) continue;
@@ -761,13 +763,19 @@ async function handleInbound(ctx: any, accountId: string, msg: any) {
761
763
  type: "message",
762
764
  role: "assistant",
763
765
  content: chunk,
764
- sessionKey: routingSessionKey, // Ensure the app knows which chat UI to attach this to
766
+ sessionKey: replySessionKey,
765
767
  });
766
768
 
767
- const outMsg = sessionE2E?.ready
769
+ let outMsg = sessionE2E?.ready
768
770
  ? await e2eEncrypt(sessionE2E, plainMsg)
769
771
  : plainMsg;
770
772
 
773
+ try {
774
+ const parsedOut = JSON.parse(outMsg);
775
+ parsedOut.sessionKey = routingSessionKey;
776
+ outMsg = JSON.stringify(parsedOut);
777
+ } catch { }
778
+
771
779
  relayState.ws.send(outMsg);
772
780
  }
773
781
  ctx.log?.info?.(`[${CHANNEL_ID}] [${accountId}] Reply delivered (${replyText.length} chars) to routingSessionKey=${routingSessionKey}`);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-mobile",
3
3
  "name": "OpenClaw Mobile",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "description": "Mobile app channel for OpenClaw — chat via the OpenClaw Mobile app through a Cloudflare Worker relay.",
6
6
  "channels": [
7
7
  "openclaw-mobile"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-mobile",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "OpenClaw Mobile channel plugin — relay bridge for the OpenClaw Mobile app",
5
5
  "main": "index.ts",
6
6
  "type": "module",