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
695 changes: 657 additions & 38 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ members = [
# crate、企业版用的第一层都不能沾上,tw-plugin 的 tests/boundary.rs 守着
"crates/tw-plugin",
"crates/tw-control",
# 配置包(.twconfig):导出、导入、本机备份与同步共用的格式,以及把一份配置拆成
# 项目与合并单位的模型
"crates/tw-pack",
# 控制通道的握手与加密。桌面端按 tag 依赖它,所以只依赖契约层和 tw-yaml
"crates/tw-link",
# ── bin ──────────────────────────────────────────────
Expand Down Expand Up @@ -76,6 +79,7 @@ tw-dialect = { path = "crates/tw-dialect" }
tw-bedrock = { path = "crates/tw-bedrock" }
tw-link = { path = "crates/tw-link" }
tw-plugin = { path = "crates/tw-plugin" }
tw-pack = { path = "crates/tw-pack" }

# ── 版本与企业版 workspace 对齐,便于反向依赖时不打架 ────
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "time", "sync", "io-util", "signal"] }
Expand Down Expand Up @@ -161,6 +165,11 @@ rand = "0.10"
zstd = { version = "0.13", default-features = false }

clap = { version = "4", features = ["derive"] }
# 配置包的口令加密(scrypt)与同步版本的密钥加密(X25519)。默认特性是空的:不要
# SSH 密钥、插件、命令行那几样
age = { version = "0.11", default-features = false }
# 配置包本身是 ZIP。只要 deflate(走已经在依赖树里的 flate2),不要别的压缩算法和加密
zip = { version = "9", default-features = false, features = ["deflate-flate2"] }
# 控制面契约导出成 TypeScript(tw-api 的 `ts` feature)。**不开任何 serde 以外的
# 类型实现**:契约里只有 std 和 serde 的类型
ts-rs = { version = "12", default-features = false, features = ["serde-compat"] }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ a time, and cannot stop core, take the diagnostic bundle or change
| `tw-observe` | Event bus |
| `tw-gateway` | Data plane: the life of a request |
| `tw-plugin` | Script-plugin sandbox: QuickJS compiled to WebAssembly, run by Wasmtime |
| `tw-pack` | Configuration packs (`.twconfig`): format, encryption, local backups, and the item model import and sync compare on |
| `tw-control` | Control-plane server |

ThinkWatch Enterprise depends only on the first four, which depend only on one
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ twcore control-key --rotate # 更换密钥;用旧密钥建立的连接随
| `tw-observe` | 事件总线 |
| `tw-gateway` | 数据面:一个请求的完整生命周期 |
| `tw-plugin` | 脚本插件的沙箱:编成 WebAssembly 的 QuickJS,由 Wasmtime 运行 |
| `tw-pack` | 配置包(`.twconfig`):格式、加密、本机备份,以及导入与同步共同比较的项目模型 |
| `tw-control` | 控制面服务 |

ThinkWatch 企业版只依赖前四个 crate,这四个 crate 也只相互依赖;CI 会针对它们的每一次改动检查企业版能否编译。ThinkWatch Lite 把 `tw-api`、`tw-types`、`tw-yaml`、`tw-guard`、`tw-watch` 和 `tw-link` 固定在某个 Release 的 tag 上,并打包同一 Release 的 `twcore`。接管 AI 客户端和扫描其配置在 Lite 中完成,作用于应用所在的机器;`twcore` 只为每个客户端签发专用的网关密钥。二进制的源码位于 `bin/twcore`。只有 `tw-gateway` 和 `twcore` 可以依赖 `tw-plugin`——它是唯一一个构建时除了 Rust 还需要别的工具的 crate(见下文),因此用这些 crate 构建 Lite 或企业版时都不需要。
Expand Down
12 changes: 12 additions & 0 deletions crates/tw-api/msg-codes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,18 @@ l3.not_streamed
l3.refused
l3.sign_failed
l3.stream_failed
pack.bad_entry
pack.corrupt
pack.item_shape
pack.missing_entry
pack.need_key
pack.need_passphrase
pack.schema_too_new
pack.too_large
pack.too_new
pack.verify_failed
pack.wrong_key
pack.wrong_passphrase
pricing.sheet.bad_multiplier
pricing.sheet.bad_price
pricing.sheet.duplicate_name
Expand Down
30 changes: 30 additions & 0 deletions crates/tw-pack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "tw-pack"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
readme.workspace = true
description = "Configuration packs (.twconfig): format, encryption, local backups, and the item model that import and sync compare on"

[dependencies]
# 配置的形状、校验、按名字改一项(保留注释)都在这里
tw-config = { workspace = true }
tw-engine = { workspace = true }
tw-pricing = { workspace = true }
tw-types = { workspace = true }
tw-yaml = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml_ng = { workspace = true }
thiserror = { workspace = true }
blake3 = { workspace = true }
sha2 = { workspace = true }
age = { workspace = true }
zip = { workspace = true }

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