Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
66ae443
added back recipe parameter support
zanesq Jul 19, 2025
8e145d3
fix chat submitting text when unrelated button elements are clicked
zanesq Jul 19, 2025
97732f3
fix navigating away from active recipe resets recipe in progress
zanesq Jul 19, 2025
135ad72
revert button changes
zanesq Jul 20, 2025
e7f8b58
actually use select, boolean and number fields
zanesq Jul 20, 2025
7bba69d
update recipe preview to show all possible recipe values
zanesq Jul 20, 2025
17db8ee
added recipe deeplink to preview
zanesq Jul 20, 2025
4e1988c
change display to one line for deeplink
zanesq Jul 20, 2025
520f448
merge in main and add missing recipe types
zanesq Jul 21, 2025
4644484
change deeplink in recipe preview to use new server version
zanesq Jul 21, 2025
4863743
move previousTitle outside of conditional
zanesq Jul 21, 2025
4e8363c
refactor hasRecipeChanged logic to be more readable
zanesq Jul 21, 2025
353baf3
remove redundant check for previousTitle
zanesq Jul 21, 2025
66dc3a5
simplify complex validation logic
zanesq Jul 21, 2025
67ebebc
remove comment
zanesq Jul 21, 2025
91291e2
preserve existing params and add new ones
zanesq Jul 21, 2025
73017ae
change lookups to be more efficient with maps and set
zanesq Jul 21, 2025
1dbb5fd
remove comment
zanesq Jul 21, 2025
893c2a0
change initialPrompt to return the actual recipe prompt when available
zanesq Jul 21, 2025
0d603a0
Merge branch 'main' of github.com:block/goose into zane/recipe-parame…
zanesq Jul 21, 2025
1a0cd8c
Merge branch 'main' of github.com:block/goose into zane/recipe-parame…
zanesq Jul 22, 2025
8b4fd1d
refactor to shared ChatType
zanesq Jul 22, 2025
c8dc5f6
Merge branch 'zane/recipe-parameters' of github.com:block/goose into …
zanesq Jul 22, 2025
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
2 changes: 2 additions & 0 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pub async fn handle_configure() -> Result<(), Box<dyn Error>> {
display_name: Some(goose::config::DEFAULT_DISPLAY_NAME.to_string()),
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
bundled: Some(true),
description: None,
},
})?;
}
Expand Down Expand Up @@ -558,6 +559,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
display_name: Some(display_name),
timeout: Some(timeout),
bundled: Some(true),
description: None,
},
})?;

Expand Down
1 change: 1 addition & 0 deletions crates/goose-cli/src/recipes/extract_from_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub fn extract_recipe_info_from_cli(
name,
values: None,
sequential_when_repeated: true,
description: None,
};
all_sub_recipes.push(additional_sub_recipe);
}
Expand Down
1 change: 1 addition & 0 deletions crates/goose-cli/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ impl Session {
// TODO: should set a timeout
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
bundled: None,
description: None,
};
self.agent
.add_extension(config)
Expand Down
7 changes: 5 additions & 2 deletions crates/goose-server/src/bin/generate_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ fn main() {
fs::create_dir_all(parent).unwrap();
}

