Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ before the client runs them.
DeepSeek Harness are pointed at the gateway in one step, with the change
previewed, the original file backed up and a restore always available;
Cursor, Continue and Antigravity CLI come with instructions. Switching
upstreams then happens in the gateway alone.
upstreams then happens in the gateway alone. Codex uses a remote native model
catalog: model and alias changes appear on its next catalog refresh without
rewriting client configuration. Codex may cache the picker list.
- **Protection against relays.** A relay sees every request in full and can
rewrite every answer. Secrets & privacy swaps API keys, private keys, JWTs,
connection-string passwords, Chinese resident ID numbers and bank card numbers
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Claude Code、Codex 等 AI 客户端的本地网关,支持 macOS、Windows 与

## 要点

- **一次接入,随时切换。** Claude Code、Claude Desktop、Codex、opencode、Pi、oh-my-pi、Grok Build、Qwen Code、Hermes Agent、Zed、Aider 与 DeepSeek Harness 可一键指向网关,写入前预览改动、备份原文件,随时可以还原;Cursor、Continue 与 Antigravity CLI 提供配置说明。此后切换上游只在网关中完成。
- **一次接入,随时切换。** Claude Code、Claude Desktop、Codex、opencode、Pi、oh-my-pi、Grok Build、Qwen Code、Hermes Agent、Zed、Aider 与 DeepSeek Harness 可一键指向网关,写入前预览改动、备份原文件,随时可以还原;Cursor、Continue 与 Antigravity CLI 提供配置说明。此后切换上游只在网关中完成。Codex 使用原生远程模型目录,模型和别名变更在下次目录刷新时生效,无需重写客户端配置;模型选择器可能保留客户端缓存。
- **防范中转站。** 中转站能看到请求的全部内容,也能改写每一次回答。「密钥与隐私」在请求发出前把 API 密钥、私钥、JWT、连接串口令、身份证号与银行卡号换成占位符,中转站拿不到原值。回答中若出现下载即执行、外发环境变量或凭据文件、读取私钥、写入开机启动项或定时任务之类的工具调用,「危险命令」会在客户端执行之前切断回答。「内容过滤」在请求发出前删除藏在不可见字符里的指令,可以直接拒绝提示注入,也可以删除或替换请求和模型回答中的指定词语。各项防护出厂处于「监控」状态,只记录并发出通知,逐项开启后生效;每条规则可单独设定动作。
- **上游互相对照。** 每个上游都与服务同一模型的其他上游对照:回答中的模型名与发出的不同、报告的输入明显偏多或偏少、提示缓存读取偏低,都会在上游列表的那一行标出,悬停可见证据与样本数。
- **扫描 MCP、技能与钩子。** 十三款客户端的 MCP 服务器并列显示并标出第三方服务器;客户端配置、技能、钩子与项目指令中的隐藏字符、提示注入、危险命令与过宽权限会被找出。
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "thinkwatch-lite",
"private": true,
"description": "Desktop app for a local AI API gateway on macOS, Windows and Linux",
"version": "2026.11.6",
"version": "2026.11.7",
"type": "module",
"packageManager": "pnpm@11.13.0",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions release-notes/2026.11.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Codex can now discover gateway models through a remote native catalog. Connect or reconnect Codex through Clients after upgrading, then restart Codex once to load the new connection settings. Subsequent model, alias and permission changes use the gateway's existing hot reload path and appear on the next catalog refresh without rewriting client configuration.

Discovery uses gateway authentication and model permissions. Native upstream instructions and tools are preserved when available; ordinary upstreams use a conservative coding profile. The standard OpenAI models endpoint keeps its existing response shape. Codex can cache its picker list, so an already open client may need to refresh its catalog or restart before showing changes.

Codex adoption configures discovery while preserving inactive profiles and restoring overridden fields when disconnected. Existing credentials are not copied into sidecar metadata. Manual setup instructions correctly show fields that need removing.

This release bundles Core 0.90.0, including the native catalog and an update to patched bundled SQLite for RUSTSEC-2026-0459. The control-plane protocol remains 58 and the request-store schema remains 28. Existing settings, upstreams, request history and usage history are preserved.
2 changes: 1 addition & 1 deletion scripts/shots/core/en/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"reachable": []
},
"uptime_secs": 0,
"version": "0.89.2"
"version": "0.90.0"
}
2 changes: 1 addition & 1 deletion scripts/shots/core/zh/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"reachable": []
},
"uptime_secs": 0,
"version": "0.89.2"
"version": "0.90.0"
}
30 changes: 15 additions & 15 deletions src-tauri/Cargo.lock

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

14 changes: 7 additions & 7 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "thinkwatch-lite"
version = "2026.11.6"
version = "2026.11.7"
edition = "2024"
# **这个数决定依赖能升到哪一版。**edition 2024 的解析器只挑声明的 Rust
# 版本编得动的依赖:写 1.85 的时候,`cargo update` 一直停在旧的 time 和
Expand All @@ -26,12 +26,12 @@ license = "MIT"
# twcore 二进制必须和这里编译进去的协议镜像来自同一个 core 版本 —— 打包脚本正是
# 从 tw-api 锁到的 tag 去取二进制的(见 scripts/fetch-core.sh)。
[workspace.dependencies]
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-types = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-yaml = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-watch = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-link = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.89.2" }
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }
tw-types = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }
tw-yaml = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }
tw-watch = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }
tw-link = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.90.0" }

