Commit Graph
74 Commits
Author SHA1 Message Date
q107580018andmac abc46cfd9b fix: remove duplicate slack app mention case (#89)
Co-authored-by: mac <mac@Mac-mini.local>
2026-03-13 07:52:18 +08:00
mofengandxinlingzhao 0628d55da2 feat(wecom): 新增企业微信 WebSocket 长连接模式 (#93)
* feat(wecom): add WebSocket long-connection mode for WeChat Work

Add WeChat Work AI Bot WebSocket support, enabling connection without
public URL, message encryption, or IP allowlist. Key implementation details:

- Use userID as chatid for single-chat scenarios (matching official SDK behavior)
- Add 500ms delay between multi-chunk sends to prevent out-of-order delivery
- Support text and pre-transcribed voice messages
- Exponential backoff reconnection with heartbeat-based dead connection detection

Made-with: Cursor

* docs(readme): add WebSocket mode for WeChat Work; test(wecom): add unit tests for WebSocket implementation

- Update README support matrix, setup guide, config examples and project
  structure to include the new WebSocket long-connection mode alongside
  existing Webhook
- Add 22 unit tests covering splitByBytes, handleMsgCallback chatID
  fallback, writeAndWaitAck, handleFrame ACK dispatch, generateReqID
  and newWebSocket

Made-with: Cursor

---------

Co-authored-by: xinlingzhao <xinlingzhao@tencent.com>
2026-03-13 07:46:59 +08:00
Shawn 6176f6d5e6 fix(feishu): sanitize non-HTTP URLs in markdown to prevent API rejection (closes #50) (#83) 2026-03-12 19:43:08 +08:00
Leigh StillardandClaude Opus 4.6 647398f765 feat: multi-workspace mode — single bot, multiple workspaces per channel (#79)
* feat: add multi-workspace mode and base_dir config fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add WorkspaceBindingManager for channel-to-workspace persistence

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add workspacePool for managing per-workspace agent state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add ChannelNameResolver interface and Slack implementation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add multi-workspace fields, SetMultiWorkspace, and idle reaper to Engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add resolveWorkspace method for channel-to-directory mapping

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: wire multi-workspace mode setup in main.go

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add workspace init flow for cloning repos and binding channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add /workspace commands (init, unbind, list, status)

Add handleWorkspaceCommand with subcommands:
- (no args): show current workspace binding for the channel
- init <git-url>: clone repo and bind workspace to channel
- unbind: remove workspace binding from channel
- list: show all workspace bindings for the project

Only available when multi-workspace mode is enabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: wire multi-workspace routing into handleMessage with per-workspace agents

Add workspace resolution to handleMessage that resolves channels to workspace
directories, creates per-workspace agents with correct work_dir, and routes
messages through workspace-specific session managers. The normal (single-workspace)
code path is unchanged — all new logic is gated behind e.multiWorkspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add integration tests for multi-workspace resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: resolve multi-workspace bugs found during live testing

Three bugs fixed:

1. App mention events not handled - Slack sends `app_mention` events
   (not `message.channels`) when the bot is @mentioned. Added
   AppMentionEvent handler in the Slack platform.

2. Bot mention prefix not stripped - app_mention text includes
   `<@UBOTID> ` prefix, breaking command parsing and workspace
   resolution. Now stripped before passing to engine.

3. Slash command syntax incompatible with Slack - `/workspace` commands
   were being intercepted by Slack as slash commands. Changed all
   user-facing references and prefix detection to use `workspace`
   without the leading slash.

Also added debug logging to handleEvent for diagnosing event delivery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: instruct agent to use Slack mrkdwn formatting

Add Slack formatting guidelines to the agent system prompt so responses
use Slack's mrkdwn syntax instead of standard Markdown (e.g. *bold*
instead of **bold**, no ## headings).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:38:58 +08:00
chenhg5andClaude 670b57021b feat(core): add card-based permission prompts with callback support
Add support for rich permission prompts using interactive cards when platforms support them. CardButtons now support Extra field for callback data. Implement fallback chain: inline buttons → cards → plain text. Includes i18n support and tests for all platforms.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 07:57:47 +08:00
chenhg5andClaude df7d456646 feat(feishu): add lark platform support and improve error messages
Add support for Lark platform alongside Feishu with shared implementation.
Update all error messages to include platform tag prefix.
Refactor platform initialization to handle both Feishu and Lark configurations.
Add tests for Lark platform specific behaviors.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 06:49:34 +08:00
chenhg5andClaude 90f0e22f73 fix(core): handle nil cards and improve error handling
Add nil checks for card operations in core engine.
Improve token redaction utility and error handling.
Initialize delete mode state properly.
Fix error message in cc-connect update.
Add missing platform allowFrom checks.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 06:28:35 +08:00
Shawn ae13e2331a fix(security): harden access control, socket permissions, and token redaction (#68)
1. Unix socket permissions: 0o660 → 0o600 (owner-only access), preventing
   other processes in the same group from injecting messages via the API.

2. Telegram bot token redaction: when file downloads fail, the bot token
   embedded in the Telegram API URL is now replaced with [REDACTED] in
   error messages to prevent token leakage in logs.

3. Startup warning for open allow_from: all platforms now log a WARN-level
   message when allow_from is not configured, making it obvious that the
   deployment permits all users. This surfaces the fail-open default so
   operators can make an informed decision.

Ref #60
2026-03-12 06:09:28 +08:00
Shawn ef37f6f7ab fix(slack): handle AppMentionEvent for channel @mention support (#66)
Slack dispatches `app_mention` events (not `message` events) when a bot
is @mentioned in a channel. Without handling this event type, the bot
only responds in DMs while silently ignoring channel mentions.

Add a `*slackevents.AppMentionEvent` case to `handleEvent` with the same
validation pipeline (bot filter, old-message guard, AllowList check,
session key generation) used for regular messages.

Also fix stale go.sum checksum for github.com/BurntSushi/toml.

Closes #48
2026-03-12 06:06:57 +08:00
q107580018andmac 986faefb4a feat(codex): support reasoning effort switching (#70)
* feat(codex): support reasoning effort switching

* fix(codex): remove unsupported minimal effort

---------

Co-authored-by: mac <mac@Mac-mini.local>
2026-03-11 19:38:00 +08:00
woqiqishi 13a750c1b5 feat(cards): interactive card UI for slash commands (Feishu) (#52)
* feat(cards): interactive card UI for slash commands on Feishu

- Add platform-agnostic Card model (core/card.go) with builder API
- Add CardSender/CardNavigable interfaces (core/interfaces.go)
- Implement Feishu card renderer using column_set for mobile layout
- Redesign all slash command responses to use interactive cards
- Add handleCardNav router and executeCardAction for in-place updates
- Convert /new /quiet /switch /stop to act: and nav: actions
- /help card uses tab buttons grouped by Session/Agent/Tools/System
- renderUpgradeCard: sync update check with 8s timeout
- Fix: return error card instead of nil in handleCardNav /list /switch

Made-with: Cursor

* fix(cards): address PR #52 review feedback

- Add enable_feishu_card config option (default true) so operators can
  fall back to plain-text replies when card permissions are unavailable;
  wraps Platform in interactivePlatform only when cards are enabled
- Fix goroutine leak in renderUpgradeCard: use buffered channel (cap 1)
  so the background goroutine can always complete even after a timeout
- Fix /stop concurrent logic in executeCardAction: consolidate state
  mutation under a single interactiveMu critical section
- Fix code indentation in platform/feishu/card.go (action map and
  CardSelect/CardNote case blocks)
- Add unit tests for Card.RenderText and Card.HasButtons (core/card_test.go)
- Add Feishu platform tests for ReplyCard/SendCard and card renderer
  (platform/feishu/platform_test.go)
- Update docs/feishu.md and README with enable_feishu_card option

Made-with: Cursor
2026-03-11 07:52:36 +08:00
kevinWangSheng 18aff5d247 fix(qqbot): handle json.Unmarshal and WriteJSON errors
Add error handling for silently ignored errors in the QQBot gateway:
- Hello payload parse (heartbeat_interval): log warning on failure
  instead of silently falling back to hardcoded default
- READY payload parse (session_id): log warning on failure instead
  of storing empty session ID that breaks resume
- InvalidSession payload parse (resumable bool): log warning on
  failure instead of always treating as non-resumable
- Heartbeat WriteJSON: log failure for connection diagnostics
2026-03-10 00:46:21 -07:00
chenhg5andClaude 3cbf69e1db feat(messaging): add message tracing and threaded replies
- Added MessageID field to Message struct for platform message tracing

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 18:08:15 +08:00
chenhg5andClaude 363a21e9ca feat: add shared session support for all platforms
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 17:38:49 +08:00
cg33 29a9c2ee47 Merge pull request #40 from bydsky/main
feat(discord): refactor session key generation and add share_session_in_channel flag
2026-03-09 16:35:43 +08:00
wujian 61268ec1c3 Merge remote-tracking branch 'upstream/main' 2026-03-09 15:53:24 +08:00
chenhg5andClaude c4eade463c fix(feishu): validate URLs before creating hyperlinks
Add URL validation for Feishu post hyperlinks to prevent rejection of non-HTTP(S) URLs. Skip invalid links during markdown parsing.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 15:21:35 +08:00
oskarwu 27c8eccdbb feat: add TTS support with Qwen and OpenAI providers 2026-03-09 12:07:40 +08:00
hexihui a27778a5cc feat(discord): refactor session key generation and add share_session_in_channel flag 2026-03-09 12:46:44 +11:00
kevinWangSheng 0158f44eb1 fix(feishu): add nil checks for SenderId.OpenId and msg.Content
Prevent nil pointer panics when Feishu sends messages where
sender.SenderId.OpenId or msg.Content is nil.
2026-03-08 17:29:46 -07:00
chenhg5andClaude c9127ae652 feat(dingtalk): preprocess markdown content for reply messages
Add preprocessDingTalkMarkdown function to handle DingTalk-specific markdown rendering quirks:
- Convert leading spaces to non-breaking spaces
- Ensure proper line breaks between non-empty lines
- Preserve code blocks formatting

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-08 22:26:25 +08:00
chenhg5andClaude 754c65af32 feat(i18n): add new message keys and improve command formatting
Add new i18n message keys for various command responses (switch, timeout, relay bindings).
Improve formatting of command list output with better descriptions and shell command display.
Adjust Feishu platform message type detection threshold for posts.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-08 21:17:25 +08:00
xiaoheicat b89aadb9c2 Merge upstream/main and resolve conflicts
Merge upstream changes (iFlow agent, multi-bot relay, QQ Beta tag)
with our QQ Bot Official Platform additions. Resolved conflicts in
README.md, README.zh-CN.md, and cmd/cc-connect/main.go by combining
both sets of changes.
2026-03-08 13:25:30 +08:00
xiaoheicat 53043e84fd fix(qqbot): address code review feedback and add image/doc support
Code review fixes:
1. Fix msgSeqMap memory leak: replace unbounded sync.Map with TTL-based
   map that evicts entries older than 5 minutes
2. Fix @mention not stripped: add stripAtMention() to parse and remove
   the <@!botid> prefix from group message content
3. Filter empty messages: skip handler call when content is empty after
   stripping (e.g. bare @bot with no text)
4. Fix reconnect race condition: add atomic.Bool guard to prevent
   concurrent reconnectLoop goroutines
5. Add shard field to Identify payload per QQ official docs
6. Cap reconnect attempts at 30 to avoid infinite retry on config errors

New features:
7. Support receiving image attachments from group and C2C messages,
   downloaded into core.ImageAttachment for agent consumption
8. Add docs/qqbot.md setup guide (bilingual EN/ZH)
9. Update README.md and README.zh-CN.md with QQ Bot platform entries
   in support matrix, setup guide table, config examples, and project
   structure
2026-03-08 13:09:48 +08:00
Rayquaza 4e5d760bd2 feat(telegram): add bot command menu registration
- add BotCommandInfo and CommandRegistrar interface for platform abstraction
- implement GetAllCommands to collect builtin/custom commands and skills
- add i18n descriptions for all 30 builtin commands (en/zh/zh-TW/ja/es)
- implement RegisterCommands for Telegram setMyCommands API integration
2026-03-08 01:12:57 +08:00
xiaoheicat f567b90dd1 feat(platform): add official QQ Bot Platform integration
Add new `qqbot` platform type using the official QQ Bot API v2
(bot.q.qq.com), coexisting with the existing `qq` (OneBot v11) platform.

- OAuth2 token management with auto-refresh
- WebSocket gateway with heartbeat, reconnection, and resume
- GROUP_AT_MESSAGE_CREATE and C2C_MESSAGE_CREATE event handling
- REST API v2 message sending with msg_seq tracking
- No new dependencies (reuses gorilla/websocket)
2026-03-07 21:13:24 +08:00
chenhg5andClaude Opus 4.6 952a0e5d24 feat(relay): support multi-bot binding in group chats
- Add AddToBind() method to incrementally add projects to binding
- Add RemoveFromBind() method to remove specific project from binding
- Update /bind command to support multiple projects:
  - /bind <project> - add project to binding
  - /bind -<project> - remove specific project
  - /bind remove - clear all bindings
- Add debug logging for telegram group message filtering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:49:23 +08:00
chenhg5andClaude f8e5e7b828 fix(streaming): clean stale previews when degraded
Add logic to delete stale preview messages when stream preview is degraded.
Implement PreviewCleaner interface for Telegram platform and add test coverage.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 09:02:19 +08:00
chenhg5andClaude 0179d098ce feat(commands): add interactive buttons for lang/model/mode commands
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 08:36:30 +08:00
chenhg5andClaude Opus 4.6 896d8db6ab feat(feishu): add three-tier rendering strategy for markdown messages
- Code blocks/tables → card (schema 2.0 markdown)
- Many \n\n paragraphs (≥4, e.g. help, status) → post rich-text (preserves blank lines)
- Other markdown → post md tag (best native rendering)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 20:40:16 +08:00
chenhg5andClaude Opus 4.6 16b028b098 feat(ui): improve status display and fix Feishu message formatting
- Add quiet mode status to /status command with i18n support
- Fix Feishu help command line breaks (use buildPostJSON instead of md tag)
- Improve tool message formatting (code block for long content)
- Strip XML tags from session summary display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 20:31:37 +08:00
chenhg5andClaude 6717b3ef0b feat(core): add message deduplication by process start time
Added StartTime tracking and IsOldMessage check to prevent processing of messages from before process startup. Implemented checks across all platforms with platform-specific timestamp handling. Includes tests for new functionality.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 15:25:08 +08:00
chenhg5andClaude e40d033c3f feat(engine): enhance session switching and markdown conversion
- Improved `/switch` command to support session names and better matching logic
- Refactored markdown-to-HTML conversion with proper tag nesting and quote escaping
- Added detailed logging for streaming preview operations
- Fixed HTML tag validation in markdown tests
- Updated Telegram platform to handle HTML parsing errors gracefully

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 10:30:29 +08:00
chenhg5andClaude 914198e597 refactor(feishu): ignore reaction removal events
Add handler to ignore reaction deletion events similar to existing reaction creation handling.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 09:46:03 +08:00
chenhg5andClaude Opus 4.6 b8e8316968 feat: add typing indicator and fix HTML escaping
Typing Indicator:
- Add TypingIndicator interface for "processing" feedback
- Discord: send typing status every 8 seconds
- Telegram: send chat typing action every 5 seconds
- Feishu: add emoji reaction, remove when done

Markdown HTML Escaping:
- Fix HTML special chars (<, >, &) escaping in all contexts
- Use placeholder strategy: extract code/links, escape all, restore

Streaming Preview:
- Remove trailing cursor character from preview messages

Feishu Card:
- Add wide_screen_mode config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:42:14 +08:00
chenhg5andClaude Opus 4.6 4b26663fd5 feat: improve markdown rendering and streaming preview
Streaming Preview:
- Add freeze() method to pause preview on permission prompts
- Improve finish() logic for better edge case handling

Markdown Rendering:
- Telegram: switch from Markdown to HTML mode with MarkdownToTelegramHTML
- Discord: use code-fence-aware message splitting
- Feishu: dual rendering strategy (card for code/tables, post for text)
- Feishu: support links, italic, strikethrough in inline parsing
- Feishu: use Patch API for card message updates

i18n:
- Use code blocks for permission prompt content
- Simplify button labels (remove emoji)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:14:50 +08:00
chenhg5andClaude Opus 4.6 e5d328d9d6 feat: add streaming preview and rate limiting support
Streaming Preview:
- Real-time message preview during agent response (like "typing" indicator)
- Supported on Telegram, Discord, and Feishu
- Configurable interval, min delta chars, and max preview length

Rate Limiting:
- Per-session sliding-window rate limiter
- Prevents users from flooding the bot with messages
- Configurable max messages and window size

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 07:02:37 +08:00
chenhg5andClaude a2a2b2b77b feat(discord): enhance session management commands
Add 'name' command and improve descriptions for session management.
Move 'delete' command to group with other session commands.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 17:42:50 +08:00
chenhg5andClaude 0667e970bf feat(agent): add session deletion capability
Implement session deletion functionality across all agent implementations (claudecode, codex, cursor, gemini)
Add new /delete command with session lookup by ID/prefix
Add i18n support for delete-related messages
Update command help texts to include new delete command
Add SessionDeleter interface for agents supporting deletion
Implement core deletion logic with active session protection

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 13:53:43 +08:00
chenhg5andClaude 506061597e feat: add group_replay_all config
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 12:50:51 +08:00
chenhg5andClaude e5b9b35278 feat(alias): add command alias support with config and runtime management
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 10:17:43 +08:00
chenhg5andClaude c6fd0d6b31 feat(restart): add graceful restart capability with notifications
Add restart functionality triggered by /restart command:
- Persists restart requests across process termination
- Sends success notifications post-restart
- Includes internationalized messages
- Supports Discord slash command
- Uses syscall.Exec for clean restart

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 01:19:19 +08:00
chenhg5andClaude 4797b78823 feat(updater): add self-update command with GitHub/Gitee support
Add new `/upgrade` command to check for updates and self-update the binary:
- Checks releases from both GitHub and Gitee APIs
- Supports semver comparison for version checking
- Downloads and replaces binary automatically (except Windows)
- Includes i18n support for all messages
- Adds Discord slash command integration

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 01:04:15 +08:00
chenhg5andClaude 7e24ec307d feat: add bot mention handling for group messages
Add bot mention requirements for group messages across Discord, Feishu, and Telegram platforms:
- Discord: Only respond when bot is @mentioned in guild channels
- Feishu: Add bot openID detection and mention filtering for group chats
- Telegram: Add group message filtering and mention handling

Includes helper functions for mention stripping and detection.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 00:46:53 +08:00
chenhg5andClaude 5e0a192b01 feat(claudecode): add provider proxy support for third-party endpoints
Add local reverse proxy support for third-party Claude providers with:
- Thinking parameter override rewriting
- Bearer token auth compatibility
- Provider clearing functionality
- Configurable thinking modes
- Improved provider management UX
- Enhanced markdown rendering for Feishu

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 23:57:13 +08:00
cg33 1c69c843e4 Merge pull request #16 from kevinWangSheng/fix/feishu-post-and-slash-passthrough
fix: 飞书 post 富文本支持 & slash 命令透传
2026-03-04 18:11:17 +08:00
shenghui kevin 7e1fc2434c fix: 飞书 post 富文本消息支持 & 未识别 slash 命令透传给 agent
1. 飞书发图片或富文本时 msgType 为 post,之前直接忽略了,现在解析其中的文字和图片
2. cc-connect 不认识的 /xxx 命令之前直接报 Unknown command,现在透传给 agent 处理
2026-03-04 01:48:18 -08:00
chenhg5andClaude 1e39199720 fix(dingtalk): handle stream start error more accurately
Check for non-nil error before formatting error message to avoid wrapping nil errors.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 12:41:05 +08:00
chenhg5andClaude e8e39413e8 refactor(session): add context-aware event sending and secure arg logging
Add context-aware select statements when sending events to prevent blocking on closed channels. Implement secure argument logging using RedactArgs to mask sensitive flags. Add atomic file writes and locks for config safety. Improve session handling with mutex protection and deduplication checks.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 12:38:37 +08:00
chenhg5andClaude 698ac48ba7 feat(discord): add slash command support with guild-specific registration
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 10:29:20 +08:00