Skip to content

跟踪 core runtime 架构拆解闭环 #970

@limityan

Description

@limityan

1. 背景

Core runtime 拆解已从低风险 contract / facade 抽取进入 owner 迁移阶段。本 Issue 用于跟踪 #964 之后的整体架构闭环,确保后续实现按分层、边界和验证策略推进,而不是退化为零散 API 增量或只增加 crate 的表面重构。

关联文档:

  • docs/architecture/core-decomposition.md:事实架构、目标分层、接口与实现分离、Product Assembly 注册模型和主要风险。
  • docs/architecture/agent-runtime-services-design.md:Agent Runtime SDK、Runtime Services、Tool Runtime、Harness、Product Capabilities、typed service injection、Remote ports、hooks/events 和验证策略。
  • docs/plans/core-decomposition-plan.md:活跃迁移节奏、剩余 owner 队列、crate 创建准入、暂停条件和验证矩阵。
  • docs/plans/core-decomposition-completed.md:已完成内容归档,避免活跃计划继续膨胀为流水账。

2. 总体目标

bitfun-core 逐步收敛为 compatibility facade 和 product assembly point。目标依赖方向为:

Product Surfaces -> Product Assembly / Capabilities -> Harness / Tool Runtime / Agent Runtime SDK -> Runtime Services -> Stable Contracts / External providers

重构目标不是增加 crate 数量。每个新增或扩展 owner 边界都必须同时满足:迁移或简化现有 core 路径、降低 concrete dependency 压力、保持旧路径兼容、可被 focused tests 和 boundary checks 验证。

3. 当前里程碑状态

里程碑 状态 当前说明
架构与执行计划基线 已建立 #964 建立事实架构、目标分层、风险和执行计划;后续只维护活跃计划与完成归档。
Runtime Services foundation 已建立 typed service bundle、provider registry、capability availability、fake provider 和 Remote port 边界已具备基础保护。
Tool / Product-domain 低风险 owner closure 已推进 portable facts、manifest/catalog、permission/result 纯策略和部分 product-domain boundary 已迁移;concrete IO 仍需按 owner 主题继续收敛。
Agent Runtime SDK owner baseline 进行中 scheduler/background delivery 已迁移;#1014 将 thread goal runtime decision owner 迁入 bitfun-agent-runtime,core 保留 metadata/tool/scheduler delivery adapter。
高风险 runtime 深迁移 待继续 concrete scheduler lifecycle、prompt loop、subagent registry facts/visibility、remote/product IO、Harness concrete execution 仍需按受保护 owner 主题推进。
Feature / build-benefit evaluation 待后置 只有 owner 边界稳定后才评估 feature matrix、no-default profile、构建收益和交付形态调整。

4. 活跃实施队列

  1. Agent Runtime SDK owner closure

    • 已迁移 scheduler/background delivery 和 thread goal runtime decisions。
    • 剩余重点是 mode-scoped subagent visibility、agent registry facts、queue/preempt/cancel policy,以及可证明等价后的 concrete scheduler lifecycle。
  2. Harness / Product Capability boundary

    • 为 Deep Review、DeepResearch、MiniApp 等 workflow 建立 provider contract。
    • Hook 必须具备顺序、timeout、错误策略和旧路径等价保护。
  3. Product-domain / Tool concrete owner closure

    • MiniApp、function-agent、tool execution、workspace/file/result materialization 等 concrete IO 必须通过最小 port/provider 迁移。
    • 不允许 domain crate 重新吸收 filesystem、Git、AI、process、platform handle 等 concrete dependency。
  4. Feature / delivery-shape evaluation

    • 在 owner 边界稳定后,用 cargo metadata / cargo tree / check profile 数据证明收益。
    • default features、release shape、构建脚本和产品能力裁剪必须单独评审。

5. 风险与质量门禁

风险 门禁
只新增抽象、不迁移逻辑,导致代码膨胀 owner PR 必须迁移、删除或显著简化旧路径;否则不得作为架构拆解 PR 合入。
用户可见行为、权限、工具曝光或 session 生命周期漂移 保留旧路径 facade,新增 focused regression;任何行为变更必须单独评审。
concrete dependency 回流到 Runtime / Tool / Harness 层 boundary check、cargo tree 和 crate AGENTS 必须覆盖新边界。
scheduler、subagent、hook、permission 等高风险路径时序漂移 先迁移 facts / decisions,再迁移 lifecycle;无法证明等价时暂停 PR。
为追求构建收益提前调整 feature 或交付形态 构建收益评估后置;runtime owner PR 不混入 default feature 或 release shape 变更。

6. Issue 生命周期

  • 本 Issue 在完整架构迁移达到完成标准前保持打开。
  • 单个实现 PR 合入时不要关闭本 Issue,只更新对应范围、状态、风险和剩余工作。
  • 如果关联 PR 改变迁移顺序、范围边界、风险评估、验证策略或完成标准,需要同步更新本 Issue 和相关架构 / 计划文档。
  • 已完成事实持续归档到 completed 文档;活跃计划只保留当前方向、剩余工作和必要门禁。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions