Skip to content
7 changes: 7 additions & 0 deletions crates/goose/acp-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,12 @@
"method": "_goose/unstable/session/update",
"paramsType": "GooseSessionNotification_unstable"
}
],
"agentRequests": [
{
"method": "_goose/unstable/session/recipe/request-params",
"requestType": "RequestRecipeParams_unstable",
"responseType": "RecipeParamsResponse_unstable"
}
]
}
233 changes: 233 additions & 0 deletions crates/goose/acp-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3691,6 +3691,116 @@
],
"description": "Live UI/session status. This is not conversation transcript content, and\nshould not be persisted or replayed as history."
},
"RequestRecipeParams_unstable": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/$defs/RecipeParameter"
}
}
},
"required": [
"sessionId",
"parameters"
],
"x-side": "client",
"x-method": "_goose/unstable/session/recipe/request-params"
},
"RecipeParameter": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"input_type": {
"$ref": "#/$defs/RecipeParameterInputType"
},
"requirement": {
"$ref": "#/$defs/RecipeParameterRequirement"
},
"description": {
"type": "string"
},
"default": {
"type": [
"string",
"null"
]
},
"options": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
}
},
"required": [
"key",
"input_type",
"requirement",
"description"
]
},
"RecipeParameterInputType": {
"oneOf": [
{
"type": "string",
"enum": [
"string",
"number",
"boolean",
"date",
"select"
]
},
{
"type": "string",
"const": "file",
"description": "File parameter that imports content from a file path.\nCannot have default values to prevent importing sensitive user files."
}
]
},
"RecipeParameterRequirement": {
"type": "string",
"enum": [
"required",
"optional",
"user_prompt"
]
},
"RecipeParamsResponse_unstable": {
"type": "object",
"properties": {
"action": {
"$ref": "#/$defs/RecipeParamsAction",
"default": "submit"
},
"values": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"default": {}
}
},
"x-side": "client",
"x-method": "_goose/unstable/session/recipe/request-params"
},
"RecipeParamsAction": {
"type": "string",
"enum": [
"submit",
"cancel"
]
},
"ExtRequest": {
"properties": {
"id": {
Expand Down Expand Up @@ -4659,6 +4769,111 @@
],
"type": "object",
"x-docs-ignore": true
},
"ExtAgentRequest": {
"properties": {
"id": {
"type": "string"
},
"method": {
"type": "string"
},
"params": {
"anyOf": [
{
"anyOf": [
{
"allOf": [
{
"$ref": "#/$defs/RequestRecipeParams_unstable"
}
],
"description": "Params for _goose/unstable/session/recipe/request-params",
"title": "RequestRecipeParams_unstable"
}
]
},
{
"description": "Untyped params",
"type": [
"object",
"null"
]
}
]
}
},
"required": [
"id",
"method"
],
"type": "object",
"x-docs-ignore": true
},
"ExtAgentResponse": {
"anyOf": [
{
"properties": {
"id": {
"type": "string"
},
"result": {
"anyOf": [
{
"anyOf": [
{
"allOf": [
{
"$ref": "#/$defs/RecipeParamsResponse_unstable"
}
],
"title": "RecipeParamsResponse_unstable"
}
]
},
{
"description": "Untyped result"
}
]
}
},
"required": [
"id"
],
"title": "Success",
"type": "object"
},
{
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"message": {
"type": "string"
},
"data": {}
},
"required": [
"code",
"message"
]
},
"id": {
"type": "string"
}
},
"required": [
"id",
"error"
],
"title": "Error",
"type": "object"
}
],
"x-docs-ignore": true
}
},
"anyOf": [
Expand Down Expand Up @@ -4688,6 +4903,24 @@
],
"description": "Extension notification (agent → client, fire-and-forget)",
"title": "Notification"
},
{
"allOf": [
{
"$ref": "#/$defs/ExtAgentRequest"
}
],
"description": "Extension agent request (agent → client)",
"title": "AgentRequest"
},
{
"allOf": [
{
"$ref": "#/$defs/ExtAgentResponse"
}
],
"description": "Extension agent response (client → agent)",
"title": "AgentResponse"
}
]
}
26 changes: 26 additions & 0 deletions crates/goose/src/acp/response_builder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::agents::ExtensionLoadResult;
use crate::config::{Config, GooseMode};
use crate::providers::inventory::{ProviderInventoryEntry, ProviderInventoryService};
use crate::session::Session;
Expand Down Expand Up @@ -77,6 +78,31 @@ pub(super) fn session_meta(session: &Session) -> serde_json::Map<String, serde_j
meta
}

pub(super) fn session_response_meta(
session: &Session,
extension_results: &[ExtensionLoadResult],
) -> serde_json::Map<String, serde_json::Value> {
let mut meta = serde_json::Map::new();
if let Some(recipe) = &session.recipe {
if let Ok(v) = serde_json::to_value(recipe) {
meta.insert("recipe".to_string(), v);
}
}
if let Some(values) = &session.user_recipe_values {
if let Ok(v) = serde_json::to_value(values) {
meta.insert("userRecipeValues".to_string(), v);
}
}
if let Ok(v) = serde_json::to_value(extension_results) {
meta.insert("extensionResults".to_string(), v);
}
meta.insert(
"workingDir".to_string(),
serde_json::Value::String(session.working_dir.to_string_lossy().to_string()),
);
meta
}

pub(super) fn build_session_info(session: Session) -> SessionInfo {
let meta = session_meta(&session);
let mut info = SessionInfo::new(SessionId::new(session.id), session.working_dir)
Expand Down
Loading
Loading