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 docs/plans/core-decomposition-completed.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- `services-core` 已承接 workspace-runtime legacy session-store merge、metadata 冲突选择、index rebuild 和 legacy path copy/move fallback;core workspace-runtime 只保留路径计算、runtime layout ensure 和错误兼容映射。
- `runtime-services` 已承接 typed runtime service assembly、capability availability、provider registry、capability validation、无副作用 capability marker ports 和 backend event delivery;core backend event system 只保留兼容 re-export。
- `bitfun-events` 已承接 backend event DTO、agentic event DTO 和 platform-neutral `EventEmitter` trait。
- `services-integrations` 已承接 remote-connect primitives、wire command routing / response assembly、IM bot provider-neutral config / persistence / file auto-push / locale / menu / state / command parsing、workspace search concrete owner、remote SSH/SFTP/PTY owner、DeepResearch report IO / display-map sidecar、MiniApp host dispatch / storage / worker / import IO。
- `services-integrations` 已承接 remote-connect primitives、wire command routing / response assembly、IM bot provider-neutral config / persistence / file auto-push / locale / menu / state / command parsing、workspace search concrete owner、remote SSH/SFTP/PTY owner、Remote SSH disabled runtime surface、Remote SSH workspace/session identity helper、remote workspace-search disabled surface、DeepResearch report IO / display-map sidecar、MiniApp host dispatch / storage / worker / import IO。
- `tool-contracts` 已承接 provider-neutral tool DTO、manifest/catalog/admission/result presentation、Computer Use DTO/input parser/screenshot payload、confirmation facts、truncation recovery presentation、runtime restriction policy 和 provider-entry materialization;core 只保留 Computer Use 旧 public path re-export / compatibility shim 与产品执行入口。
- `tool-execution` 已承接 local / remote IO helper、Bash shell helper、batching plan、retry policy、state counting、tool state event payload shaping / result redaction、cancellation-state/token-store policy、background exec output capture、ExecCommand provider-neutral 呈现 / control facts / completion shape、prompt-safe tool context facts / custom-data materialization、Computer Use loop detection / screenshot hash / verification / retry policy,以及 File tool 的 provider-neutral 结果展示、写入 mode/status/line-count 规则、Edit guardrail 分类和 Delete success 文本;core 只保留 ToolResult 包装、权限、checkpoint、runtime handles、process manager / host adapter 调用、read-state adapter、remote shell/FS 调用和旧工具入口。
- `agent-runtime` 已承接 scheduler/background delivery 纯决策、dialog lifecycle port contracts、runtime event queue/router、session management/cancellation port contracts、session/config/summary facts、persisted session state sidecar / processing-state sanitization、session state facts / event-label projection、session state manager / event emission owner、dialog-turn id / stats facts、side-question runtime-only tracking、thread-goal facts、context profile / model capability policy、prompt markup / prompt / prompt-cache facts 与持久化写入决策、remote file delivery prompt facts、turn skill/agent snapshot DTO/diff/render/store、file-read session state / prior-read guardrail / freshness 决策、session evidence ledger 与 compression-contract projection、dialog-turn cancellation token store、tool confirmation gate / wait channel state、user-question wait channel state、custom agent / mode / subagent schema、默认值、discovery/loading、markdown IO、validation、review 工具过滤、skill catalog/root specs、mode policy、selection/shadow/mode-info 规则、assistant payload rendering、post-call hook routing、DeepReview provider-neutral policy/queue/retry/diagnostics shaping 与 queue event payload shaping、DeepResearch citation renumber 与 report post-process gate,并建立不暴露 `bitfun-core` / `product-full` / concrete manager 的内部 SDK facade。SDK facade 已支持注入 fake runtime services、tool registry、harness registry、hook registry 和 agent registry。
Expand Down
2 changes: 1 addition & 1 deletion docs/plans/core-decomposition-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- Desktop / CLI / ACP 仍通过 `bitfun-core/product-full` 获取完整能力;Server / Remote / Web / Mobile Web 不直接依赖 core。
- Product Assembly 已按入口矩阵裁剪能力计划:完整兼容入口保留 product-full 能力,无直接 core 入口不再 materialize product-full capability packs、feature groups、runtime services、tool groups 或 harness routes。
- Runtime Services、Agent Runtime、Tool Contracts、Tool Execution、Harness、Product Domains、Services Core、Services Integrations 等 owner crate 已建立;部分 concrete 生命周期仍由 core concrete manager 或产品命令路径持有。
- Custom agent / mode / skill、Agent lifecycle、tool side-effect、Computer Use、file tool、MiniApp、DeepReview、DeepResearch、remote-connect、workspace search、remote SSH/SFTP/PTY 等多批 provider-neutral 或 concrete owner 已迁出。
- Custom agent / mode / skill、Agent lifecycle、tool side-effect、Computer Use、file tool、MiniApp、DeepReview、DeepResearch、remote-connect、workspace search、remote SSH/SFTP/PTY、Remote SSH disabled surface、remote workspace identity 和 remote search disabled surface 等多批 provider-neutral 或 concrete owner 已迁出。
- Root boundary scripts 已覆盖核心 owner 防回流、six-layer path 解析、facade-only 文件、custom agent owner / custom subagent wrapper 保护和重点 feature gate。
- Agent Runtime session workspace resolution、Cron / SessionControl / SessionMessage / SessionHistory 的 target session/workspace owner routing、`/goal` tool management runtime-port routing、session/config/context/lifecycle fact owner 收口,以及 `services-integrations` workspace search preview/result conversion 已纳入已完成摘要;后续计划只保留仍需迁移的 feature/kernel、security/control-plane、execution、extension 和 cross-platform adapter 主体工作。
- MiniApp built-in seed orchestration 已进入 `product-domains`,core 只保留 concrete host adapter;session state manager 已进入 `agent-runtime`,core 只保留兼容 re-export。
Expand Down
22 changes: 22 additions & 0 deletions scripts/core-boundaries/rules/source/forbidden-rules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,11 @@ export const forbiddenContentRules = [
{
path: 'src/crates/assembly/core/src/service/search/mod.rs',
patterns: [
{
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*mod remote_disabled\b/s,
message:
'core workspace search facade must not own disabled remote search stubs; re-export services-integrations remote_ssh workspace_search disabled surface',
},
{
regex: /\bbitfun_services_integrations::workspace_search::flashgrep\b/,
message:
Expand Down Expand Up @@ -2657,6 +2662,15 @@ export const forbiddenContentRules = [
},
],
},
{
path: 'src/crates/assembly/core/src/service/remote_ssh/mod.rs',
patterns: [
{
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*mod disabled\b/s,
message: 'core remote SSH facade must not own disabled runtime stubs; re-export services-integrations remote_ssh',
},
],
},
{
path: 'src/crates/assembly/core/src/service/remote_ssh/workspace_state.rs',
patterns: [
Expand Down Expand Up @@ -2700,6 +2714,14 @@ export const forbiddenContentRules = [
regex: /\bpub fn unresolved_remote_session_storage_key\b/,
message: 'core remote SSH workspace runtime must not redefine unresolved session keys; use the integrations contract',
},
{
regex: /\bpub struct WorkspaceSessionIdentity\b/,
message: 'core remote SSH workspace runtime must not redefine workspace session identity; use the integrations path helper',
},
{
regex: /\bpub fn workspace_session_identity\b/,
message: 'core remote SSH workspace runtime must not redefine workspace session identity construction; use the integrations path helper',
},
{
regex: /\bstruct RegisteredRemoteWorkspace\b/,
message: 'core remote SSH workspace runtime must not own workspace registrations; use the integrations registry',
Expand Down
42 changes: 29 additions & 13 deletions scripts/core-boundaries/rules/source/required-rules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3771,11 +3771,11 @@ export const requiredContentRules = [
{
path: 'src/crates/assembly/core/src/service/remote_ssh/mod.rs',
reason:
'core remote SSH compatibility facade must keep service-backed SSH surfaces behind the ssh-remote feature while preserving lightweight workspace identity helpers',
'core remote SSH compatibility facade must keep concrete SSH surfaces behind the ssh-remote feature and re-export services-owned disabled stubs for lightweight builds',
patterns: [
{
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*mod disabled\b/s,
message: 'missing disabled remote SSH runtime surface for no-default builds',
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*pub use bitfun_services_integrations::remote_ssh::\{/s,
message: 'missing services-owned disabled remote SSH re-export for no-default builds',
},
{
regex: /#\[cfg\(feature = "ssh-remote"\)\]\s*pub mod manager\b/s,
Expand All @@ -3796,9 +3796,9 @@ export const requiredContentRules = [
],
},
{
path: 'src/crates/assembly/core/src/service/remote_ssh/disabled.rs',
path: 'src/crates/services/services-integrations/src/remote_ssh/disabled.rs',
reason:
'no-default core builds must expose explicit unsupported remote SSH stubs instead of compiling russh-backed runtime code',
'services-integrations must own explicit unsupported remote SSH stubs for lightweight builds',
patterns: [
{
regex: /Remote SSH support is disabled; enable the `ssh-remote` feature/,
Expand All @@ -3823,6 +3823,14 @@ export const requiredContentRules = [
reason:
'services-integrations remote_ssh must own concrete SSH/SFTP/PTY runtime behind the remote-ssh-concrete feature while keeping lightweight path/type contracts separate',
patterns: [
{
regex: /#\[cfg\(not\(feature = "remote-ssh-concrete"\)\)\]\s*mod disabled\b/s,
message: 'missing disabled remote SSH owner module',
},
{
regex: /#\[cfg\(not\(feature = "remote-ssh-concrete"\)\)\]\s*pub use disabled::\{/s,
message: 'missing disabled remote SSH owner exports',
},
{
regex: /#\[cfg\(feature = "remote-ssh-concrete"\)\]\s*pub mod manager\b/s,
message: 'missing concrete SSH manager owner module',
Expand Down Expand Up @@ -7062,6 +7070,10 @@ export const requiredContentRules = [
reason:
'remote SSH workspace_search strategy helpers must stay crate-internal and keep behavior-equivalence tests near the owner',
patterns: [
{
regex: /#\[cfg\(not\(feature = "remote-ssh-concrete"\)\)\]\s*pub mod disabled\b/s,
message: 'missing gated service-owned disabled remote workspace search surface',
},
{
regex: /\bpub\(crate\)\s+fn\s+build_remote_scope\b/,
message: 'remote scope helper must stay crate-internal',
Expand Down Expand Up @@ -7160,19 +7172,15 @@ export const requiredContentRules = [
message: 'missing ssh-remote gate for real remote search implementation',
},
{
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*mod remote_disabled\b/s,
message: 'missing disabled remote search implementation for no-default builds',
},
{
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*pub use remote_disabled/s,
message: 'missing disabled remote search export',
regex: /#\[cfg\(not\(feature = "ssh-remote"\)\)\]\s*pub use bitfun_services_integrations::remote_ssh::workspace_search::disabled/s,
message: 'missing service-owned disabled remote search export',
},
],
},
{
path: 'src/crates/assembly/core/src/service/search/remote_disabled.rs',
path: 'src/crates/services/services-integrations/src/remote_ssh/workspace_search/disabled.rs',
reason:
'no-default core builds must keep remote search unavailable with an explicit diagnostic',
'services-integrations must own disabled remote workspace search diagnostics for lightweight SSH builds',
patterns: [
{
regex: /Remote SSH search is disabled; enable the `ssh-remote` feature/,
Expand Down Expand Up @@ -7647,6 +7655,14 @@ export const requiredContentRules = [
reason:
'services-integrations remote-ssh owns workspace path/session identity helpers that do not require concrete SSH runtime handles',
patterns: [
{
regex: /\bpub struct WorkspaceSessionIdentity\b/,
message: 'missing workspace session identity contract',
},
{
regex: /\bpub fn workspace_session_identity\b/,
message: 'missing workspace session identity builder',
},
{
regex: /\bpub fn remote_workspace_runtime_root\b/,
message: 'missing remote workspace runtime root helper',
Expand Down
21 changes: 14 additions & 7 deletions scripts/core-boundaries/self-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,8 @@ export function runManifestParserSelfTest({
{
path: 'src/crates/services/services-integrations/src/remote_ssh/workspace_search/mod.rs',
contracts: [
'not(feature = "remote-ssh-concrete")',
'pub mod disabled',
'build_remote_scope',
'shell_escape',
'should_retry_remote_scan_fallback_as_files_with_matches',
Expand All @@ -2652,10 +2654,13 @@ export function runManifestParserSelfTest({
},
{
path: 'src/crates/assembly/core/src/service/search/mod.rs',
contracts: ['mod remote_disabled', 'feature = "ssh-remote"', 'pub use remote_disabled'],
contracts: [
'feature = "ssh-remote"',
'bitfun_services_integrations::remote_ssh::workspace_search::disabled',
],
},
{
path: 'src/crates/assembly/core/src/service/search/remote_disabled.rs',
path: 'src/crates/services/services-integrations/src/remote_ssh/workspace_search/disabled.rs',
contracts: ['Remote SSH search is disabled', 'RemoteWorkspaceSearchService', 'remote_workspace_search_service_for_path'],
},
{
Expand Down Expand Up @@ -2979,15 +2984,15 @@ export function runManifestParserSelfTest({
},
{
path: 'src/crates/assembly/core/src/service/remote_ssh/mod.rs',
contracts: ['mod disabled', 'pub mod manager', 'pub mod remote_fs', 'pub mod remote_terminal', 'pub mod workspace_state'],
contracts: ['bitfun_services_integrations::remote_ssh', 'pub mod manager', 'pub mod remote_fs', 'pub mod remote_terminal', 'pub mod workspace_state'],
},
{
path: 'src/crates/assembly/core/src/service/remote_ssh/disabled.rs',
contracts: ['Remote SSH support is disabled', 'SSHConnectionManager', 'RemoteFileService', 'RemoteTerminalManager'],
path: 'src/crates/services/services-integrations/src/remote_ssh/mod.rs',
contracts: ['mod disabled', 'pub use disabled', 'remote-ssh-concrete', 'pub mod manager', 'mod remote_exec', 'pub mod remote_fs', 'pub mod remote_terminal'],
},
{
path: 'src/crates/services/services-integrations/src/remote_ssh/mod.rs',
contracts: ['remote-ssh-concrete', 'pub mod manager', 'mod remote_exec', 'pub mod remote_fs', 'pub mod remote_terminal'],
path: 'src/crates/services/services-integrations/src/remote_ssh/disabled.rs',
contracts: ['Remote SSH support is disabled', 'SSHConnectionManager', 'RemoteFileService', 'RemoteTerminalManager'],
},
{
path: 'src/crates/services/services-integrations/src/remote_ssh/manager.rs',
Expand All @@ -3008,6 +3013,8 @@ export function runManifestParserSelfTest({
{
path: 'src/crates/services/services-integrations/src/remote_ssh/paths.rs',
contracts: [
'WorkspaceSessionIdentity',
'workspace_session_identity',
'remote_workspace_runtime_root',
'remote_workspace_session_mirror_dir',
'canonicalize_local_workspace_root',
Expand Down
24 changes: 11 additions & 13 deletions src/crates/assembly/core/src/service/remote_ssh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
//! This allows BitFun to work with files on remote servers via SSH,
//! similar to VSCode's Remote SSH extension.

#[cfg(not(feature = "ssh-remote"))]
mod disabled;
#[cfg(feature = "ssh-remote")]
pub mod manager;
#[cfg(feature = "ssh-remote")]
Expand All @@ -15,6 +13,17 @@ pub mod remote_terminal;
pub mod types;
pub mod workspace_state;

#[cfg(not(feature = "ssh-remote"))]
pub use bitfun_services_integrations::remote_ssh::{
get_global_remote_exec_process_manager, KnownHostEntry, PTYSession, PortForward,
PortForwardDirection, PortForwardManager, RemoteExecCommandRequest, RemoteExecCommandResponse,
RemoteExecControlAction, RemoteExecControlOrigin, RemoteExecControlRequest, RemoteExecError,
RemoteExecProcessLifecycleEvent, RemoteExecProcessLifecycleStatus, RemoteExecProcessManager,
RemoteExecResult, RemoteExecSessionCompletion, RemoteExecSessionCompletionSource,
RemoteExecSessionCompletionStatus, RemoteFileService, RemoteSendStdinRequest,
RemoteTerminalManager, RemoteTerminalSession, RemoteWriteStdinRequest, SSHConnectionManager,
SessionStatus,
};
#[cfg(feature = "ssh-remote")]
pub use bitfun_services_integrations::remote_ssh::{
get_global_remote_exec_process_manager, RemoteExecCommandRequest, RemoteExecCommandResponse,
Expand All @@ -28,17 +37,6 @@ pub use bitfun_services_integrations::remote_ssh::{
KnownHostEntry, PTYSession, PortForward, PortForwardDirection, PortForwardManager,
SSHConnectionManager,
};
#[cfg(not(feature = "ssh-remote"))]
pub use disabled::{
get_global_remote_exec_process_manager, KnownHostEntry, PTYSession, PortForward,
PortForwardDirection, PortForwardManager, RemoteExecCommandRequest, RemoteExecCommandResponse,
RemoteExecControlAction, RemoteExecControlOrigin, RemoteExecControlRequest, RemoteExecError,
RemoteExecProcessLifecycleEvent, RemoteExecProcessLifecycleStatus, RemoteExecProcessManager,
RemoteExecResult, RemoteExecSessionCompletion, RemoteExecSessionCompletionSource,
RemoteExecSessionCompletionStatus, RemoteFileService, RemoteSendStdinRequest,
RemoteTerminalManager, RemoteTerminalSession, RemoteWriteStdinRequest, SSHConnectionManager,
SessionStatus,
};
#[cfg(feature = "ssh-remote")]
pub use remote_fs::RemoteFileService;
#[cfg(feature = "ssh-remote")]
Expand Down
Loading
Loading