diff --git a/cmd/picoclaw/cmd_gateway.go b/cmd/picoclaw/cmd_gateway.go index f8b7a9432..188aac507 100644 --- a/cmd/picoclaw/cmd_gateway.go +++ b/cmd/picoclaw/cmd_gateway.go @@ -233,7 +233,7 @@ func gatewayCmd() { if webAppURL != "" { provider := &agentLoopDataProvider{loop: agentLoop, workspace: cfg.WorkspacePath()} - sender := &telegramCommandSender{bus: msgBus, channelManager: channelManager} + sender := &telegramCommandSender{bus: msgBus} miniappNotifier = miniapp.NewStateNotifier() handler := miniapp.NewHandler(provider, sender, cfg.Channels.Telegram.Token, miniappNotifier) agentLoop.OnStateChange = miniappNotifier.Notify @@ -507,21 +507,10 @@ func collectGitRepoInfo(gitRoot string) miniapp.GitInfo { // telegramCommandSender injects Mini App commands into the message bus. type telegramCommandSender struct { - bus *bus.MessageBus - channelManager *channels.Manager + bus *bus.MessageBus } func (s *telegramCommandSender) SendCommand(senderID, chatID, command string) { - // Create a placeholder so status messages (streaming preview, tool progress) - // are visible to the user while the LLM processes the request. - if s.channelManager != nil { - if ch, ok := s.channelManager.GetChannel("telegram"); ok { - if tc, ok := ch.(*channels.TelegramChannel); ok { - tc.CreatePlaceholder(context.Background(), chatID) - } - } - } - s.bus.PublishInbound(bus.InboundMessage{ Channel: "telegram", SenderID: senderID, diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index aa0d5d853..953c7aca9 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -259,6 +259,14 @@ func (al *AgentLoop) Run(ctx context.Context) error { Content: "via MiniApp: " + msg.Content, SkipPlaceholder: true, }) + // Create a placeholder AFTER the echo so status updates appear below it. + if al.channelManager != nil { + if ch, ok := al.channelManager.GetChannel(msg.Channel); ok { + if tc, ok := ch.(*channels.TelegramChannel); ok { + tc.CreatePlaceholder(ctx, msg.ChatID) + } + } + } } // Fast path: handle slash commands immediately without blocking the LLM worker.