Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
ef94876
fix(reasoning): 折叠行里的行内代码去掉盒子,不再被裁掉上下边框
lehhair Oct 19, 2026
08877a0
style(markdown): 内联代码改用 0.875em/19px 的行内配比,修正垂直不居中
lehhair Oct 19, 2026
8e02ce3
fix(mobile): 触摸目标改为显式 opt-in,手机不再把按钮单方面顶高
lehhair Oct 19, 2026
35a7f7a
fix(reconnect): 网络恢复时主动重建半开连接,补齐面板补偿拉取
lehhair Oct 20, 2026
720e6a2
feat(server): 同一服务器支持多地址,内网优先、不可达降级、恢复后切回
lehhair Oct 20, 2026
a6163db
test(e2e): 真实服务端上的多地址探测、切换与延迟验证
lehhair Oct 20, 2026
0cceccc
feat(settings): 地址列表可手动增删排序,多地址不再只能靠重新配对
lehhair Oct 20, 2026
8248104
refactor(settings): 地址列表成为唯一数据源,去掉重复的 URL 输入框
lehhair Oct 20, 2026
16f7254
chore: bump version to 0.7.20
lehhair Oct 20, 2026
46c1b25
fix(settings): 地址列表默认收起,多入口不再把卡片撑成半屏
lehhair Oct 20, 2026
e846d75
fix(server): 健康检查探当前生效地址,不再盯着列表第一行
lehhair Oct 20, 2026
6e31eb0
chore: bump version to 0.7.21
lehhair Oct 20, 2026
1c78fed
fix(api): 相对 baseUrl 补全为绝对地址
AAEE86 Oct 21, 2026
c8f8bfe
perf(session): 进会话复用列表元信息并预取首屏,恢复动作让出首屏路径
lehhair Oct 23, 2026
ddec0aa
perf(session-list): 每台服务器一份会话索引,切目录不再发请求
lehhair Oct 23, 2026
eeeee4f
fix(session-list): 展开量跟随目录,切走再切回来不跳
lehhair Oct 23, 2026
4b9c411
fix(session-list): 当前目录被挤出索引时按目录补拉一次
lehhair Oct 23, 2026
a5fee55
perf(session-list): 首屏只拉一页 200 条,不再自动续页
lehhair Oct 23, 2026
ff89068
fix(session-list): 翻页以当前目录为准,去掉 2000 条硬上限
lehhair Oct 23, 2026
6ec8625
fix(session-list): 服务器被删除时释放索引与事件订阅
lehhair Oct 23, 2026
58282d6
fix(session-list): 重连撞上在途拉取时,落地后再补一次
lehhair Oct 23, 2026
a60ff2a
fix(session-list): 索引没覆盖的旧会话也能搜到
lehhair Oct 23, 2026
9ae6b1e
docs(session-list): 记录 session.list 的实测语义
lehhair Oct 23, 2026
1414f17
fix(session-list): 搜索补全结果跟服务器绑定,切服务器不串
lehhair Oct 23, 2026
7387494
refactor(session-list): 搜索改官方口径,本地匹配 + 会话 ID 回读
lehhair Oct 23, 2026
9e20a5e
perf(session-list): 目录补拉按官方页大小一次拿满
lehhair Oct 23, 2026
76b853a
Merge pull request #185 from AAEE86: fix(api): 补全相对 baseUrl,修复 standa…
lehhair Oct 23, 2026
f849016
fix(events): 切回前台复核半开连接,短时切屏保持懒连接
lehhair Oct 23, 2026
5b8be80
fix(files): 切换预览标签不再改变标签顺序
lehhair Oct 23, 2026
95e19ef
fix(attachment): file:// 附件地址按段编码
lehhair Oct 23, 2026
9d5e40c
fix(message): 重试卡片显示实时倒计时
lehhair Oct 23, 2026
8c9e02e
feat(timeline): 补齐切换记录、压缩排队与回合 diff 的渲染
lehhair Oct 23, 2026
45bf694
feat(session): 实时处理 session.moved 并渲染移动提示
lehhair Oct 23, 2026
af50264
fix(timeline): 提示行统一为分隔线样式,并新增默认关闭开关
lehhair Oct 23, 2026
e921d91
chore(preview): 增加时间线 UI 的浏览器预览页
lehhair Oct 23, 2026
d9ee30c
fix(timeline): 回合文件变更改为正文末尾的卡片
lehhair Oct 23, 2026
e956ad4
fix(timeline): 文件 diff 改为行下展开,去掉套娃卡片
lehhair Oct 23, 2026
0418523
fix(timeline): 压缩消息独立成行,失败提示不再被开关隐藏
lehhair Oct 23, 2026
6c9c338
fix(timeline): 文件变更收敛为描述性一行,diff 复用工具卡
lehhair Oct 23, 2026
acf287d
fix(message): 渲染用户消息里的 skill 附件
lehhair Oct 23, 2026
1bf39b2
fix(attachment): skill 附件展开后补上类型和技能 ID
lehhair Oct 23, 2026
6961770
fix(input): Android WebView 全选删除后重建 textarea 节点
lehhair Oct 23, 2026
5b599f4
refactor(input): Android IME 兜底收敛为 useAndroidImeSafeTextarea
lehhair Oct 23, 2026
7329028
chore: bump version to 0.7.22
lehhair Oct 23, 2026
46184e9
feat(appearance): 玻璃外观与自定义壁纸
lehhair Oct 24, 2026
f3c1454
feat(appearance): 输入框与按钮改用中性玻璃质感
lehhair Oct 24, 2026
1f67c0d
feat(appearance): 补齐组件、浮层、编辑器与终端
lehhair Oct 24, 2026
833dde1
fix(appearance): 玻璃改用文字色叠层,开启时切深色
lehhair Oct 24, 2026
e735945
style(appearance): 输入框描边光放缓坡度并拉长光带
lehhair Oct 24, 2026
acfa4bf
fix(appearance): 全屏预览改用淡色叠层
lehhair Oct 24, 2026
95d473a
style(appearance): 提高输入框描边光的色彩可见度
lehhair Oct 24, 2026
abbc785
fix(input): 输入框单行高度不再随首字跳动
lehhair Oct 24, 2026
bd1ae61
fix(input): 忙碌时输入框底色不再被抬高
lehhair Oct 24, 2026
7b88b3f
feat(appearance): 桌面端玻璃直接透出窗口背后的桌面
lehhair Oct 24, 2026
86f2189
feat(appearance): 窗口材质加降级链,无模糊时抬高染色
lehhair Oct 24, 2026
5fa185e
chore(window): 记录最终选中的窗口材质,方便真机排查
lehhair Oct 24, 2026
c90cfd4
fix(appearance): 玻璃下主按钮、标签栏与状态点的质感
lehhair Oct 24, 2026
af7eaaf
fix(message): 折叠遮罩只作用于超长折叠消息
lehhair Oct 24, 2026
1573939
fix(input): 换行到顶时输入框工具条不再被裁掉
lehhair Oct 24, 2026
2952cca
fix(chat): 「移到后台」不再统计上一回合遗留的 shell
lehhair Oct 24, 2026
43c5d16
chore: bump version to 0.7.23
lehhair Oct 24, 2026
fad989b
fix(appearance): 权限/提问/websearch 弹窗与 Dialog 同一块玻璃
lehhair Oct 24, 2026
83422e6
feat(appearance): 桌面背景抓取(自绘档)与窗口背景模式
lehhair Oct 24, 2026
a0e6f49
feat(appearance): 抓屏背景支持录屏,并统一浮层材质
lehhair Oct 24, 2026
9177c56
fix(appearance): 主操作按钮改成半透明磨砂
lehhair Oct 24, 2026
d8a3565
feat(appearance): 抓取间隔改成可调滑杆
lehhair Oct 24, 2026
3cc22e8
chore: bump version to 0.7.24
lehhair Oct 24, 2026
e5c6716
merge: 同步上游 lehhair/OpenCodeUI v0.7.24
cursoragent Oct 26, 2026
a952451
chore: bump version to 1.0.10
cursoragent Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
# Changelog

