Skip to content

Commit 685c481

Browse files
committed
bump version to 5.1.0.9400 across all files
1 parent 01677c3 commit 685c481

File tree

16 files changed

+292
-56
lines changed

16 files changed

+292
-56
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ MaClaw(码卡龙)是一款基于 Wails + Go + React 开发的桌面 AI 编
5151

5252
## 关于
5353

54-
* **版本**:V5.0.0.9300
54+
* **版本**:V5.1.0.9400
5555
* **作者**:Dr. Daniel
5656
* **GitHub**[RapidAI/MaClaw](https://github.com/rapidai/maclaw)
5757
* **产品网站**[maclaw.top](https://maclaw.top)

README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Select a provider and enter your API Key in the configuration panel for each too
5151

5252
## About
5353

54-
* **Version**: V5.0.0.9300
54+
* **Version**: V5.1.0.9400
5555
* **Author**: Dr. Daniel
5656
* **GitHub**: [RapidAI/MaClaw](https://github.com/rapidai/maclaw)
5757
* **Website**: [maclaw.top](https://maclaw.top)

build_number

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5494
1+
9400

corelib/weixin/gateway.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ type Gateway struct {
355355
wg sync.WaitGroup
356356
running bool
357357

358+
// Last active user for diagnostic broadcast
359+
lastActiveUID string
360+
358361
// Session pause state
359362
pauseMu sync.Mutex
360363
pauseUntil time.Time
@@ -427,6 +430,13 @@ func (g *Gateway) GetContextToken(userID string) string {
427430
return g.ctxTokens.Get(userID)
428431
}
429432

433+
// LastActiveUserID returns the most recent user who sent a message.
434+
func (g *Gateway) LastActiveUserID() string {
435+
g.mu.Lock()
436+
defer g.mu.Unlock()
437+
return g.lastActiveUID
438+
}
439+
430440
func (g *Gateway) emitStatus(status string) {
431441
if g.onStatus != nil {
432442
g.onStatus(status)
@@ -633,6 +643,11 @@ func (g *Gateway) processIncomingMessage(ctx context.Context, msg weixinMessage)
633643
return
634644
}
635645

646+
// Track last active user for diagnostic broadcast
647+
g.mu.Lock()
648+
g.lastActiveUID = fromUserID
649+
g.mu.Unlock()
650+
636651
// Cache context token
637652
if msg.ContextToken != "" {
638653
g.ctxTokens.Set(fromUserID, msg.ContextToken)

gui/frontend/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const recommendedModels: { [provider: string]: { id: string; note?: string }[] }
140140
{ id: "glm-4.7" },
141141
],
142142
};
143-
const APP_VERSION = "5.0.0.9300"
143+
const APP_VERSION = "5.1.0.9400"
144144

145145
// Tool name constants to avoid repeated string arrays
146146
const TOOL_NAMES = ['claude', 'gemini', 'codex', 'opencode', 'codebuddy', 'cursor', 'iflow', 'kilo'] as const;

gui/frontend/src/components/remote/OnboardingWizard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useState, useCallback, useEffect, useRef } from "react";
2+
import { QRCodeSVG } from "qrcode.react";
23
import {
34
GetMaclawLLMProviders,
45
SaveMaclawLLMProviders,
@@ -9,6 +10,7 @@ import {
910
GetWeixinStatus,
1011
StartWeixinQRLogin,
1112
WaitWeixinQRLogin,
13+
RestartWeixin,
1214
} from "../../../wailsjs/go/main/App";
1315

1416
interface LLMProvider {
@@ -273,6 +275,8 @@ export function OnboardingWizard({ lang, hubUrl, email, uiMode, onClose, onLLMCo
273275
setWxMsg(poll.message || t("✅ 微信绑定成功", "✅ WeChat connected"));
274276
setWxDone(true);
275277
wxPollingRef.current = false;
278+
// Auto-start WeChat process after successful QR scan
279+
RestartWeixin().catch(() => {});
276280
break;
277281
} else if (st === "scaned") {
278282
setWxStatus("scaned");
@@ -598,8 +602,8 @@ export function OnboardingWizard({ lang, hubUrl, email, uiMode, onClose, onLLMCo
598602

599603
{wxQrUrl && wxStatus !== "expired" && wxStatus !== "error" && (
600604
<div style={{ textAlign: "center" }}>
601-
<img src={wxQrUrl} alt="WeChat QR" style={{
602-
width: 180, height: 180, borderRadius: 8,
605+
<QRCodeSVG value={wxQrUrl} size={180} style={{
606+
borderRadius: 8,
603607
border: "1px solid #e2e8f0",
604608
}} />
605609
</div>

gui/frontend/src/version.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const buildNumber = '5494';
2-
export const appVersion = '5.0.0.5494';
1+
export const buildNumber = '9400';
2+
export const appVersion = '5.1.0.9400';

gui/remote_hub_client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,14 @@ func (c *RemoteHubClient) handleIMGatewayClaimResult(msg inboundHubEnvelope) {
10131013
} else {
10141014
log.Printf("[hub-client] gateway claim DENIED for platform=%s: %s", payload.Platform, payload.Reason)
10151015
}
1016+
// Send claim result as diagnostic to WeChat if applicable
1017+
if payload.Platform == "weixin" && c.app.weixinGateway != nil {
1018+
diagText := fmt.Sprintf("🔍 [客户端] gateway claim result\nplatform=%s ok=%v", payload.Platform, payload.OK)
1019+
if !payload.OK {
1020+
diagText += "\nreason=" + payload.Reason
1021+
}
1022+
c.app.weixinGateway.BroadcastDiag(diagText)
1023+
}
10161024
}
10171025

10181026
func (c *RemoteHubClient) handleNicknameAssigned(msg inboundHubEnvelope) {

gui/weixin_gateway.go

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ func (m *weixinGatewayManager) onIncomingMessage(msg weixin.IncomingMessage) {
179179
return
180180
}
181181

182-
if cfg.IsWeixinLocalMode() {
182+
isLocal := cfg.IsWeixinLocalMode()
183+
hubClient := m.app.hubClient()
184+
hubNil := hubClient == nil
185+
hubConn := !hubNil && hubClient.IsConnected()
186+
log.Printf("[weixin-mgr] onIncomingMessage: user=%s local_mode=%v hub_nil=%v hub_connected=%v", msg.FromUserID, isLocal, hubNil, hubConn)
187+
188+
if isLocal {
183189
m.handleLocalMessage(msg)
184190
return
185191
}
@@ -191,19 +197,7 @@ func (m *weixinGatewayManager) onIncomingMessage(msg weixin.IncomingMessage) {
191197
func (m *weixinGatewayManager) forwardToHub(msg weixin.IncomingMessage) {
192198
hubClient := m.app.hubClient()
193199
if hubClient == nil || !hubClient.IsConnected() {
194-
log.Printf("[weixin-mgr] hub not connected, cannot forward WX message from user=%s", msg.FromUserID)
195-
m.mu.Lock()
196-
gw := m.gateway
197-
m.mu.Unlock()
198-
if gw != nil {
199-
if err := gw.SendText(context.Background(), weixin.OutgoingText{
200-
ToUserID: msg.FromUserID,
201-
Text: "⚠️ Hub 未连接,无法处理消息。",
202-
ContextToken: msg.ContextToken,
203-
}); err != nil {
204-
log.Printf("[weixin-mgr] failed to send hub-disconnected notice to user=%s: %v", msg.FromUserID, err)
205-
}
206-
}
200+
log.Printf("[weixin-mgr] forwardToHub FAILED: hub_nil=%v user=%s", hubClient == nil, msg.FromUserID)
207201
return
208202
}
209203

@@ -227,7 +221,11 @@ func (m *weixinGatewayManager) forwardToHub(msg weixin.IncomingMessage) {
227221
payload["context_token"] = msg.ContextToken
228222
}
229223

230-
hubClient.SendIMGatewayMessage("weixin", payload)
224+
if err := hubClient.SendIMGatewayMessage("weixin", payload); err != nil {
225+
log.Printf("[weixin-mgr] forwardToHub SendIMGatewayMessage error: %v", err)
226+
} else {
227+
log.Printf("[weixin-mgr] forwardToHub OK: user=%s text=%q", msg.FromUserID, truncateForLog(msg.Text, 30))
228+
}
231229
}
232230

233231
// ---------------------------------------------------------------------------
@@ -600,7 +598,51 @@ func (m *weixinGatewayManager) saveMediaToTemp(msg weixin.IncomingMessage) (stri
600598
return p, nil
601599
}
602600

603-
// mediaLabel returns a Chinese label for the media type.
601+
// sendDiag sends a diagnostic message to the WeChat user for remote debugging.
602+
func (m *weixinGatewayManager) sendDiag(toUserID, contextToken, text string) {
603+
m.mu.Lock()
604+
gw := m.gateway
605+
m.mu.Unlock()
606+
if gw == nil {
607+
return
608+
}
609+
_ = gw.SendText(context.Background(), weixin.OutgoingText{
610+
ToUserID: toUserID,
611+
Text: text,
612+
ContextToken: contextToken,
613+
})
614+
}
615+
616+
// BroadcastDiag sends a diagnostic message to the last known WeChat user.
617+
// Used when we don't have a specific user ID (e.g. claim result callback).
618+
func (m *weixinGatewayManager) BroadcastDiag(text string) {
619+
m.mu.Lock()
620+
gw := m.gateway
621+
m.mu.Unlock()
622+
if gw == nil {
623+
return
624+
}
625+
// Use gateway's last known user for broadcast
626+
lastUID := gw.LastActiveUserID()
627+
if lastUID == "" {
628+
log.Printf("[weixin-mgr] BroadcastDiag: no last active user, dropping: %s", text)
629+
return
630+
}
631+
_ = gw.SendText(context.Background(), weixin.OutgoingText{
632+
ToUserID: lastUID,
633+
Text: text,
634+
})
635+
}
636+
637+
// truncateForLog truncates a string for log output.
638+
func truncateForLog(s string, maxRunes int) string {
639+
runes := []rune(s)
640+
if len(runes) <= maxRunes {
641+
return s
642+
}
643+
return string(runes[:maxRunes]) + "..."
644+
}
645+
604646
func mediaLabel(mediaType string) string {
605647
switch mediaType {
606648
case "image":
@@ -618,10 +660,12 @@ func mediaLabel(mediaType string) string {
618660

619661
// HandleGatewayReply dispatches a reply from Hub to the WeChat API.
620662
func (m *weixinGatewayManager) HandleGatewayReply(reply GatewayReplyPayload) {
663+
log.Printf("[weixin-mgr] HandleGatewayReply: type=%s uid=%s text_len=%d", reply.ReplyType, reply.PlatformUID, len(reply.Text))
621664
m.mu.Lock()
622665
gw := m.gateway
623666
m.mu.Unlock()
624667
if gw == nil {
668+
log.Printf("[weixin-mgr] HandleGatewayReply: gateway is nil, dropping reply")
625669
return
626670
}
627671

@@ -743,6 +787,8 @@ func (a *App) SetWeixinLocalMode(enabled bool) error {
743787
if err := a.SaveConfig(cfg); err != nil {
744788
return err
745789
}
790+
log.Printf("[weixin-mgr] SetWeixinLocalMode: enabled=%v (local_mode after save: %v)", enabled, cfg.IsWeixinLocalMode())
791+
746792
// Invalidate cached local handler so it's recreated on next message.
747793
if a.weixinGateway != nil {
748794
a.weixinGateway.resetLocalHandler()
@@ -753,9 +799,14 @@ func (a *App) SetWeixinLocalMode(enabled bool) error {
753799
// send the gateway claim so Hub registers this machine as the owner.
754800
if !enabled {
755801
hubClient := a.hubClient()
802+
hubNil := hubClient == nil
803+
hubConnected := !hubNil && hubClient.IsConnected()
804+
log.Printf("[weixin-mgr] switching to hub mode: hub_nil=%v hub_connected=%v", hubNil, hubConnected)
756805
if hubClient != nil && hubClient.IsConnected() {
757806
hubClient.SendIMGatewayClaim("weixin")
758807
log.Printf("[weixin-mgr] sent gateway claim after switching to hub mode")
808+
} else {
809+
log.Printf("[weixin-mgr] WARNING: cannot send gateway claim, hub not available")
759810
}
760811
}
761812
return nil

hub/internal/im/core.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,12 @@ func (a *Adapter) HandleMessage(ctx context.Context, msg IncomingMessage) {
200200

201201
target := UserTarget{PlatformUID: msg.PlatformUID}
202202

203+
log.Printf("[IM Adapter] HandleMessage: platform=%s uid=%s text_len=%d", msg.PlatformName, msg.PlatformUID, len(msg.Text))
204+
203205
// 1. Identity mapping
204206
unifiedID, err := a.identity.ResolveUser(ctx, msg.PlatformName, msg.PlatformUID)
205207
if err != nil {
208+
log.Printf("[IM Adapter] ResolveUser FAILED: platform=%s uid=%s err=%v", msg.PlatformName, msg.PlatformUID, err)
206209
a.sendResponse(ctx, plugin, target, &GenericResponse{
207210
StatusCode: 403,
208211
StatusIcon: "👋",
@@ -581,6 +584,8 @@ func (a *Adapter) HandleMessage(ctx context.Context, msg IncomingMessage) {
581584
}
582585

583586
// 5. Route to MaClaw Agent — via Coordinator (if wired) or MessageRouter.
587+
log.Printf("[IM Adapter] routing: user=%s coordinator=%v text_len=%d", unifiedID, a.coordinator != nil, len(text))
588+
584589
var routeResp *GenericResponse
585590
var routeErr error
586591
if a.coordinator != nil {

0 commit comments

Comments
 (0)