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
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ members = [
"crates/aionui-conversation",
"crates/aionui-extension",
"crates/aionui-channel",
"crates/aionui-team-prompts",
"crates/aionui-team",
"crates/aionui-cron",
"crates/aionui-assistant",
Expand Down Expand Up @@ -46,6 +47,7 @@ aionui-mcp = { path = "crates/aionui-mcp" }
aionui-conversation = { path = "crates/aionui-conversation" }
aionui-extension = { path = "crates/aionui-extension" }
aionui-channel = { path = "crates/aionui-channel" }
aionui-team-prompts = { path = "crates/aionui-team-prompts" }
aionui-team = { path = "crates/aionui-team" }
aionui-cron = { path = "crates/aionui-cron" }
aionui-assistant = { path = "crates/aionui-assistant" }
Expand Down
1 change: 1 addition & 0 deletions crates/aionui-ai-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ aionui-realtime.workspace = true
aionui-runtime.workspace = true
aionui-extension.workspace = true
aionui-api-types.workspace = true
aionui-team-prompts.workspace = true
aionui-system.workspace = true
axum.workspace = true
base64.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/aionui-ai-agent/src/capability/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ pub(crate) mod cli_process;
pub(crate) mod first_message_injector;
pub mod prompt_pipeline;
pub(crate) mod skill_manager;
pub(crate) mod team_guide_prompt;

pub use prompt_pipeline::{PostRecvHook, PreSendHook, PromptCtx, PromptPipeline};
184 changes: 0 additions & 184 deletions crates/aionui-ai-agent/src/capability/team_guide_prompt.rs

This file was deleted.

83 changes: 81 additions & 2 deletions crates/aionui-ai-agent/src/factory/acp_assembler.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::capability::team_guide_prompt;
use crate::shared_kernel::PersistedSessionState;
use agent_client_protocol::schema::{EnvVariable, McpServer, McpServerStdio, NewSessionRequest};
use aionui_api_types::AgentMetadata;
use aionui_api_types::{AcpBuildExtra, GuideMcpConfig, TEAM_MCP_SERVER_NAME, TeamMcpStdioConfig};
use aionui_common::CommandSpec;
use aionui_team_prompts::guide as team_guide_prompt;
use std::path::PathBuf;

use aionui_common::constants::TEAM_CAPABLE_BACKENDS;
Expand Down Expand Up @@ -194,7 +194,14 @@ mod tests {
fn compose_preset_context_team_capable_backend_appends_guide() {
let result = compose_preset_context(None, Some("claude"), false);
assert!(result.is_some());
assert!(result.unwrap().contains("team"));
let prompt = result.unwrap();
assert!(prompt.contains("aion_create_team"));
assert!(prompt.contains("aion_list_models"));
assert!(prompt.contains("hand off to the created Team conversation"));
assert!(!prompt.contains("Immediately"));
assert!(!prompt.contains(
"use team tools (`team_spawn_agent`, `team_send_message`, `team_members`, `team_task_create`, etc.) to manage your team"
));
}

#[test]
Expand All @@ -207,6 +214,78 @@ mod tests {
McpServer::Stdio(McpServerStdio::new(name, "/bin/sh"))
}

fn team_cfg() -> TeamMcpStdioConfig {
TeamMcpStdioConfig {
team_id: "team-1".into(),
port: 9999,
token: "tok".into(),
slot_id: "slot-lead".into(),
binary_path: "/bin/backend".into(),
}
}

fn test_metadata() -> AgentMetadata {
AgentMetadata {
id: "agent-1".into(),
icon: None,
name: "Test ACP".into(),
name_i18n: None,
description: None,
description_i18n: None,
backend: Some("claude".into()),
agent_type: aionui_common::AgentType::Acp,
agent_source: aionui_api_types::AgentSource::Builtin,
agent_source_info: aionui_api_types::AgentSourceInfo::default(),
enabled: true,
available: true,
command: Some("claude".into()),
resolved_command: None,
args: vec![],
env: vec![],
native_skills_dirs: None,
behavior_policy: aionui_api_types::BehaviorPolicy::default(),
yolo_id: None,
sort_order: 0,
team_capable: true,
handshake: aionui_api_types::AgentHandshake::default(),
}
}

#[tokio::test]
async fn assemble_acp_params_uses_frozen_preset_context_and_snapshot_seeds() {
let config = AcpBuildExtra {
backend: Some("claude".into()),
preset_context: Some("frozen rules".into()),
skills: vec!["pdf".into()],
mcp_server_ids: Some(vec!["mcp-docs".into()]),
team_mcp_stdio_config: Some(team_cfg()),
..Default::default()
};

let params = assemble_acp_params(
"conv-1".into(),
WorkspaceInfo {
path: "/tmp/workspace".into(),
is_custom: false,
},
test_metadata(),
CommandSpec::default(),
config,
vec![user_stdio("mcp-docs")],
None,
PathBuf::from("/tmp/data"),
)
.await;

assert_eq!(params.preset_context.as_deref(), Some("frozen rules"));
assert_eq!(params.config.skills, vec!["pdf"]);
assert_eq!(
params.config.mcp_server_ids.as_deref(),
Some(&["mcp-docs".to_owned()][..])
);
assert_eq!(params.mcp_servers.len(), 2);
}

#[test]
fn resolve_mcp_servers_prefers_team_over_guide() {
let config = AcpBuildExtra {
Expand Down
Loading
Loading