feat: add configurable system messages (#1343)

Co-authored-by: GoClaw Operator <operator@goclaw>
This commit is contained in:
nguyenha935andGoClaw Operator authored and GitHub committed 2026-07-04 21:57:14 +07:00
1 parent 8d28f23efb
commit e1fcccea4f
27 files changed
+1280 -41

No files matched your search

+2
View File
@@ -48,6 +48,7 @@ import (
"github.com/nextlevelbuilder/goclaw/internal/security"
"github.com/nextlevelbuilder/goclaw/internal/skills"
"github.com/nextlevelbuilder/goclaw/internal/store"
"github.com/nextlevelbuilder/goclaw/internal/systemmessages"
"github.com/nextlevelbuilder/goclaw/internal/tools"
usagecaps "github.com/nextlevelbuilder/goclaw/internal/usage/caps"
usagepricing "github.com/nextlevelbuilder/goclaw/internal/usage/pricing"
@@ -689,6 +690,7 @@ func runGateway() {
// Channel manager
channelMgr := channels.NewManager(msgBus)
channelMgr.SetSystemMessages(systemmessages.NewResolver(cfg))
deps.channelMgr = channelMgr
// Wire channel member resolver into permission grant paths (WS + HTTP) so
+5 -1
View File
@@ -24,6 +24,7 @@ import (
"github.com/nextlevelbuilder/goclaw/internal/gateway"
"github.com/nextlevelbuilder/goclaw/internal/gateway/methods"
"github.com/nextlevelbuilder/goclaw/internal/store"
"github.com/nextlevelbuilder/goclaw/internal/systemmessages"
"github.com/nextlevelbuilder/goclaw/pkg/protocol"
)
@@ -216,13 +217,16 @@ func wireChannelEventSubscribers(
// Wire pairing approval notification → channel (matching TS notifyPairingApproved).
botName := cfg.ResolveDisplayName("default")
messageResolver := systemmessages.NewResolver(cfg)
pairingMethods.SetOnApprove(func(ctx context.Context, channel, chatID, senderID string) {
// Browser/internal channels use WebSocket — UI polls approval status directly.
if channels.IsInternalChannel(channel) {
slog.Debug("pairing approved for internal channel, skipping notification", "channel", channel)
return
}
msg := fmt.Sprintf("✅ %s access approved. Send a message to start chatting.", botName)
msg := messageResolver.Render("", systemmessages.KeyPairingApproved, systemmessages.Vars{
"app_name": botName,
})
// Group pairings need group_id metadata so channels (e.g. Zalo) route to group API.
if strings.HasPrefix(senderID, "group:") {
msgBus.PublishOutbound(bus.OutboundMessage{