Commit Graph

39 Commits

Author SHA1 Message Date
xintaofei
ec07afed50 fix(acp): dedupe slash commands at session update mapping 2026-04-25 17:58:41 +08:00
xintaofei
bcfaba10c7 fix(acp): prevent memory blowup from streaming terminal tool output
Large raw_output snapshots from tool_call_update notifications caused
O(N²) traffic through the event pipeline, multi-GB transient allocations
and WKWebView crashes. The fix turns cumulative snapshots into bounded
incremental deltas and removes redundant payload copies.

- Add ToolCallOutputCache keyed by tool_call_id with a 8KB tail
  fingerprint and total length. Detects cumulative extensions by
  matching the cached tail at the expected offset in the incoming
  snapshot, so it works even when the full output grows into the MB
  range. Emits suffix deltas with raw_output_append=true; falls back
  to a truncated replacement when content diverges.
- Cap any single emitted raw_output chunk at 64KB (MAX_SINGLE_EMIT_BYTES)
  with a UTF-8 char-boundary-safe tail and ANSI-sequence-safe trimming.
  Apply the same cap to emit_terminal_output_update.
- Bound the cache at 256 entries with FIFO eviction, and clear entries
  when the tool call reaches completed / failed / cancelled / error.
- Seed the cache via a dedicated seed() method on SessionUpdate::ToolCall
  so the initial event never emits an accidental append.
- Share emit payloads as Arc<serde_json::Value> across broadcast
  receivers and skip the Tauri-side clone: serialize once and hand the
  same Arc to both the webview emit and the WebSocket broadcaster.
- Add 14 unit tests covering boundary cases: identity, prefix extension
  past the cached tail, divergence, oversized deltas, multibyte UTF-8
  truncation, final-status cleanup, FIFO eviction, seed semantics, and
  ANSI-safe trimming.
2026-04-24 14:28:41 +08:00
xintaofei
022172a9ea chore(lint): clean up frontend and Rust lint issues 2026-04-23 15:56:41 +08:00
xintaofei
834340e536 feat(acp): forward meta/locations fields and use parentToolUseId for precise Agent child grouping
Forward the previously-dropped `locations` and `meta` fields from ACP
SDK ToolCall/ToolCallUpdate events through to the frontend. The meta
field carries `claudeCode.parentToolUseId` which enables precise
parent-child matching for concurrent Agent tool calls during streaming.

- Forward locations/meta in Rust AcpEvent types and connection handlers
- Use parentToolUseId for exact agent→child mapping, with position-based
  fallback for agents that don't provide it (Codex, OpenCode)
- Replace `any` types with proper ToolCallMeta / unknown types
- Add runtime guards for meta field parsing (defensive against
  unexpected shapes from different agents)
- Cache inferLiveToolName results per tool_call_id to avoid redundant
  computation across Phase 1 and Phase 2
- Lazy-construct agentStats only when children exist
2026-04-17 08:24:12 +08:00
xintaofei
f9010634ff fix(acp): stop stripping auto config option for Claude Code
Claude Code SDK now supports the "auto" permission mode, so the
filtering that hid it from the selector and silently dropped attempts
to set it is no longer needed.
2026-04-15 16:54:04 +08:00
xintaofei
f9923df1fe feat(acp): surface Claude API retry state in chat input
Enable raw Claude SDK forwarding for ACP sessions and emit only system/api_retry events to the frontend.

Show a localized single-line retry banner with loading under the conversation input, including error details and retry progress.
2026-04-14 14:59:32 +08:00
xintaofei
1c1738298b fix(acp): harden session-page connection and localize backend errors
- Session-page connect never triggers download/install; returns
  SdkNotInstalled immediately and prompts the user to install from
  Agent Settings instead
- Binary agents now accept any cached version via
  find_best_cached_binary_for_agent so stale caches still connect
- Bound Initialize handshake with a 60s timeout and convert it to
  AcpError::InitializeTimeout via a sentinel in run_connection
- Spawn background task owns ConnectionManager map insertion and
  removes the entry on exit through an RAII guard that survives
  panics, preventing leaked stale entries
- AcpError gains SdkNotInstalled and InitializeTimeout variants plus
  a stable code() identifier; AcpEvent::Error carries code so the
  frontend can render localized messages by key
- Frontend preflight now runs for all connect sources; error event
  handler switches on code to show translated text for
  initialize_timeout, sdk_not_installed, platform_not_supported,
  process_exited, spawn_failed and download_failed
- Remove ConnectionStatus::Downloading enum variant, all frontend
  branches, and i18n strings; drop obsolete autoLinkFailedTitle,
  autoLinkPreflightFailed, preflightCheckFailedDefault and
  preflightFailedTitle keys across 10 locales
- Add backendErrors.* translations in 10 languages
- Diagnostic logging: always log agent stderr plus binary
  path/size/args/env keys and Initialize timing; gate stdin/stdout
  JSON-RPC tracing behind CODEG_ACP_DEBUG to avoid persisting user
  content into OS log files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 03:36:08 +08:00
