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
2 changes: 1 addition & 1 deletion AGENTS-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BitFun 是一个由 Rust workspace 与 React 前端组成的项目。
2. 日常开发使用下方主要产品循环;surface 专属的替代命令由最近的应用指南维护。
3. 修改 Rust 文件后,优先使用 `pnpm run fmt:rs`,只格式化已改动或已暂存的 `.rs` 文件。只有在你明确需要更大范围格式化时才使用 `cargo fmt`。
4. 改完后从离改动最近的 `AGENTS.md` 选择 focused 验证命令;下方仓库级验证章节只维护跨模块检查原则。
5. Rust workspace 依赖应在根清单中统一版本,而由消费 crate 按自身职责声明所需 feature;仅测试所需的 feature 应放入 `dev-dependencies`,受 crate feature 控制的服务能力应只在对应 feature 中启用。禁止使用 `tokio/full` 绕过依赖边界设计。
5. Rust workspace 依赖应在根清单中统一版本,而由消费 crate 按自身职责声明所需 feature;仅测试所需的 feature 应放入 `dev-dependencies`,受 crate feature 控制的服务能力应只在对应 feature 中启用。第三方依赖的默认 feature 若不是所有 consumer 的稳定契约,应在 `[workspace.dependencies]` 统一关闭,成员只增加自身需要的切片。仓内 crate 的 `default` 已由边界契约保证为空时,不在每条依赖边重复写 `default-features = false`;ACP 这类有意保留兼容默认的 crate 仍由窄 consumer 显式关闭。被单独复制到 Docker 构建上下文的 manifest 无法继承 workspace 根,必须继续维护显式版本和默认策略。禁止使用 `tokio/full` 绕过依赖边界设计。

## 分层模块索引

Expand Down
11 changes: 9 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ Repository rule: **keep product logic platform-agnostic, then expose it through
5. Workspace Rust dependencies own compatible versions, not broad capability
unions. Each crate must select the dependency features it actually uses;
keep test-only features in dev-dependencies and attach feature-gated service
capabilities to the owning crate feature. `tokio/full` is forbidden in the
root workspace and workspace members.
capabilities to the owning crate feature. Disable third-party defaults in
`[workspace.dependencies]` when they are not part of every consumer's
contract; members inherit that policy and add only their needed slices. For
internal crates whose guarded `default` is empty, do not repeat
`default-features = false` on every edge. Narrow consumers of an intentional
compatibility default, such as ACP, must still disable it explicitly.
Manifests copied into a standalone Docker build context must keep explicit
versions and default policy because they cannot inherit the workspace root.
`tokio/full` is forbidden in the root workspace and workspace members.

## Layered Module Index

Expand Down
137 changes: 0 additions & 137 deletions Cargo.lock

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

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ undocumented_unsafe_blocks = "warn"
[workspace.dependencies]
# Async runtime
tokio = { version = "1.52", default-features = false }
tokio-stream = "0.1.18"
tokio-stream = { version = "0.1.18", default-features = false }
tokio-util = "0.7.18"
async-trait = "0.1.89"
futures = "0.3.31"
futures = { version = "0.3.31", default-features = false, features = ["std"] }
futures-util = "0.3.31"

# Serialization
Expand All @@ -102,12 +102,12 @@ thiserror = "2"

# Logging
log = "0.4"
tracing = "0.1"
tracing = { version = "0.1", default-features = false, features = ["std"] }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

# Utilities
uuid = { version = "1.0", features = ["v4", "serde"] }
chrono = { version = "0.4", features = ["serde", "clock"] }
chrono = { version = "0.4", default-features = false, features = ["serde", "clock", "std"] }
chrono-tz = "0.10.4"
cron = "0.15.0"
# Tauri 2.9.2 utilities conflict with time 0.3.48 on current stable Rust.
Expand Down Expand Up @@ -171,7 +171,7 @@ clap = { version = "4.6.1", features = ["derive"] }
crossterm = "0.28"
ratatui = "0.29"
unicode-width = "0.2"
pulldown-cmark = "0.11"
pulldown-cmark = { version = "0.11", default-features = false }
syntect = { version = "5", default-features = false, features = ["default-syntaxes", "default-themes", "regex-onig"] }
once_cell = "1"
libc = "0.2"
Expand All @@ -194,7 +194,7 @@ similar = "2.5"
urlencoding = "2.1"
oxc = { version = "0.138.0", default-features = false, features = ["ast_visit", "codegen", "semantic", "transformer"] }
oxc-parse = { package = "oxc", version = "0.138.0", default-features = false }
rquickjs = { version = "0.9", default-features = false, features = ["classes", "properties", "macro"] }
sqlx = { version = "0.8", default-features = false }

