Skip to content

Commit 815cf6e

Browse files
author
李杰
committed
release: v0.20.17
1 parent be1bbc7 commit 815cf6e

41 files changed

Lines changed: 3029 additions & 106 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ All notable changes to Cockpit Tools will be documented in this file.
66

77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88

9+
---
10+
## [0.20.17] - 2026-04-01
11+
12+
### Changed
13+
- **Antigravity auto-switch now supports model-group scope selection (`any_group` / `selected_groups`) and group-level threshold evaluation**: quick settings can target specific display groups, config now persists selected group IDs, and candidate selection follows monitored-group thresholds.
14+
- **Codex shared-resource link sync now force-rebuilds mismatched instance links instead of blocking with manual-merge errors**: when shared directories/files diverge from global defaults, stale instance targets are removed and recreated as symlinks automatically.
15+
16+
### Fixed
17+
- **Antigravity account switch failure now rehydrates current-account state before returning errors**: the account store refetches account lists/current account and emits account-change events only when the effective current account actually changes, preventing stale UI state after failed switches.
18+
919
---
1020
## [0.20.16] - 2026-03-31
1121

CHANGELOG.zh-CN.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66

77
格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/)
88

9+
---
10+
## [0.20.17] - 2026-04-01
11+
12+
### 变更
13+
- **Antigravity 自动切号现已支持模型分组触发范围(`any_group` / `selected_groups`)与分组阈值判定**:快捷设置可指定分组,配置会持久化所选分组 ID,候选账号筛选也会按监控分组阈值执行。
14+
- **Codex 共享资源链接同步现已在实例链接不一致时自动强制重建**:当实例目录/文件与全局默认共享资源不一致时,会自动清理旧目标并重新创建符号链接,不再卡在“需手工合并”错误。
15+
16+
### 修复
17+
- **Antigravity 切号失败后现会先回读并修正当前账号状态再返回错误**:账号 store 会重新拉取账号列表与当前账号,仅在当前账号实际变化时再派发变更事件,避免失败后界面残留旧状态。
18+
919
---
1020
## [0.20.16] - 2026-03-31
1121

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cockpit-tools",
33
"private": true,
4-
"version": "0.20.16",
4+
"version": "0.20.17",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cockpit-tools"
3-
version = "0.20.16"
3+
version = "0.20.17"
44
description = "Cockpit Tools"
55
authors = ["jlcodes"]
66
license = "CC-BY-NC-SA-4.0"

src-tauri/src/commands/account.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,29 @@ pub async fn refresh_current_quota(app: tauri::AppHandle) -> Result<(), String>
146146
/// 切换账号(完整流程:Token刷新 + 关闭程序 + 注入 + 指纹同步 + 重启)
147147
#[tauri::command]
148148
pub async fn switch_account(app: AppHandle, account_id: String) -> Result<models::Account, String> {
149+
if modules::config::get_user_config().antigravity_dual_switch_no_restart_enabled {
150+
let result = modules::account::switch_account_dual_no_restart(
151+
&account_id,
152+
"manual",
153+
"tools.account.switch",
154+
"dual_no_restart",
155+
None,
156+
)
157+
.await;
158+
if let Err(error) = &result {
159+
if error.starts_with("APP_PATH_NOT_FOUND:") {
160+
let _ = app.emit(
161+
"app:path_missing",
162+
serde_json::json!({
163+
"app": "antigravity",
164+
"retry": { "kind": "switchAccount", "accountId": account_id }
165+
}),
166+
);
167+
}
168+
}
169+
return result;
170+
}
171+
149172
modules::logger::log_info(&format!("开始切换账号: {}", account_id));
150173

151174
// 1. 加载并验证账号存在
@@ -273,6 +296,17 @@ pub async fn switch_account(app: AppHandle, account_id: String) -> Result<models
273296
Ok(account)
274297
}
275298

