16 Commits
Author SHA1 Message Date
Markandma_k c07740b6e1 feat(cron): add per-job permission mode override (#367)
* feat(cron): add per-job permission mode override

Allow individual cron jobs to specify a permission mode (e.g.
bypassPermissions) that overrides the project default during execution.
The mode is restored after the job completes to prevent leakage into
subsequent user messages.

Changes:
- CronJob.Mode field with validation against known modes
- Message.ModeOverride as runtime carrier to processInteractiveMessageWith
- LiveModeSwitcher.SetLiveMode applied with defer-based restoration
- CronAddRequest.Mode in both Unix socket and management HTTP APIs
- Management API PATCH support for editing existing cron jobs
- Web dashboard: inline mode selector per job + create form dropdown
- i18n translations for all 5 languages (EN/ZH/ZH-TW/JA/ES)

* fix(web): always show permission mode badge on cron job cards

---------

Co-authored-by: ma_k <ma_k@ctrip.com>
2026-04-02 09:38:28 +08:00
术士木星andClaude Opus 4.6 38ece2a2d2 feat(cron): add command to show job details
Add new CLI command `cc-connect cron info <id>` that displays full JSON
details of a scheduled task. This helps users inspect all configuration
fields of a cron job that aren't visible in the compact `cron list` output.

Changes:
- Add `/cron/info` API endpoint in core/api.go
- Add `runCronInfo` CLI handler in cmd/cc-connect/cron.go
- Update help text to include the new command

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 15:30:25 +08:00
术士木星andClaude Opus 4.6 ab87b68b0b feat(cron): add cron edit command to modify job fields
* feat(cron): add `cron edit` command to modify job fields

Add new CLI command `cc-connect cron edit <id> <field> <value>` that
modifies individual fields of a scheduled task.

Features:
- Supports all editable fields: project, session_key, cron_expr, prompt,
  exec, work_dir, description, enabled, silent, mute, session_mode, timeout_mins
- Type validation: bool fields (enabled, mute) and int fields (timeout_mins)
- Read-only fields protected: id, created_at cannot be modified
- Cron expression validation before applying
- Automatic rescheduling when cron_expr or enabled changes

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

* feat(cron): add fallback reflection for string fields + comprehensive help

- Add reflection-based fallback for unknown string fields in updateJobField
- Add printCronEditUsage() with full field list, types, and examples
- Add --help/-h flag support to runCronEdit
- Update error messages to reference --help

The reflection fallback allows editing new string fields without code changes,
while type validation for known fields (bool, int) is preserved.

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

* fix(cron): protect last_run and last_error from editing

Add last_run and last_error to read-only fields list.
These are system-maintained fields that should not be manually edited.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:03:21 +08:00
q107580018 8a75a00df5 feat(telegram): add async startup recovery
* docs: add telegram async recovery design

* feat(telegram): add async startup recovery

* fix(telegram): resolve lint nits

* fix(core): resolve errcheck lint issues

* chore: fix launchd lint issues

* test(telegram): wrap bot api fixtures for interface
2026-03-22 12:03:30 +08:00
术士木星 253a7a73e8 feat(cron): optional new session per run and per-job timeout (#236)
* feat(cron): optional new session per run and per-job timeout

- Add session_mode (reuse default, new_per_run) and timeout_mins to CronJob
- new_per_run uses isolated interactiveState + CC_SESSION_KEY unchanged
- Per-job scheduler/shell wait timeout; 0 = unlimited; nil = 30m
- Wire Unix socket, management API, CLI; docs + tests

Made-with: Cursor

* docs(cron): document optional flags and clean up variable naming
2026-03-21 20:32:24 +08:00
Claude b9af7ea7ba fix: handle errors and add error logging throughout codebase
The changes add error handling for previously ignored operations and introduce logging for critical errors and warnings. This includes:
- Adding error checks for file operations, JSON unmarshaling, system calls
- Logging warnings/errors for failed operations using slog
- Properly handling return values from functions that were previously ignored
- Adding context to error messages for better debugging
- Cleaning up unused code and variables

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-20 00:31:00 +08:00
Claude 2b2210829b feat(attachments): add size limit and path sanitization
Added max attachment size limit (50MB) with validation. Implemented path sanitization for attachments. Added related tests for size limit and path cleaning. Also added i18n messages for BTW command responses and improved connection cleanup in WeCom websocket.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-18 11:50:18 +08:00
q107580018 db8f5f4c00 feat: support agent attachment send-back (#180)
* feat: support agent attachment send-back

* fix: allow default attachment_send in validation
2026-03-18 07:57:40 +08:00
Sean bbd5d56197 fix(cron): validate session_key in cron add to prevent silent runtime failures (#126)
When creating a cron job via `cron add`, if no session_key was provided
(neither via --session-key flag nor CC_SESSION_KEY env), the job was
created with an empty session_key. At runtime, ExecuteCronJob would fail
silently because it couldn't determine the target platform from an empty
session key.

Add server-side validation and auto-detection in handleCronAdd:
- If session_key is empty, attempt to auto-detect from the engine's
  active interactive sessions (works when exactly one session exists)
- If auto-detection fails, return a clear error to the client

Add Engine.ActiveSessionKeys() helper method to expose active session
keys for the auto-detection logic. Uses platform != nil check (instead
of agent session alive check) so sessions are discoverable even before
an agent process is started.
2026-03-15 18:20:07 +08:00
chenhg5andClaude 805045501b feat(cron): add support for shell command execution in cron jobs
The changes introduce a new `--exec` flag to run shell commands directly in cron jobs, mutually exclusive with `--prompt`. This includes:
- Adding `exec` and `work_dir` fields to cron job structs
- Implementing shell command execution logic with timeout handling
- Adding new `/cron addexec` command for shell jobs
- Updating API validation and documentation
- Adding i18n support for new shell-related messages

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-14 11:18:45 +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
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
chenhg5andClaude e6fb09474c refactor(api): store http.Server instance and improve provider listing
- Store http.Server instance in APIServer struct for better resource management
- Enhance provider listing with current provider marker and remove bold formatting
- Update i18n strings for provider list titles

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 00:28:16 +08:00
chenhg5andClaude c33f90cb34 feat(cron): add cron scheduling system with CLI and API support
generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-02 14:35:05 +08:00
chenhg5andClaude 4871157250 feat(claude): add image support and CLI API server for sending messages
Add multimodal image support to Claude sessions by saving attachments to temp files and sending as base64-encoded content. Implement new CLI `send` command and Unix socket API server for external tools to send messages to active sessions. Image support added across all platforms (Discord, Feishu, Line, Slack, Telegram, WeCom).

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-01 12:08:00 +08:00