-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Feat: Support Recipe Parameters in Goose desktop app #3155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Support Recipe Parameters in Goose desktop app #3155
Conversation
| // Escape special characters in the key (parameter) and match optional whitespace | ||
| const regex = new RegExp(`{{\\s*${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*}}`, 'g'); | ||
| const beforeSubstitution = substitutedPrompt; | ||
| substitutedPrompt = substitutedPrompt.replace(regex, params[key]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Treat the parameter as literal text, to avoid regex injection and unintended matching.
For example, without santization
// matches {{user_name}}, {{user-name}}, etc
substitutedPrompt.replace(new RegExp('{{user.name}}'), value) with sanitization
// matches exactly {{user.name}}
substitutedPrompt.replace(new RegExp('{{user\.name}}'), value)…rompt' and remove unused options in ParameterInput refactor: simplify onClose handler in ParameterInputModal and clean up styling comments
…ges and avoid duplicates
* main: return missign npx/uvx (block#3148) docs: add more instructions about resuming a session for cli users (block#3146)
|
|
||
| // Log each substitution for debugging | ||
| if (beforeSubstitution !== substitutedPrompt) { | ||
| console.log(`Replaced {{${key}}} with "${params[key]}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm logging.
| } | ||
| } | ||
|
|
||
| console.log('Final substituted prompt:', substitutedPrompt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""
|
|
||
| // Log each substitution for debugging | ||
| if (beforeSubstitution !== substitutedText) { | ||
| console.log(`Replaced {{${key}}} with "${params[key]}" in instructions`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more logging.
katzdave
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took another look + tested some more with recipes with various types of params. I think looks good.
|
|
||
| // Create and send the user message | ||
| const userMessage = createUserMessage(recipeConfig.prompt); | ||
| console.log('Auto-sending substituted prompt for scheduled execution:', finalPrompt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove?
| console.log('Final config extensions:', config.extensions); | ||
|
|
||
| const yamlString = serializeParametersToYAML(parameters); | ||
| console.log('Serialized Parameters to YAML:', yamlString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove?
| const originalInstructions = (recipeConfig as { instructions?: string })?.instructions; | ||
|
|
||
| if (!originalInstructions) { | ||
| console.log('No instructions to substitute parameters in'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove?
|
|
||
| if (!response.ok) { | ||
| console.warn(`Failed to update system prompt with parameters: ${response.statusText}`); | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove the else clause?
.github/workflows/build-cli.yml
Outdated
| # Move the built binary to the expected location (inside container) | ||
| mkdir -p ../target/x86_64-pc-windows-gnu/release | ||
| mv temporal-service.exe ../target/x86_64-pc-windows-gnu/release/temporal-service.exe | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah, sorry – I have automatic linting on, and it linted all the changed files from the merge. Let me know if I should revert the whitespace issues.
* main: (37 commits) fix: fix desktop recipe url generation (block#3209) feat: improve UX for saving recipes (block#3214) fix: Pass Google AI API key in HTTP header, not query param (block#3192) docs: add linter to CONTRIBUTING.md (block#3168) feat: Structured output for recipes (block#3188) Fix cost tracking accuracy and OpenRouter model pricing (block#3189) docs: update cli install instructions for windows (block#3205) Docs: Cost tracking on the desktop app (block#3204) feat: Adding streamable-http transport support for backend, desktop and cli (block#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (block#3193) Temporarily Remove GH Copilot Provider (block#3199) docs: fix tab navigation (block#3201) feat: use tiktoken-rs instead of tokenizers, single global tokenizer (block#3115) add playwright-mcp server to extensions list (block#3010) Add `/extension` path for extension installation (block#3011) feat(desktop): Prioritize suffix when truncating path in header (block#3110) chore(release): release version 1.0.31 (block#3185) feat: additional sub recipes via command line (block#3163) Add Internal Recipes To Recipes Cookbook (block#3179) pipe the argument to storage (block#3184) ...
|
I'm going to need to force push to reset the branch back to a healthy state. I'll re-request reviews |
6ad0a3a to
e314a58
Compare
* main: Defend against invalid sessions (block#3229) Clean up session file optionality for --no-session (block#3230) Feat: Support Recipe Parameters in Goose desktop app (block#3155) docs: update recipe example (block#3222) Add native OAuth 2.0 authentication support to MCP client (block#3213) build: Check in Cargo.lock changes (block#3220) fix: fix desktop recipe url generation (block#3209) feat: improve UX for saving recipes (block#3214)
* main: (150 commits) Defend against invalid sessions (block#3229) Clean up session file optionality for --no-session (block#3230) Feat: Support Recipe Parameters in Goose desktop app (block#3155) docs: update recipe example (block#3222) Add native OAuth 2.0 authentication support to MCP client (block#3213) build: Check in Cargo.lock changes (block#3220) fix: fix desktop recipe url generation (block#3209) feat: improve UX for saving recipes (block#3214) fix: Pass Google AI API key in HTTP header, not query param (block#3192) docs: add linter to CONTRIBUTING.md (block#3168) feat: Structured output for recipes (block#3188) Fix cost tracking accuracy and OpenRouter model pricing (block#3189) docs: update cli install instructions for windows (block#3205) Docs: Cost tracking on the desktop app (block#3204) feat: Adding streamable-http transport support for backend, desktop and cli (block#2942) fix: use the correct `contains` syntax on create-recipe-pr.yml (block#3193) Temporarily Remove GH Copilot Provider (block#3199) docs: fix tab navigation (block#3201) feat: use tiktoken-rs instead of tokenizers, single global tokenizer (block#3115) add playwright-mcp server to extensions list (block#3010) ...
…x-turns * origin/main: Defend against invalid sessions (#3229) Clean up session file optionality for --no-session (#3230) Feat: Support Recipe Parameters in Goose desktop app (#3155) docs: update recipe example (#3222) Add native OAuth 2.0 authentication support to MCP client (#3213) build: Check in Cargo.lock changes (#3220) fix: fix desktop recipe url generation (#3209) feat: improve UX for saving recipes (#3214) fix: Pass Google AI API key in HTTP header, not query param (#3192) docs: add linter to CONTRIBUTING.md (#3168)
Signed-off-by: Adam Tarantino <[email protected]>
Signed-off-by: Soroosh <[email protected]>
Signed-off-by: Kyle Santiago <[email protected]>
This pull request introduces enhancements to support recipe parameters in the desktop UI, including parameter substitution, validation, and serialization. The changes span multiple files, adding functionality for parameter handling in recipes, improving user interaction, and enabling serialization of parameters to YAML format.
✨ What's New
Recipe Parameters - Transform your recipes into flexible, reusable templates with dynamic parameter substitution! 🎯
This PR introduces a powerful new parameter system that allows recipes to accept user input at runtime, making them adaptable to different projects, environments, and use cases.
🚀 Key Features
🔧 Parameter Definition
{{parameter_name}}placeholders in instructions and prompts🎨 Interactive Parameter Collection
⚡ Dynamic Substitution
🎁 User Experience Enhancements
🔧 Technical Implementation
Core Components
Parameter Flow
🎨 UI/UX Features
🔧 Development Notes
Force Push Required: Local git hooks were automatically running linting and including formatting changes in merge commits. A force push was necessary to maintain clean commit history and separate linting changes from feature implementation.
✅ Testing
📁 Files Changed
ui/desktop/src/types/recipe/index.ts- Parameter interface definitionsui/desktop/src/components/ParameterInputModal.tsx- Parameter collection UIui/desktop/src/components/RecipeEditor.tsx- Recipe parameter integrationui/desktop/src/main.ts- Parameter substitution and chat window creationui/desktop/src/utils/parameterSubstitution.ts- Template processing engineResult: Recipes are now powerful, reusable templates that adapt to any context. Users can create once and reuse everywhere with personalized parameter values! 🎉