From 7ce8d92aa96f5ac2403296733fadad4c3879940a Mon Sep 17 00:00:00 2001 From: fylorn <249551762+fylorn@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:46:15 +0800 Subject: [PATCH] chore: v0.10.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Core says everything it has to say in English now, and the sentences it sends to a client carry a stable code beside them. The desktop app needs a tag to pin before it can read any of it. What changed for anyone reading the protocol: - Every human-readable sentence is a `Msg` — a code, the arguments that fill it, and the English text — rather than a `String`. `Event::RequestFailed.message`, `ProxyChanged.detail`, `L1Result.error` and `HistoryRow.error` are all `Msg` now. `ProxyChanged` also gained `failed`, the stage the connection got stuck at. - A control-plane error responds with a JSON `Msg` rather than a plain-text body. - The synthesized default route is `default` and its catch-all rule is `catch-all`, not 默认 and 兜底. - The request store gained `error_code` and `error_args` (schema 13), so a failure keeps its code when the app reads history back. - `tw-adopt` writes English markers and English field names into the user's own files, and `tw-scan`'s built-in rules have English ids and reasons. A client adopted by 0.9.x cannot be restored by 0.10, and an override file that disables a rule by its old Chinese id reports that the id is unknown. `CONTROL_API_VERSION` goes to 2 for all of it. A client built against 1 would render these as strings — a screenful of JSON — so it is better that it refuses at the handshake and says to rebuild. Co-Authored-By: Claude Opus 5 --- Cargo.lock | 40 ++++++++++++++++++++-------------------- Cargo.toml | 2 +- crates/tw-api/src/lib.rs | 6 +++++- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6eb23f4..703413dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2775,7 +2775,7 @@ dependencies = [ [[package]] name = "tw-adopt" -version = "0.9.1" +version = "0.10.0" dependencies = [ "serde", "serde_json", @@ -2789,7 +2789,7 @@ dependencies = [ [[package]] name = "tw-api" -version = "0.9.1" +version = "0.10.0" dependencies = [ "serde", "serde_json", @@ -2798,7 +2798,7 @@ dependencies = [ [[package]] name = "tw-config" -version = "0.9.1" +version = "0.10.0" dependencies = [ "blake3", "notify", @@ -2818,7 +2818,7 @@ dependencies = [ [[package]] name = "tw-control" -version = "0.9.1" +version = "0.10.0" dependencies = [ "axum", "base64", @@ -2856,7 +2856,7 @@ dependencies = [ [[package]] name = "tw-crypto" -version = "0.9.1" +version = "0.10.0" dependencies = [ "aes-gcm", "anyhow", @@ -2868,7 +2868,7 @@ dependencies = [ [[package]] name = "tw-dialect" -version = "0.9.1" +version = "0.10.0" dependencies = [ "serde", "serde_json", @@ -2876,7 +2876,7 @@ dependencies = [ [[package]] name = "tw-engine" -version = "0.9.1" +version = "0.10.0" dependencies = [ "serde", "serde_json", @@ -2889,7 +2889,7 @@ dependencies = [ [[package]] name = "tw-gateway" -version = "0.9.1" +version = "0.10.0" dependencies = [ "arc-swap", "async-stream", @@ -2932,7 +2932,7 @@ dependencies = [ [[package]] name = "tw-observe" -version = "0.9.1" +version = "0.10.0" dependencies = [ "tokio", "tracing", @@ -2941,7 +2941,7 @@ dependencies = [ [[package]] name = "tw-pricing" -version = "0.9.1" +version = "0.10.0" dependencies = [ "arc-swap", "flate2", @@ -2953,7 +2953,7 @@ dependencies = [ [[package]] name = "tw-protocol" -version = "0.9.1" +version = "0.10.0" dependencies = [ "bytes", "futures", @@ -2965,7 +2965,7 @@ dependencies = [ [[package]] name = "tw-provider" -version = "0.9.1" +version = "0.10.0" dependencies = [ "async-stream", "aws-credential-types", @@ -2990,7 +2990,7 @@ dependencies = [ [[package]] name = "tw-redact" -version = "0.9.1" +version = "0.10.0" dependencies = [ "base64", "serde", @@ -3000,7 +3000,7 @@ dependencies = [ [[package]] name = "tw-resil" -version = "0.9.1" +version = "0.10.0" dependencies = [ "futures", "metrics", @@ -3013,7 +3013,7 @@ dependencies = [ [[package]] name = "tw-scan" -version = "0.9.1" +version = "0.10.0" dependencies = [ "notify", "regex", @@ -3030,14 +3030,14 @@ dependencies = [ [[package]] name = "tw-secret" -version = "0.9.1" +version = "0.10.0" dependencies = [ "thiserror", ] [[package]] name = "tw-store" -version = "0.9.1" +version = "0.10.0" dependencies = [ "bytes", "libc", @@ -3055,7 +3055,7 @@ dependencies = [ [[package]] name = "tw-types" -version = "0.9.1" +version = "0.10.0" dependencies = [ "serde", "serde_json", @@ -3064,7 +3064,7 @@ dependencies = [ [[package]] name = "tw-yaml" -version = "0.9.1" +version = "0.10.0" dependencies = [ "saphyr-parser", "serde_yaml_ng", @@ -3073,7 +3073,7 @@ dependencies = [ [[package]] name = "twcore" -version = "0.9.1" +version = "0.10.0" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 963158bf..77d6130d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ repository = "https://github.com/ThinkWatchProject/ThinkWatch-Core" # 二进制走 CalVer,crate 走 SemVer —— 两者是两回事,卖给不同的人。 # 这里是 crate 的版本。 -version = "0.9.1" +version = "0.10.0" [workspace.dependencies] # ── 内部 crate ─────────────────────────────────────────── diff --git a/crates/tw-api/src/lib.rs b/crates/tw-api/src/lib.rs index 1416c167..d051c084 100644 --- a/crates/tw-api/src/lib.rs +++ b/crates/tw-api/src/lib.rs @@ -17,7 +17,11 @@ pub use tw_types::Msg; /// 控制面协议版本。UI 和 CLI 连上来时检查,不匹配就明确提示「请升级 /// 客户端」,而不是以奇怪的方式失败。 -pub const CONTROL_API_VERSION: u32 = 1; +/// +/// **2 起,凡是给人看的一句话都是 [`Msg`],不是 `String`。**错误响应的 +/// 响应体也从纯文本变成了 JSON。照 1 写的客户端会把这些当字符串显示, +/// 屏幕上是一坨 JSON —— 所以这里要跳号,让它在连上的那一刻就失败。 +pub const CONTROL_API_VERSION: u32 = 2; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Status {