[lib]
name = "thinkwatch_lite_lib"
Expand Down
67 changes: 48 additions & 19 deletions src-tauri/crates/tw-adopt/src/clients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ pub(crate) const NO_KEY: &str = "no-key";
#[derive(Debug, Clone)]
pub struct Edit {
pub path: Vec<String>,
/// TOML has no null: a null edit removes this field while retaining its
/// original value for restoration. JSON/YAML nulls remain literal values.
pub value: Val,
/// 这个值是密钥。决定它进不进旁文件、要不要提示权限。
pub secret: bool,
Expand Down Expand Up @@ -1028,16 +1030,9 @@ pub fn edits(client: &Client, gw: &Gateway) -> Vec<Edit> {
// `POST /v1/responses`,`http_headers` 原样送达,
// `experimental_bearer_token` 变成 `Authorization: Bearer`。
//
// **这里曾经有一条「Codex 不从网关取模型列表」的接管代价,删了。**
// 0.139.0 确实一个 GET 都没有,0.153.4 开始会先来一个
// `GET /v1/models?client_version=…` —— 但它要的是 Codex 自己的目录
// 格式(顶层 `models`),网关答的是 OpenAI 的 `data` 形状,它解码
// 失败,只记一行日志。**而这不影响任何人用**:codex 的
// `models-manager/models.json` 是 `include_str!` 编进二进制的,远端
// 目录只是补充;模型名在内置表里就没有任何提示,不在就按兜底的
// 272k 上下文跑。openai/codex 今天的 main 上还加了闸 —— 设了自定义
// base_url 又没设 `model_catalog_url` 的 provider 直接跳过这次请求。
// 一条不拦人、还在自己消失的事,不值得占接管对话框的一行。
// The native remote catalog uses a separate endpoint: /v1/models keeps
// its standard OpenAI shape. Configure discovery once; later model and
// alias changes come from the live gateway, not config rewrites.
"codex" => {
let p = |k: &str| {
vec![
Expand All @@ -1062,6 +1057,14 @@ pub fn edits(client: &Client, gw: &Gateway) -> Vec<Edit> {
value: Val::s(gw.v1()),
secret: false,
},
Edit {
path: p("model_catalog_url"),
value: Val::s(format!("{}/codex/models", gw.base.trim_end_matches('/'))),
secret: false,
},
e(&["features", "api_key_model_discovery"], Val::Bool(true)),
e(&["model_catalog_json"], Val::Null),
e(&["model_providers", PROVIDER_ID, "env_key"], Val::Null),
// `wire_api = "chat"` 已经被上游移除,只剩 responses
Edit {
path: p("wire_api"),
Expand Down Expand Up @@ -1091,15 +1094,16 @@ pub fn edits(client: &Client, gw: &Gateway) -> Vec<Edit> {
secret: false,
},
];
if let Some(k) = &gw.key {
// 名字带 experimental_,上游可能改。**改了也只是丢掉鉴权,
// 上面那个 http_headers 仍然认得出是谁发的。**
v.push(Edit {
path: p("experimental_bearer_token"),
value: Val::s(k),
secret: true,
});
}
// API-key discovery needs an API key, even on a gateway that does
// not require authentication. A sentinel avoids falling back to
// the user's OpenAI credentials and enables remote discovery.
v.push(Edit {
path: p("experimental_bearer_token"),
value: Val::s(gw.key.as_deref().unwrap_or(NO_KEY)),
// The field's original value can still be a real credential.
// Keep it out of sidecars even when writing the sentinel.
secret: true,
});
v
}
// 写 v1 的写法:v1 和 v2 都认。已经有原生那一条的见 [`edits_for`]
Expand Down Expand Up @@ -1208,6 +1212,31 @@ pub fn edits_for(client: &Client, gw: &Gateway, current: &str) -> Vec<Edit> {
"hermes-agent" => crate::hermes::edits(gw, current),
"codex" => {
let mut v = edits(client, gw);
// The selected default profile overrides root fields. Keep inactive
// profiles intact and restore these few fields on disconnect.
if let Ok(Some(Val::Str(profile))) = crate::toml::get(current, &["profile"]) {
let p = |field: &str| vec!["profiles".into(), profile.clone(), field.into()];
v.push(Edit {
path: p("model_provider"),
value: Val::s(PROVIDER_ID),
secret: false,
});
v.push(Edit {
path: p("model_catalog_json"),
value: Val::Null,
secret: false,
});
v.push(Edit {
path: vec![
"profiles".into(),
profile,
"features".into(),
"api_key_model_discovery".into(),
],
value: Val::Bool(true),
secret: false,
});
}
v.extend(codex_detail_mode(current));
v
}
Expand Down
7 changes: 6 additions & 1 deletion src-tauri/crates/tw-adopt/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,12 @@ pub(crate) fn adopt_file(
},
};
originals.push(Original::new(p, was));
carries_secret |= secret;
carries_secret |= *secret && *value != Val::s(crate::clients::NO_KEY);
if fmt == Format::Toml && *value == Val::Null {
text = drop_(fmt, &text, &r, client)?;
targets.push(Target::Remove(p.clone()));
continue;
}
// 已经是这个值了就不碰那一段字节:JSON 的数组和对象是重新排出来的,
// 重排一遍会换掉原来的排版 —— 重复接管也就不再是空操作
let same = fmt == Format::Json
Expand Down
Loading
Loading