Skip to content

refactor: add runtime services foundation#975

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/runtime-services-foundation
May 30, 2026
Merged

refactor: add runtime services foundation#975
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/runtime-services-foundation

Conversation

@limityan
Copy link
Copy Markdown
Collaborator

Refs #970

背景

本 PR 实现 core runtime 架构迁移计划中的 PR1:Product Assembly / Runtime Services Foundation。目标是先建立可测试、可审查的 typed service assembly 基础,作为后续 remote / agent runtime / tool runtime 深迁移的前置门禁。

变更内容

  • 新增 bitfun-runtime-services crate,提供 RuntimeServicesRuntimeServicesBuilderRuntimeServicesRegistry、provider registration、capability availability 和 typed unsupported / mismatch error。
  • bitfun-runtime-ports 中补充 Runtime Services 所需的轻量 service port trait 与 Remote port trait,只表达 typed registration boundary,不暴露 SSH、relay、Tauri、process、filesystem manager 等 concrete handle。
  • 增加 test_support::FakeRuntimeServicesProvider 与 focused tests,覆盖 mandatory service、optional remote service、unsupported capability、capability availability 和 provider capability mismatch。
  • 更新 scripts/check-core-boundaries.mjs,将 bitfun-runtime-services 纳入 no-core dependency、轻量依赖 profile 和 required-content 检查。
  • 更新 core-decomposition-plan.md,把后续迁移收敛为 PR1-PR7,并细化 PR1 的实施步骤和验收门禁;同步更新架构设计文档和 AGENTS 模块索引。

设计一致性与影响

  • 本 PR 不迁移任何 concrete service owner,也不修改产品行为、默认能力集合、权限语义、工具曝光、事件语义、session 生命周期或构建脚本。
  • 与设计文档保持一致:Product Assembly / Runtime Services 先建立 typed builder 和 provider registration,后续 owner 迁移必须在该边界上继续推进。
  • 细节收敛:bitfun-runtime-services 当前仅依赖 bitfun-runtime-portsasync-traitthiserrorbitfun-core-types / bitfun-events 仍是后续 service DTO 或 event contract 需要时才引入的允许依赖。这样可以避免 PR1 阶段引入未使用依赖,影响是依赖面更小,不改变功能边界。

对抗性审查结果

  • 已检查新 crate 不依赖 bitfun-core,也不依赖 concrete service / product runtime / tool runtime 实现。
  • 已修复审查中发现的 provider mismatch 风险:builder 会拒绝“字段类型正确但 port 自报 capability 错误”的注入。
  • 已修复 runtime-ports 测试 fixture 中会触发 repo hygiene 的本地绝对路径字面量。

验证

  • cargo test -p bitfun-runtime-services
  • cargo test -p bitfun-runtime-ports
  • node scripts/check-core-boundaries.mjs
  • pnpm run check:repo-hygiene
  • git diff --check gcwing/main..HEAD
  • cargo check -p bitfun-core --features product-full
  • cargo check --workspace

@limityan limityan merged commit 18aa2df into GCWing:main May 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant