Commit Graph

317 Commits

Author SHA1 Message Date
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
c8dfd00317 feat(appearance): add theme color picker, zoom level selector, reset button
外观设置页新增三个 UI 单元:12 个 shadcn 主题预设的色盘按钮网格、6 档窗口缩放
下拉选择器、以及只重置主题色和缩放(不动主题模式)的恢复默认按钮。
i18n 键在上一个 Task 中已预备好,本提交后整个外观设置功能即可在浏览器中端到端使用。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 16:01:09 +08:00
xintaofei
92b8a9729e fix(i18n): restore pre-existing AppearanceSettings translations
Task 7 inadvertently overwrote 18 carefully-tuned translations across 7 languages
(ar/de/es/fr/ja/ko/pt) with the plan author's slightly different wording while
adding the new themeColor / zoomLevel / resetToDefaults keys. The new additions
remain intact; only the pre-existing keys are reverted to the project's original
translations (e.g. de "Designmodus" instead of "Design-Modus", ja
"システム追従" instead of "システムに従う"). Affects: sectionDescription,
themeMode, placeholder, system, currentTheme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:58:52 +08:00
xintaofei
87f1f686b2 i18n(appearance): add theme color, zoom level, and reset translations
为 10 种语言(en/zh-CN/zh-TW/ja/ko/es/de/fr/pt/ar)的 AppearanceSettings 命名空间
新增 themeColor / zoomLevel / resetToDefaults / resetHint 等键。预设颜色名保留
英文原名以与 shadcn 品牌一致。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:55:04 +08:00
xintaofei
a5cd1ce2a8 feat(appearance): wire AppearanceProvider and FOUC script into root layout
在 <body> 顶部注入同步执行的 inline 脚本,在 hydration 前为 <html> 写入
data-theme 属性和 font-size 样式;在 ThemeProvider 内嵌套 AppearanceProvider
管理 React 侧 state。两条通道并行运作,互不干扰。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:50:25 +08:00
xintaofei
ecff8832c0 feat(appearance): add AppearanceProvider and use-appearance hooks
新增 React Context 管理 themeColor 和 zoomLevel state,与 next-themes 正交,
通过 localStorage 持久化并支持跨标签页同步。提供语义化 hook
useThemeColor / useZoomLevel 供调用点按需使用。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:48:06 +08:00
xintaofei
fc457725c1 feat(appearance): add 11 shadcn theme color presets to globals.css
新增 zinc / slate / stone / gray / red / rose / orange / green / blue / yellow / violet
共 11 个主题预设的 light + dark CSS 变量定义,配合 [data-theme] 选择器使用。
chart 颜色全预设共用,避免数据可视化随主题色失真。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:45:28 +08:00
xintaofei
4b2e6d188a refactor(appearance): migrate base theme tokens to data-theme="neutral"
把现有 :root / .dark 中的 shadcn CSS 变量整体迁移到 [data-theme="neutral"]
和 [data-theme="neutral"].dark 选择器下,并保留 :root:not([data-theme]) 兜底
确保 inline 脚本未生效时仍维持原视觉。这是后续添加 11 个其他主题预设的基础。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:40:57 +08:00
xintaofei
2d5b71bf8a feat(appearance): add FOUC prevention inline script
提供同步执行的 inline 脚本字符串,在 hydration 前从 localStorage 读取
themeColor 和 zoomLevel 写入 <html>,避免首次加载时的主题/缩放闪烁。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:36:44 +08:00
xintaofei
5298830fb8 feat(appearance): add theme presets constants module
定义 12 个 shadcn 主题预设标识、6 档缩放档位以及 UI 预览代表色,
作为后续 AppearanceProvider 和 globals.css 的共享基础。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 15:35:31 +08:00
xintaofei
3901c40518 fix(chat): stop plan in-progress spinner when agent is not streaming
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:20:28 +08:00
xintaofei
4ba74a06bd fix(chat): support mid-text slash trigger and keyboard scroll in autocomplete
Track the slash trigger position so the menu can open after prose, then
splice only the slash token on selection instead of clobbering the whole
input. Also scroll the highlighted row into view when keyboard navigation
moves past the popup viewport.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:08:22 +08:00
xintaofei
b97efb5f72 feat(chat): show skills list on $ trigger for Codex instead of experts
The Codex $ prefix autocomplete now lists skills from
acp_list_agent_skills (excluding ids that match built-in experts), while
experts remain reachable via the dedicated Sparkles button. Non-Codex
agents are unchanged and still show only their native ACP commands on
the / trigger.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 10:20:13 +08:00
xintaofei
1eb9b4872e feat(settings): add Skills toggle for Codex CLI and improve config editor UX
Add "Enable Skills" toggle below "Enable WebSocket" in Codex CLI settings,
writing `skills = true` under [features] in config.toml. Also add max-height
to auth.json and config.toml textareas, and fix TOML section key insertion
to avoid stray blank lines between entries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 01:14:17 +08:00
xintaofei
19979d50d0 fix(chat): use ~/.codex/skills/ for Codex expert symlinks and keep expert button always enabled
Change Codex skill storage to use only ~/.codex/skills/ instead of
~/.agents/skills/, and never disable the expert skills button so users
can always access the empty-state hint. Also fix stale expert list in
conversation window after linking in the separate settings window by
re-fetching on window focus.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 00:37:31 +08:00
xintaofei
ade59f474c fix(chat): query expert skills via symlinks and use $ prefix for Codex
Expert skills in the chat session were derived by intersecting built-in
experts with ACP availableCommands, which caused Codex experts to never
appear since Codex does not advertise skills through ACP.

- Add `experts_list_for_agent` backend API that checks symlink status
  across all global skill dirs for the given agent type
- Replace availableCommands-based expert filtering with symlink-based
  query, making the settings page the single source of truth
- Use `$` prefix for Codex expert skills while keeping `/` for slash
  commands and other agents' experts
- Disable the expert button when no experts are linked for the agent
- Invalidate per-agent expert cache after link/unlink in settings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 00:13:42 +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
3dfa913584 fix(settings): fix Gemini CLI model edit resetting provider fields and not persisting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:26:55 +08:00
xintaofei
2d42fa97b3 fix(chat): raise input selector collapse breakpoint to 480px
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 17:10:14 +08:00
xintaofei
0b6a013fd9 fix(chat): harden experts menu selection and viewport fit
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 16:56:37 +08:00
xintaofei
b63fe3f800 feat(chat): add experts menu to message input toolbar
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 16:38:03 +08:00
xintaofei
b876022377 i18n(settings): translate Agents nav label in zh-CN and zh-TW
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:22:46 +08:00
xintaofei
5b613daded feat(experts): add built-in expert skills with per-agent activation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:17:51 +08:00
xintaofei
64d4e9c903 fix(ui): increase container query breakpoint for input selector collapse
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 22:52:08 +08:00
xintaofei
150b927610 fix(ui): unify scrollbar styles across scrollable containers
Add .scrollbar-thin and .scrollbar-thin-edge utility classes in
globals.css and apply them to sidebar, file tree, git changes,
git log, session files, diff preview, and message thread panels.
Replace scattered inline webkit-scrollbar overrides with the
shared classes for consistent appearance and gutter behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 18:50:14 +08:00
xintaofei
56cd207801 fix(ui): add max-height limit to commit message textarea
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 18:48:27 +08:00
xintaofei
98691c1d9e fix(ui): add flex container to sidebar wrapper to enable conversation list scrolling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 14:02:17 +08:00
xintaofei
0f38b8ee32 fix(ui): override Python monarch tokenizer to fix triple-quoted string highlighting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 23:42:25 +08:00
xintaofei
c367117392 fix(ui): add KaTeX CSS and normalize LaTeX math delimiters for proper formula rendering
Import KaTeX CSS in layout.tsx to ensure math formulas display correctly
in both dev and production modes. Convert LaTeX-style `\[...\]` / `\(...\)`
delimiters to `$$...$$` / `$...$` since remark-math only supports dollar
sign delimiters, fixing formula rendering for agents like Codex.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 23:27:40 +08:00
xintaofei
8d97ba6f44 feat(ui): upgrade @lobehub/icons to v5 and update agent icon colors
Upgrade @lobehub/icons from v4 to v5.3.0, adopt new icon components (ClaudeCode, Codex, GeminiCLI) with Color variants, and align fallback AGENT_COLORS with official brand colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:42:22 +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
0401319281 fix(settings): update chat channel icons to Play/Square and SendHorizontal
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 12:58:12 +08:00
xintaofei
ad3f393e92 fix(settings): reorder nav menu to place Agents below Skills
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:23:48 +08:00
xintaofei
8362bdf2c7 fix(settings): limit model provider agent types and adjust card layout
Restrict supported agent types to Claude Code, Codex CLI, and Gemini CLI. Reposition agent type badges to be vertically centered beside the name and API URL block in provider cards.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:20:12 +08:00
xintaofei
faf8ff0731 feat(settings): add model selection combobox for OpenCode agent configuration
Replace plain text inputs for model and small_model with searchable
combobox dropdowns that list models from configured providers, while
still supporting custom text entry on blur.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 10:55:42 +08:00
xintaofei
a3d5335e7f feat(settings): protect model provider deletion and cascade credential updates
- Block deletion of a model provider when it is referenced by any agent,
  returning an error that lists the agent names so the user knows what to unlink first