xintaofei
e4eb7f67eb fix(chat): preserve Gemini CLI history sessions on reopen
When reopening a Gemini CLI history session, session/load fails with
"Authentication required" and the fallback session/new overwrites the
DB external_id with a new session ID that has no corresponding file,
causing all historical messages to disappear.

- Skip session/new when session/load returns "Authentication required"
- Add Gemini to the parser fallback so stale external_ids recover via
  folder_path + started_at matching
- Guard externalIdSavedRef for existing conversations to prevent
  session/new from overwriting the persisted external_id
- Only update conversation status on disconnect when user has sent a
  message, avoiding spurious "completed" flips on pure history views

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 22:32:56 +08:00
xintaofei
40d0a4b995 fix: disable "auto" config option for Claude Code to prevent errors
Claude Code errors when setting config options to "auto". Strip "auto"
values from config options returned to frontend and skip set requests
with "auto" value for Claude Code agent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:54:48 +08:00
xintaofei
ac0d849a7b chore: upgrade sacp to 11.0.0 stable and agent-client-protocol-schema to 0.11
- Upgrade sacp/sacp-tokio from 11.0.0-alpha.1 to 11.0.0 stable
- Upgrade agent-client-protocol-schema from 0.10 to 0.11
- Rebase vendor/sacp-tokio patches (kill_tree, CREATE_NO_WINDOW, stderr
  truncation) onto official 11.0.0 baseline
- Adapt renamed types: FileSystemCapability → FileSystemCapabilities,
  KillTerminalCommandRequest/Response → KillTerminalRequest/Response

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:10:15 +08:00
xintaofei
80a5f8c589 修复acp返回空用量信息导致会话中断 2026-03-31 22:18:14 +08:00
xintaofei
0bc470181d 修复消息渠道的事件未触发 2026-03-31 14:05:03 +08:00
xintaofei
9b9169f61d 解决codex在会话页面有时不返回权限配置选项 2026-03-30 14:00:42 +08:00
xintaofei
080a16f26c 支持无GUI的Server运行模式 2026-03-29 18:36:30 +08:00
xintaofei
d75f94acf3 Merge branch 'main' into cline 2026-03-28 20:15:21 +08:00
xintaofei
be3f4986d7 支持Cline Agent 2026-03-28 20:14:48 +08:00
xintaofei
829e8cd126 优化文件差异的行数计算代码 2026-03-28 18:52:18 +08:00
xintaofei
ab8a936767 优化文件编辑权限请求的差异样式 2026-03-28 18:47:00 +08:00
xintaofei
a049db51e2 优化agent请求文件修改权限时的文件差异显示样式 2026-03-28 18:10:20 +08:00
xintaofei
4ea8954535 支持实时响应时解析读取工具的代码行号 2026-03-28 17:22:21 +08:00
xintaofei
0ab9d46b63 支持实时响应时解析编辑工具的代码行号 2026-03-28 17:13:29 +08:00
xintaofei
d1eaa8f725 重构会话agent连接、初始化、加载配置流程 2026-03-26 19:55:28 +08:00
xintaofei
ac09d3db9e 初始化web服务功能 2026-03-25 14:26:26 +08:00
xintaofei
ad49d9e9ec 修复进行中会话有时无法被取消 2026-03-22 23:20:01 +08:00
xintaofei
048b8a8480 修复警告和错误 2026-03-21 19:29:29 +08:00
itpkcn@gmail.com
f707d988c5 Merge remote-tracking branch 'origin/main' 2026-03-19 21:41:41 +08:00
xintaofei
2712bd1f91 修复警告 2026-03-19 21:33:21 +08:00
xintaofei
e3784fb3f3 使用rust which包来查找命令路径,解决部分电脑环境变量识别问题 2026-03-18 22:59:12 +08:00
xintaofei
bcba054309 重构Agent管理/链接 2026-03-17 20:30:51 +08:00
xintaofei
879d96f5a4 彻底删除支持不完整的Agent和相关代码,减轻维护工作量,等后续真正适配好了再加回来 2026-03-17 18:10:31 +08:00
xintaofei
35f5e16c11 提前检测Agent是否支持fork会话,避免无效展示和操作 2026-03-17 16:03:08 +08:00
xintaofei
f517f4fcbb 优化OpenClaw会话解析 2026-03-17 15:35:34 +08:00
xintaofei
f50484f08c 支持在历史会话中分叉出新会话 2026-03-15 11:44:01 +08:00
xintaofei
5564fdd39f 优化会话加载逻辑 2026-03-10 13:10:46 +08:00
xintaofei
46b276443b 代码警告消除和优化 2026-03-09 10:05:22 +08:00
xintaofei
2b4f00484d 支持部分agent实时更新上下文用量信息 2026-03-08 23:48:47 +08:00
xintaofei
7a4cbcb73e 支持在会话输入框直接进行文件/图片的拖拽和粘贴 2026-03-08 10:54:06 +08:00
xintaofei
dacec69481 处理#[allow(dead_code)]代码 2026-03-07 18:04:36 +08:00
xggz
54d1097b41 Initial commit 2026-03-06 22:56:13 +08:00