Commit Graph

75 Commits

Author SHA1 Message Date
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
4189aa04de feat(ui): render streaming Agent tool calls as Agent cards with nested child grouping
Support Agent card rendering during live streaming responses for Claude
Code, Codex CLI, and OpenCode. Previously Agent cards only rendered for
loaded/historical messages parsed from the DB.

- Fix tool name inference: subagent_type in input now returns "agent"
  instead of "task"; add spawn_agent/wait_agent/close_agent aliases
- Group sub-agent tool calls inside parent Agent cards during streaming
  using position-based heuristic (ACP SDK lacks parent_id tracking)
- Clean raw Agent output (JSON content blocks, XML task_result wrappers)
- Emit agent_stats with nested tool calls so AgentToolCallPart renders
  child execution inline, matching the loaded message appearance
2026-04-17 01:28:13 +08:00
xintaofei
2cec462594 feat(chat): stream partial tool output during live agent response
Live tool calls that produce output while running (e.g. streaming bash
stdout from Codex) now render their partial output in real time instead
of appearing blank until the tool completes. The tool card keeps its
running visual state — spinner and 24KB tail truncation — while chunks
arrive, and transitions to the completed state once the final status
lands. A WeakMap keyed on the ACP reducer's chunks-array identity
memoizes the joined output so repeated renders don't re-run O(n) string
concatenation.
2026-04-15 19:16:50 +08:00
xintaofei
9f1540129b fix(folder): keep mobile sidebars closed on initial load
Prevent left and right sidebars from auto-opening on small screens during folder page initialization, regardless of persisted open state.

Gate mobile sidebar sheets behind restored panel state to avoid initial sidebar pop-in.
2026-04-14 15:52:52 +08:00
xintaofei
7808a5f0d0 feat(acp): notify when permission approval is requested
Send a system notification when an agent triggers a permission request while the app window is not visible.
2026-04-14 15:31:12 +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
96acd6039d perf(frontend): optimize ACP tool call output handling to reduce CPU and memory pressure
Replace raw_output single-string accumulation with a chunks array to
eliminate O(n^2) string concatenation on every 200ms terminal poll event.
Batch tool_call_update dispatches via requestAnimationFrame so multiple
agents no longer trigger 25+ React re-renders per second.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 22:05:26 +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
768d1326b1 feat(ui): add responsive layout support for mobile and small screens
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:47:16 +08:00
xintaofei
4f394ea521 fix: use randomUUID fallback for non-secure contexts in terminal-context
Replace crypto.randomUUID() with the existing randomUUID() utility
that falls back to crypto.getRandomValues() over plain HTTP.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 19:21:56 +08:00
xintaofei
e7bd12e16f fix: sync run button state with terminal process via centralized exit tracking
Centralize terminal process lifecycle in terminal-context as single
source of truth. TerminalView reports exit/failure via callback,
context maintains exitedTerminals set, command-dropdown reacts to it.

