Skip to content

Commit 0d0bf4d

Browse files
committed
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
1 parent 64b9b4d commit 0d0bf4d

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

src/tools/sisyphus-task/tools.test.ts

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,48 @@ describe("sisyphus-task", () => {
213213
expect(SISYPHUS_TASK_DESCRIPTION).toContain("skills")
214214
expect(SISYPHUS_TASK_DESCRIPTION).toContain("Array of skill names")
215215
})
216+
217+
test("skills parameter is required - returns error when not provided", async () => {
218+
// #given
219+
const { createSisyphusTask } = require("./tools")
220+
221+
const mockManager = { launch: async () => ({}) }
222+
const mockClient = {
223+
app: { agents: async () => ({ data: [] }) },
224+
session: {
225+
create: async () => ({ data: { id: "test-session" } }),
226+
prompt: async () => ({ data: {} }),
227+
messages: async () => ({ data: [] }),
228+
},
229+
}
230+
231+
const tool = createSisyphusTask({
232+
manager: mockManager,
233+
client: mockClient,
234+
})
235+
236+
const toolContext = {
237+
sessionID: "parent-session",
238+
messageID: "parent-message",
239+
agent: "Sisyphus",
240+
abort: new AbortController().signal,
241+
}
242+
243+
// #when - skills not provided (undefined)
244+
const result = await tool.execute(
245+
{
246+
description: "Test task",
247+
prompt: "Do something",
248+
category: "ultrabrain",
249+
run_in_background: false,
250+
},
251+
toolContext
252+
)
253+
254+
// #then - should return error about missing skills
255+
expect(result).toContain("skills")
256+
expect(result).toContain("REQUIRED")
257+
})
216258
})
217259

218260
describe("resume with background parameter", () => {
@@ -268,7 +310,8 @@ describe("sisyphus-task", () => {
268310
description: "Resume test",
269311
prompt: "Continue the task",
270312
resume: "ses_resume_test",
271-
background: false,
313+
run_in_background: false,
314+
skills: [],
272315
},
273316
toolContext
274317
)
@@ -321,7 +364,8 @@ describe("sisyphus-task", () => {
321364
description: "Resume bg test",
322365
prompt: "Continue in background",
323366
resume: "ses_bg_resume",
324-
background: true,
367+
run_in_background: true,
368+
skills: [],
325369
},
326370
toolContext
327371
)

src/tools/sisyphus-task/tools.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,20 @@ export function createSisyphusTask(options: SisyphusTaskToolOptions): ToolDefini
121121
subagent_type: tool.schema.string().optional().describe("Agent name directly (e.g., 'oracle', 'explore'). Mutually exclusive with category."),
122122
run_in_background: tool.schema.boolean().describe("Run in background. MUST be explicitly set. Use false for task delegation, true only for parallel exploration."),
123123
resume: tool.schema.string().optional().describe("Session ID to resume - continues previous agent session with full context"),
124-
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."),
124+
skills: tool.schema.array(tool.schema.string()).describe("Array of skill names to prepend to the prompt. Use [] if no skills needed."),
125125
},
126126
async execute(args: SisyphusTaskArgs, toolContext) {
127127
const ctx = toolContext as ToolContextWithMetadata
128128
if (args.run_in_background === undefined) {
129129
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.`
130130
}
131+
if (args.skills === undefined) {
132+
return `❌ Invalid arguments: 'skills' parameter is REQUIRED. Use skills=[] if no skills needed.`
133+
}
131134
const runInBackground = args.run_in_background === true
132135

133136
let skillContent: string | undefined
134-
if (args.skills && args.skills.length > 0) {
137+
if (args.skills.length > 0) {
135138
const { resolved, notFound } = resolveMultipleSkills(args.skills)
136139
if (notFound.length > 0) {
137140
const available = createBuiltinSkills().map(s => s.name).join(", ")

src/tools/sisyphus-task/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export interface SisyphusTaskArgs {
55
subagent_type?: string
66
run_in_background: boolean
77
resume?: string
8-
skills?: string[]
8+
skills: string[]
99
}

0 commit comments

Comments
 (0)