mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix recipe instructions from session metadata not being injected
This commit is contained in:
@@ -147,10 +147,17 @@ export function useAgent(): UseAgentReturn {
|
||||
}
|
||||
|
||||
agentWaitingMessage('Extensions are loading');
|
||||
|
||||
const sessionMetadata = agentSessionInfo.metadata;
|
||||
|
||||
// Pass the recipe config to initializeSystem so it can inject instructions
|
||||
const recipeConfigForInit =
|
||||
initContext.recipeConfig || sessionMetadata.recipe || undefined;
|
||||
await initializeSystem(agentSessionInfo.session_id, provider as string, model as string, {
|
||||
getExtensions,
|
||||
addExtension,
|
||||
setIsExtensionsLoading: initContext.setIsExtensionsLoading,
|
||||
recipeConfig: recipeConfigForInit,
|
||||
});
|
||||
|
||||
if (COST_TRACKING_ENABLED) {
|
||||
@@ -160,8 +167,6 @@ export function useAgent(): UseAgentReturn {
|
||||
console.error('Failed to initialize cost database:', error);
|
||||
}
|
||||
}
|
||||
|
||||
const sessionMetadata = agentSessionInfo.metadata;
|
||||
// Use the recipe config from initContext if available, otherwise fall back to session metadata
|
||||
const recipeConfig = initContext.recipeConfig || sessionMetadata.recipe;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { ExtensionConfig, FixedExtensionEntry } from '../components/ConfigC
|
||||
import { addSubRecipesToAgent } from '../recipe/add_sub_recipe_on_agent';
|
||||
import {
|
||||
extendPrompt,
|
||||
Recipe,
|
||||
RecipeParameter,
|
||||
SubRecipe,
|
||||
updateAgentProvider,
|
||||
@@ -204,6 +205,7 @@ export const initializeSystem = async (
|
||||
getExtensions?: (b: boolean) => Promise<FixedExtensionEntry[]>;
|
||||
addExtension?: (name: string, config: ExtensionConfig, enabled: boolean) => Promise<void>;
|
||||
setIsExtensionsLoading?: (loading: boolean) => void;
|
||||
recipeConfig?: Recipe; // Recipe config from agent session metadata
|
||||
}
|
||||
) => {
|
||||
try {
|
||||
@@ -228,8 +230,8 @@ export const initializeSystem = async (
|
||||
console.log('This will not end well');
|
||||
}
|
||||
|
||||
// Get recipeConfig directly here
|
||||
const recipeConfig = window.appConfig?.get?.('recipe');
|
||||
// Get recipeConfig from options (passed from agent session) or fallback to window.appConfig
|
||||
const recipeConfig = options?.recipeConfig || window.appConfig?.get?.('recipe');
|
||||
const recipe_instructions = (recipeConfig as { instructions?: string })?.instructions;
|
||||
const responseConfig = (recipeConfig as { response?: { json_schema?: unknown } })?.response;
|
||||
const subRecipes = (recipeConfig as { sub_recipes?: SubRecipe[] })?.sub_recipes;
|
||||
@@ -237,7 +239,7 @@ export const initializeSystem = async (
|
||||
const hasParameters = parameters && parameters?.length > 0;
|
||||
const hasSubRecipes = subRecipes && subRecipes?.length > 0;
|
||||
let prompt = desktopPrompt;
|
||||
if (!hasParameters && recipe_instructions) {
|
||||
if (recipe_instructions) {
|
||||
prompt = `${desktopPromptBot}\nIMPORTANT instructions for you to operate as agent:\n${recipe_instructions}`;
|
||||
}
|
||||
// Extend the system prompt with desktop-specific information
|
||||
|
||||
Reference in New Issue
Block a user