299+
#[tauri::command]
300+
pub fn load_antigravity_switch_history(
301+
) -> Result<Vec<modules::antigravity_switch_history::AntigravitySwitchHistoryItem>, String> {
302+
modules::antigravity_switch_history::load_history()
303+
}
304+
305+
#[tauri::command]
306+
pub fn clear_antigravity_switch_history() -> Result<(), String> {
307+
modules::antigravity_switch_history::clear_history()
308+
}
309+
276310
#[tauri::command]
277311
pub async fn bind_account_fingerprint(
278312
account_id: String,

src-tauri/src/commands/system.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,16 @@ pub struct GeneralConfig {
127127
pub openclaw_auth_overwrite_on_switch: bool,
128128
/// 切换 Codex 时是否自动启动/重启 Codex App
129129
pub codex_launch_on_switch: bool,
130+
/// Antigravity 切号是否启用“本地落盘 + 扩展无感”且不重启
131+
pub antigravity_dual_switch_no_restart_enabled: bool,
130132
/// 是否启用自动切号
131133
pub auto_switch_enabled: bool,
132134
/// 自动切号阈值(百分比)
133135
pub auto_switch_threshold: i32,
136+
/// 自动切号触发模式:any_group | selected_groups
137+
pub auto_switch_scope_mode: String,
138+
/// 自动切号指定模型分组(分组 ID)
139+
pub auto_switch_selected_group_ids: Vec<String>,
134140
/// 是否启用 Codex 自动切号
135141
pub codex_auto_switch_enabled: bool,
136142
/// Codex primary_window 自动切号阈值(百分比)
@@ -374,8 +380,12 @@ pub fn save_network_config(
374380
ghcp_launch_on_switch: current.ghcp_launch_on_switch,
375381
openclaw_auth_overwrite_on_switch: current.openclaw_auth_overwrite_on_switch,
376382
codex_launch_on_switch: current.codex_launch_on_switch,
383+
antigravity_dual_switch_no_restart_enabled: current
384+
.antigravity_dual_switch_no_restart_enabled,
377385
auto_switch_enabled: current.auto_switch_enabled,
378386
auto_switch_threshold: current.auto_switch_threshold,
387+
auto_switch_scope_mode: current.auto_switch_scope_mode,
388+
auto_switch_selected_group_ids: current.auto_switch_selected_group_ids,
379389
codex_auto_switch_enabled: current.codex_auto_switch_enabled,
380390
codex_auto_switch_primary_threshold: current.codex_auto_switch_primary_threshold,
381391
codex_auto_switch_secondary_threshold: current.codex_auto_switch_secondary_threshold,
@@ -473,8 +483,12 @@ pub fn get_general_config() -> Result<GeneralConfig, String> {
473483
ghcp_launch_on_switch: user_config.ghcp_launch_on_switch,
474484
openclaw_auth_overwrite_on_switch: user_config.openclaw_auth_overwrite_on_switch,
475485
codex_launch_on_switch: user_config.codex_launch_on_switch,
486+
antigravity_dual_switch_no_restart_enabled: user_config
487+
.antigravity_dual_switch_no_restart_enabled,
476488
auto_switch_enabled: user_config.auto_switch_enabled,
477489
auto_switch_threshold: user_config.auto_switch_threshold,
490+
auto_switch_scope_mode: user_config.auto_switch_scope_mode,
491+
auto_switch_selected_group_ids: user_config.auto_switch_selected_group_ids,
478492
codex_auto_switch_enabled: user_config.codex_auto_switch_enabled,
479493
codex_auto_switch_primary_threshold: user_config.codex_auto_switch_primary_threshold,
480494
codex_auto_switch_secondary_threshold: user_config.codex_auto_switch_secondary_threshold,
@@ -576,8 +590,11 @@ pub fn save_general_config(
576590
ghcp_launch_on_switch: Option<bool>,
577591
openclaw_auth_overwrite_on_switch: Option<bool>,
578592
codex_launch_on_switch: bool,
593+
antigravity_dual_switch_no_restart_enabled: Option<bool>,
579594
auto_switch_enabled: Option<bool>,
580595
auto_switch_threshold: Option<i32>,
596+
auto_switch_scope_mode: Option<String>,
597+
auto_switch_selected_group_ids: Option<Vec<String>>,
581598
codex_auto_switch_enabled: Option<bool>,
582599
codex_auto_switch_primary_threshold: Option<i32>,
583600
codex_auto_switch_secondary_threshold: Option<i32>,
@@ -752,8 +769,16 @@ pub fn save_general_config(
752769
openclaw_auth_overwrite_on_switch: openclaw_auth_overwrite_on_switch
753770
.unwrap_or(current.openclaw_auth_overwrite_on_switch),
754771
codex_launch_on_switch,
772+
antigravity_dual_switch_no_restart_enabled: antigravity_dual_switch_no_restart_enabled
773+
.unwrap_or(current.antigravity_dual_switch_no_restart_enabled),
755774
auto_switch_enabled: auto_switch_enabled.unwrap_or(current.auto_switch_enabled),
756775
auto_switch_threshold: auto_switch_threshold.unwrap_or(current.auto_switch_threshold),
776+
auto_switch_scope_mode: auto_switch_scope_mode
777+
.map(|value| value.trim().to_string())
778+
.filter(|value| !value.is_empty())
779+
.unwrap_or(current.auto_switch_scope_mode),
780+
auto_switch_selected_group_ids: auto_switch_selected_group_ids
781+
.unwrap_or(current.auto_switch_selected_group_ids),
757782
codex_auto_switch_enabled: codex_auto_switch_enabled
758783
.unwrap_or(current.codex_auto_switch_enabled),
759784
codex_auto_switch_primary_threshold: codex_auto_switch_primary_threshold

src-tauri/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ pub fn run() {
200200
commands::account::refresh_all_quotas,
201201
commands::account::refresh_current_quota,
202202
commands::account::switch_account,
203+
commands::account::load_antigravity_switch_history,
204+
commands::account::clear_antigravity_switch_history,
203205
commands::account::bind_account_fingerprint,
204206
commands::account::get_bound_accounts,
205207
commands::account::update_account_tags,

0 commit comments

Comments
 (0)