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: 2 additions & 2 deletions crates/goose-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use goose_bench::runners::metric_aggregator::MetricAggregator;
use goose_bench::runners::model_runner::ModelRunner;
use std::io::Read;
use std::path::PathBuf;
use tracing::warn;

#[derive(Parser)]
#[command(author, version, display_name = "", about, long_about = None)]
Expand Down Expand Up @@ -820,9 +821,8 @@ pub struct RecipeInfo {
pub async fn cli() -> Result<()> {
let cli = Cli::parse();

// Track the current directory in projects.json
if let Err(e) = crate::project_tracker::update_project_tracker(None, None) {
eprintln!("Warning: Failed to update project tracker: {}", e);
warn!("Warning: Failed to update project tracker: {}", e);
}

let command_name = match &cli.command {
Expand Down
2 changes: 2 additions & 0 deletions crates/goose-server/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use goose::conversation::message::{
ToolRequest, ToolResponse,
};

use crate::routes::reply::MessageEvent;
use utoipa::openapi::schema::{
AdditionalProperties, AnyOfBuilder, ArrayBuilder, ObjectBuilder, OneOfBuilder, Schema,
SchemaFormat, SchemaType,
Expand Down Expand Up @@ -420,6 +421,7 @@ derive_utoipa!(Icon as IconSchema);
ResourceContentsSchema,
SystemNotificationType,
SystemNotificationContent,
MessageEvent,
JsonObjectSchema,
RoleSchema,
ProviderMetadata,
Expand Down
5 changes: 4 additions & 1 deletion crates/goose-server/src/routes/reply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ pub enum MessageEvent {
},
Notification {
request_id: String,
#[schema(value_type = Object)]
message: ServerNotification,
},
UpdateConversation {
Expand Down Expand Up @@ -170,7 +171,9 @@ async fn stream_event(
path = "/reply",
request_body = ChatRequest,
responses(
(status = 200, description = "Streaming response initiated", content_type = "text/event-stream"),
(status = 200, description = "Streaming response initiated",
body = MessageEvent,
content_type = "text/event-stream"),
(status = 424, description = "Agent not initialized"),
(status = 500, description = "Internal server error")
)
Expand Down
146 changes: 145 additions & 1 deletion ui/desktop/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,14 @@
},
"responses": {
"200": {
"description": "Streaming response initiated"
"description": "Streaming response initiated",
"content": {
"text/event-stream": {
"schema": {
"$ref": "#/components/schemas/MessageEvent"
}
}
}
},
"424": {
"description": "Agent not initialized"
Expand Down Expand Up @@ -3172,6 +3179,143 @@
"propertyName": "type"
}
},
"MessageEvent": {
"oneOf": [
{
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"$ref": "#/components/schemas/Message"
},
"type": {
"type": "string",
"enum": [
"Message"
]
}
}
},
{
"type": "object",
"required": [
"error",
"type"
],
"properties": {
"error": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Error"
]
}
}
},
{
"type": "object",
"required": [
"reason",
"type"
],
"properties": {
"reason": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Finish"
]
}
}
},
{
"type": "object",
"required": [
"model",
"mode",
"type"
],
"properties": {
"mode": {
"type": "string"
},
"model": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"ModelChange"
]
}
}
},
{
"type": "object",
"required": [
"request_id",
"message",
"type"
],
"properties": {
"message": {
"type": "object"
},
"request_id": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"Notification"
]
}
}
},
{
"type": "object",
"required": [
"conversation",
"type"
],
"properties": {
"conversation": {
"$ref": "#/components/schemas/Conversation"
},
"type": {
"type": "string",
"enum": [
"UpdateConversation"
]
}
}
},
{
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Ping"
]
}
}
}
],
"discriminator": {
"propertyName": "type"
}
},
"MessageMetadata": {
"type": "object",
"description": "Metadata for message visibility",
Expand Down
2 changes: 1 addition & 1 deletion ui/desktop/src/api/sdk.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export const scanRecipe = <ThrowOnError extends boolean = false>(options: Option
};

export const reply = <ThrowOnError extends boolean = false>(options: Options<ReplyData, ThrowOnError>) => {
return (options.client ?? client).post<ReplyResponses, ReplyErrors, ThrowOnError>({
return (options.client ?? client).sse.post<ReplyResponses, ReplyErrors, ThrowOnError>({
url: '/reply',
...options,
headers: {
Expand Down
30 changes: 29 additions & 1 deletion ui/desktop/src/api/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,32 @@ export type MessageContent = (TextContent & {
type: 'systemNotification';
});

export type MessageEvent = {
message: Message;
type: 'Message';
} | {
error: string;
type: 'Error';
} | {
reason: string;
type: 'Finish';
} | {
mode: string;
model: string;
type: 'ModelChange';
} | {
message: {
[key: string]: unknown;
};
request_id: string;
type: 'Notification';
} | {
conversation: Conversation;
type: 'UpdateConversation';
} | {
type: 'Ping';
};

/**
* Metadata for message visibility
*/
Expand Down Expand Up @@ -1825,9 +1851,11 @@ export type ReplyResponses = {
/**
* Streaming response initiated
*/
200: unknown;
200: MessageEvent;
};

export type ReplyResponse = ReplyResponses[keyof ReplyResponses];

export type CreateScheduleData = {
body: CreateScheduleRequest;
path?: never;
Expand Down
Loading
Loading