Skip to content

Commit 56bb198

Browse files
committed
fix(desktop): remove workflow trust warning
1 parent 810144e commit 56bb198

10 files changed

Lines changed: 2 additions & 432 deletions

File tree

ui/desktop/src/components/BaseChat.tsx

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import { cn } from '../utils';
1818
import { useChatStream } from '../hooks/useChatStream';
1919
import { useNavigation } from '../hooks/useNavigation';
2020
import { RecipeHeader } from './RecipeHeader';
21-
import { RecipeWarningModal } from './ui/RecipeWarningModal';
22-
import { scanRecipe } from '../recipe';
2321
import { UserInput } from '../types/message';
2422
import RecipeActivities from './recipes/RecipeActivities';
2523
import { useToolCount } from './alerts/useToolCount';
@@ -86,8 +84,6 @@ export default function BaseChat({
8684
const chatInputRef = useRef<HTMLTextAreaElement>(null);
8785
const disableAnimation = location.state?.disableAnimation || false;
8886
const [hasStartedUsingRecipe, setHasStartedUsingRecipe] = React.useState(false);
89-
const [hasNotAcceptedRecipe, setHasNotAcceptedRecipe] = useState<boolean>();
90-
const [hasRecipeSecurityWarnings, setHasRecipeSecurityWarnings] = useState(false);
9187
const isMobile = useIsMobile();
9288
const navContext = useNavigationContextSafe();
9389
const setView = useNavigation();
@@ -128,15 +124,13 @@ export default function BaseChat({
128124
return initialMessage;
129125
}, [initialMessage, recipe?.prompt, session?.user_recipe_values]);
130126

131-
const canAutoSubmit = !recipe || hasNotAcceptedRecipe === false;
132-
133127
useAutoSubmit({
134128
sessionId,
135129
session,
136130
messages,
137131
chatState,
138132
initialMessage: resolvedInitialMessage,
139-
canAutoSubmit,
133+
canAutoSubmit: true,
140134
handleSubmit,
141135
});
142136

@@ -204,29 +198,6 @@ export default function BaseChat({
204198
return null;
205199
}, [messages]);
206200

207-
useEffect(() => {
208-
if (!recipe || !isActiveSession) return;
209-
210-
(async () => {
211-
const accepted = await window.electron.hasAcceptedRecipeBefore(recipe);
212-
setHasNotAcceptedRecipe(!accepted);
213-
214-
if (!accepted) {
215-
const scanResult = await scanRecipe(recipe);
216-
setHasRecipeSecurityWarnings(scanResult.has_security_warnings);
217-
}
218-
})();
219-
}, [recipe, isActiveSession]);
220-
221-
const handleRecipeAccept = async (accept: boolean) => {
222-
if (recipe && accept) {
223-
await window.electron.recordRecipeHash(recipe);
224-
setHasNotAcceptedRecipe(false);
225-
} else {
226-
setView('chat');
227-
}
228-
};
229-
230201
// Track if this is the initial render for session resuming
231202
const initialRenderRef = useRef(true);
232203

@@ -503,7 +474,7 @@ export default function BaseChat({
503474
messages={messages}
504475
disableAnimation={disableAnimation}
505476
recipe={recipe}
506-
recipeAccepted={!hasNotAcceptedRecipe}
477+
recipeAccepted={true}
507478
initialPrompt={initialPrompt}
508479
toolCount={toolCount || 0}
509480
sessionModel={sessionModel}
@@ -515,20 +486,6 @@ export default function BaseChat({
515486
</div>
516487
</MainPanelLayout>
517488

518-
{recipe && isActiveSession && (
519-
<RecipeWarningModal
520-
isOpen={!!hasNotAcceptedRecipe}
521-
onConfirm={() => handleRecipeAccept(true)}
522-
onCancel={() => handleRecipeAccept(false)}
523-
recipeDetails={{
524-
title: recipe.title,
525-
description: recipe.description,
526-
instructions: recipe.instructions || undefined,
527-
}}
528-
hasSecurityWarnings={hasRecipeSecurityWarnings}
529-
/>
530-
)}
531-
532489
{recipe?.parameters && recipe.parameters.length > 0 && !session?.user_recipe_values && (
533490
<ParameterInputModal
534491
parameters={recipe.parameters}

ui/desktop/src/components/ui/RecipeWarningModal.tsx

Lines changed: 0 additions & 161 deletions
This file was deleted.

ui/desktop/src/i18n/messages/en.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,39 +3122,6 @@
31223122
"recipeNameField.formatHint": {
31233123
"defaultMessage": "Will be automatically formatted (lowercase, dashes for spaces)"
31243124
},
3125-
"recipeWarningModal.cancel": {
3126-
"defaultMessage": "Cancel"
3127-
},
3128-
"recipeWarningModal.descriptionLabel": {
3129-
"defaultMessage": "Description:"
3130-
},
3131-
"recipeWarningModal.firstTimeDescription": {
3132-
"defaultMessage": "You are about to execute a workflow that you haven't run before."
3133-
},
3134-
"recipeWarningModal.hiddenCharsWarning": {
3135-
"defaultMessage": "This workflow contains hidden characters that will be ignored for your safety, as they could be used for malicious purposes."
3136-
},
3137-
"recipeWarningModal.instructionsLabel": {
3138-
"defaultMessage": "Instructions:"
3139-
},
3140-
"recipeWarningModal.newRecipeWarningTitle": {
3141-
"defaultMessage": "⚠️ New Workflow Warning"
3142-
},
3143-
"recipeWarningModal.recipePreview": {
3144-
"defaultMessage": "Workflow Preview:"
3145-
},
3146-
"recipeWarningModal.securityWarningTitle": {
3147-
"defaultMessage": "⚠️ Security Warning"
3148-
},
3149-
"recipeWarningModal.titleLabel": {
3150-
"defaultMessage": "Title:"
3151-
},
3152-
"recipeWarningModal.trustAndExecute": {
3153-
"defaultMessage": "Trust and Execute"
3154-
},
3155-
"recipeWarningModal.trustSource": {
3156-
"defaultMessage": "Only proceed if you trust the source of this workflow."
3157-
},
31583125
"recipesView.addSchedule": {
31593126
"defaultMessage": "Add schedule"
31603127
},

ui/desktop/src/i18n/messages/zh-CN.json

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,39 +3071,6 @@
30713071
"recipeNameField.formatHint": {
30723072
"defaultMessage": "将自动格式化(小写字母,空格转为短横线)"
30733073
},
3074-
"recipeWarningModal.cancel": {
3075-
"defaultMessage": "取消"
3076-
},
3077-
"recipeWarningModal.descriptionLabel": {
3078-
"defaultMessage": "描述:"
3079-
},
3080-
"recipeWarningModal.firstTimeDescription": {
3081-
"defaultMessage": "你即将执行一个从未运行过的工作流。"
3082-
},
3083-
"recipeWarningModal.hiddenCharsWarning": {
3084-
"defaultMessage": "此工作流包含隐藏字符,为了你的安全这些字符会被忽略,因为它们可能被用于恶意目的。"
3085-
},
3086-
"recipeWarningModal.instructionsLabel": {
3087-
"defaultMessage": "指令:"
3088-
},
3089-
"recipeWarningModal.newRecipeWarningTitle": {
3090-
"defaultMessage": "⚠️ 新工作流警告"
3091-
},
3092-
"recipeWarningModal.recipePreview": {
3093-
"defaultMessage": "工作流预览:"
3094-
},
3095-
"recipeWarningModal.securityWarningTitle": {
3096-
"defaultMessage": "⚠️ 安全警告"
3097-
},
3098-
"recipeWarningModal.titleLabel": {
3099-
"defaultMessage": "标题:"
3100-
},
3101-
"recipeWarningModal.trustAndExecute": {
3102-
"defaultMessage": "信任并执行"
3103-
},
3104-
"recipeWarningModal.trustSource": {
3105-
"defaultMessage": "只有在你信任此工作流来源的情况下才应继续。"
3106-
},
31073074
"recipesView.addSchedule": {
31083075
"defaultMessage": "添加计划"
31093076
},

ui/desktop/src/main.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ import {
4646
updateTrayMenu,
4747
} from './utils/autoUpdater';
4848
import { UPDATES_ENABLED } from './updates';
49-
import './utils/recipeHash';
50-
import { calculateStableRecipeHash } from './utils/stableRecipeHash';
5149
import { Client } from './api/client';
5250
import { GooseApp } from './api';
5351
import * as mesh from './mesh';
@@ -181,15 +179,11 @@ async function seedDefaultRecipes(): Promise<void> {
181179
? path.join(process.resourcesPath, 'default-recipes')
182180
: path.join(__dirname, '..', 'default-recipes');
183181
const destDir = path.join(os.homedir(), '.config', 'goose', 'recipes');
184-
const hashesDir = path.join(app.getPath('userData'), 'recipe_hashes');
185-
const bundledTitlesFile = path.join(app.getPath('userData'), 'bundled-recipe-titles.json');
186182

187183
if (!fsSync.existsSync(sourceRoot)) return;
188184

189185
await fs.mkdir(destDir, { recursive: true });
190-
await fs.mkdir(hashesDir, { recursive: true });
191186
const entries = await fs.readdir(sourceRoot);
192-
const bundledTitles: Array<{ title: string; description: string }> = [];
193187
for (const entry of entries) {
194188
if (!entry.endsWith('.yaml') && !entry.endsWith('.yml')) continue;
195189
const sourcePath = path.join(sourceRoot, entry);
@@ -199,34 +193,6 @@ async function seedDefaultRecipes(): Promise<void> {
199193
await fs.copyFile(sourcePath, destPath);
200194
log.info(`[seedDefaultRecipes] seeded ${entry}${destPath}`);
201195
}
202-
203-
try {
204-
const yamlContent = await fs.readFile(sourcePath, 'utf-8');
205-
const parsed = yaml.parse(yamlContent);
206-
if (
207-
parsed &&
208-
typeof parsed === 'object' &&
209-
typeof parsed.title === 'string' &&
210-
typeof parsed.description === 'string'
211-
) {
212-
bundledTitles.push({ title: parsed.title, description: parsed.description });
213-
}
214-
const hash = calculateStableRecipeHash(parsed);
215-
const hashFile = path.join(hashesDir, `${hash}.hash`);
216-
if (!fsSync.existsSync(hashFile)) {
217-
await fs.writeFile(hashFile, new Date().toISOString());
218-
log.info(`[seedDefaultRecipes] pre-trusted hash for ${entry}${hash}`);
219-
}
220-
} catch (err) {
221-
log.warn(`[seedDefaultRecipes] failed to pre-trust ${entry}:`, err);
222-
}
223-
}
224-
225-
try {
226-
await fs.writeFile(bundledTitlesFile, JSON.stringify(bundledTitles, null, 2));
227-
log.info(`[seedDefaultRecipes] wrote bundled-recipe-titles.json with ${bundledTitles.length} titles`);
228-
} catch (err) {
229-
log.warn(`[seedDefaultRecipes] failed to write bundled-recipe-titles.json:`, err);
230196
}
231197
}
232198

0 commit comments

Comments
 (0)