feat(sisyphus-task): make skills parameter required
- Add validation for skills parameter (must be provided, use [] if empty) - Update schema to remove .optional() - Update type definition to make skills non-optional - Fix existing tests to include skills parameter
This commit is contained in:
@@ -213,6 +213,48 @@ describe("sisyphus-task", () => {
|
||||
expect(SISYPHUS_TASK_DESCRIPTION).toContain("skills")
|
||||
expect(SISYPHUS_TASK_DESCRIPTION).toContain("Array of skill names")
|
||||
})
|
||||
|
||||
test("skills parameter is required - returns error when not provided", async () => {
|
||||
// #given
|
||||
const { createSisyphusTask } = require("./tools")
|
||||
|
||||
const mockManager = { launch: async () => ({}) }
|
||||
const mockClient = {
|
||||
app: { agents: async () => ({ data: [] }) },
|
||||
session: {
|
||||
create: async () => ({ data: { id: "test-session" } }),
|
||||
prompt: async () => ({ data: {} }),
|
||||
messages: async () => ({ data: [] }),
|
||||
},
|
||||
}
|
||||
|
||||
const tool = createSisyphusTask({
|
||||
manager: mockManager,
|
||||
client: mockClient,
|
||||
})
|
||||
|
||||
const toolContext = {
|
||||
sessionID: "parent-session",
|
||||
messageID: "parent-message",
|
||||
agent: "Sisyphus",
|
||||
abort: new AbortController().signal,
|
||||
}
|
||||
|
||||
// #when - skills not provided (undefined)
|
||||
const result = await tool.execute(
|
||||
{
|
||||
description: "Test task",
|
||||
prompt: "Do something",
|
||||
category: "ultrabrain",
|
||||
run_in_background: false,
|
||||
},
|
||||
toolContext
|
||||
)
|
||||
|
||||
// #then - should return error about missing skills
|
||||
expect(result).toContain("skills")
|
||||
expect(result).toContain("REQUIRED")
|
||||
})
|
||||
})
|
||||
|
||||
describe("resume with background parameter", () => {
|
||||
@@ -268,7 +310,8 @@ describe("sisyphus-task", () => {
|
||||
description: "Resume test",
|
||||
prompt: "Continue the task",
|
||||
resume: "ses_resume_test",
|
||||
background: false,
|
||||
run_in_background: false,
|
||||
skills: [],
|
||||
},
|
||||
toolContext
|
||||
)
|
||||
@@ -321,7 +364,8 @@ describe("sisyphus-task", () => {
|
||||
description: "Resume bg test",
|
||||
prompt: "Continue in background",
|
||||
resume: "ses_bg_resume",
|
||||
background: true,
|
||||
run_in_background: true,
|
||||
skills: [],
|
||||
},
|
||||
toolContext
|
||||
)
|
||||
|
||||
@@ -121,17 +121,20 @@ export function createSisyphusTask(options: SisyphusTaskToolOptions): ToolDefini
|
||||
subagent_type: tool.schema.string().optional().describe("Agent name directly (e.g., 'oracle', 'explore'). Mutually exclusive with category."),
|
||||
run_in_background: tool.schema.boolean().describe("Run in background. MUST be explicitly set. Use false for task delegation, true only for parallel exploration."),
|
||||
resume: tool.schema.string().optional().describe("Session ID to resume - continues previous agent session with full context"),
|
||||
skills: tool.schema.array(tool.schema.string()).optional().describe("Array of skill names to prepend to the prompt. Skills will be resolved and their content prepended with a separator."),
|
||||
skills: tool.schema.array(tool.schema.string()).describe("Array of skill names to prepend to the prompt. Use [] if no skills needed."),
|
||||
},
|
||||
async execute(args: SisyphusTaskArgs, toolContext) {
|
||||
const ctx = toolContext as ToolContextWithMetadata
|
||||
if (args.run_in_background === undefined) {
|
||||
return `❌ Invalid arguments: 'run_in_background' parameter is REQUIRED. Use run_in_background=false for task delegation, run_in_background=true only for parallel exploration.`
|
||||
}
|
||||
if (args.skills === undefined) {
|
||||
return `❌ Invalid arguments: 'skills' parameter is REQUIRED. Use skills=[] if no skills needed.`
|
||||
}
|
||||
const runInBackground = args.run_in_background === true
|
||||
|
||||
let skillContent: string | undefined
|
||||
if (args.skills && args.skills.length > 0) {
|
||||
if (args.skills.length > 0) {
|
||||
const { resolved, notFound } = resolveMultipleSkills(args.skills)
|
||||
if (notFound.length > 0) {
|
||||
const available = createBuiltinSkills().map(s => s.name).join(", ")
|
||||
|
||||
@@ -5,5 +5,5 @@ export interface SisyphusTaskArgs {
|
||||
subagent_type?: string
|
||||
run_in_background: boolean
|
||||
resume?: string
|
||||
skills?: string[]
|
||||
skills: string[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user