refactor: update TS types for steps-based recipes, remove dead code

Add RecipeStep interface, update Recipe (remove patchTemplate/
impactCategory/impactSummary/action), replace previewApply/applyRecipe
with applyConfigPatch, delete recipe_catalog.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
zhixian
2026-02-17 22:43:51 +09:00
parent 1c636c35fd
commit 1c96af57f1
3 changed files with 9 additions and 85 deletions

View File

@@ -12,10 +12,8 @@ export const api = {
invoke("refresh_model_catalog", {}),
listRecipes: (source?: string): Promise<Recipe[]> =>
invoke("list_recipes", source ? { source } : {}),
previewApply: (recipeId: string, params: Record<string, string>, source?: string): Promise<PreviewResult> =>
invoke("preview_apply", { recipeId, params, source }),
applyRecipe: (recipeId: string, params: Record<string, string>, source?: string): Promise<ApplyResult> =>
invoke("apply_recipe", { recipeId, params, source }),
applyConfigPatch: (patchTemplate: string, params: Record<string, string>): Promise<ApplyResult> =>
invoke("apply_config_patch", { patchTemplate, params }),
listHistory: (limit = 20, offset = 0): Promise<{ items: HistoryItem[] }> =>
invoke("list_history", { limit, offset }),
previewRollback: (snapshotId: string): Promise<PreviewResult> =>

View File

@@ -1,77 +0,0 @@
export const builtinRecipes = [
{
id: "discord-channel-persona",
name: "Discord channel persona",
description: "Inject different system prompt for one Discord channel",
version: "1.0.0",
tags: ["discord", "persona", "beginner"],
difficulty: "easy",
params: [
{
id: "guild_id",
label: "Guild",
type: "discord_guild",
required: true,
},
{
id: "channel_id",
label: "Channel",
type: "discord_channel",
required: true,
},
{
id: "persona",
label: "Persona description",
type: "textarea",
required: true,
minLength: 1,
placeholder: "You are...",
},
],
patchTemplate: `{
"channels": {
"discord": {
"guilds": {
"{{guild_id}}": {
"channels": {
"{{channel_id}}": {
"systemPrompt": "{{persona}}"
}
}
}
}
}
}
}`,
impactCategory: "low",
impactSummary: "Add/modify channel persona",
},
{
id: "default-model-switch",
name: "Switch default model",
description:
"Change the global default model used by all agents (unless overridden per-agent)",
version: "1.0.0",
tags: ["model", "productivity"],
difficulty: "easy",
params: [
{
id: "model_name",
label: "Model",
type: "model_profile",
required: true,
},
],
patchTemplate: `{
"agents": {
"defaults": {
"model": {
"primary": "{{model_name}}"
}
}
}
}`,
impactCategory: "low",
impactSummary: "Switch default model",
},
];

View File

@@ -18,6 +18,12 @@ export interface RecipeParam {
placeholder?: string;
}
export interface RecipeStep {
action: string;
label: string;
args: Record<string, unknown>;
}
export interface Recipe {
id: string;
name: string;
@@ -26,10 +32,7 @@ export interface Recipe {
tags: string[];
difficulty: "easy" | "normal" | "advanced";
params: RecipeParam[];
action?: string;
patchTemplate: string;
impactCategory: string;
impactSummary: string;
steps: RecipeStep[];
}
export interface ChangeItem {