Skip to content
Open
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
39 changes: 29 additions & 10 deletions docs/architecture/core-decomposition.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Rust 编译和链接面。
| `bitfun-agent-stream` | Stream 聚合和 stream-focused 测试 | done:stream 聚合已独立 |
| `bitfun-runtime-ports` | 面向 service/agent 边界的轻量跨层 DTO 和 trait | partial:DTO/trait-only 边界已建立,包含 agent submission/transcript/cancel、remote state、runtime event 与 remote image attachment 契约;不拥有 runtime 实现 |
| `bitfun-agent-runtime` | Sessions、execution、coordination、agent system | target:crate 尚不存在,agent runtime 仍在 core |
| `bitfun-agent-tools` | 轻量 tool DTO / contract、portable tool context facts / provider、runtime restriction、host path normalization / runtime artifact URI / remote POSIX path pure contract、allowed-list / collapsed-tool execution gate policy、pure manifest/exposure and GetToolSpec presentation/schema/static metadata/detail/result assembly / execution-plan contract、provider-backed tool catalog / GetToolSpec runtime facade、provider-backed GetToolSpec execution result helper / Tool-result vector adapter、generic contextual manifest resolver、generic catalog snapshot provider / GetToolSpec catalog provider、generic registry / static-provider / dynamic-provider / decorator-ref / snapshot-decorator adapter / runtime assembly container、generic readonly/enabled snapshot filter | partial:product registry snapshot access、`ToolUseContext` adapter、`GetToolSpec` Tool impl 和 concrete tools 仍在 core,并由 core `tools/product_runtime.rs` 作为单一 product runtime owner 组装;core 当前从 `bitfun-tool-packs` provider plan 物化内置工具列表,static-provider 安装 assembly、decorator reference、generic snapshot decorator adapter、provider-backed catalog runtime facade 与 readonly/enabled 过滤规则已委托给 `bitfun-agent-tools` |
| `bitfun-agent-tools` | 轻量 tool DTO / contract、portable tool context facts / provider、runtime restriction、host path normalization / runtime artifact URI / remote POSIX path pure contract、provider-neutral tool path resolution / absolute-path check / runtime artifact reference assembly、allowed-list / collapsed-tool execution gate policy、provider-neutral path policy root matching / denial message、pure manifest/exposure and GetToolSpec presentation/schema/static metadata/detail/result assembly / execution-plan contract、provider-backed tool catalog / GetToolSpec runtime facade、provider-backed GetToolSpec execution result helper / Tool-result vector adapter、generic contextual manifest resolver、generic catalog snapshot provider / GetToolSpec catalog provider、generic registry / static-provider / dynamic-provider / decorator-ref / snapshot-decorator adapter / runtime assembly container、generic readonly/enabled snapshot filter | partial:product registry snapshot access、`ToolUseContext` adapter、`GetToolSpec` Tool impl 和 concrete tools 仍在 core,并由 core `tools/product_runtime.rs` 作为单一 product runtime owner 组装;core 当前从 `bitfun-tool-packs` provider plan 物化内置工具列表,static-provider 安装 assembly、decorator reference、generic snapshot decorator adapter、provider-backed catalog runtime facade、readonly/enabled 过滤规则、provider-neutral tool path resolution / runtime artifact reference assembly 与 path policy 判定已委托给 `bitfun-agent-tools` |
| `bitfun-tool-packs` | 由 feature group 隔离的工具 provider plan | partial:提供 basic / git / mcp / browser-web / computer-use / image-analysis / miniapp / agent-control feature-group 元数据和 product provider group plan;不得声明 concrete tools 已迁移 |
| `bitfun-services-core` | Config、session、workspace、storage、filesystem、system services | partial:部分 pure helper 已迁出;config/workspace/filesystem runtime 多数仍在 core |
| `bitfun-services-integrations` | Git、MCP、remote SSH、remote connect、file watch integrations | partial:MCP runtime 已迁入;remote SSH 仍只迁移低风险 contracts/helpers;remote-connect 已拥有 wire DTO、request builder、tracker state / registry lifecycle、tracker event reduction、dialog submission orchestration port/provider、file IO/path resolution helper 与 image-context adapter contract;concrete scheduler/session restore/terminal adapter、workspace-root source、response wrapping 与 product execution 仍在 core |
Expand Down Expand Up @@ -160,9 +160,12 @@ owner 边界,否则不要把一个 feature group 继续拆成更小的 crate
可执行 service handle;workspace root 使用 session identity 的 logical path
(remote 为 normalized remote root)。`PortableToolContextProvider` 只是只读 facts
provider 合约,当前由 core `ToolUseContext` 实现;`ToolUseContext` 本体仍归 core 拥有。
- host path normalization、runtime artifact URI 与 remote POSIX path containment
现在是 `bitfun-agent-tools` 的纯路径契约;core `workspace_paths` / `restrictions`
只保留 `BitFunError` 映射、workspace runtime-root lookup 与 `ToolUseContext` 集成。
- host path normalization、runtime artifact URI、provider-neutral tool path resolution /
effective absolute-path check、runtime artifact reference assembly 与 remote
POSIX path containment 现在是
`bitfun-agent-tools` 的纯路径契约;core `workspace_paths` / `restrictions`
只保留 `BitFunError` 映射、workspace runtime-root lookup、local canonicalize 回调
与 `ToolUseContext` 集成。
- tool allowed-list 与 collapsed tool 的直接执行 gate policy 现在由
`bitfun-agent-tools` 作为纯契约持有;core pipeline 仍保存
`ToolUseContext.unlocked_collapsed_tools`,负责失败状态更新与 `BitFunError`
Expand Down Expand Up @@ -235,6 +238,9 @@ owner 边界,否则不要把一个 feature group 继续拆成更小的 crate
或任何产品 crate feature set 调整。
- 高风险项不能作为 P2/P3 普通收尾任务顺带执行,必须先有等价性测试、port/provider 设计、
旧路径兼容策略和用户确认。
- 从 2026-05-22 起,后续 PR 不再按 helper / guard / facade 小块拆分;除当前 draft PR
的文档与保护补强外,每次 PR 都必须围绕一个完整高风险 owner 主题推进,并在动代码前
先写清设计、预保护、验证矩阵和对抗性审核方式。
- 后续 runtime 迁移以 `docs/plans/core-decomposition-plan.md` 的里程碑表为准,不再按零散
“剩余 PR 数量”临时拆分。LR1 已闭环为文档/边界/基线校准,不包含 runtime owner
迁移;后续高风险队列只允许按 H1-H5 的单一 owner 主题推进:
Expand Down Expand Up @@ -282,11 +288,10 @@ owner 边界,否则不要把一个 feature group 继续拆成更小的 crate
runtime assembly;未完成等价评审的 runtime owner 继续显式 core-owned。
- H5:optional feature/build-benefit evaluation。`bitfun-core default = []`、per-product
feature matrix、依赖版本收敛和构建收益评估只能在 H1-H4 后独立进行。
- H4 之后的剩余工作口径必须区分“当前闭环必需项”和“后续深度 runtime 迁移”:
当前 H1-H4 主线闭环后,不再把 deferred/core-owned runtime 当作当前 PR 漏项;
若继续外移高风险 owner,最多按 tool runtime、product-domain runtime、
service/agent runtime 这 3 个条件性大型 PR 重新评审;这些 HR 项不是 H5
之后的必做项。H5 仍是单独且可选的 feature/build-benefit evaluation,
- H4 之后的剩余工作口径必须区分“低风险准备已完成”和“后续深度 runtime 迁移”:
不再把 deferred/core-owned runtime 当作零散漏项;若继续外移高风险 owner,
只允许按 tool runtime、product-domain runtime、service/agent runtime 这 3 个
大型 PR 重新评审和实施。H5 仍是单独且可选的 feature/build-benefit evaluation,
只能在选择继续外移的 HR 项完成或明确 defer 后评估。
- HR1-HR3 的共同底线是功能影响范围可控、无性能劣化且不改变产品发布形态:
不修改 default feature、产品 crate feature set、CI/release 覆盖、desktop/installer
Expand All @@ -309,6 +314,11 @@ owner 边界,否则不要把一个 feature group 继续拆成更小的 crate
本体、runtime service handles 或 concrete tool behavior,并通过 remote workspace
containment、runtime URI scope、path policy、task/description/preflight context materialization
与 cancellation hook 回归测试保护现有工具语义。
- 当前受保护 HR1 迁移只把 provider-neutral tool path resolution / effective
absolute-path check、runtime artifact reference assembly、path policy root matching 与拒绝消息移入
`bitfun-agent-tools`;core 仍负责 workspace/runtime root 获取、allowed root
解析、local canonicalize、remote POSIX containment 回调、`BitFunError` 映射和
`ToolUseContext` runtime binding。
- 已完成的 MCP runtime/dynamic tools、remote-connect tracker/wire/pure policy、
semantic baseline、product-domain port/facade 与 tool contract/helper 外移不得重复规划;
如果后续发现这些已完成项存在实现错误,应在对应 H 阶段记录问题、风险和修复方案,
Expand Down Expand Up @@ -391,15 +401,24 @@ BitFun 的重构目标不是把 Desktop、CLI、Remote、Server 和 ACP 强行
`ssh-remote`、`tool-packs` 或 `product-domains` 这些明确 feature owner 显式启用。
后续新增 optional dependency 时,必须同步更新 owner feature 规则,避免出现隐式或孤儿
feature 引用。
- 当前 boundary check 已把该规则变成全量覆盖检查:凡列入 no-default product/runtime
forbidden list 且仍存在为 optional dependency 的条目,必须在 feature-owner 规则中声明;
owner feature 缺失或未显式启用对应依赖都会失败。
- Boundary check 也必须保护产品入口的完整能力装配:Desktop、CLI、ACP 对
`bitfun-core` 的依赖必须保持 `default-features = false` 且显式启用 `product-full`,
避免产品完整 runtime 退回到隐式默认 feature;脚本会扫描产品入口范围内新增的
`bitfun-core` 依赖,防止遗漏显式装配规则。
- 在单独完成产品矩阵评审前,Boundary check 必须继续锁定
`bitfun-core default = ["product-full"]`,不得把默认 feature 变轻作为依赖裁剪的副作用。
- `bitfun-core/product-full` 必须继续显式聚合当前 owner feature group:`ssh-remote`、
`product-domains`、`service-integrations` 和 `tool-packs`,防止完整产品 runtime
在后续依赖裁剪中被隐式拆散。
- Boundary check 还必须锁定 owner crate 的 feature graph:`tool-packs`、
`services-integrations`、`product-domains` 的 `default` 保持空,`product-full`
只显式聚合当前 owner crate 已声明的 feature group。
只显式聚合当前 owner crate 已声明的 feature group,且不得夹带未纳入规则的 feature
或 dependency shortcut。`services-integrations` 与 `product-domains` 的 runtime/domain
optional dependency 也必须由对应 feature group 显式拥有,避免 owner crate default-light
边界回退。
- Core 的 `service-integrations` feature 当前仍是完整 `product-full` runtime assembly 的一部分,
不是可单独发布或单独验证的产品形态;MCP/remote-connect/review-platform 仍引用 agentic、
snapshot 或 product execution owner。若未来要让该 feature 独立可编译,必须先做
Expand Down
Loading
Loading