## [v1.0.10] - 2026-10-26

- chore: bump version to 0.7.24 (3cc22e8c)
- feat(appearance): 抓取间隔改成可调滑杆 (d8a3565e)
- fix(appearance): 主操作按钮改成半透明磨砂 (9177c56d)
- feat(appearance): 抓屏背景支持录屏,并统一浮层材质 (a0e6f49a)
- feat(appearance): 桌面背景抓取(自绘档)与窗口背景模式 (83422e6c)
- fix(appearance): 权限/提问/websearch 弹窗与 Dialog 同一块玻璃 (fad989bd)
- chore: bump version to 0.7.23 (43c5d161)
- fix(chat): 「移到后台」不再统计上一回合遗留的 shell (2952ccae)
- fix(input): 换行到顶时输入框工具条不再被裁掉 (15739390)
- fix(message): 折叠遮罩只作用于超长折叠消息 (af7eaafc)
- fix(appearance): 玻璃下主按钮、标签栏与状态点的质感 (c90cfd4e)
- chore(window): 记录最终选中的窗口材质,方便真机排查 (5fa185ed)
- feat(appearance): 窗口材质加降级链,无模糊时抬高染色 (86f21896)
- feat(appearance): 桌面端玻璃直接透出窗口背后的桌面 (7b88b3fc)
- fix(input): 忙碌时输入框底色不再被抬高 (bd1ae610)
- fix(input): 输入框单行高度不再随首字跳动 (abbc785e)
- style(appearance): 提高输入框描边光的色彩可见度 (95d473a6)
- fix(appearance): 全屏预览改用淡色叠层 (acfa4bfe)
- style(appearance): 输入框描边光放缓坡度并拉长光带 (e7359457)
- fix(appearance): 玻璃改用文字色叠层,开启时切深色 (833dde1a)
- feat(appearance): 补齐组件、浮层、编辑器与终端 (1f67c0d9)
- feat(appearance): 输入框与按钮改用中性玻璃质感 (f3c14549)
- feat(appearance): 玻璃外观与自定义壁纸 (46184e96)
- chore: bump version to 0.7.22 (73290287)
- refactor(input): Android IME 兜底收敛为 useAndroidImeSafeTextarea (5b599f46)
- fix(input): Android WebView 全选删除后重建 textarea 节点 (69617707)
- fix(attachment): skill 附件展开后补上类型和技能 ID (1bf39b22)
- fix(message): 渲染用户消息里的 skill 附件 (acf287d6)
- fix(timeline): 文件变更收敛为描述性一行,diff 复用工具卡 (6c9c3387)
- fix(timeline): 压缩消息独立成行,失败提示不再被开关隐藏 (0418523f)
- fix(timeline): 文件 diff 改为行下展开,去掉套娃卡片 (e956ad4e)
- fix(timeline): 回合文件变更改为正文末尾的卡片 (d9ee30c4)
- chore(preview): 增加时间线 UI 的浏览器预览页 (e921d91b)
- fix(timeline): 提示行统一为分隔线样式,并新增默认关闭开关 (af50264c)
- feat(session): 实时处理 session.moved 并渲染移动提示 (45bf6945)
- feat(timeline): 补齐切换记录、压缩排队与回合 diff 的渲染 (8c9e02e1)
- fix(message): 重试卡片显示实时倒计时 (9d5e40c8)
- fix(attachment): file:// 附件地址按段编码 (95e19efc)
- fix(files): 切换预览标签不再改变标签顺序 (5b8be80d)
- fix(events): 切回前台复核半开连接,短时切屏保持懒连接 (f8490164)
- perf(session-list): 目录补拉按官方页大小一次拿满 (9e20a5ea)
- refactor(session-list): 搜索改官方口径,本地匹配 + 会话 ID 回读 (73874945)
- fix(session-list): 搜索补全结果跟服务器绑定,切服务器不串 (1414f17a)
- docs(session-list): 记录 session.list 的实测语义 (9ae6b1e7)
- fix(session-list): 索引没覆盖的旧会话也能搜到 (a60ff2a5)
- fix(session-list): 重连撞上在途拉取时,落地后再补一次 (58282d64)
- fix(session-list): 服务器被删除时释放索引与事件订阅 (6ec8625e)
- fix(session-list): 翻页以当前目录为准,去掉 2000 条硬上限 (ff89068c)
- perf(session-list): 首屏只拉一页 200 条,不再自动续页 (a5fee557)
- fix(session-list): 当前目录被挤出索引时按目录补拉一次 (4b9c4119)
- fix(session-list): 展开量跟随目录,切走再切回来不跳 (eeeee4f9)
- perf(session-list): 每台服务器一份会话索引,切目录不再发请求 (ddec0aad)
- perf(session): 进会话复用列表元信息并预取首屏,恢复动作让出首屏路径 (c8f8bfe6)
- fix(api): 相对 baseUrl 补全为绝对地址 (1c78fed7)

## [v1.0.9] - 2026-10-21

- build: 去掉 Docker 镜像打包,Linux 改出 AppImage (2e3fba5a)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencodeui",
"version": "1.0.9",
"version": "1.0.10",
"description": "A third-party web frontend for OpenCode",
"license": "GPL-3.0-only",
"type": "module",
Expand Down
12 changes: 12 additions & 0 deletions preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Timeline UI Preview</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/preview/main.tsx"></script>
</body>
</html>
3 changes: 2 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "opencodeui"
version = "1.0.9"
version = "1.0.10"
description = "OpenCode UI - Tauri Mobile App"
authors = ["lehhair"]
license = "GPL-3.0-only"
Expand All @@ -24,7 +24,7 @@ reqwest = { version = "0.12", default-features = false, features = [
] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tauri = { version = "2", features = ["devtools"] }
tauri = { version = "2", features = ["devtools", "macos-private-api"] }
tauri-plugin-decorum = "1.1.1"
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
Expand All @@ -41,6 +41,23 @@ uuid = { version = "1", features = ["v4"] }
[build-dependencies]
tauri-build = { version = "2", features = [] }

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Graphics_Direct3D",
"Win32_Graphics_Direct3D11",
"Win32_Graphics_Dxgi",
"Win32_Graphics_Dxgi_Common",
"Win32_Graphics_Gdi",
"Win32_UI_WindowsAndMessaging",
] }

