Add LINE Messaging API as the 9th messaging channel using HTTP Webhook.
Supports text/image/audio messages, group chat @mention detection,
reply with quote, and loading animation.
- No external SDK required (standard library only)
- HMAC-SHA256 webhook signature verification
- Reply Token (free) with Push API fallback
- Group chat: respond only when @mentioned
- Quote original message in replies using quoteToken
Closes#146
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous implementation used len(codes)-1 in ReplaceAllStringFunc,
which caused all placeholders to point to the same (last) index.
This resulted in only the last code block being displayed correctly
when multiple code blocks were present in a message.
Now using a proper counter variable that increments for each match,
ensuring each code block gets a unique placeholder index.
Extract formatVersion() and formatBuildInfo() helper functions to reduce code duplication between printVersion() and statusCmd(). Update git commit default value to "dev" in Makefile for consistency with version handling. Update documentation for QQ and DingTalk chat integration in Japanese README.
Merge upstream/main into bugfix/fix-duplicate-telegram-messages.
Conflict resolutions:
- pkg/agent/loop.go: Adopt upstream's processSystemMessage which removes
runAgentLoop call entirely (subagents now communicate via message tool
directly). Keep PR's HasSentInRound() check in Run() for normal
message processing path.
- pkg/tools/message.go: Merge both changes - keep sentInRound tracking
from PR and adopt upstream's *ToolResult return type with Silent: true.
- Add Heartbeat section explaining periodic task execution
- Document spawn tool for async subagent creation
- Explain independent context and message tool communication
- Add workflow diagram for subagent communication
- Update workspace layout with HEARTBEAT.md and state/
- Add heartbeat config to config.example.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add constants package with IsInternalChannel helper to centralize internal channel checks across agent, channels, and heartbeat services
- Add ToProviderDefs method to ToolRegistry to consolidate tool definition conversion logic used in agent loop and tool loop
- Refactor SubagentTool.Execute to use RunToolLoop for consistent tool execution with iteration tracking
- Remove duplicate inline map definitions and type assertion code throughout codebase
Two issues caused duplicate messages to be sent to users:
1. System messages (from subagent): processSystemMessage set SendResponse:true,
causing runAgentLoop to publish outbound. Then Run() also published outbound
using the returned response string, resulting in two identical messages.
Fix: processSystemMessage now returns empty string since runAgentLoop already
handles the send.
2. Message tool double-send: When LLM called the "message" tool during
processing, it published outbound immediately. Then Run() published the
final response again. Fix: Track whether MessageTool sent a message in the
current round (sentInRound flag, reset on each SetContext call). Run()
checks HasSentInRound() before publishing to avoid duplicates.
Extract core LLM tool loop logic into shared RunToolLoop function that can be
used by both main agent and subagents. Subagents now run their own tool loop
with dedicated tool registry, enabling full independence.
Key changes:
- New pkg/tools/toolloop.go with reusable tool execution logic
- Subagents use message tool to communicate directly with users
- Heartbeat processing is now stateless via ProcessHeartbeat
- Simplified system message routing without result forwarding
- Shared tool registry creation for consistency between agents
This architecture follows openclaw's design where async tools notify via
bus and subagents handle their own user communication.