# Tauri (desktop only)
tauri = { version = "2.11", features = ["unstable", "macos-private-api", "tray-icon"] }
Expand Down Expand Up @@ -222,10 +222,10 @@ foreign-types = "0.5"
dispatch = "0.2"
block2 = "0.6"
objc2 = "0.6"
objc2-foundation = "0.3"
objc2-app-kit = "0.3"
objc2-vision = { version = "0.3.2", features = ["VNRecognizeTextRequest", "VNRequest", "VNObservation", "VNRequestHandler", "VNUtils", "VNTypes", "objc2-core-foundation"] }
objc2-web-kit = { version = "0.3", features = ["WKWebView", "WKSnapshotConfiguration", "WKPDFConfiguration", "block2", "objc2-app-kit"] }
objc2-foundation = { version = "0.3", default-features = false }
objc2-app-kit = { version = "0.3", default-features = false }
objc2-vision = { version = "0.3.2", default-features = false }
objc2-web-kit = { version = "0.3", default-features = false }
tempfile = "3"
webview2-com = "0.38"
windows = "0.61"
Expand Down Expand Up @@ -255,7 +255,7 @@ local-ip-address = "0.6"
hostname = "0.4"

# QR code generation
qrcode = "0.14"
qrcode = { version = "0.14", default-features = false }

# WebSocket client
tokio-tungstenite = { version = "0.29", features = ["rustls-tls-native-roots"] }
Expand Down
16 changes: 10 additions & 6 deletions docs/architecture/rust-build-dependency-boundaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ Cargo 会统一同一 package 在依赖图中的 feature;workspace dependency

### 3.2 产品入口显式选择 Core 能力

`src/apps/*`、`src/crates/interfaces/*` 和 installer app 直接依赖 `bitfun-core` 时必须同时:

1. 设置 `default-features = false`;
2. 声明非空 `features` 列表。
`src/apps/*`、`src/crates/interfaces/*` 和 installer app 直接依赖 `bitfun-core` 时必须声明非空
`features` 列表。Core 的 `default` 由 Core 自身和边界检查保证为空,因此仓内 consumer 不重复声明
`default-features = false`;能力边界仍由 consumer 的显式 feature 集合决定。

入口应选择真实需要的 owner feature;`product-full` 只能描述确实需要完整产品装配的兼容入口,不能作为尚未完成 feature/owner 分解时的占位解法。缩小某个产品的 capability 集合时必须从实际 construction/command path 反推,并保留行为等价或明确 unsupported-state 测试。

Expand Down Expand Up @@ -83,6 +82,11 @@ Plugin Source 和完整 domain feature 集合一起带回 Agent Runtime。产品
### 3.3 Workspace dependency 只提供共同底座

- workspace 声明负责版本和真正跨产品共享的最小 feature;
- 第三方依赖的默认 feature 若不是每个 consumer 的稳定契约,在 workspace 声明统一关闭;成员继承该策略,
只增加自身实际使用的 feature,不在各 manifest 重复 `default-features = false`;
- 仓内 crate 的空默认值由被依赖 crate 拥有并由边界检查锁定,consumer 不重复关闭;只有 ACP 这类有意保留
非空兼容默认的 crate,窄 consumer 才必须显式关闭默认值并选择角色;
- 被 Docker 等独立构建上下文单独复制的 manifest 无法继承 workspace 根,继续显式声明版本与默认策略;
- runtime、HTTP、TLS、crypto、codec 等产品特定 feature 留给实际 app/service/adapter owner;
- `full` feature 只有在所有真实消费者都需要且更窄集合不能稳定维护时才允许;
- target-specific dependency 放在最接近平台实现的 owner,不因单一平台需求污染跨平台 crate;
Expand All @@ -103,8 +107,8 @@ Plugin Source 和完整 domain feature 集合一起带回 Agent Runtime。产品
或复制公共类型。feature 关闭时 API 不可见是明确的编译期契约变化;feature 开启后必须保留原公开路径、序列化
形状和错误语义。

- contract crate 的 `default` 保持空,consumer 的每条 normal/dev/build/target dependency edge 都显式关闭
default features,并只选择实际消费的切片;
- contract crate 的 `default` 保持空并由目标 crate 的边界契约看护;consumer 继承该空默认值,只选择实际
消费的切片,不在每条 normal/dev/build/target dependency edge 重复关闭 default features;
- feature 名描述稳定能力,例如 Agent API、workspace/terminal/remote/Git port、协议 bridge 或 Computer Use
contract,不描述某个临时调用方、PR 或测试;
- 不提供 `full`、`service-ports`、`all-contracts` 等重新合并全部表面的 umbrella。只有多个 owner 共同消费且
Expand Down
Loading