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
4 changes: 4 additions & 0 deletions docs/plans/core-decomposition-completed.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
- `bitfun-core` 的 function-agent AI concrete acquisition 已从旧 `runtime_services` 路径收拢到明确的 core port adapter;Git / AI compatibility re-export 仍保留旧 public path。
- Product Assembly 已承接 `DeliveryProfile`、当前交付形态入口矩阵、`CapabilitySet`、feature group matrix、profile-scoped capability plan、product-full provider plan、service availability report、profile-scoped harness registry 入口与 legacy-route 行为保护,以及 `ProductAssembler` 对 explicit profile input、runtime services、harness registry 和 service requirement 的验证;core 只保留兼容 re-export。ProductFull / Desktop / CLI / ACP 保留完整能力;Server / Remote / Web / MobileWeb 不再 materialize product-full capability packs、feature groups、runtime services、tool groups 或 harness routes。

- Agent session/workspace owner routing 已继续收敛:`AgentRuntime` 提供 port-backed session workspace resolution entrypoint;Cron、SessionControl、SessionMessage 和 SessionHistory 不再在工具实现中直接解析目标 session workspace,Cron 保留 target session 可见性验证,workspace identity 中的 `workspace_id` / remote connection / remote host 通过 runtime contract 传递。
- `/goal` model tool management 已继续收敛:`AgentRuntime` 提供 thread-goal management port,`get_goal` / `create_goal` / `update_goal` 经 `CoreServiceAgentRuntime` 路由到 core concrete adapter;goal lifecycle、metadata、tool response wire shape 和错误类别保持等价。
- `services-integrations` workspace search result mapping 已承接 flashgrep hit conversion 与 preview split owner,保持缺失 `line_text` 时的既有输出语义,并由 focused tests 覆盖有无 preview 两种路径。

## 3. 已建立保护

- owner crate 不得依赖回 `bitfun-core`。
Expand Down
6 changes: 3 additions & 3 deletions docs/plans/core-decomposition-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- 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 已迁出。
- Root boundary scripts 已覆盖核心 owner 防回流、six-layer path 解析、facade-only 文件、custom agent owner / custom subagent wrapper 保护和重点 feature gate。
- 当前 `main` 的 boundary check 仍暴露未闭环 owner:Agent Runtime 缺少 session workspace resolution entrypoint;CronTool、SessionControlSessionMessage 仍缺 port-backed target session / workspace resolution routing`services-integrations` workspace search result mapping 仍缺 shared flashgrep preview/result conversion owner。上述缺口优先纳入 PR-A / PR-B / PR-C 的实际迁移范围
- Agent Runtime session workspace resolution、Cron / SessionControl / SessionMessage / SessionHistory 的 target session/workspace owner routing、`/goal` tool management runtime-port routing,以及 `services-integrations` workspace search preview/result conversion 已纳入已完成摘要;后续计划只保留仍需迁移的 feature/kernel、security/control-plane、execution、extension 和 cross-platform adapter 主体工作

## 3. 后续大块 PR 节奏

Expand All @@ -34,9 +34,9 @@

目标:

- 建立 feature bundle / capability pack 的判定口径,把 `/goal`、DeepReview、MiniApp、input command、settings、UI panel 等从 Agent Kernel 能力中分离。
- 建立 feature bundle / capability pack 的判定口径,把 DeepReview、MiniApp、input command、settings、UI panel 等产品特性从 Agent Kernel 能力中分离;`/goal` 已先完成 model tool 到 AgentRuntime thread-goal management port 的 owner routing
- 识别仍留在 `bitfun-core` 中的 provider-neutral feature mapping、command-to-runtime request、UI-facing DTO 和 long-running task 相关旧路径。
- 迁移或显著简化至少一组实际 feature 主体路径,优先选择长程任务 / `/goal` 边界或 DeepReview / MiniApp 的 feature assembly 路径。
- 迁移或显著简化至少一组实际 feature 主体路径`/goal` 之后优先选择 DeepReview / MiniApp / input command 的 feature assembly 路径。

保护:

Expand Down
12 changes: 6 additions & 6 deletions scripts/core-boundaries/rules/source/forbidden-rules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ export const forbiddenContentRules = [
'SessionMessage must submit through AgentRuntime dialog lifecycle port, not direct DialogScheduler',
},
{
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_path\b/,
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_binding\b/,
message:
'SessionMessage target workspace resolution must flow through AgentRuntime session-management port, not direct coordinator access',
},
{
regex: /\bresolve_session_workspace_path\s*\(\s*&?target_session_id\b/,
regex: /\bresolve_session_workspace_binding\s*\(\s*&?target_session_id\b/,
message:
'SessionMessage target workspace resolution must use AgentSessionWorkspaceRequest, not legacy direct session id calls',
},
Expand All @@ -245,12 +245,12 @@ export const forbiddenContentRules = [
'SessionControl requester-aware cancellation must flow through AgentRuntime cancellation port, not direct DialogScheduler',
},
{
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_path\b/,
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_binding\b/,
message:
'SessionControl workspace resolution must flow through AgentRuntime session-management port, not direct coordinator access',
},
{
regex: /\bresolve_session_workspace_path\s*\(\s*session_id\b/,
regex: /\bresolve_session_workspace_binding\s*\(\s*session_id\b/,
message:
'SessionControl workspace resolution must use AgentSessionWorkspaceRequest, not legacy direct session id calls',
},
Expand Down Expand Up @@ -290,12 +290,12 @@ export const forbiddenContentRules = [
path: 'src/crates/assembly/core/src/agentic/tools/implementations/cron_tool.rs',
patterns: [
{
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_path\b/,
regex: /\bcoordinator\s*\.\s*resolve_session_workspace_binding\b/,
message:
'CronTool target workspace resolution must flow through AgentRuntime session-management port, not direct coordinator access',
},
{
regex: /\bresolve_session_workspace_path\s*\(\s*&?session_id\b/,
regex: /\bresolve_session_workspace_binding\s*\(\s*&?session_id\b/,
message:
'CronTool target workspace resolution must use AgentSessionWorkspaceRequest, not legacy direct session id calls',
},
Expand Down
14 changes: 7 additions & 7 deletions scripts/core-boundaries/rules/source/required-rules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const requiredContentRules = [
message: 'missing agent session delete entrypoint',
},
{
regex: /\bresolve_session_workspace_path\b/,
regex: /\bresolve_session_workspace_binding\b/,
message: 'missing agent session workspace resolution entrypoint',
},
{
Expand Down Expand Up @@ -1914,8 +1914,8 @@ export const requiredContentRules = [
message: 'missing port-backed cron target session list call',
},
{
regex: /\bresolve_session_workspace_path\b/,
message: 'missing port-backed cron target workspace resolution call',
regex: /\bresolve_session_workspace_binding\b/,
message: 'missing port-backed cron target workspace binding resolution call',
},
],
},
Expand Down Expand Up @@ -4746,8 +4746,8 @@ export const requiredContentRules = [
message: 'missing port-backed agent session delete call',
},
{
regex: /\bresolve_session_workspace_path\b/,
message: 'missing port-backed session workspace resolution call',
regex: /\bresolve_session_workspace_binding\b/,
message: 'missing port-backed session workspace binding resolution call',
},
{
regex: /"createdBy"/,
Expand Down Expand Up @@ -4789,8 +4789,8 @@ export const requiredContentRules = [
message: 'missing port-backed target session list call',
},
{
regex: /\bresolve_session_workspace_path\b/,
message: 'missing port-backed target session workspace resolution call',
regex: /\bresolve_session_workspace_binding\b/,
message: 'missing port-backed target session workspace binding resolution call',
},
{
regex: /"createdBy"/,
Expand Down
14 changes: 7 additions & 7 deletions scripts/core-boundaries/self-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ export function runManifestParserSelfTest({
throw new Error('SessionMessage boundary rule must forbid direct scheduler submit');
}
const sessionMessageLegacySessionAccessContracts = [
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'list_sessions',
];
for (const contract of sessionMessageLegacySessionAccessContracts) {
Expand All @@ -758,7 +758,7 @@ export function runManifestParserSelfTest({
throw new Error('SessionControl boundary rule must forbid direct scheduler cancellation');
}
const sessionControlLegacySessionAccessContracts = [
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'list_sessions',
'delete_session',
];
Expand All @@ -777,7 +777,7 @@ export function runManifestParserSelfTest({
'src/crates/assembly/core/src/agentic/tools/implementations/cron_tool.rs',
);
const cronToolLegacySessionAccessContracts = [
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'list_sessions',
];
for (const contract of cronToolLegacySessionAccessContracts) {
Expand Down Expand Up @@ -1035,7 +1035,7 @@ export function runManifestParserSelfTest({
'MissingSessionManagementPort',
'list_sessions',
'delete_session',
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'session_management_delegates_to_registered_port',
'RuntimeServices',
'RuntimeEventEnvelope',
Expand Down Expand Up @@ -1518,7 +1518,7 @@ export function runManifestParserSelfTest({
'AgentSessionListRequest',
'AgentSessionWorkspaceRequest',
'list_sessions',
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
],
},
{
Expand Down Expand Up @@ -1962,7 +1962,7 @@ export function runManifestParserSelfTest({
'AgentSessionWorkspaceRequest',
'list_sessions',
'delete_session',
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'"createdBy"',
'AgentTurnCancellationRequest',
'requester_session_id',
Expand All @@ -1976,7 +1976,7 @@ export function runManifestParserSelfTest({
'AgentSessionListRequest',
'AgentSessionWorkspaceRequest',
'list_sessions',
'resolve_session_workspace_path',
'resolve_session_workspace_binding',
'"createdBy"',
'AgentDialogTurnRequest',
'AgentDialogPrependedReminder',
Expand Down
65 changes: 65 additions & 0 deletions src/crates/assembly/core/src/agentic/coordination/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6099,6 +6099,7 @@ fn runtime_session_summary(session: SessionSummary) -> bitfun_runtime_ports::Age

fn runtime_session_workspace_binding(binding: WorkspaceBinding) -> AgentSessionWorkspaceBinding {
AgentSessionWorkspaceBinding {
workspace_id: binding.workspace_id.clone(),
workspace_path: binding.root_path_string(),
remote_connection_id: binding.connection_id().map(ToOwned::to_owned),
remote_ssh_host: if binding.is_remote() {
Expand All @@ -6109,6 +6110,27 @@ fn runtime_session_workspace_binding(binding: WorkspaceBinding) -> AgentSessionW
}
}

fn runtime_port_error_from_bitfun(error: BitFunError) -> bitfun_runtime_ports::PortError {
let (kind, message) = match error {
BitFunError::Validation(message) => {
(bitfun_runtime_ports::PortErrorKind::InvalidRequest, message)
}
BitFunError::NotFound(message) => (bitfun_runtime_ports::PortErrorKind::NotFound, message),
BitFunError::Cancelled(message) => {
(bitfun_runtime_ports::PortErrorKind::Cancelled, message)
}
BitFunError::Timeout(message) => (bitfun_runtime_ports::PortErrorKind::Timeout, message),
BitFunError::NotImplemented(message) => {
(bitfun_runtime_ports::PortErrorKind::NotAvailable, message)
}
other => (
bitfun_runtime_ports::PortErrorKind::Backend,
other.to_string(),
),
};
bitfun_runtime_ports::PortError::new(kind, message)
}

#[async_trait::async_trait]
impl bitfun_runtime_ports::AgentSessionManagementPort for ConversationCoordinator {
async fn list_sessions(
Expand Down Expand Up @@ -6184,6 +6206,49 @@ impl bitfun_runtime_ports::AgentSessionManagementPort for ConversationCoordinato
}
}

#[async_trait::async_trait]
impl bitfun_runtime_ports::AgentThreadGoalManagementPort for ConversationCoordinator {
async fn get_thread_goal(
&self,
request: bitfun_runtime_ports::AgentThreadGoalGetRequest,
) -> bitfun_runtime_ports::PortResult<Option<ThreadGoal>> {
self.get_thread_goal(
&request.session_id,
std::path::Path::new(&request.workspace_path),
)
.await
.map_err(runtime_port_error_from_bitfun)
}

async fn create_thread_goal(
&self,
request: bitfun_runtime_ports::AgentThreadGoalCreateRequest,
) -> bitfun_runtime_ports::PortResult<ThreadGoal> {
self.create_thread_goal(
&request.session_id,
std::path::Path::new(&request.workspace_path),
request.objective,
request.token_budget,
)
.await
.map_err(runtime_port_error_from_bitfun)
}

async fn update_thread_goal_status(
&self,
request: bitfun_runtime_ports::AgentThreadGoalUpdateStatusRequest,
) -> bitfun_runtime_ports::PortResult<ThreadGoal> {
self.update_thread_goal_status(
&request.session_id,
std::path::Path::new(&request.workspace_path),
request.status,
request.turn_id.as_deref(),
)
.await
.map_err(runtime_port_error_from_bitfun)
}
}

#[async_trait::async_trait]
impl bitfun_runtime_ports::AgentTurnCancellationPort for ConversationCoordinator {
async fn cancel_turn(
Expand Down
Loading
Loading