feat(categories): add disable field to CategoryConfigSchema

Allow individual categories to be disabled via `disable: true` in
config. Introduce shared `mergeCategories()` utility to centralize
category merging and disabled filtering across all 7 consumption sites.
This commit is contained in:
YeonGyu-Kim
2026-02-11 13:52:06 +09:00
parent 67b4665c28
commit bfe1730e9f
11 changed files with 131 additions and 29 deletions
+4 -1
View File
@@ -32,7 +32,10 @@ export function resolveCategoryConfig(
const userConfig = userCategories?.[categoryName]
const hasExplicitUserConfig = userConfig !== undefined
// Check if category requires a specific model - bypass if user explicitly provides config
if (userConfig?.disable) {
return null
}
const categoryReq = CATEGORY_MODEL_REQUIREMENTS[categoryName]
if (categoryReq?.requiresModel && availableModels && !hasExplicitUserConfig) {
if (!isModelAvailable(categoryReq.requiresModel, availableModels)) {
+5 -4
View File
@@ -1,7 +1,7 @@
import type { ModelFallbackInfo } from "../../features/task-toast-manager/types"
import type { DelegateTaskArgs } from "./types"
import type { ExecutorContext } from "./executor-types"
import { DEFAULT_CATEGORIES } from "./constants"
import { mergeCategories } from "../../shared/merge-categories"
import { SISYPHUS_JUNIOR_AGENT } from "./sisyphus-junior-agent"
import { resolveCategoryConfig } from "./categories"
import { parseModelString } from "./model-string-parser"
@@ -30,7 +30,8 @@ export async function resolveCategoryExecution(
const availableModels = await getAvailableModelsForDelegateTask(client)
const categoryName = args.category!
const categoryExists = DEFAULT_CATEGORIES[categoryName] !== undefined || userCategories?.[categoryName] !== undefined
const enabledCategories = mergeCategories(userCategories)
const categoryExists = enabledCategories[categoryName] !== undefined
const resolved = resolveCategoryConfig(categoryName, {
userCategories,
@@ -41,7 +42,7 @@ export async function resolveCategoryExecution(
if (!resolved) {
const requirement = CATEGORY_MODEL_REQUIREMENTS[categoryName]
const allCategoryNames = Object.keys({ ...DEFAULT_CATEGORIES, ...userCategories }).join(", ")
const allCategoryNames = Object.keys(enabledCategories).join(", ")
if (categoryExists && requirement?.requiresModel) {
return {
@@ -146,7 +147,7 @@ Available categories: ${allCategoryNames}`,
const categoryPromptAppend = resolved.promptAppend || undefined
if (!categoryModel && !actualModel) {
const categoryNames = Object.keys({ ...DEFAULT_CATEGORIES, ...userCategories })
const categoryNames = Object.keys(enabledCategories)
return {
agentToUse: "",
categoryModel: undefined,
+3 -2
View File
@@ -1,6 +1,7 @@
import { tool, type ToolDefinition } from "@opencode-ai/plugin"
import type { DelegateTaskArgs, ToolContextWithMetadata, DelegateTaskToolOptions } from "./types"
import { DEFAULT_CATEGORIES, CATEGORY_DESCRIPTIONS } from "./constants"
import { CATEGORY_DESCRIPTIONS } from "./constants"
import { mergeCategories } from "../../shared/merge-categories"
import { log } from "../../shared/logger"
import { buildSystemContent } from "./prompt-builder"
import type {
@@ -26,7 +27,7 @@ export { buildSystemContent } from "./prompt-builder"
export function createDelegateTask(options: DelegateTaskToolOptions): ToolDefinition {
const { userCategories } = options
const allCategories = { ...DEFAULT_CATEGORIES, ...userCategories }
const allCategories = mergeCategories(userCategories)
const categoryNames = Object.keys(allCategories)
const categoryExamples = categoryNames.map(k => `'${k}'`).join(", ")