fs::write(&output_path, schema).unwrap();
println!(
fs::write(&output_path, &schema).unwrap();
eprintln!(
"Successfully generated OpenAPI schema at {}",
output_path.display()
);

// Output the schema to stdout for piping
println!("{}", schema);
}
1 change: 1 addition & 0 deletions crates/goose-server/src/routes/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ async fn add_extension(
display_name,
timeout,
bundled: None,
description: None,
},
ExtensionConfigRequest::Frontend {
name,
Expand Down
2 changes: 2 additions & 0 deletions crates/goose/src/agents/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ pub enum ExtensionConfig {
/// The name used to identify this extension
name: String,
display_name: Option<String>, // needed for the UI
description: Option<String>,
timeout: Option<u64>,
/// Whether this extension is bundled with Goose
#[serde(default)]
Expand Down Expand Up @@ -208,6 +209,7 @@ impl Default for ExtensionConfig {
Self::Builtin {
name: config::DEFAULT_EXTENSION.to_string(),
display_name: Some(config::DEFAULT_DISPLAY_NAME.to_string()),
description: None,
timeout: Some(config::DEFAULT_EXTENSION_TIMEOUT),
bundled: Some(true),
}
Expand Down
1 change: 1 addition & 0 deletions crates/goose/src/agents/extension_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ impl ExtensionManager {
ExtensionConfig::Builtin {
name,
display_name: _,
description: _,
timeout,
bundled: _,
} => {
Expand Down
1 change: 1 addition & 0 deletions crates/goose/src/config/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl ExtensionConfigManager {
display_name: Some(DEFAULT_DISPLAY_NAME.to_string()),
timeout: Some(DEFAULT_EXTENSION_TIMEOUT),
bundled: Some(true),
description: Some(DEFAULT_EXTENSION_DESCRIPTION.to_string()),
},
},
)]);
Expand Down
5 changes: 5 additions & 0 deletions crates/goose/src/recipe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ pub struct SubRecipe {
pub values: Option<HashMap<String, String>>,
#[serde(default)]
pub sequential_when_repeated: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
}

fn deserialize_value_map_as_string<'de, D>(
Expand Down Expand Up @@ -204,6 +206,7 @@ pub enum RecipeParameterInputType {
Boolean,
Date,
File,
Select,
}

impl fmt::Display for RecipeParameterInputType {
Expand All @@ -224,6 +227,8 @@ pub struct RecipeParameter {
pub description: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub default: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub options: Option<Vec<String>>,
}

/// Builder for creating Recipe instances
Expand Down
18 changes: 17 additions & 1 deletion ui/desktop/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,10 @@
"description": "Whether this extension is bundled with Goose",
"nullable": true
},
"description": {
"type": "string",
"nullable": true
},
"display_name": {
"type": "string",
"nullable": true
Expand Down Expand Up @@ -2297,6 +2301,13 @@
"key": {
"type": "string"
},
"options": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true
},
"requirement": {
"$ref": "#/components/schemas/RecipeParameterRequirement"
}
Expand All @@ -2309,7 +2320,8 @@
"number",
"boolean",
"date",
"file"
"file",
"select"
]
},
"RecipeParameterRequirement": {
Expand Down Expand Up @@ -2717,6 +2729,10 @@
"path"
],
"properties": {
"description": {
"type": "string",
"nullable": true
},
"name": {
"type": "string"
},
Expand Down
48 changes: 36 additions & 12 deletions ui/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import AnnouncementModal from './components/AnnouncementModal';
import { generateSessionId } from './sessions';
import ProviderGuard from './components/ProviderGuard';

import Hub, { type ChatType } from './components/hub';
import { ChatType } from './types/chat';
import Hub from './components/hub';
import Pair from './components/pair';
import SettingsView, { SettingsViewOptions } from './components/settings/SettingsView';
import SessionsView from './components/sessions/SessionsView';
Expand Down Expand Up @@ -182,6 +183,12 @@ const PairRouteWrapper = ({

// Check if we have a resumed session or recipe config from navigation state
useEffect(() => {
// Only process if we actually have navigation state
if (!location.state) {
console.log('No navigation state, preserving existing chat state');
return;
}

const resumedSession = location.state?.resumedSession as SessionDetails | undefined;
const recipeConfig = location.state?.recipeConfig as Recipe | undefined;
const resetChat = location.state?.resetChat as boolean | undefined;
Expand All @@ -205,30 +212,47 @@ const PairRouteWrapper = ({

// Clear the navigation state to prevent reloading on navigation
window.history.replaceState({}, document.title);
} else if (recipeConfig) {
console.log('Loading recipe config in pair view:', recipeConfig.title);
} else if (recipeConfig && resetChat) {
console.log('Loading new recipe config in pair view:', recipeConfig.title);

// Load recipe config and optionally reset chat
// Use the ref to get the current chat state without adding it as a dependency
const currentChat = chatRef.current;
const updatedChat: ChatType = {
...currentChat,
recipeConfig: recipeConfig,
id: chatRef.current.id, // Keep the same ID
title: recipeConfig.title || 'Recipe Chat',
messages: [], // Clear messages to start fresh
messageHistoryIndex: 0,
recipeConfig: recipeConfig,
recipeParameters: null, // Clear parameters for new recipe
};

if (resetChat) {
updatedChat.messages = [];
updatedChat.messageHistoryIndex = 0;
}
// Update both the local chat state and the app-level pairChat state
setChat(updatedChat);
setPairChat(updatedChat);

// Clear the navigation state to prevent reloading on navigation
window.history.replaceState({}, document.title);
} else if (recipeConfig && !chatRef.current.recipeConfig) {
// Only set recipe config if we don't already have one (e.g., from deeplinks)

const updatedChat: ChatType = {
...chatRef.current,
recipeConfig: recipeConfig,
title: recipeConfig.title || chatRef.current.title,
};

// Update both the local chat state and the app-level pairChat state
setChat(updatedChat);
setPairChat(updatedChat);

// Clear the navigation state to prevent reloading on navigation
window.history.replaceState({}, document.title);
} else if (location.state) {
// We have navigation state but it doesn't match our conditions
// Clear it to prevent future processing, but don't modify chat state
console.log('Clearing unprocessed navigation state');
window.history.replaceState({}, document.title);
}
// If we have a recipe config but resetChat is false and we already have a recipe,
// do nothing - just continue with the existing chat state
}, [location.state, setChat, setPairChat]);

return (
Expand Down
5 changes: 4 additions & 1 deletion ui/desktop/src/api/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export type ExtensionConfig = {
* Whether this extension is bundled with Goose
*/
bundled?: boolean | null;
description?: string | null;
display_name?: string | null;
/**
* The name used to identify this extension
Expand Down Expand Up @@ -451,10 +452,11 @@ export type RecipeParameter = {
description: string;
input_type: RecipeParameterInputType;
key: string;
options?: Array<string> | null;
requirement: RecipeParameterRequirement;
};

export type RecipeParameterInputType = 'string' | 'number' | 'boolean' | 'date' | 'file';
export type RecipeParameterInputType = 'string' | 'number' | 'boolean' | 'date' | 'file' | 'select';

export type RecipeParameterRequirement = 'required' | 'optional' | 'user_prompt';

Expand Down Expand Up @@ -622,6 +624,7 @@ export type Settings = {
};

export type SubRecipe = {
description?: string | null;
name: string;
path: string;
sequential_when_repeated?: boolean;
Expand Down
58 changes: 20 additions & 38 deletions ui/desktop/src/components/BaseChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,12 @@ import { useSessionContinuation } from '../hooks/useSessionContinuation';
import { useFileDrop } from '../hooks/useFileDrop';
import { useCostTracking } from '../hooks/useCostTracking';
import { Message } from '../types/message';
import { Recipe } from '../recipe';

// Context for sharing current model info
const CurrentModelContext = createContext<{ model: string; mode: string } | null>(null);
export const useCurrentModelInfo = () => useContext(CurrentModelContext);

export interface ChatType {
id: string;
title: string;
messageHistoryIndex: number;
messages: Message[];
recipeConfig?: Recipe | null; // Add recipe configuration to chat state
}
import { ChatType } from '../types/chat';

interface BaseChatProps {
chat: ChatType;
Expand Down Expand Up @@ -204,17 +197,29 @@ function BaseChatContent({

// Reset recipe usage tracking when recipe changes
useEffect(() => {
if (recipeConfig?.title !== currentRecipeTitle) {
setCurrentRecipeTitle(recipeConfig?.title || null);
setHasStartedUsingRecipe(false);
const previousTitle = currentRecipeTitle;
const newTitle = recipeConfig?.title || null;
const hasRecipeChanged = newTitle !== currentRecipeTitle;

if (hasRecipeChanged) {
setCurrentRecipeTitle(newTitle);

const isSwitchingBetweenRecipes = previousTitle && newTitle;
const isInitialRecipeLoad = !previousTitle && newTitle && messages.length === 0;
const hasExistingConversation = newTitle && messages.length > 0;

// Clear existing messages when a new recipe is loaded
if (recipeConfig?.title && recipeConfig.title !== currentRecipeTitle) {
if (isSwitchingBetweenRecipes) {
console.log('Switching from recipe:', previousTitle, 'to:', newTitle);
setHasStartedUsingRecipe(false);
setMessages([]);
setAncestorMessages([]);
} else if (isInitialRecipeLoad) {
setHasStartedUsingRecipe(false);
} else if (hasExistingConversation) {
setHasStartedUsingRecipe(true);
}
}
}, [recipeConfig?.title, currentRecipeTitle, setMessages, setAncestorMessages]);
}, [recipeConfig?.title, currentRecipeTitle, messages.length, setMessages, setAncestorMessages]);

// Handle recipe auto-execution
useEffect(() => {
Expand Down Expand Up @@ -427,29 +432,6 @@ function BaseChatContent({
{error.message || 'Honk! Goose experienced an error while responding'}
</div>

{/* Expandable Error Details */}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this expandable error details area as it wasn't providing any other useful context than what is displayed on the screen.

<details className="w-full max-w-2xl mb-2">
<summary className="text-xs text-textSubtle cursor-pointer hover:text-textStandard transition-colors">
Error details
</summary>
<div className="mt-2 p-3 bg-bgSubtle border border-borderSubtle rounded-lg text-xs font-mono text-textStandard">
<div className="mb-2">
<strong>Error Type:</strong> {error.name || 'Unknown'}
</div>
<div className="mb-2">
<strong>Message:</strong> {error.message || 'No message'}
</div>
{error.stack && (
<div>
<strong>Stack Trace:</strong>
<pre className="mt-1 whitespace-pre-wrap text-xs overflow-x-auto">
{error.stack}
</pre>
</div>
)}
</div>
</details>

{/* Regular retry button for non-token-limit errors */}
<div
className="px-3 py-2 mt-2 text-center whitespace-nowrap cursor-pointer text-textStandard border border-borderSubtle hover:bg-bgSubtle rounded-full inline-block transition-all duration-150"
Expand Down Expand Up @@ -501,7 +483,7 @@ function BaseChatContent({
isLoading={isLoading}
onStop={onStopGoose}
commandHistory={commandHistory}
initialValue={_input || initialPrompt}
initialValue={_input || (messages.length === 0 ? initialPrompt : '')}
setView={setView}
numTokens={sessionTokenCount}
inputTokens={sessionInputTokens || localInputTokens}
Expand Down
Loading
Loading