Commit Graph
96 Commits
Author SHA1 Message Date
cg33 9a2fc734c9 Merge branch 'main' into feat/inject-sender-info 2026-03-13 09:32:08 +08:00
chenhg5andClaude 07cd76f2bb feat(workspace): add multi-workspace support with bind command and i18n messages
Added support for managing multiple workspaces including:
- New workspace bind command to link existing directories
- Enhanced session management scoped to workspaces
- Improved error handling with localized messages
- Fixed interactive state lookup for multi-workspace contexts

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-13 09:13:49 +08:00
sean2077 55b624deab feat: add chat_id to inject_sender preamble
Include chat_id (extracted from session key) in the agent prompt
preamble so the agent can distinguish which group/channel a message
came from.
2026-03-13 09:02:56 +08:00
sean2077 a1f70177ac feat: inject message sender identity into agent prompt
Add opt-in `inject_sender` config option for projects. When enabled,
cc-connect prepends a metadata line to each message before forwarding
to the agent:

    [cc-connect sender_id=ou_abc123 platform=feishu]
    <original message>

This allows agents (Claude Code, Codex, etc.) to identify who sent the
message and adjust behavior accordingly — e.g. personal task views,
role-based access control, or per-user tone.

The feature is off by default and can be enabled per-project:

    [[projects]]
    inject_sender = true

