fix(tool-registry): unify task_system default
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test"
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
import type { ToolsRecord } from "./types"
|
||||
import { trimToolsToCap } from "./tool-registry"
|
||||
import { createToolRegistry, trimToolsToCap } from "./tool-registry"
|
||||
|
||||
const fakeTool = tool({
|
||||
description: "test tool",
|
||||
@@ -27,3 +27,57 @@ describe("#given tool trimming prioritization", () => {
|
||||
expect(filteredTools).toHaveProperty("read")
|
||||
})
|
||||
})
|
||||
|
||||
describe("#given task_system configuration", () => {
|
||||
test("#when task_system is omitted #then task tools are not registered by default", () => {
|
||||
const result = createToolRegistry({
|
||||
ctx: { directory: "/tmp" } as Parameters<typeof createToolRegistry>[0]["ctx"],
|
||||
pluginConfig: {},
|
||||
managers: {
|
||||
backgroundManager: {},
|
||||
tmuxSessionManager: {},
|
||||
skillMcpManager: {},
|
||||
} as Parameters<typeof createToolRegistry>[0]["managers"],
|
||||
skillContext: {
|
||||
mergedSkills: [],
|
||||
availableSkills: [],
|
||||
browserProvider: "playwright",
|
||||
disabledSkills: new Set(),
|
||||
},
|
||||
availableCategories: [],
|
||||
})
|
||||
|
||||
expect(result.taskSystemEnabled).toBe(false)
|
||||
expect(result.filteredTools).not.toHaveProperty("task_create")
|
||||
expect(result.filteredTools).not.toHaveProperty("task_get")
|
||||
expect(result.filteredTools).not.toHaveProperty("task_list")
|
||||
expect(result.filteredTools).not.toHaveProperty("task_update")
|
||||
})
|
||||
|
||||
test("#when task_system is enabled #then task tools are registered", () => {
|
||||
const result = createToolRegistry({
|
||||
ctx: { directory: "/tmp" } as Parameters<typeof createToolRegistry>[0]["ctx"],
|
||||
pluginConfig: {
|
||||
experimental: { task_system: true },
|
||||
},
|
||||
managers: {
|
||||
backgroundManager: {},
|
||||
tmuxSessionManager: {},
|
||||
skillMcpManager: {},
|
||||
} as Parameters<typeof createToolRegistry>[0]["managers"],
|
||||
skillContext: {
|
||||
mergedSkills: [],
|
||||
availableSkills: [],
|
||||
browserProvider: "playwright",
|
||||
disabledSkills: new Set(),
|
||||
},
|
||||
availableCategories: [],
|
||||
})
|
||||
|
||||
expect(result.taskSystemEnabled).toBe(true)
|
||||
expect(result.filteredTools).toHaveProperty("task_create")
|
||||
expect(result.filteredTools).toHaveProperty("task_get")
|
||||
expect(result.filteredTools).toHaveProperty("task_list")
|
||||
expect(result.filteredTools).toHaveProperty("task_update")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from "../tools"
|
||||
import { getMainSessionID } from "../features/claude-code-session-state"
|
||||
import { filterDisabledTools } from "../shared/disabled-tools"
|
||||
import { log } from "../shared"
|
||||
import { isTaskSystemEnabled, log } from "../shared"
|
||||
|
||||
import type { Managers } from "../create-managers"
|
||||
import type { SkillContext } from "./skill-context"
|
||||
@@ -175,8 +175,7 @@ export function createToolRegistry(args: {
|
||||
nativeSkills: "skills" in ctx ? (ctx as { skills: SkillLoadOptions["nativeSkills"] }).skills : undefined,
|
||||
})
|
||||
|
||||
// task_system defaults to true since v3.14 — delegation (oracle, subagents) requires it
|
||||
const taskSystemEnabled = pluginConfig.experimental?.task_system ?? true
|
||||
const taskSystemEnabled = isTaskSystemEnabled(pluginConfig)
|
||||
const taskToolsRecord: Record<string, ToolDefinition> = taskSystemEnabled
|
||||
? {
|
||||
task_create: createTaskCreateTool(pluginConfig, ctx),
|
||||
|
||||
Reference in New Issue
Block a user