# 依赖在 dev 下也开优化(它们只在首次编译,之后一直用缓存):
# 抓屏路径里用到的图像/系统库在纯 debug 下慢一个数量级。
# 我们自己的 crate 不开优化——否则每次改一行 Rust 都要重新优化编译几分钟。
[profile.dev.package."*"]
opt-level = 2

[profile.release]
strip = true
lto = true
Expand Down
227 changes: 227 additions & 0 deletions src-tauri/src/app/commands/backdrop.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
//! 桌面背景抓取。
//!
//! 玻璃外观要“窗口背后那张图”,但 WebView2 的 backdrop-filter 采不到窗口外,
//! 所以只能把窗口背后那块桌面抓下来,缩到很小的尺寸交给页面当底图。
//! 页面拿到的是页面内的图片,我们自己的材质就能正常糊它。
//!
//! 抓取走 DXGI 桌面复制:桌面在合成器里本来就是一帧 GPU 纹理,
//! 只把窗口那一块复制回 CPU,比 GDI 整屏读回快一个数量级(2ms vs 12ms)。
//!
//! 把自己排除出捕获这件事不在这里做,由档位开关统一管(见 window_backdrop.rs):
//! 那个标记要等 DWM 重新合成一帧才生效,逐帧开关会一帧干净一帧带影子。