- When a provider's api_url or api_key is updated, automatically propagate
  the new credentials to all dependent agents: updates env_json in the database
  and patches on-disk config files (Claude Code settings.json, Gemini settings.json,
  Codex auth.json + config.toml, OpenCode auth.json) using the same field names
  and structure as the agent settings UI
- Fix error message display in provider dialogs for both Tauri and web transports,
  which throw plain objects rather than Error instances

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 00:25:01 +08:00
xintaofei
4245df2f4a fix(settings): improve codex CLI auth mode switching to preserve auth.json keys
- Patch only `OPENAI_API_KEY` and `auth_mode` in auth.json when switching
  auth modes, instead of resetting the entire file
- Clean up `OPENAI_BASE_URL` from env when codex loads in official
  subscription mode
- Hide API URL and API Key inputs when model provider mode is selected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 23:05:52 +08:00
xintaofei
b64976e4d6 feat(settings): refactor agent auth modes and add model provider authentication
- Split env vars and config file persistence into separate save operations
- Add model_provider_id field to agent_setting for tracking selected provider
- Add "Model Provider" auth mode for Claude Code, Codex CLI, and Gemini CLI
- Add "Custom Endpoint" auth mode for Claude Code (previously only official subscription)
- Unify auth mode labels across all three agents (official subscription / custom endpoint / model provider)
- When model provider is selected, fill api_url and api_key into env and config automatically
- Resolve model provider credentials at ACP connect time as a backend fallback
- Clear provider deletion cascades to agent_setting.model_provider_id
- Claude Code writes API credentials to config.env (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN)
- Codex: switching auth modes patches config.toml instead of clearing it
- Add i18n keys for new auth modes in all 10 supported languages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:10:18 +08:00
xintaofei
d28c54a038 fix(settings): reorder nav menu to place model providers after skills
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 16:40:37 +08:00
xintaofei
ba19299696 feat(settings): add model provider management with full CRUD support
Add a new settings page for managing API model providers (name, API URL,
API key, applicable agent types). Includes database migration, SeaORM
entity, backend CRUD commands/handlers, frontend settings UI with agent
type filter, add/edit/delete dialogs, and i18n support for all 10 locales.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 16:35:14 +08:00
xintaofei
6359651247 feat(chat): add slash command dropdown button in message input toolbar
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 13:24:26 +08:00
xintaofei
32a1c5adc0 fix: improve error message when exporting long conversations as image
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 23:38:25 +08:00
xintaofei
c06e854975 feat: add favicon for web/server mode browser tabs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 19:03:55 +08:00
xintaofei
4c36369dd2 feat: add export conversation to image, markdown, and HTML formats
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 18:56:37 +08:00
xintaofei
1282dcee19 feat: add copy button on hover for user messages in conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:22:34 +08:00
xintaofei
ea3b20b2d9 fix: update run button state when terminal tab is closed directly
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:42:50 +08:00
xintaofei
9396127cd9 feat: add @ file mention support in chat input and unify directory attachment
Support typing "@" in the chat input to trigger a file list popup with
filtering, keyboard navigation, and file/directory attachment. Directories
from the sidebar file tree now attach as resource links instead of injecting
text into the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:43:27 +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
236f0ed5e3 Merge branch 'main-fix' 2026-04-02 16:25:00 +08:00