Removes redundant polling and per-component exit event subscriptions
that raced with deferred spawn introduced in b2d10fa.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 19:02:01 +08:00
xintaofei
b2d10fa008 optimize: terminal spawn lifecycle to eliminate output race condition
Move PTY spawn from context layer to view layer so event subscription
happens before spawn, preventing loss of initial terminal output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 13:55:38 +08:00
xintaofei
3a5d720cc9 optimize: session list loading 2026-04-01 13:41:22 +08:00
xintaofei
4f051715bf folder窗口异常处理 2026-03-31 16:31:14 +08:00
xintaofei
25a2bd0922 Agent在实时响应中因为错误而中断时发送系统通知 2026-03-31 15:43:00 +08:00
xintaofei
aa799760fc 修复会话页面缓存的模式和模型没有实际生效 2026-03-29 00:15:55 +08:00
xintaofei
10725df8ab 现在会话输入框会记住用户的配置选项和模型选择,避免每次都要重新勾选 2026-03-27 22:19:07 +08:00
xintaofei
d1eaa8f725 重构会话agent连接、初始化、加载配置流程 2026-03-26 19:55:28 +08:00
xintaofei
e93b0586b9 支持标签页folder窗口打开 2026-03-25 21:56:54 +08:00
xintaofei
388f92637c 优化folder打开逻辑 2026-03-25 18:24:32 +08:00
xintaofei
218055ab01 完善folder页面的web接口实现 2026-03-25 15:27:43 +08:00
xintaofei
ac09d3db9e 初始化web服务功能 2026-03-25 14:26:26 +08:00
xintaofei
ba64b2224b 会话部分文本表达优化 2026-03-25 00:46:13 +08:00
xintaofei
0fc829a618 同步会话实时响应时的样式 2026-03-25 00:27:44 +08:00
xintaofei
b7df63c5f8 支持在软件内预览图片 2026-03-24 16:31:33 +08:00
xintaofei
30f35e3bcb 新会话默认agent取Agents管理里排第一的Agent,而不是注册表里面的第一个 2026-03-23 15:06:30 +08:00
xintaofei
ad49d9e9ec 修复进行中会话有时无法被取消 2026-03-22 23:20:01 +08:00
xintaofei
58ddcb818b 修复会话有时无法关闭 2026-03-22 23:00:34 +08:00
xintaofei
49760ccb58 新会话默认连接agent列表里面的第一个agent,不再固定使用codex 2026-03-22 22:35:01 +08:00
xintaofei
046289748b 之前是会话tab激活的会话不被空闲回收,现在改为会话tab所有的会话都不被空闲回收 2026-03-22 21:45:45 +08:00
xintaofei
06ac2be0b1 修复新会话可能泄漏问题 2026-03-22 21:25:55 +08:00
xintaofei
048b8a8480 修复警告和错误 2026-03-21 19:29:29 +08:00
xintaofei
d0655066b6 发送系统通知时携带folder名 2026-03-21 19:14:38 +08:00
xintaofei
a9e0a742ac 集成系统通知,并在Agent响应完成后发出通知 2026-03-21 18:39:28 +08:00
xintaofei
450b081e88 重构git凭证托管,改为操作系统托管 2026-03-21 18:00:05 +08:00
xintaofei
7fecc83d40 修复lint问题和错误 2026-03-21 15:14:35 +08:00
yyimba@qq.com
107ee21a48 优化git处理 2026-03-21 14:45:42 +08:00
itpkcn@gmail.com
9e21ac439b 支持快捷打开github凭据生成页面 2026-03-21 14:15:16 +08:00
itpkcn@gmail.com
aaad19adb5 支持实时处理Git凭证 2026-03-21 13:20:46 +08:00
itpkcn@gmail.com
e002280cf6 临时会话被顶替后立即断开连接 2026-03-21 10:45:41 +08:00
itpkcn@gmail.com
f707d988c5 Merge remote-tracking branch 'origin/main' 2026-03-19 21:41:41 +08:00
xintaofei
f6fd3da401 放开部分文件读/写限制 2026-03-19 21:33:07 +08:00
xintaofei
33d70b8866 支持搜索文件和目录 2026-03-19 00:24:50 +08:00
xintaofei
acbdabe9e4 优化Agent Connect时的agent状态获取 2026-03-17 23:24:07 +08:00
xintaofei
ef3978a4fa 去掉agent连接时的预检步骤,正常情况下都会通过,做了无畏的工作,如果异常则连接时弹出通知和告警 2026-03-17 22:31:27 +08:00
xintaofei
35f5e16c11 提前检测Agent是否支持fork会话,避免无效展示和操作 2026-03-17 16:03:08 +08:00
xintaofei
b4a6f70389 支持markdown预览和html文件浏览器打开 2026-03-17 00:29:20 +08:00
xintaofei
0720aa930b Merge branch 'main' into cv-main-xx1jlt 2026-03-13 22:08:52 +08:00
xintaofei
0c843ec14e 优化上下文事件更新的处理逻辑 2026-03-13 22:07:29 +08:00
xintaofei
3376974d0f 支持文件和变更区域的根目录快捷操作 2026-03-13 21:50:15 +08:00