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 +13 -5
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
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 (
|
|
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-${
|
|
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:
|
|
766
|
+
sessionKey: replySessionKey,
|
|
765
767
|
});
|
|
766
768
|
|
|
767
|
-
|
|
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}`);
|
package/openclaw.plugin.json
CHANGED