mirror of
https://github.com/aaif-goose/goose.git
synced 2026-06-02 06:14:27 +02:00
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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user