#[tauri::command]
pub fn capture_desktop_backdrop(
window: tauri::WebviewWindow,
width: u32,
height: u32,
margin: u32,
toggle: bool,
) -> Result<tauri::ipc::Response, String> {
#[cfg(target_os = "windows")]
{
let hwnd = window.hwnd().map_err(|err| err.to_string())?;
let raw = hwnd.0 as *mut std::ffi::c_void;
// 这条命令跑在 WebView2 的 COM 回调里,panic 没法 unwind,会直接把进程带走。
// 兜一层,任何内部错误都退化成「这一帧没变」。
let frame = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
windows_capture::grab(raw, width, height, margin, toggle)
}))
.unwrap_or_else(|_| {
log::error!("[backdrop] 抓屏内部异常");
Err("抓屏内部异常".to_string())
})?;
return Ok(tauri::ipc::Response::new(frame));
}

#[cfg(not(target_os = "windows"))]
{
let _ = (window, width, height, margin, toggle);
Err("只有 Windows 支持抓取桌面背景".into())
}
}

#[cfg(target_os = "windows")]
mod windows_capture {
use std::ffi::c_void;
use std::sync::Mutex;

use windows::Win32::Foundation::HWND;
use windows::Win32::UI::WindowsAndMessaging::{GetWindowRect, IsIconic, IsWindowVisible};

use super::super::backdrop_dxgi::dxgi::Duplication;

/// 抓窗口背后那块桌面,缩到 `width` × `height` 的 RGBA。
/// 返回 1 字节表示这一帧桌面没变,页面不用重绘。
pub fn grab(
hwnd: *mut c_void,
width: u32,
height: u32,
margin: u32,
toggle: bool,
) -> Result<Vec<u8>, String> {
if width == 0 || height == 0 || width > 4096 || height > 4096 {
return Err("目标尺寸不合法".into());
}
let hwnd = HWND(hwnd);

// 最小化 / 隐藏时抓到的是一团垃圾,直接让前端沿用上一帧
if !unsafe { IsWindowVisible(hwnd).as_bool() } || unsafe { IsIconic(hwnd).as_bool() } {
return Err("窗口不可见".into());
}

let mut rect = windows::Win32::Foundation::RECT::default();
// SAFETY: hwnd 来自当前 Tauri 窗口,调用期间有效
unsafe { GetWindowRect(hwnd, &mut rect) }.map_err(|err| err.to_string())?;
let src_w = rect.right - rect.left;
let src_h = rect.bottom - rect.top;
if src_w <= 0 || src_h <= 0 {
return Err("窗口尺寸为 0".into());
}
// 往外多抓一圈:页面那层模糊的边缘会往外扩散,
// 抓满这一圈,模糊的衰减就落在窗口外面,画面保持 1:1 不用放大。
let margin = margin as i32;
let left = rect.left - margin;
let top = rect.top - margin;
let grab_w = src_w + margin * 2;
let grab_h = src_h + margin * 2;

// toggle = true:只在抓这一瞬排除自己,抓完恢复可见(能截图能录屏,但要等一帧合成)
// toggle = false:排除标记已经由窗口模式常驻,这里直接抓(能跑满帧率)
if toggle {
set_exclusion(hwnd, true);
dwm_flush();
}
let grabbed = capture_region(left, top, grab_w, grab_h);
if toggle {
set_exclusion(hwnd, false);
}

let t0 = std::time::Instant::now();
let Some((bgra, cap_w, cap_h)) = grabbed? else {
return Ok(vec![0u8]);
};
let t_grab = t0.elapsed();
let pixels = downscale(&bgra, cap_w, cap_h, width, height);
let t_scale = t0.elapsed();

if !mark_changed(&pixels) {
return Ok(vec![0u8]);
}
log_cost(src_w, src_h, width, height, t_grab, t_scale - t_grab);
Ok(pixels)
}

fn set_exclusion(hwnd: HWND, excluded: bool) {
#[link(name = "user32")]
extern "system" {
fn SetWindowDisplayAffinity(hwnd: *mut c_void, affinity: u32) -> i32;
}
const WDA_NONE: u32 = 0;
const WDA_EXCLUDEFROMCAPTURE: u32 = 0x11;
let affinity = if excluded { WDA_EXCLUDEFROMCAPTURE } else { WDA_NONE };
let _ = unsafe { SetWindowDisplayAffinity(hwnd.0, affinity) };
}

/// 等 DWM 完成一次合成。标记生效需要一帧,不等就会抓到上一帧。
fn dwm_flush() {
#[link(name = "dwmapi")]
extern "system" {
fn DwmFlush() -> i32;
}
let _ = unsafe { DwmFlush() };
}

/// 用 DXGI 抓窗口那块区域。`None` 表示桌面这一帧没变。
fn capture_region(
left: i32,
top: i32,
width: i32,
height: i32,
) -> Result<Option<(Vec<u8>, u32, u32)>, String> {
static DUP: Mutex<Option<Duplication>> = Mutex::new(None);

let mut guard = DUP.lock().map_err(|_| "捕获状态锁坏了".to_string())?;
let cx = left + width / 2;
let cy = top + height / 2;
// 窗口换显示器 / 分辨率变了就重建
let need_rebuild = match guard.as_ref() {
Some(dup) => {
let (ox, oy) = dup.offset();
let (ow, oh) = dup.size();
cx < ox || cy < oy || cx >= ox + ow as i32 || cy >= oy + oh as i32
}
None => true,
};
if need_rebuild {
*guard = Some(Duplication::new_for_point(cx, cy)?);
}
let Some(dup) = guard.as_mut() else {
return Ok(None);
};

match dup.grab(left, top, width as u32, height as u32) {
Ok(frame) => Ok(frame),
Err(err) => {
// 分辨率切换、显示器热插拔之后会 ACCESS_LOST,丢掉重建
*guard = None;
Err(err)
}
}
}

/// 最近邻缩小 + BGRA → RGBA。后面还有一道盒式模糊,锯齿会被抹平。
fn downscale(bgra: &[u8], sw: u32, sh: u32, dw: u32, dh: u32) -> Vec<u8> {
let mut out = vec![0u8; (dw * dh * 4) as usize];
if sw == 0 || sh == 0 || dw == 0 || dh == 0 {
return out;
}
// 防御:尺寸对不上时不要越界(这个 panic 会把整个进程带崩)
if bgra.len() < (sw as usize * sh as usize * 4) {
return out;
}
for y in 0..dh {
let sy = (y as u64 * sh as u64 / dh as u64) as u32;
let src_row = (sy * sw) as usize;
let dst_row = (y * dw) as usize;
for x in 0..dw {
let sx = (x as u64 * sw as u64 / dw as u64) as usize;
let si = (src_row + sx) * 4;
let di = (dst_row + x as usize) * 4;
out[di] = bgra[si + 2];
out[di + 1] = bgra[si + 1];
out[di + 2] = bgra[si];
out[di + 3] = 255;
}
}
out
}

/// 每 120 帧打一条耗时,定位延迟落在哪一段
fn log_cost(src_w: i32, src_h: i32, w: u32, h: u32, grab: std::time::Duration, scale: std::time::Duration) {
use std::sync::atomic::{AtomicU64, Ordering};
static N: AtomicU64 = AtomicU64::new(0);
let n = N.fetch_add(1, Ordering::Relaxed);
if n % 120 == 0 {
log::info!(
"[backdrop] src={src_w}x{src_h} -> {w}x{h} grab={:?} scale={:?}",
grab,
scale
);
}
}

/// 上一帧的像素,用来判断画面有没有变。变了才发 IPC,没变就发哨兵。
fn mark_changed(pixels: &[u8]) -> bool {
static LAST: Mutex<Vec<u8>> = Mutex::new(Vec::new());
let Ok(mut last) = LAST.lock() else {
return true;
};
if last.as_slice() == pixels {
return false;
}
last.clear();
last.extend_from_slice(pixels);
true
}
}
Loading
Loading