|
3 | 3 | applyManageTasks, |
4 | 4 | createManageTasksRunner, |
5 | 5 | hasActiveTasks, |
| 6 | + parseManageTasksArgs, |
6 | 7 | type Task, |
7 | 8 | } from "../../../src/agent/tasks.js"; |
8 | 9 |
|
@@ -157,4 +158,45 @@ test("manage_tasks runner rejects invalid args", async () => { |
157 | 158 | const run = createManageTasksRunner(); |
158 | 159 | const result = await run({}); |
159 | 160 | expect(result.isError).toBe(true); |
| 161 | + expect(result.content).toMatch(/action/i); |
| 162 | +}); |
| 163 | + |
| 164 | +test("manage_tasks runner names invalid status, not missing action", async () => { |
| 165 | + const run = createManageTasksRunner(); |
| 166 | + const result = await run({ |
| 167 | + action: "create", |
| 168 | + tasks: [{ id: "t1", title: "Inspect", status: "bogus" }], |
| 169 | + }); |
| 170 | + expect(result.isError).toBe(true); |
| 171 | + expect(result.content).toMatch(/status/i); |
| 172 | + expect(result.content).not.toMatch(/requires action/i); |
| 173 | +}); |
| 174 | + |
| 175 | +test("manage_tasks runner accepts a GLM-shaped create with in_progress", async () => { |
| 176 | + const run = createManageTasksRunner(); |
| 177 | + const glmPayload = { |
| 178 | + action: "create", |
| 179 | + tasks: [ |
| 180 | + { id: "t1", title: "Inspect branch", status: "in_progress" }, |
| 181 | + { id: "t2", title: "Write failing test", status: "todo" }, |
| 182 | + ], |
| 183 | + }; |
| 184 | + const result = await run(glmPayload); |
| 185 | + expect(result.isError).toBeUndefined(); |
| 186 | + expect(result.content).toBe("Tasks updated."); |
| 187 | + expect( |
| 188 | + ( |
| 189 | + await run({ |
| 190 | + action: "update", |
| 191 | + updates: [{ id: "t1", status: "doing" }], |
| 192 | + }) |
| 193 | + ).content, |
| 194 | + ).toBe("No change: t1 already doing."); |
| 195 | + expect(parseManageTasksArgs(glmPayload)).toEqual({ |
| 196 | + action: "create", |
| 197 | + tasks: [ |
| 198 | + { id: "t1", title: "Inspect branch", status: "doing" }, |
| 199 | + { id: "t2", title: "Write failing test", status: "todo" }, |
| 200 | + ], |
| 201 | + }); |
160 | 202 | }); |
0 commit comments