Closes #91
2026-03-12 20:59:42 +08:00
q107580018andmac 949cf1a8f1 feat: add usage command for codex oauth (#80)
Co-authored-by: mac <mac@Mac-mini.local>
2026-03-12 19:39:50 +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 b84bbfc43f feat(i18n): add note text for permission card
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 08:06:06 +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 47df97e35d feat(admin): add admin privilege system for privileged commands
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 07:26:28 +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
q107580018andmac 6bdecaad49 feat: support explicit batch session deletion (#74)
* feat: support batch session deletion

* feat(feishu): add card-based delete flow

* fix(feishu): report missing selected sessions

---------

Co-authored-by: mac <mac@Mac-mini.local>
2026-03-12 06:01:02 +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
chenhg5andClaude 1061d82be6 feat(bind): add setup command and system prompt support
Add `/bind setup` command to write relay instructions to memory file.
Implement SystemPromptSupporter interface to detect native prompt support.
Add related i18n messages for setup flow and hint messages.
Update bind command to show setup hint when needed.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 21:22:54 +08:00
chenhg5andClaude 7ad7584583 fix(engine): prevent stale event processing in agent sessions
Add drainEvents utility to clear buffered events between turns and apply it in processInteractiveMessage and cmdCompress to avoid processing stale events from previous agent interactions.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 19:12:24 +08: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 533dc7d84a feat(tts): improve TTS config handling and add mode validation
Refactor TTS configuration to use pointer type and add validation for TTS mode. Update help messages to include TTS command documentation. Fix ffmpeg command construction for audio conversion.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-09 16:55:55 +08:00
wujian 0dc9168029 tts:fix some code review comments 2026-03-09 15:45:21 +08:00
oskarwu 27c8eccdbb feat: add TTS support with Qwen and OpenAI providers 2026-03-09 12:07:40 +08:00
kevinWangSheng 4f74588429 fix(engine): stop idle timer during permission wait
The idle timer in processInteractiveEvents kept running while
the event loop was blocked waiting for a user permission response.
If the user took longer than eventIdleTimeout to respond, the timer
would fire and kill the session on the next loop iteration.

Stop the idle timer before waiting on pending.Resolved and restart
it after the permission is resolved.
2026-03-08 17:29:09 -07:00
chenhg5andClaude 7d722d65a6 refactor(cmdCompress): improve compression command handling
Move compression logic to async goroutine with proper state handling.
Add event processing with timeout and cleanup.
Add i18n support for compression done message.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-08 21:34:53 +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
chenhg5andClaude c70d3eed7e feat(iflow): update CLI flags and preserve quiet state
Updated iFlow CLI integration flags from `-p` to `-i` for interactive mode.
Modified quiet mode handling to preserve state across session stops.
Added shell command support in i18n messages.
Fixed empty tool ID handling in iFlow session.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-08 09:30:28 +08:00
chenhg5andClaude b14d34d7b2 feat(engine): add shell command execution capability
Add new `/shell` command (with aliases `/sh`, `/exec`, `/run`) to execute shell commands and return output. Includes timeout handling, working directory detection, output trimming, and error handling. Also adds command documentation in all supported languages.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-08 09:09:23 +08:00
Rayquaza d4469bfafd Merge branch 'chenhg5:main' into main 2026-03-08 01:19:50 +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
cg33 82abdc0990 Merge pull request #19 from kevinWangSheng/fix/quiet-global-scope
fix: /quiet 改为全局作用域
2026-03-07 23:12:19 +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 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 8f630a0538 feat(commands): add support for exec commands with shell execution
Add ability to define custom slash commands that execute shell commands directly:
- Extend CommandConfig with Exec and WorkDir fields
- Add cmdCommandsAddExec handler for exec commands
- Implement executeShellCommand with timeout and output handling
- Add work_dir support for exec commands
- Update documentation and i18n messages
- Add tests and error handling

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 07:55:24 +08:00
chenhg5andClaude 796526df50 feat(engine): add configurable agent idle timeout
Add support for configuring agent idle timeout duration via config file
(idle_timeout_mins). Defaults to 2 hours (changed from previous fixed 30 mins).
Timeout can be disabled by setting to 0.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 00:21:40 +08:00
chenhg5andClaude 0c119d8682 refactor(engine): increase event idle timeout to 30 minutes
Adjust eventIdleTimeout constant from 5 to 30 minutes to better handle agent response scenarios. Also includes minor code formatting cleanup in Engine struct.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 00:08:00 +08:00
kevinWangShengandClaude Opus 4.6 f97bf3dcc1 fix: /quiet 支持 per-session 和 global 两种模式
- /quiet:切换当前会话的静默模式,/new 后重置
- /quiet global:切换全局静默模式,跨会话生效,/new 不影响
- 事件处理时 global || session 任一为 true 即静默

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 06:36:51 -08:00
kevinWangShengandClaude Opus 4.6 c7d985edd9 fix: /quiet 改为全局作用域,不再跟随 session 重置
之前 quiet 绑定在 interactiveState 上,/new 或 /switch 会清掉 state 导致
quiet 被重置。用户开了静默模式换个 session 又要重新开一次,体验不好。

改为挂在 Engine 上,全局生效,/new /switch 不影响。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 06:35:59 -08:00
chenhg5andClaude Opus 4.6 54ea246f60 feat(i18n): add translation for session switch success message
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 20:34:13 +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 44c48de8f2 refactor(core): improve message splitting logic with boundary checks
Optimize the splitMessage function to handle newline boundaries more intelligently by checking if the boundary is in the second half of the chunk. Also simplifies the chunking logic and improves variable scoping.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 17:52:23 +08:00
chenhg5andClaude 50ee383051 feat(engine): improve error handling for platform startups
Change engine startup to continue with partial failures instead of exiting.
Handle .old binary paths correctly during restarts. Update logging to reflect
partial startup status and improve restart reliability after updates.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 17:07:20 +08:00
chenhg5andClaude 5befb5cc0e feat(search): add session search command with name/ID matching
Implement new `/search` command that allows searching sessions by:
- Session name or summary (case-insensitive)
- Session ID prefix
Adds internationalization support and usage documentation
Includes error handling and formatted results output

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 16:39:06 +08:00
chenhg5andClaude b0aa286c03 feat(cmd): add pagination support for list command
The cmdList function now accepts page arguments and displays paginated results. Added new i18n messages for paginated titles and hints. Implemented page size constant and page calculation logic.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 16:19:00 +08:00
chenhg5andClaude 2a48df3224 fix(engine): add idle timeout for unresponsive agent sessions
Added eventIdleTimeout constant and idle timer logic to detect and handle stuck agent sessions that stop emitting events. The timer resets on each new event and terminates the session if no events are received within 5 minutes.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 16:07:56 +08:00
chenhg5andClaude 802c694a92 feat(updater): improve update process with auto-restart and Gitee support
Add platform-specific restart handling with restart_unix.go and restart_windows.go. Enhance updater to support Gitee mirrors for Chinese users and automatically restart after updates. Improve version display in restart notifications and streamline update messages.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 14:45:00 +08:00
chenhg5andClaude fcc0da88e2 feat(cron): add silent mode for cron job notifications
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 14:00:12 +08:00
chenhg5andClaude aa4b9a495a feat(relay): add bot-to-bot relay functionality with CLI and API support
This commit introduces a new relay system for bot-to-bot communication, including:
- New `relay` command with send/bind functionality
- RelayManager for coordinating messages between engines
- API endpoints for relay operations
- Interactive `/bind` command for chat group binding
- Session handling and message forwarding
- CLI documentation and help messages
- Internationalization support for relay messages
- Stream preview improvements for relay messages

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 13:49:21 +08:00
chenhg5 53d5576b4b build: release v1.2.0-beta.5 — streaming preview, typing indicators, markdown rendering, rate limiting
Made-with: Cursor
2026-03-06 11:21:46 +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 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 Opus 4.6 00477f25a8 refactor(core): remove redundant fmt.Sprintf and add unit tests
- Remove unnecessary fmt.Sprintf wrapper around i18n.T() calls
- Add comprehensive unit tests for core module components

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 20:56:38 +08:00