Build summon instructions per turn (#9329)

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2026-05-24 20:55:58 -04:00
committed by GitHub
parent c4d64d1a83
commit e1cc44f7ec
@@ -428,11 +428,8 @@ impl Drop for SummonClient {
impl SummonClient { impl SummonClient {
pub fn new(context: PlatformExtensionContext) -> Result<Self> { pub fn new(context: PlatformExtensionContext) -> Result<Self> {
let instructions = build_subagent_instructions(context.session.as_deref());
let info = InitializeResult::new(ServerCapabilities::builder().enable_tools().build()) let info = InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
.with_server_info(Implementation::new(EXTENSION_NAME, "1.0.0").with_title("Summon")) .with_server_info(Implementation::new(EXTENSION_NAME, "1.0.0").with_title("Summon"));
.with_instructions(instructions);
Ok(Self { Ok(Self {
info, info,
@@ -1744,6 +1741,15 @@ impl McpClientTrait for SummonClient {
Some(&self.info) Some(&self.info)
} }
fn get_instructions(&self) -> Option<String> {
let instructions = build_subagent_instructions(self.context.session.as_deref());
if instructions.is_empty() {
None
} else {
Some(instructions)
}
}
async fn subscribe(&self) -> mpsc::Receiver<ServerNotification> { async fn subscribe(&self) -> mpsc::Receiver<ServerNotification> {
let (tx, rx) = mpsc::channel(16); let (tx, rx) = mpsc::channel(16);
self.notification_subscribers.lock().await.push(tx); self.notification_subscribers.lock().await.push(tx);