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
219 changes: 207 additions & 12 deletions src-tauri/Cargo.lock

Large diffs are not rendered by default.

40 changes: 34 additions & 6 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@ rust-version = "1.88"
license = "MIT"
description = "Desktop app for a local AI gateway, built for individual developers"

# 接管和扫描这两个 crate 在 `crates/` 下,和应用同一个 workspace:`cargo test`
# 一次跑全,Cargo.lock 只有一份
[workspace]
members = ["crates/*"]
default-members = [".", "crates/*"]

[workspace.package]
edition = "2024"
rust-version = "1.88"
license = "MIT"

# core 的几个 crate。**钉在 tag 上,不是分支,而且全部钉同一个 tag。**跟着 `main`
# 走意味着同一份源码今天和明天编出来的东西不一样;而更要紧的是,打进 `.app` 的那个
# twcore 二进制必须和这里编译进去的协议镜像来自同一个 core 版本 —— 打包脚本正是
# 从 tw-api 锁到的 tag 去取二进制的(见 scripts/fetch-core.sh)。
[workspace.dependencies]
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0" }
tw-types = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0" }
tw-yaml = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0" }
tw-guard = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0" }
tw-watch = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0" }

[lib]
name = "thinkwatch_lite_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
Expand All @@ -35,17 +57,21 @@ tauri-plugin-opener = "2"
# 浏览器里授权完成之后,那一页把应用带回前台(`thinkwatch://`)
tauri-plugin-deep-link = "2"

# 控制面契约来自 core。UI 和 CLI 依赖同一份类型,不会各写一遍。
# **钉在 tag 上,不是分支。**跟着 `main` 走意味着同一份源码今天和明天
# 编出来的东西不一样;而更要紧的是,打进 `.app` 的那个 twcore 二进制
# 必须和这里编译进去的协议镜像来自同一个 core 版本 —— 打包脚本正是从
# 这个 tag 去取二进制的(见 scripts/fetch-core.sh)。
tw-api = { git = "https://github.com/ThinkWatchProject/ThinkWatch-Core.git", tag = "v0.46.0", features = ["ts"] }
# 控制面契约来自 core,版本钉在下面的 `[workspace.dependencies]` 里。
tw-api = { workspace = true, features = ["ts"] }
# 客户端接管、MCP、客户端配置面的扫描:只有桌面版用,住在这个仓库里(`crates/`)
tw-adopt = { path = "crates/tw-adopt" }
tw-scan = { path = "crates/tw-scan" }
tw-types = { workspace = true }
tw-guard = { workspace = true }

anyhow = "1"
# 生成控制面的凭据(见 src/token.rs)
rand = "0.10"
libc = "0.2"
# 界面和 Rust 侧之间不经过 core 的那些类型,导出成 TypeScript(`wire.rs`)。
# 和 tw-api 的 `ts` 特性用的是同一份
ts-rs = { version = "12", default-features = false, features = ["serde-compat"] }
hyper = { version = "1", features = ["client", "http1"] }
hyper-util = { version = "0.1", features = ["tokio", "client", "client-legacy"] }
http-body-util = "0.1"
Expand Down Expand Up @@ -142,3 +168,5 @@ windows = { version = "0.61", features = [
[dev-dependencies]
# 去抖和限流要按时间测。**暂停时钟**,不是真的等一分钟
tokio = { version = "1", features = ["test-util", "macros", "rt-multi-thread"] }
# 接管、扫描的测试在一台假机器(临时目录)上做
tempfile = "3.20"
35 changes: 35 additions & 0 deletions src-tauri/crates/tw-adopt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "tw-adopt"
version = "0.1.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
publish = false
description = "Detect local AI clients, take over their configuration, and restore it"

[dependencies]
serde = { version = "1", features = ["derive"] }
tw-types = { workspace = true }
# 数据目录在哪由契约层回答,见 `tw_api::data`
tw-api = { workspace = true }
tw-yaml = { workspace = true }
serde_json = "1"
# 保格式地改 TOML。接管 Codex 要写它的 config.toml,而重新序列化
# 会把用户的注释和排版一起抹掉
toml_edit = "0.25"
thiserror = "2"

[target.'cfg(windows)'.dependencies]
# 原子替换一个已存在的文件:`rename` 在这个平台上做不到,见 foreign.rs
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
# 同名环境变量设在哪儿:注册表,见 detect.rs
"Win32_System_Registry",
# 客户端进程什么时候起的:枚举进程 + 取创建时刻,见 detect.rs
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_Threading",
] }

[dev-dependencies]
tempfile = "3"
Loading
Loading