54 Commits
Author SHA1 Message Date
cg33andClaude a7164eec1e feat(codex): support custom CLI binary via cli_path option (#545) (#679)
Add cliBin and cliExtraArgs fields to the codex Agent, parsed from the
new cli_path option (e.g. cli_path = "omx" or cli_path = "omx --flag").
The binary is used for both LookPath validation and subprocess execution,
allowing users to run codex-compatible CLIs like omx through cc-connect.

Closes #545

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-27 14:54:24 +08:00
Claude 20268b2b17 fix(codex): use configured codex_home for session listing/history/delete
ListSessions, GetSessionHistory, DeleteSession, and patchSessionSource
all ignored the Agent.codexHome config field and only checked the
CODEX_HOME environment variable. When codex_home was set in config.toml,
StartSession correctly wrote sessions to the custom directory, but the
listing functions searched the default ~/.codex/sessions/ — making all
sessions invisible.

- Add resolveCodexHomeDir helper (explicit config > env > default)
- Thread codexHome through listCodexSessions, findSessionFile,
  getSessionHistory, and patchSessionSource
- Extract CODEX_HOME from session extraEnv for post-exit patching

Made-with: Cursor
2026-04-20 21:49:37 +08:00
Claude d02a5f1370 feat: provider switch fixes, agent type switching, integration tests & i18n
- Fix provider switch not taking effect: clear agent session ID on switch
  to force fresh session instead of resuming with stale config
- Fix ANTHROPIC_MODEL env leak from cc-switch: explicitly set model env
  when provider has custom BaseURL
- Add "clear provider" option in Feishu card for unsetting active provider
- Add debug logging for provider env vars and session startup commands
  (with secret redaction via RedactEnv/RedactArgs)
- Web UI: add agent type switcher in project settings with provider
  compatibility filtering and restart-required flow
- Web UI: filter global providers by agent_types when linking to project
- Web UI: fix heartbeat tab showing "running" for all projects (now shows
  "not configured" when heartbeat is not enabled)
- Web UI: fix page not refreshing after agent type change + restart
- Add comprehensive integration tests for both claudecode and codex
  provider switching (env vars, session args, config writing, send/receive)
- Complete i18n for all 5 languages: replyFooter, injectSender,
  thinkingMessages, toolMessages and their hints

Made-with: Cursor
2026-04-19 00:10:29 +08:00
Claude f8d2cad68f refactor: restructure provider presets with per-agent-type configuration
- Restructure provider-presets.json (v1→v2): replace flat endpoints/
  agent_models/models/agents/codex_config fields with a unified
  `agents` map keyed by agent type, each containing base_url, model,
  models list, and optional codex_config
- Update ProviderPreset Go struct with PresetAgentConfig and helper
  methods SupportsAgent()/AgentConfig()
- Add AgentModelLists to config.ProviderConfig for per-agent model
  lists; ResolveProviderRefs now resolves models per agent type
- Filter global provider linking by agent type in IM /provider add
  card and executeProviderLink to prevent incompatible associations
- Fix Codex 404 caused by shengsuanyun agent_types including "codex"
  with wrong base_url; remove codex from its agent_types
- Update web frontend ProviderPreset type and preset display/add logic
  to use the new agents map structure

Made-with: Cursor
2026-04-18 15:24:32 +08:00
Jerry fdd7173b78 fix(skills): align static discovery with agent layouts (#633) 2026-04-16 14:45:14 +08:00
Jerry d4addfb13f fix(codex): preserve workspace app-server options (#612)
* fix(codex): preserve workspace app-server options

* fix(core): tighten workspace agent option snapshots
2026-04-16 14:44:52 +08:00
xxb e119d54b5d feat(codex): add runtime reply footer aligned with Codex CLI (#578)
* feat(core): add optional reply footer metadata

* feat(config): enable reply footer by default

* feat(codex): use runtime footer metadata from app-server

* feat(codex): resolve exec footer metadata at runtime

* feat(core): style reply footer and prefer context left

* feat(codex): use real runtime context for reply footer

* feat(core): use english left footer text

* fix(codex): use current context tokens for footer left

* fix(codex): match cli context left calculation

* test(codex): adapt footer tests to session base url arg
2026-04-16 14:44:11 +08:00
cg33andClaude 782e4a1d78 fix(codex): pass base URL via -c flag for provider switching (#568)
Codex CLI 0.118.0 deprecated the OPENAI_BASE_URL env var. When users
switch providers via /provider, the new base URL was set as an env var
but ignored by the CLI. Now pass it as `-c openai_base_url=<url>` on
each subprocess invocation so the correct endpoint is used immediately.

Closes #554

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-12 06:19:23 +08:00
Claude d1d93f60b0 fix: address high/medium priority issues from PR review
- PR #445: auto-compress skips when agent has no CompressCommand;
  --max-context-tokens is now configurable via agent options instead
  of being hardcoded to 900000
- PR #448: codex app-server RPC timeout cleans pending map entry;
  emit() uses non-blocking send to prevent readLoop stall;
  readLoop uses scanner with 10MB max line size
- PR #462: restore backward-compatible quiet config — maps to
  display.thinking_messages/tool_messages when [display] not set
- PR #479: Gemini STT sends API key via x-goog-api-key header
  instead of URL query param; model name is URL-escaped
- PR #489: feishu fetchQuotedMessage uses caller context instead
  of context.Background; extractPostPlainText includes code_block
- PR #447/#474: SendToSessionWithAttachments uses workspace-prefix
  stripping fallback matching cron/heartbeat logic
- PR #446: PATH prepend for custom commands limited to Windows only

All changes are backward-compatible; new behavior gated by config.
Tests added for quiet config, workspace prefix, Gemini header, and
feishu code_block extraction.

Made-with: Cursor
2026-04-08 23:11:39 +08:00
4c6eaf1266 fix: cron process leak (#348), codex /compact (#378), auto-compress notify, context limit (#384) (#445)
- fix(#348): call cleanupInteractiveState after new_per_run cron completes
  to prevent orphaned Claude CLI processes accumulating over time

- fix(#378): codex CompressCommand() returns "" since /compact is not
  reliably executed in exec/resume mode (may be treated as plain text)

- feat: notify user via platform message before auto-compress triggers,
  including token estimate (~Xk tokens) for transparency

- fix(#384): pass --max-context-tokens 900000 to claude CLI, raising the
  effective context limit from ~254K to 900K tokens

Co-authored-by: 菇菇 <gugu@gugudeMac-mini.local>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 22:27:12 +08:00
IkariKr 9aea457b27 feat(codex): add optional app-server stdio backend (#448) 2026-04-08 22:26:58 +08:00
Claude f479f6e370 test(codex): fix flaky stdin capture wait in multiline Send test
waitForFileContent returned on first successful open of the file; the
fake codex script uses `cat > file`, which can expose an empty file
briefly. Poll until contents equal the expected prompt so -cover and
CI do not race.
2026-03-28 21:06:58 +08:00
Claude e0e2be4e31 fix(core): 出站限流补全、工具结果展示与 i18n 收紧
- waitOutgoing/sendWithError:重启通知、SendToSession(含图片/文件)、权限与 AskQuestion 内联按钮路径纳入出站令牌桶

- EventResult 分块与 channelClosed 收尾使用 sendWithError,首包失败即停止发送

- ProgressStyleProvider 且 progress_style=legacy 时不再单独推送 EventToolResult 聊天消息(compact/card 仍走 writer)

- 工具结果 fallback 标签改为 MsgKey,补全日/西/繁中翻译

- config.example.toml:说明小数 max_per_second 时 burst 取 ceil

- 修复 processInteractiveEvents 测试参数;新增 SuppressStandaloneToolResultEvent 单测

- fix(codex): 假 codex 脚本用 stdin 读 prompt,适配 --json -
2026-03-28 00:42:35 +08:00
Jerry b56865fb06 feat(feishu): add configurable progress styles (compact/card) to reduce message spam
* feat(feishu): add compact progress style for thinking/tool updates

* feat(feishu): add card-style streaming progress updates
2026-03-28 00:16:13 +08:00
devnu11 2a8c8d3a4a fix(codex): preserve multiline prompts on resume 2026-03-27 23:20:16 +08:00
xxb 526f52e5fc fix(codex): force kill session process group on stop (#340)
* fix(codex): force kill session process group on stop

* fix(codex): kill all active session processes on stop

* fix(core): stop stale event loops on stop
2026-03-27 23:11:16 +08:00
Claude 161176e368 fix(codex): avoid closing events channel before readLoop exits
Close() previously closed cs.events after an 8s wait even when wg.Wait
had not finished, while readLoop could still send in flushPendingAsText
(turn.completed), causing "panic: send on closed channel" after /stop
then /new. Defer channel close until readLoop completes.

Fixes https://github.com/chenhg5/cc-connect/issues/281
2026-03-24 08:16:32 +08:00
Claude cb2371c15a feat: /dir cards, context indicator toggle, Feishu flat send option
- core: interactive /dir card (nav/act) on CardSender platforms; dirApply refactor
- core+i18n: card strings for dir history UI
- config: projects.show_context_indicator (hide [ctx: ~N%] suffix)
- feishu/lark: reply_to_trigger=false posts via Create instead of Reply
- codex: skip flush when ctx done; sync.Once on session Close
- dingtalk: stream runner reconnect loop; cancel on Stop
- go.mod: mark rsc.io/qr as direct require
2026-03-23 16:49:42 +08:00
quabugandClaude Opus 4.6 71a2f9b284 fix: ignore ContinueSession sentinel in non-Claude agents
* fix: ignore ContinueSession sentinel in non-Claude agents

The ContinueSession ("__continue__") sentinel was introduced in df5cc64
for the --continue bridge, but only the claudecode agent was updated to
handle it. All other agents (pi, gemini, codex, cursor, qoder, opencode,
iflow) stored the literal "__continue__" as their session/resume ID,
causing CLI failures like `No session found matching '__continue__'` and
persistent "(empty response)" replies.

The fix adds a `resumeID != core.ContinueSession` guard to each agent's
session constructor so the sentinel is treated as "" (fresh session).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(codex): remove --cd from exec resume args

The codex CLI's `exec resume` subcommand does not support --cd, causing
"unexpected argument '--cd'" errors on every resumed session. The process
working directory is already set via cmd.Dir, so --cd is unnecessary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 10:21:11 +08:00
Claude e2d12c2454 fix: reserve CLI --continue bridge for real user traffic
- Only flip hasConnectedOnce when starting an agent for non-synthetic
  messages (exclude UserID cron and heartbeat) so scheduled jobs cannot
  consume the one-time ContinueSession bridge.
- Add regression tests and align Codex exec resume arg comments with
  the actual --json placement.
2026-03-21 20:58:42 +08:00
a807c732af fix(codex): correct --json flag position in exec resume command (#239)
Fixes issue #220 where the second message in a Codex session would fail
with "error: unexpected argument '--json' found" because the --json flag
was placed before the thread_id positional argument instead of after it.

The codex CLI requires the --json flag to be placed after the subcommand
and positional arguments (thread_id) for the resume command to work correctly.

Before:
  codex exec resume --json --skip-git-repo-check <thread_id> <prompt>

After:
  codex exec resume --skip-git-repo-check <thread_id> --json --cd <dir> <prompt>

Co-authored-by: Ubuntu <ubuntu@localhost.localdomain>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 20:32:23 +08:00
Deeka WongandDeeka Wong 9df8d494dd feat(core): align /model switching with provider flow (#246)
Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
2026-03-21 20:32:22 +08:00
Deeka WongandDeeka Wong 1123c83edb fix(core): share provider model lookup and stabilize tests (#210)
* fix(core): share provider model lookup and stabilize tests

* fix(tests): address PR review follow-ups

---------

Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
2026-03-19 07:55:48 +08:00
80ce4a5632 Add models list to provider config for per-provider model selection via alias (#200)
* Initial plan

* Add models parameter to provider config for /model command support

Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com>

* Change provider models config to alias+model table format with alias-based switching

Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com>

* Update README and docs with /model command and [[providers.models]] alias config format

Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huangdijia <8337659+huangdijia@users.noreply.github.com>
2026-03-18 17:44:44 +08:00
Gaoyuan-SIAT f04c7c51cd feat: add /dir command for dynamic work directory switching 2026-03-16 12:08:41 +08:00
Shawn 588b22b223 fix(agent): always close events channel on session Close timeout (#163)
Six agent session adapters (codex, cursor, gemini, iflow, opencode,
qoder) only close the events channel when wg.Wait completes within
the 8-second timeout. If the timeout fires, the channel is left open,
which can cause consumers to block indefinitely waiting for channel
closure and prevents the engine from detecting that the session has
ended.

Move close(events) after the select block so the channel is always
closed regardless of whether the timeout fires, matching the pattern
already used by piSession.
2026-03-16 06:46:04 +08:00
q107580018 2f01442f75 feat(feishu): add setup/new/bind onboarding with config-safe writeback (#151)
* feat(feishu): add setup/new/bind onboarding and config-safe writeback

* test(codex): stabilize args-file polling under coverage
2026-03-16 06:43:38 +08:00
cg33 a1b76929ea Merge pull request #133 from kevinWangSheng/fix/agent-session-close-events-panic
fix(agent): prevent send-on-closed-channel panic in session Close()
2026-03-14 23:58:51 +08:00
kevinWangSheng be74fddca2 fix(agent): prevent panic from closing events channel while readLoop may still send
In 6 agent session implementations (codex, opencode, qoder, iflow, cursor,
gemini), Close() unconditionally calls close(events) after an 8-second
timeout, even when the readLoop goroutine may still be running and
sending events to the channel. Due to Go's select non-determinism, the
readLoop goroutine can choose the send case over the ctx.Done() case,
causing a "send on closed channel" panic.

Move close(events) into the case where wg.Wait() succeeds (readLoop has
fully exited), and skip closing on timeout to prevent the race. This
follows the same safe pattern already used by claudeSession, where the
events channel is only closed after the readLoop goroutine has finished.
2026-03-14 08:36:29 -07:00
Codex 40a7d2d797 fix(codex): handle large stdout json lines 2026-03-14 21:12:11 +08:00
zhuguanqiandClaude Opus 4.6 444b4a285b fix(codex): update test calls to match new Send signature
Add missing files parameter (nil) to Send() calls in codex tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:16:55 +08:00
zhuguanqiandClaude Opus 4.6 9be1b78295 feat: enable file attachment support for all agents
Extract SaveFilesToDisk/AppendFileRefs helpers into core package and
wire up file handling for Cursor, Codex, OpenCode, Qoder, and iFlow.
Files are saved to .cc-connect/attachments/ and paths are appended to
the prompt so each CLI can read them with its built-in tools.
Also refactors Claude Code to reuse the shared helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:16:55 +08:00
zhuguanqiandClaude Opus 4.6 f7cbc8c2d0 feat(feishu): add file message support
Add FileAttachment type and wire up file handling across the stack so
that files sent in Feishu are downloaded and forwarded to agents.
Claude Code saves files locally for tool-based reading; Gemini passes
them as temp file references. Other agents log a warning and ignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:16:55 +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
q107580018andmac cebe23f93c fix: support codex image attachments (#81)
Co-authored-by: mac <mac@Mac-mini.local>
2026-03-12 19:39:28 +08:00
chenhg5andClaude 8818d3bed1 refactor(agent): optimize scanner buffer sizes
Updated buffer sizes for stdout scanners across all agent sessions:
- Initial buffer size reduced from 1MB to 64KB
- Max buffer size increased from 1MB to 10MB

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-12 06:34: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
q107580018andmac 7a34ca4e00 feat(codex): fallback /model list to local models cache (#65)
Co-authored-by: mac <mac@Mac-mini.local>
2026-03-11 11:41:53 +08:00
chenhg5andClaude c77b94d139 feat(codex): add pending message buffering and improved event handling
Add pending message buffer to accumulate agent messages before classification.
Improve event handling with better logging and support for additional event types.
Add helper functions for text extraction and tool input processing.
Handle turn failures and flush messages appropriately for thinking/text events.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-10 10:40:29 +08:00
chenhg5andClaude fe3306f385 feat(codex): patch session source to make CLI visible
Add patchSessionSource function to rewrite session_meta lines in Codex JSONL transcripts, changing source from "exec" to "cli" and originator to "codex_cli_rs" for CLI visibility. Includes tests for patching behavior and idempotency.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-07 08:46:25 +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 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
chenhg5andClaude f2920739d8 feat: add timeout handling for agent session closure
Added timeout mechanisms with logging for graceful session closure across multiple agent types (claudecode, codex, cursor, gemini, opencode, qoder). Modified engine cleanup to handle timeouts and improve logging. Sessions now timeout after 8-10 seconds with appropriate warnings/errors.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 22:02:54 +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 905287adb1 refactor: remove hardcoded 200-char truncation in tool input
Remove fixed 200-rune truncation from all agents since truncation
is now handled dynamically via /config (thinking_max_len, tool_max_len).

Affected agents: claudecode, codex, cursor, gemini, qoder

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-04 10:07:18 +08:00
chenhg5andClaude Opus 4.6 ca728fbe70 feat: add SkillProvider support for codex, cursor, qoder agents
Extend skill discovery to remaining agents:
- codex: .codex/skills + .claude/skills + CODEX_HOME/skills
- cursor: .claude/skills (project + home)
- qoder: .claude/skills (project + home)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 09:02:39 +08:00
chenhg5andClaude b229ea5801 feat(cc-connect): add --stdin support and improve message sending
- Added --stdin support for sending multi-line/special character messages via heredoc

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 18:03:59 +08:00
chenhg5andClaude 88e55674a5 feat(core): add context compression support
Implement context compression functionality across agents with `/compress` and `/compact` commands. Adds ContextCompressor interface, command handling in engine, and i18n messages. Supported agents implement CompressCommand() with their specific commands.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-03 09:59:00 +08:00
chenhg5andClaude 9265d2bdff feat(agent): add model switching support with /model command
Add model selection capabilities across all agents with:
- ModelSwitcher interface for dynamic model switching
- `/model` command to list/change models
- Default model lists for each agent
- API-based model fetching with fallback
- Session-aware model persistence
- I18n support for model messages

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-02 19:36:27 +08:00
chenhg5andClaude c05f87759a feat(memory): add /memory command with project/global file support
Add MemoryFileProvider interface and implement in claudecode, codex, and gemini agents
Add /memory command to view/edit memory files with translations
Update help text to include new command

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-02 18:09:32 +08:00