@wrongstack/tools 0.287.0 → 0.289.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_fetch-guard.d.ts.map +1 -1
- package/dist/_redact-command.d.ts.map +1 -1
- package/dist/_spawn-stream.d.ts.map +1 -1
- package/dist/audit.js +61 -14
- package/dist/audit.js.map +3 -3
- package/dist/bash.d.ts +1 -1
- package/dist/bash.d.ts.map +1 -1
- package/dist/bash.js +97 -19
- package/dist/bash.js.map +3 -3
- package/dist/builtin.d.ts +12 -10
- package/dist/builtin.d.ts.map +1 -1
- package/dist/builtin.js +1620 -803
- package/dist/builtin.js.map +3 -3
- package/dist/codebase-index/background-indexer.d.ts.map +1 -1
- package/dist/codebase-index/bm25.d.ts +1 -2
- package/dist/codebase-index/bm25.d.ts.map +1 -1
- package/dist/codebase-index/codebase-index-tool.d.ts.map +1 -1
- package/dist/codebase-index/codebase-search-tool.d.ts.map +1 -1
- package/dist/codebase-index/codebase-stats-tool.d.ts +7 -0
- package/dist/codebase-index/codebase-stats-tool.d.ts.map +1 -1
- package/dist/codebase-index/index-service.d.ts +11 -1
- package/dist/codebase-index/index-service.d.ts.map +1 -1
- package/dist/codebase-index/index.d.ts +2 -1
- package/dist/codebase-index/index.d.ts.map +1 -1
- package/dist/codebase-index/index.js +749 -192
- package/dist/codebase-index/index.js.map +3 -3
- package/dist/codebase-index/indexer.d.ts.map +1 -1
- package/dist/codebase-index/schema.d.ts +43 -1
- package/dist/codebase-index/schema.d.ts.map +1 -1
- package/dist/codebase-index/ts-parser.d.ts.map +1 -1
- package/dist/codebase-index/worker-protocol.d.ts +1 -0
- package/dist/codebase-index/worker-protocol.d.ts.map +1 -1
- package/dist/codebase-index/worker.js +610 -152
- package/dist/codebase-index/worker.js.map +3 -3
- package/dist/codebase-index/writer.d.ts +27 -1
- package/dist/codebase-index/writer.d.ts.map +1 -1
- package/dist/e2e.js +477 -0
- package/dist/e2e.js.map +7 -0
- package/dist/exec.d.ts +1 -1
- package/dist/exec.d.ts.map +1 -1
- package/dist/exec.js +60 -5
- package/dist/exec.js.map +3 -3
- package/dist/fetch.js +2 -2
- package/dist/fetch.js.map +2 -2
- package/dist/format.js +61 -14
- package/dist/format.js.map +3 -3
- package/dist/glob.js +2 -2
- package/dist/glob.js.map +1 -1
- package/dist/grep.d.ts.map +1 -1
- package/dist/grep.js +2 -2
- package/dist/grep.js.map +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1786 -809
- package/dist/index.js.map +3 -3
- package/dist/install.js +61 -14
- package/dist/install.js.map +3 -3
- package/dist/kanban.d.ts +11 -2
- package/dist/kanban.d.ts.map +1 -1
- package/dist/kanban.js +695 -571
- package/dist/kanban.js.map +3 -3
- package/dist/languages/detect.d.ts.map +1 -1
- package/dist/languages/index.js +61 -14
- package/dist/languages/index.js.map +3 -3
- package/dist/languages/types.d.ts +7 -0
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/lint.js +61 -14
- package/dist/lint.js.map +3 -3
- package/dist/outdated.js +61 -14
- package/dist/outdated.js.map +3 -3
- package/dist/pack.js +1617 -800
- package/dist/pack.js.map +3 -3
- package/dist/plan.js +4 -0
- package/dist/plan.js.map +2 -2
- package/dist/process-registry.js +12 -5
- package/dist/process-registry.js.map +2 -2
- package/dist/search.js +2 -2
- package/dist/search.js.map +2 -2
- package/dist/session-kanban.d.ts +9 -0
- package/dist/session-kanban.d.ts.map +1 -1
- package/dist/session-kanban.js +137 -0
- package/dist/session-kanban.js.map +2 -2
- package/dist/task.js +4 -0
- package/dist/task.js.map +2 -2
- package/dist/test.js +61 -14
- package/dist/test.js.map +3 -3
- package/dist/todo.js +4 -0
- package/dist/todo.js.map +2 -2
- package/dist/tree.js +2 -2
- package/dist/tree.js.map +1 -1
- package/dist/typecheck.js +61 -14
- package/dist/typecheck.js.map +3 -3
- package/package.json +7 -3
package/dist/kanban.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/kanban.ts
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { deserializeTaskGraph as deserializeTaskGraph2, loadTasks as loadTasks2, serializeTaskGraph } from "@wrongstack/core";
|
|
3
4
|
import {
|
|
4
5
|
addCheckToTask,
|
|
@@ -38,7 +39,9 @@ import {
|
|
|
38
39
|
setTaskChain,
|
|
39
40
|
splitTask,
|
|
40
41
|
syncBoardFromTaskGraph as syncBoardFromTaskGraph2,
|
|
42
|
+
transitionTask,
|
|
41
43
|
transferTaskToBoard,
|
|
44
|
+
touchKanbanPresence as touchKanbanPresence2,
|
|
42
45
|
updateBoard as updateBoard2,
|
|
43
46
|
updateCheckOnTask,
|
|
44
47
|
updateColumn,
|
|
@@ -50,17 +53,21 @@ import {
|
|
|
50
53
|
// src/session-kanban.ts
|
|
51
54
|
import {
|
|
52
55
|
deserializeTaskGraph,
|
|
56
|
+
GlobalMailbox,
|
|
53
57
|
loadPlan,
|
|
54
58
|
loadTasks,
|
|
55
59
|
mutatePlan,
|
|
56
60
|
mutateTasks
|
|
57
61
|
} from "@wrongstack/core";
|
|
62
|
+
import { resolveWstackPaths } from "@wrongstack/core/utils";
|
|
58
63
|
import {
|
|
59
64
|
createBoard,
|
|
60
65
|
getBoard,
|
|
66
|
+
getKanbanDir,
|
|
61
67
|
listBoards,
|
|
62
68
|
removeBoard,
|
|
63
69
|
syncBoardFromTaskGraph,
|
|
70
|
+
touchKanbanPresence,
|
|
64
71
|
updateBoard
|
|
65
72
|
} from "@wrongstack/kanban";
|
|
66
73
|
function taskFileToSerializedGraph(tasks, sessionId) {
|
|
@@ -104,8 +111,8 @@ function taskFileToSerializedGraph(tasks, sessionId) {
|
|
|
104
111
|
var kanbanTool = {
|
|
105
112
|
name: "kanban",
|
|
106
113
|
category: "Project",
|
|
107
|
-
description: "Manage project-scoped multi-kanban boards stored under .wrongstack/kanbans.
|
|
108
|
-
usageHint: "Use this for durable project kanban state.
|
|
114
|
+
description: "Manage and audit project-scoped multi-kanban boards stored under .wrongstack/kanbans. Managed cards enforce fully specified details and adjacent Backlog \u2192 Todo \u2192 Running \u2192 Review \u2192 Done transitions with persistent comments and evidence. Successful board access records live agent/session presence.",
|
|
115
|
+
usageHint: "Use this for durable project kanban state. Reassess with get_board whenever evidence changes; agents may add, update, split, merge, reprioritize, or remove tasks so the board remains a live plan. Presence includes active/last-seen session and agent metadata. For managed boards, fully fill card details, use transition_task after every material step, attach truthful evidence, and never use update_task/move_task to bypass lifecycle guards. Worker completion enters Review; only passed acceptance criteria plus review evidence allow Done.",
|
|
109
116
|
permission: "confirm",
|
|
110
117
|
mutating: true,
|
|
111
118
|
capabilities: ["fs.write"],
|
|
@@ -142,6 +149,7 @@ var kanbanTool = {
|
|
|
142
149
|
"transfer_task",
|
|
143
150
|
"get_task",
|
|
144
151
|
"update_task",
|
|
152
|
+
"transition_task",
|
|
145
153
|
"move_task",
|
|
146
154
|
"delete_task",
|
|
147
155
|
"set_chain",
|
|
@@ -172,6 +180,7 @@ var kanbanTool = {
|
|
|
172
180
|
targetColumnId: { type: "string" },
|
|
173
181
|
title: { type: "string" },
|
|
174
182
|
description: { type: "string" },
|
|
183
|
+
dueDate: { type: "string" },
|
|
175
184
|
tags: { type: "array", items: { type: "string" } },
|
|
176
185
|
labels: { type: "array", items: { type: "string" } },
|
|
177
186
|
priority: { type: "string", enum: ["critical", "high", "medium", "low"] },
|
|
@@ -218,6 +227,18 @@ var kanbanTool = {
|
|
|
218
227
|
type: "string",
|
|
219
228
|
enum: ["assigned", "queued", "running", "completed", "failed", "cancelled"]
|
|
220
229
|
},
|
|
230
|
+
lifecycleStage: {
|
|
231
|
+
type: "string",
|
|
232
|
+
enum: ["backlog", "todo", "running", "review", "done"]
|
|
233
|
+
},
|
|
234
|
+
transitionAction: { type: "string" },
|
|
235
|
+
transitionComment: { type: "string" },
|
|
236
|
+
attachmentUrl: { type: "string" },
|
|
237
|
+
attachmentTitle: { type: "string" },
|
|
238
|
+
attachmentType: {
|
|
239
|
+
type: "string",
|
|
240
|
+
enum: ["issue", "pr", "doc", "commit", "design", "file", "url", "other"]
|
|
241
|
+
},
|
|
221
242
|
releaseStatus: { type: "string", enum: ["pending", "ready", "blocked"] },
|
|
222
243
|
releaseReason: { type: "string" },
|
|
223
244
|
clearAssignee: { type: "boolean" },
|
|
@@ -288,591 +309,632 @@ var kanbanTool = {
|
|
|
288
309
|
async execute(input, ctx) {
|
|
289
310
|
const projectRoot = ctx.projectRoot;
|
|
290
311
|
if (!projectRoot) return fail("No project root is available.");
|
|
312
|
+
const withPresence = async (result) => {
|
|
313
|
+
const boardId = result.board?.id ?? input.boardId;
|
|
314
|
+
if (!result.ok || !boardId || !ctx.session?.id || !ctx.agentId) return result;
|
|
315
|
+
try {
|
|
316
|
+
const board = await touchKanbanPresence2(projectRoot, boardId, {
|
|
317
|
+
sessionId: ctx.session.id,
|
|
318
|
+
agentId: ctx.agentId,
|
|
319
|
+
agentName: ctx.agentName,
|
|
320
|
+
taskId: input.taskId ?? result.task?.id,
|
|
321
|
+
runTaskId: input.runTaskId
|
|
322
|
+
});
|
|
323
|
+
return board ? { ...result, board } : result;
|
|
324
|
+
} catch {
|
|
325
|
+
return result;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
291
328
|
try {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
329
|
+
const result = await (async () => {
|
|
330
|
+
switch (input.action) {
|
|
331
|
+
case "list_boards": {
|
|
332
|
+
const boards = await listBoards2(projectRoot);
|
|
333
|
+
return { ok: true, message: `${boards.length} board(s).`, boards };
|
|
334
|
+
}
|
|
335
|
+
case "get_board": {
|
|
336
|
+
const board = await requireBoard(projectRoot, input.boardId);
|
|
337
|
+
return board ? okBoard(board) : fail("Board not found.");
|
|
338
|
+
}
|
|
339
|
+
case "create_board": {
|
|
340
|
+
if (!input.title) return fail("create_board requires title.");
|
|
341
|
+
const board = await createBoard2(projectRoot, {
|
|
342
|
+
title: input.title,
|
|
343
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
344
|
+
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
345
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {}
|
|
346
|
+
});
|
|
347
|
+
return { ok: true, message: `Board created: ${board.title}`, board };
|
|
348
|
+
}
|
|
349
|
+
case "update_board": {
|
|
350
|
+
if (!input.boardId) return fail("update_board requires boardId.");
|
|
351
|
+
const board = await updateBoard2(projectRoot, input.boardId, {
|
|
352
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
353
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
354
|
+
...input.tags !== void 0 ? { tags: input.tags } : {}
|
|
355
|
+
});
|
|
356
|
+
return board ? okBoard(board, "Board updated.") : fail("Board not found.");
|
|
357
|
+
}
|
|
358
|
+
case "duplicate_board": {
|
|
359
|
+
if (!input.boardId) return fail("duplicate_board requires boardId.");
|
|
360
|
+
const board = await duplicateBoard(projectRoot, input.boardId, {
|
|
361
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
362
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
363
|
+
...input.includeTasks !== void 0 ? { includeTasks: input.includeTasks } : {},
|
|
364
|
+
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {},
|
|
365
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {}
|
|
366
|
+
});
|
|
367
|
+
return board ? okBoard(board, "Board duplicated.") : fail("Board not found.");
|
|
368
|
+
}
|
|
369
|
+
case "delete_board": {
|
|
370
|
+
if (!input.boardId) return fail("delete_board requires boardId.");
|
|
371
|
+
const removed = await removeBoard2(projectRoot, input.boardId);
|
|
372
|
+
return { ok: removed, message: removed ? "Board deleted." : "Board not found." };
|
|
373
|
+
}
|
|
374
|
+
case "generate_board": {
|
|
375
|
+
if (!input.description) return fail("generate_board requires description.");
|
|
376
|
+
const boardInput = generateBoardFromDescription({
|
|
377
|
+
description: input.description,
|
|
378
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
379
|
+
...input.context !== void 0 ? { context: input.context } : {},
|
|
380
|
+
...input.columns !== void 0 ? { columns: input.columns } : {}
|
|
381
|
+
});
|
|
382
|
+
const board = await createBoard2(projectRoot, boardInput);
|
|
383
|
+
for (const taskInput2 of parseLinesIntoTasks(
|
|
384
|
+
input.description,
|
|
385
|
+
board.columns[0]?.id ?? "backlog"
|
|
386
|
+
)) {
|
|
387
|
+
await addTask(projectRoot, board.id, taskInput2);
|
|
388
|
+
}
|
|
389
|
+
return okBoard(await getBoard2(projectRoot, board.id) ?? board, "Board generated.");
|
|
390
|
+
}
|
|
391
|
+
case "export_markdown": {
|
|
392
|
+
const board = await requireBoard(projectRoot, input.boardId);
|
|
393
|
+
if (!board) return fail("Board not found.");
|
|
394
|
+
return {
|
|
395
|
+
ok: true,
|
|
396
|
+
message: "Board exported.",
|
|
397
|
+
board,
|
|
398
|
+
markdown: exportBoardAsMarkdown(board)
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
case "export_task_graph": {
|
|
402
|
+
if (!input.boardId) return fail("export_task_graph requires boardId.");
|
|
403
|
+
const exported = await exportBoardToTaskGraph(projectRoot, input.boardId, {
|
|
404
|
+
...input.graphId !== void 0 ? { graphId: input.graphId } : {},
|
|
405
|
+
...input.specId !== void 0 ? { specId: input.specId } : {},
|
|
406
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
407
|
+
...input.preserveOriginTaskIds !== void 0 ? { preserveOriginTaskIds: input.preserveOriginTaskIds } : {},
|
|
408
|
+
...input.includeArchived !== void 0 ? { includeArchived: input.includeArchived } : {}
|
|
409
|
+
});
|
|
410
|
+
if (!exported) return fail("Board not found.");
|
|
411
|
+
return {
|
|
412
|
+
ok: true,
|
|
413
|
+
message: `Task graph exported with ${exported.graph.nodes.size} node(s).`,
|
|
414
|
+
board: exported.board,
|
|
415
|
+
taskGraph: serializeTaskGraph(exported.graph)
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
case "sync_task_graph": {
|
|
419
|
+
if (!input.boardId || !input.taskGraph) {
|
|
420
|
+
return fail("sync_task_graph requires boardId and taskGraph.");
|
|
421
|
+
}
|
|
422
|
+
const graph = deserializeTaskGraph2(input.taskGraph);
|
|
423
|
+
const result2 = await syncBoardFromTaskGraph2(projectRoot, input.boardId, graph, {
|
|
424
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
425
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
426
|
+
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
427
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
428
|
+
...input.sourceSystem !== void 0 ? { sourceSystem: input.sourceSystem } : {},
|
|
429
|
+
...input.phaseId !== void 0 ? { phaseId: input.phaseId } : {},
|
|
430
|
+
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {},
|
|
431
|
+
...input.archiveMissingTasks !== void 0 ? { archiveMissingTasks: input.archiveMissingTasks } : {},
|
|
432
|
+
...input.preserveManualDependencies !== void 0 ? { preserveManualDependencies: input.preserveManualDependencies } : {}
|
|
433
|
+
});
|
|
434
|
+
return result2 ? {
|
|
435
|
+
ok: true,
|
|
436
|
+
message: `Task graph synced: ${result2.createdTaskIds.length} created, ${result2.updatedTaskIds.length} updated, ${result2.archivedTaskIds.length} archived.`,
|
|
437
|
+
board: result2.board
|
|
438
|
+
} : fail("Board not found.");
|
|
439
|
+
}
|
|
440
|
+
case "create_from_graph": {
|
|
441
|
+
if (!input.taskGraph) return fail("create_from_graph requires taskGraph.");
|
|
442
|
+
const graph = deserializeTaskGraph2(input.taskGraph);
|
|
443
|
+
const { board } = await createBoardFromTaskGraph(projectRoot, graph, {
|
|
444
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
445
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
446
|
+
...input.tags !== void 0 ? { tags: input.tags } : {},
|
|
447
|
+
...input.generatedBy !== void 0 ? { generatedBy: input.generatedBy } : {},
|
|
448
|
+
...input.sourceSystem !== void 0 ? { sourceSystem: input.sourceSystem } : {},
|
|
449
|
+
...input.phaseId !== void 0 ? { phaseId: input.phaseId } : {},
|
|
450
|
+
...input.includeCompletedTasks !== void 0 ? { includeCompletedTasks: input.includeCompletedTasks } : {}
|
|
451
|
+
});
|
|
452
|
+
return {
|
|
453
|
+
ok: true,
|
|
454
|
+
message: `Created board "${board.title}" from task graph with ${board.tasks.length} tasks.`,
|
|
455
|
+
board
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
case "import_session_tasks": {
|
|
459
|
+
const taskPath = ctx.meta?.["task.path"];
|
|
460
|
+
if (!taskPath) return fail("No session task file for this session.");
|
|
461
|
+
const file = await loadTasks2(taskPath);
|
|
462
|
+
if (!file || file.tasks.length === 0) return fail("No session tasks to import.");
|
|
463
|
+
const sessionId = ctx.session?.id ?? file.sessionId ?? "session";
|
|
464
|
+
const graph = deserializeTaskGraph2(taskFileToSerializedGraph(file.tasks, sessionId));
|
|
465
|
+
const tags = ["session", `session:${sessionId}`];
|
|
466
|
+
const existing = (await listBoards2(projectRoot)).find(
|
|
467
|
+
(b) => b.tags?.includes(`session:${sessionId}`)
|
|
468
|
+
);
|
|
469
|
+
if (existing) {
|
|
470
|
+
const result2 = await syncBoardFromTaskGraph2(projectRoot, existing.id, graph, {
|
|
471
|
+
sourceSystem: "session",
|
|
472
|
+
tags,
|
|
473
|
+
archiveMissingTasks: true,
|
|
474
|
+
includeCompletedTasks: true
|
|
475
|
+
});
|
|
476
|
+
return result2 ? {
|
|
477
|
+
ok: true,
|
|
478
|
+
message: `Synced ${file.tasks.length} session tasks into board "${result2.board.title}".`,
|
|
479
|
+
board: result2.board
|
|
480
|
+
} : fail("Session board vanished mid-sync.");
|
|
481
|
+
}
|
|
482
|
+
const { board } = await createBoardFromTaskGraph(projectRoot, graph, {
|
|
483
|
+
title: `Session tasks (${sessionId.slice(0, 8)})`,
|
|
433
484
|
sourceSystem: "session",
|
|
434
|
-
tags
|
|
435
|
-
archiveMissingTasks: true,
|
|
436
|
-
includeCompletedTasks: true
|
|
485
|
+
tags
|
|
437
486
|
});
|
|
438
|
-
return
|
|
487
|
+
return {
|
|
439
488
|
ok: true,
|
|
440
|
-
message: `
|
|
441
|
-
board
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
});
|
|
519
|
-
return board ? okBoard(board, "Column deleted.") : fail("Column not found.");
|
|
520
|
-
}
|
|
521
|
-
case "add_task": {
|
|
522
|
-
if (!input.boardId || !input.title) return fail("add_task requires boardId and title.");
|
|
523
|
-
const result = await addTask(projectRoot, input.boardId, taskInput(input));
|
|
524
|
-
return result ? okTask(result.board, result.task, "Task added.") : fail("Board not found.");
|
|
525
|
-
}
|
|
526
|
-
case "split_task": {
|
|
527
|
-
if (!input.boardId || !input.taskId || !input.childTitles?.length) {
|
|
528
|
-
return fail("split_task requires boardId, taskId, and childTitles.");
|
|
529
|
-
}
|
|
530
|
-
const result = await splitTask(projectRoot, input.boardId, input.taskId, {
|
|
531
|
-
titles: input.childTitles,
|
|
532
|
-
...input.targetColumnId !== void 0 ? { columnId: input.targetColumnId } : {},
|
|
533
|
-
...input.inheritAssignment !== void 0 ? { inheritAssignment: input.inheritAssignment } : {},
|
|
534
|
-
...input.inheritLabels !== void 0 ? { inheritLabels: input.inheritLabels } : {},
|
|
535
|
-
...input.inheritSuccessCriteria !== void 0 ? { inheritSuccessCriteria: input.inheritSuccessCriteria } : {},
|
|
536
|
-
...input.inheritGoalMetrics !== void 0 ? { inheritGoalMetrics: input.inheritGoalMetrics } : {},
|
|
537
|
-
...input.inheritDependencies !== void 0 ? { inheritDependencies: input.inheritDependencies } : {},
|
|
538
|
-
...input.chainChildren !== void 0 ? { chainChildren: input.chainChildren } : {},
|
|
539
|
-
...input.rewireDependents !== void 0 ? { rewireDependents: input.rewireDependents } : {}
|
|
540
|
-
});
|
|
541
|
-
return result ? {
|
|
542
|
-
ok: true,
|
|
543
|
-
message: `${result.children.length} child task(s) created.`,
|
|
544
|
-
board: result.board,
|
|
545
|
-
task: result.parent,
|
|
546
|
-
children: result.children
|
|
547
|
-
} : fail("Task not found.");
|
|
548
|
-
}
|
|
549
|
-
case "merge_tasks": {
|
|
550
|
-
if (!input.boardId || !input.taskIds?.length || !input.title) {
|
|
551
|
-
return fail("merge_tasks requires boardId, taskIds, and title.");
|
|
552
|
-
}
|
|
553
|
-
const result = await mergeTasks(projectRoot, input.boardId, {
|
|
554
|
-
taskIds: input.taskIds,
|
|
555
|
-
title: input.title,
|
|
556
|
-
...input.description !== void 0 ? { description: input.description } : {},
|
|
557
|
-
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
558
|
-
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
559
|
-
...input.closeSourceTasks !== void 0 ? { closeSourceTasks: input.closeSourceTasks } : {}
|
|
560
|
-
});
|
|
561
|
-
return result ? okTask(result.board, result.task, "Tasks merged.") : fail("Board or task not found.");
|
|
562
|
-
}
|
|
563
|
-
case "copy_task": {
|
|
564
|
-
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
565
|
-
return fail("copy_task requires boardId, taskId, and targetBoardId.");
|
|
566
|
-
}
|
|
567
|
-
const result = await copyTaskToBoard(
|
|
568
|
-
projectRoot,
|
|
569
|
-
input.boardId,
|
|
570
|
-
input.taskId,
|
|
571
|
-
input.targetBoardId,
|
|
572
|
-
{
|
|
573
|
-
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
574
|
-
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
575
|
-
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
576
|
-
...input.preserveDependencies !== void 0 ? { preserveDependencies: input.preserveDependencies } : {}
|
|
489
|
+
message: `Imported ${file.tasks.length} session tasks into new board "${board.title}".`,
|
|
490
|
+
board
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
case "search_tasks": {
|
|
494
|
+
const tasks = await searchKanban(projectRoot, {
|
|
495
|
+
query: input.query,
|
|
496
|
+
boardId: input.boardId,
|
|
497
|
+
assignedAgent: input.agentId,
|
|
498
|
+
status: input.status,
|
|
499
|
+
priority: input.priority,
|
|
500
|
+
label: input.labels?.[0],
|
|
501
|
+
chainId: input.chainId
|
|
502
|
+
});
|
|
503
|
+
return { ok: true, message: `${tasks.length} task(s) matched.`, tasks };
|
|
504
|
+
}
|
|
505
|
+
case "ready_tasks": {
|
|
506
|
+
const tasks = await listReadyTasks(projectRoot, {
|
|
507
|
+
query: input.query,
|
|
508
|
+
boardId: input.boardId,
|
|
509
|
+
assignedAgent: input.agentId,
|
|
510
|
+
priority: input.priority,
|
|
511
|
+
label: input.labels?.[0],
|
|
512
|
+
chainId: input.chainId,
|
|
513
|
+
limit: input.limit
|
|
514
|
+
});
|
|
515
|
+
return { ok: true, message: `${tasks.length} ready task(s).`, tasks };
|
|
516
|
+
}
|
|
517
|
+
case "snapshot": {
|
|
518
|
+
const snapshot = await getKanbanOrchestrationSnapshot(projectRoot, {
|
|
519
|
+
query: input.query,
|
|
520
|
+
boardId: input.boardId,
|
|
521
|
+
assignedAgent: input.agentId,
|
|
522
|
+
status: input.status,
|
|
523
|
+
priority: input.priority,
|
|
524
|
+
label: input.labels?.[0],
|
|
525
|
+
chainId: input.chainId
|
|
526
|
+
});
|
|
527
|
+
return {
|
|
528
|
+
ok: true,
|
|
529
|
+
message: `${snapshot.ready.length} ready, ${snapshot.running.length} running, ${snapshot.blocked.length} blocked.`,
|
|
530
|
+
snapshot
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
case "add_column": {
|
|
534
|
+
if (!input.boardId || !input.title) return fail("add_column requires boardId and title.");
|
|
535
|
+
const result2 = await addColumn(projectRoot, input.boardId, {
|
|
536
|
+
title: input.title,
|
|
537
|
+
...input.description !== void 0 ? { description: input.description } : {}
|
|
538
|
+
});
|
|
539
|
+
return result2 ? okBoard(result2.board, "Column added.") : fail("Board not found.");
|
|
540
|
+
}
|
|
541
|
+
case "update_column": {
|
|
542
|
+
if (!input.boardId || !input.columnId)
|
|
543
|
+
return fail("update_column requires boardId and columnId.");
|
|
544
|
+
const board = await updateColumn(projectRoot, input.boardId, input.columnId, {
|
|
545
|
+
...input.title !== void 0 ? { title: input.title } : {},
|
|
546
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
547
|
+
...input.order !== void 0 ? { order: input.order } : {}
|
|
548
|
+
});
|
|
549
|
+
return board ? okBoard(board, "Column updated.") : fail("Column not found.");
|
|
550
|
+
}
|
|
551
|
+
case "delete_column": {
|
|
552
|
+
if (!input.boardId || !input.columnId)
|
|
553
|
+
return fail("delete_column requires boardId and columnId.");
|
|
554
|
+
const board = await removeColumn(projectRoot, input.boardId, input.columnId, {
|
|
555
|
+
moveTasksToColumnId: input.moveTasksToColumnId
|
|
556
|
+
});
|
|
557
|
+
return board ? okBoard(board, "Column deleted.") : fail("Column not found.");
|
|
558
|
+
}
|
|
559
|
+
case "add_task": {
|
|
560
|
+
if (!input.boardId || !input.title) return fail("add_task requires boardId and title.");
|
|
561
|
+
const result2 = await addTask(projectRoot, input.boardId, taskInput(input));
|
|
562
|
+
return result2 ? okTask(result2.board, result2.task, "Task added.") : fail("Board not found.");
|
|
563
|
+
}
|
|
564
|
+
case "split_task": {
|
|
565
|
+
if (!input.boardId || !input.taskId || !input.childTitles?.length) {
|
|
566
|
+
return fail("split_task requires boardId, taskId, and childTitles.");
|
|
577
567
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
568
|
+
const result2 = await splitTask(projectRoot, input.boardId, input.taskId, {
|
|
569
|
+
titles: input.childTitles,
|
|
570
|
+
...input.targetColumnId !== void 0 ? { columnId: input.targetColumnId } : {},
|
|
571
|
+
...input.inheritAssignment !== void 0 ? { inheritAssignment: input.inheritAssignment } : {},
|
|
572
|
+
...input.inheritLabels !== void 0 ? { inheritLabels: input.inheritLabels } : {},
|
|
573
|
+
...input.inheritSuccessCriteria !== void 0 ? { inheritSuccessCriteria: input.inheritSuccessCriteria } : {},
|
|
574
|
+
...input.inheritGoalMetrics !== void 0 ? { inheritGoalMetrics: input.inheritGoalMetrics } : {},
|
|
575
|
+
...input.inheritDependencies !== void 0 ? { inheritDependencies: input.inheritDependencies } : {},
|
|
576
|
+
...input.chainChildren !== void 0 ? { chainChildren: input.chainChildren } : {},
|
|
577
|
+
...input.rewireDependents !== void 0 ? { rewireDependents: input.rewireDependents } : {}
|
|
578
|
+
});
|
|
579
|
+
return result2 ? {
|
|
580
|
+
ok: true,
|
|
581
|
+
message: `${result2.children.length} child task(s) created.`,
|
|
582
|
+
board: result2.board,
|
|
583
|
+
task: result2.parent,
|
|
584
|
+
children: result2.children
|
|
585
|
+
} : fail("Task not found.");
|
|
586
|
+
}
|
|
587
|
+
case "merge_tasks": {
|
|
588
|
+
if (!input.boardId || !input.taskIds?.length || !input.title) {
|
|
589
|
+
return fail("merge_tasks requires boardId, taskIds, and title.");
|
|
590
|
+
}
|
|
591
|
+
const result2 = await mergeTasks(projectRoot, input.boardId, {
|
|
592
|
+
taskIds: input.taskIds,
|
|
593
|
+
title: input.title,
|
|
594
|
+
...input.description !== void 0 ? { description: input.description } : {},
|
|
591
595
|
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
592
|
-
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
593
596
|
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
594
|
-
...input.
|
|
597
|
+
...input.closeSourceTasks !== void 0 ? { closeSourceTasks: input.closeSourceTasks } : {}
|
|
598
|
+
});
|
|
599
|
+
return result2 ? okTask(result2.board, result2.task, "Tasks merged.") : fail("Board or task not found.");
|
|
600
|
+
}
|
|
601
|
+
case "copy_task": {
|
|
602
|
+
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
603
|
+
return fail("copy_task requires boardId, taskId, and targetBoardId.");
|
|
595
604
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
return fail("update_task requires boardId and taskId.");
|
|
607
|
-
const board = await updateTask(
|
|
608
|
-
projectRoot,
|
|
609
|
-
input.boardId,
|
|
610
|
-
input.taskId,
|
|
611
|
-
taskPatch(input)
|
|
612
|
-
);
|
|
613
|
-
return board ? okBoard(board, "Task updated.") : fail("Task not found.");
|
|
614
|
-
}
|
|
615
|
-
case "move_task": {
|
|
616
|
-
if (!input.boardId || !input.taskId || !input.targetColumnId) {
|
|
617
|
-
return fail("move_task requires boardId, taskId, and targetColumnId.");
|
|
618
|
-
}
|
|
619
|
-
const board = await moveTask(
|
|
620
|
-
projectRoot,
|
|
621
|
-
input.boardId,
|
|
622
|
-
input.taskId,
|
|
623
|
-
input.targetColumnId,
|
|
624
|
-
input.order
|
|
625
|
-
);
|
|
626
|
-
return board ? okBoard(board, "Task moved.") : fail("Move failed.");
|
|
627
|
-
}
|
|
628
|
-
case "delete_task": {
|
|
629
|
-
if (!input.boardId || !input.taskId)
|
|
630
|
-
return fail("delete_task requires boardId and taskId.");
|
|
631
|
-
const board = await removeTask(projectRoot, input.boardId, input.taskId);
|
|
632
|
-
return board ? okBoard(board, "Task deleted.") : fail("Task not found.");
|
|
633
|
-
}
|
|
634
|
-
case "set_chain": {
|
|
635
|
-
if (!input.boardId || !input.taskIds?.length) {
|
|
636
|
-
return fail("set_chain requires boardId and taskIds.");
|
|
637
|
-
}
|
|
638
|
-
const result = await setTaskChain(projectRoot, input.boardId, {
|
|
639
|
-
taskIds: input.taskIds,
|
|
640
|
-
...input.chainId !== void 0 ? { chainId: input.chainId } : {},
|
|
641
|
-
...input.enforceDependencies !== void 0 ? { enforceDependencies: input.enforceDependencies } : {}
|
|
642
|
-
});
|
|
643
|
-
return result ? {
|
|
644
|
-
ok: true,
|
|
645
|
-
message: `Chain set: ${result.chainId}`,
|
|
646
|
-
board: result.board,
|
|
647
|
-
chain: result.tasks
|
|
648
|
-
} : fail("Board or task not found.");
|
|
649
|
-
}
|
|
650
|
-
case "get_chain": {
|
|
651
|
-
if (!input.boardId || !(input.taskId || input.chainId)) {
|
|
652
|
-
return fail("get_chain requires boardId and taskId or chainId.");
|
|
653
|
-
}
|
|
654
|
-
const result = await getTaskChain(
|
|
655
|
-
projectRoot,
|
|
656
|
-
input.boardId,
|
|
657
|
-
input.taskId ?? input.chainId ?? ""
|
|
658
|
-
);
|
|
659
|
-
return result ? {
|
|
660
|
-
ok: true,
|
|
661
|
-
message: `Chain loaded: ${result.chainId}`,
|
|
662
|
-
board: result.board,
|
|
663
|
-
chain: result.tasks
|
|
664
|
-
} : fail("Chain not found.");
|
|
665
|
-
}
|
|
666
|
-
case "claim_task": {
|
|
667
|
-
const result = await claimReadyTask(projectRoot, {
|
|
668
|
-
...input.boardId !== void 0 ? { boardId: input.boardId } : {},
|
|
669
|
-
...input.taskId !== void 0 ? { taskId: input.taskId } : {},
|
|
670
|
-
...assignmentInput(input),
|
|
671
|
-
status: input.assignmentStatus ?? "queued"
|
|
672
|
-
});
|
|
673
|
-
return result ? okTask(result.board, result.task, "Task claimed.") : fail("No ready kanban task matched the claim.");
|
|
674
|
-
}
|
|
675
|
-
case "release_task": {
|
|
676
|
-
if (!input.boardId || !input.taskId) {
|
|
677
|
-
return fail("release_task requires boardId and taskId.");
|
|
678
|
-
}
|
|
679
|
-
const board = await releaseTaskClaim(projectRoot, input.boardId, input.taskId, {
|
|
680
|
-
...input.releaseStatus !== void 0 ? { status: input.releaseStatus } : {},
|
|
681
|
-
...input.releaseReason !== void 0 ? { reason: input.releaseReason } : {},
|
|
682
|
-
...input.clearAssignee !== void 0 ? { clearAssignee: input.clearAssignee } : {}
|
|
683
|
-
});
|
|
684
|
-
return board ? okBoard(board, "Task claim released.") : fail("Task not found.");
|
|
685
|
-
}
|
|
686
|
-
case "assign_task": {
|
|
687
|
-
if (!input.boardId || !input.taskId)
|
|
688
|
-
return fail("assign_task requires boardId and taskId.");
|
|
689
|
-
const board = await assignTask(
|
|
690
|
-
projectRoot,
|
|
691
|
-
input.boardId,
|
|
692
|
-
input.taskId,
|
|
693
|
-
assignmentInput(input)
|
|
694
|
-
);
|
|
695
|
-
return board ? okBoard(board, "Task assigned.") : fail("Task not found.");
|
|
696
|
-
}
|
|
697
|
-
case "mark_assignment": {
|
|
698
|
-
if (!input.boardId || !input.taskId)
|
|
699
|
-
return fail("mark_assignment requires boardId and taskId.");
|
|
700
|
-
const assignmentStatus = input.assignmentStatus ?? (input.status === "completed" ? "completed" : input.error ? "failed" : void 0);
|
|
701
|
-
const board = await updateTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
702
|
-
...assignmentStatus !== void 0 ? { status: assignmentStatus } : {},
|
|
703
|
-
...input.subagentId !== void 0 ? { subagentId: input.subagentId } : {},
|
|
704
|
-
...input.runTaskId !== void 0 ? { runTaskId: input.runTaskId } : {},
|
|
705
|
-
...input.lastResult !== void 0 ? { lastResult: input.lastResult } : {},
|
|
706
|
-
...input.error !== void 0 ? { error: input.error } : {},
|
|
707
|
-
...input.agentId !== void 0 ? { agentId: input.agentId } : {},
|
|
708
|
-
...input.leaseId !== void 0 ? { leaseId: input.leaseId } : {},
|
|
709
|
-
...input.claimedAt !== void 0 ? { claimedAt: input.claimedAt } : {},
|
|
710
|
-
...input.heartbeatAt !== void 0 ? { heartbeatAt: input.heartbeatAt } : {},
|
|
711
|
-
...input.leaseExpiresAt !== void 0 ? { leaseExpiresAt: input.leaseExpiresAt } : {},
|
|
712
|
-
...input.attempt !== void 0 ? { attempt: input.attempt } : {},
|
|
713
|
-
...input.maxAttempts !== void 0 ? { maxAttempts: input.maxAttempts } : {}
|
|
714
|
-
});
|
|
715
|
-
return board ? okBoard(board, "Assignment updated.") : fail("Task not found.");
|
|
716
|
-
}
|
|
717
|
-
case "heartbeat_assignment": {
|
|
718
|
-
if (!input.boardId || !input.taskId) {
|
|
719
|
-
return fail("heartbeat_assignment requires boardId and taskId.");
|
|
720
|
-
}
|
|
721
|
-
const board = await heartbeatTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
722
|
-
...input.heartbeatAt !== void 0 ? { heartbeatAt: input.heartbeatAt } : {},
|
|
723
|
-
...input.leaseExpiresAt !== void 0 ? { leaseExpiresAt: input.leaseExpiresAt } : {}
|
|
724
|
-
});
|
|
725
|
-
return board ? okBoard(board, "Assignment heartbeat updated.") : fail("Task assignment not found.");
|
|
726
|
-
}
|
|
727
|
-
case "recover_stale": {
|
|
728
|
-
if (!input.boardId) return fail("recover_stale requires boardId.");
|
|
729
|
-
const policyFields = [
|
|
730
|
-
input.recoveryPolicyFailOnCostCeiling !== void 0,
|
|
731
|
-
input.recoveryPolicyReleaseOnFailureKinds !== void 0,
|
|
732
|
-
input.recoveryPolicyReleaseOnHeartbeatDue !== void 0,
|
|
733
|
-
input.recoveryPolicyRetryPolicyOverride !== void 0
|
|
734
|
-
].some(Boolean);
|
|
735
|
-
const result = await recoverStaleTaskAssignments(projectRoot, input.boardId, {
|
|
736
|
-
...input.recoveryMode !== void 0 ? { mode: input.recoveryMode } : {},
|
|
737
|
-
...input.recoveryNow !== void 0 ? { now: input.recoveryNow } : {},
|
|
738
|
-
...input.releaseReason !== void 0 ? { reason: input.releaseReason } : {},
|
|
739
|
-
...input.clearAssignee !== void 0 ? { clearAssignee: input.clearAssignee } : {},
|
|
740
|
-
...policyFields ? {
|
|
741
|
-
policy: {
|
|
742
|
-
...input.recoveryPolicyFailOnCostCeiling !== void 0 ? { failWhenCostCeilingSet: input.recoveryPolicyFailOnCostCeiling } : {},
|
|
743
|
-
...input.recoveryPolicyReleaseOnFailureKinds !== void 0 ? {
|
|
744
|
-
releaseOnFailureKinds: input.recoveryPolicyReleaseOnFailureKinds
|
|
745
|
-
} : {},
|
|
746
|
-
...input.recoveryPolicyReleaseOnHeartbeatDue !== void 0 ? {
|
|
747
|
-
releaseOnHeartbeatDue: input.recoveryPolicyReleaseOnHeartbeatDue
|
|
748
|
-
} : {},
|
|
749
|
-
...input.recoveryPolicyRetryPolicyOverride !== void 0 ? {
|
|
750
|
-
retryPolicyOverride: input.recoveryPolicyRetryPolicyOverride
|
|
751
|
-
} : {}
|
|
605
|
+
const result2 = await copyTaskToBoard(
|
|
606
|
+
projectRoot,
|
|
607
|
+
input.boardId,
|
|
608
|
+
input.taskId,
|
|
609
|
+
input.targetBoardId,
|
|
610
|
+
{
|
|
611
|
+
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
612
|
+
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
613
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
614
|
+
...input.preserveDependencies !== void 0 ? { preserveDependencies: input.preserveDependencies } : {}
|
|
752
615
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
input.boardId
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
616
|
+
);
|
|
617
|
+
return result2 ? okTask(result2.targetBoard, result2.task, "Task copied to target board.") : fail("Board or task not found.");
|
|
618
|
+
}
|
|
619
|
+
case "transfer_task": {
|
|
620
|
+
if (!input.boardId || !input.taskId || !input.targetBoardId) {
|
|
621
|
+
return fail("transfer_task requires boardId, taskId, and targetBoardId.");
|
|
622
|
+
}
|
|
623
|
+
const result2 = await transferTaskToBoard(
|
|
624
|
+
projectRoot,
|
|
625
|
+
input.boardId,
|
|
626
|
+
input.taskId,
|
|
627
|
+
input.targetBoardId,
|
|
628
|
+
{
|
|
629
|
+
...input.targetColumnId !== void 0 ? { targetColumnId: input.targetColumnId } : {},
|
|
630
|
+
...input.order !== void 0 ? { targetOrder: input.order } : {},
|
|
631
|
+
...input.preserveAssignment !== void 0 ? { preserveAssignment: input.preserveAssignment } : {},
|
|
632
|
+
...input.preserveDependencies !== void 0 ? { preserveDependencies: input.preserveDependencies } : {}
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
return result2 ? okTask(result2.targetBoard, result2.task, "Task transferred to target board.") : fail("Board or task not found.");
|
|
636
|
+
}
|
|
637
|
+
case "get_task": {
|
|
638
|
+
if (!input.boardId || !input.taskId) return fail("get_task requires boardId and taskId.");
|
|
639
|
+
const task = await getTask(projectRoot, input.boardId, input.taskId);
|
|
640
|
+
return task ? { ok: true, message: "Task loaded.", task } : fail("Task not found.");
|
|
641
|
+
}
|
|
642
|
+
case "update_task": {
|
|
643
|
+
if (!input.boardId || !input.taskId)
|
|
644
|
+
return fail("update_task requires boardId and taskId.");
|
|
645
|
+
const board = await updateTask(
|
|
646
|
+
projectRoot,
|
|
647
|
+
input.boardId,
|
|
648
|
+
input.taskId,
|
|
649
|
+
taskPatch(input)
|
|
650
|
+
);
|
|
651
|
+
return board ? okBoard(board, "Task updated.") : fail("Task not found.");
|
|
652
|
+
}
|
|
653
|
+
case "transition_task": {
|
|
654
|
+
if (!input.boardId || !input.taskId || !input.lifecycleStage || !input.author || !input.transitionComment) {
|
|
655
|
+
return fail(
|
|
656
|
+
"transition_task requires boardId, taskId, lifecycleStage, author, and transitionComment."
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
const result2 = await transitionTask(projectRoot, input.boardId, input.taskId, {
|
|
660
|
+
to: input.lifecycleStage,
|
|
661
|
+
actor: input.author,
|
|
662
|
+
comment: input.transitionComment,
|
|
663
|
+
...input.transitionAction !== void 0 ? { action: input.transitionAction } : {},
|
|
664
|
+
...input.attachmentUrl !== void 0 ? {
|
|
665
|
+
attachment: {
|
|
666
|
+
url: input.attachmentUrl,
|
|
667
|
+
type: input.attachmentType ?? "url",
|
|
668
|
+
...input.attachmentTitle !== void 0 ? { title: input.attachmentTitle } : {}
|
|
669
|
+
}
|
|
670
|
+
} : {},
|
|
671
|
+
patch: taskPatch(input)
|
|
672
|
+
});
|
|
673
|
+
return result2 ? okTask(result2.board, result2.task, `Task advanced to ${result2.transition.to}.`) : fail("Board or task not found.");
|
|
674
|
+
}
|
|
675
|
+
case "move_task": {
|
|
676
|
+
if (!input.boardId || !input.taskId || !input.targetColumnId) {
|
|
677
|
+
return fail("move_task requires boardId, taskId, and targetColumnId.");
|
|
678
|
+
}
|
|
679
|
+
const board = await moveTask(
|
|
680
|
+
projectRoot,
|
|
681
|
+
input.boardId,
|
|
682
|
+
input.taskId,
|
|
683
|
+
input.targetColumnId,
|
|
684
|
+
input.order
|
|
685
|
+
);
|
|
686
|
+
return board ? okBoard(board, "Task moved.") : fail("Move failed.");
|
|
687
|
+
}
|
|
688
|
+
case "delete_task": {
|
|
689
|
+
if (!input.boardId || !input.taskId)
|
|
690
|
+
return fail("delete_task requires boardId and taskId.");
|
|
691
|
+
const board = await removeTask(projectRoot, input.boardId, input.taskId);
|
|
692
|
+
return board ? okBoard(board, "Task deleted.") : fail("Task not found.");
|
|
693
|
+
}
|
|
694
|
+
case "set_chain": {
|
|
695
|
+
if (!input.boardId || !input.taskIds?.length) {
|
|
696
|
+
return fail("set_chain requires boardId and taskIds.");
|
|
697
|
+
}
|
|
698
|
+
const result2 = await setTaskChain(projectRoot, input.boardId, {
|
|
699
|
+
taskIds: input.taskIds,
|
|
700
|
+
...input.chainId !== void 0 ? { chainId: input.chainId } : {},
|
|
701
|
+
...input.enforceDependencies !== void 0 ? { enforceDependencies: input.enforceDependencies } : {}
|
|
702
|
+
});
|
|
703
|
+
return result2 ? {
|
|
704
|
+
ok: true,
|
|
705
|
+
message: `Chain set: ${result2.chainId}`,
|
|
706
|
+
board: result2.board,
|
|
707
|
+
chain: result2.tasks
|
|
708
|
+
} : fail("Board or task not found.");
|
|
709
|
+
}
|
|
710
|
+
case "get_chain": {
|
|
711
|
+
if (!input.boardId || !(input.taskId || input.chainId)) {
|
|
712
|
+
return fail("get_chain requires boardId and taskId or chainId.");
|
|
713
|
+
}
|
|
714
|
+
const result2 = await getTaskChain(
|
|
715
|
+
projectRoot,
|
|
716
|
+
input.boardId,
|
|
717
|
+
input.taskId ?? input.chainId ?? ""
|
|
718
|
+
);
|
|
719
|
+
return result2 ? {
|
|
720
|
+
ok: true,
|
|
721
|
+
message: `Chain loaded: ${result2.chainId}`,
|
|
722
|
+
board: result2.board,
|
|
723
|
+
chain: result2.tasks
|
|
724
|
+
} : fail("Chain not found.");
|
|
725
|
+
}
|
|
726
|
+
case "claim_task": {
|
|
727
|
+
const result2 = await claimReadyTask(projectRoot, {
|
|
728
|
+
...input.boardId !== void 0 ? { boardId: input.boardId } : {},
|
|
729
|
+
...input.taskId !== void 0 ? { taskId: input.taskId } : {},
|
|
730
|
+
...assignmentInput(input),
|
|
731
|
+
status: input.assignmentStatus ?? "queued"
|
|
732
|
+
});
|
|
733
|
+
return result2 ? okTask(result2.board, result2.task, "Task claimed.") : fail("No ready kanban task matched the claim.");
|
|
734
|
+
}
|
|
735
|
+
case "release_task": {
|
|
736
|
+
if (!input.boardId || !input.taskId) {
|
|
737
|
+
return fail("release_task requires boardId and taskId.");
|
|
738
|
+
}
|
|
739
|
+
const board = await releaseTaskClaim(projectRoot, input.boardId, input.taskId, {
|
|
740
|
+
...input.releaseStatus !== void 0 ? { status: input.releaseStatus } : {},
|
|
741
|
+
...input.releaseReason !== void 0 ? { reason: input.releaseReason } : {},
|
|
742
|
+
...input.clearAssignee !== void 0 ? { clearAssignee: input.clearAssignee } : {}
|
|
743
|
+
});
|
|
744
|
+
return board ? okBoard(board, "Task claim released.") : fail("Task not found.");
|
|
745
|
+
}
|
|
746
|
+
case "assign_task": {
|
|
747
|
+
if (!input.boardId || !input.taskId)
|
|
748
|
+
return fail("assign_task requires boardId and taskId.");
|
|
749
|
+
const board = await assignTask(
|
|
750
|
+
projectRoot,
|
|
751
|
+
input.boardId,
|
|
752
|
+
input.taskId,
|
|
753
|
+
assignmentInput(input)
|
|
754
|
+
);
|
|
755
|
+
return board ? okBoard(board, "Task assigned.") : fail("Task not found.");
|
|
756
|
+
}
|
|
757
|
+
case "mark_assignment": {
|
|
758
|
+
if (!input.boardId || !input.taskId)
|
|
759
|
+
return fail("mark_assignment requires boardId and taskId.");
|
|
760
|
+
const assignmentStatus = input.assignmentStatus ?? (input.status === "completed" ? "completed" : input.error ? "failed" : void 0);
|
|
761
|
+
const board = await updateTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
762
|
+
...assignmentStatus !== void 0 ? { status: assignmentStatus } : {},
|
|
763
|
+
...input.subagentId !== void 0 ? { subagentId: input.subagentId } : {},
|
|
764
|
+
...input.runTaskId !== void 0 ? { runTaskId: input.runTaskId } : {},
|
|
765
|
+
...input.lastResult !== void 0 ? { lastResult: input.lastResult } : {},
|
|
766
|
+
...input.error !== void 0 ? { error: input.error } : {},
|
|
767
|
+
...input.agentId !== void 0 ? { agentId: input.agentId } : {},
|
|
768
|
+
...input.leaseId !== void 0 ? { leaseId: input.leaseId } : {},
|
|
769
|
+
...input.claimedAt !== void 0 ? { claimedAt: input.claimedAt } : {},
|
|
770
|
+
...input.heartbeatAt !== void 0 ? { heartbeatAt: input.heartbeatAt } : {},
|
|
771
|
+
...input.leaseExpiresAt !== void 0 ? { leaseExpiresAt: input.leaseExpiresAt } : {},
|
|
772
|
+
...input.attempt !== void 0 ? { attempt: input.attempt } : {},
|
|
773
|
+
...input.maxAttempts !== void 0 ? { maxAttempts: input.maxAttempts } : {}
|
|
774
|
+
});
|
|
775
|
+
return board ? okBoard(board, "Assignment updated.") : fail("Task not found.");
|
|
776
|
+
}
|
|
777
|
+
case "heartbeat_assignment": {
|
|
778
|
+
if (!input.boardId || !input.taskId) {
|
|
779
|
+
return fail("heartbeat_assignment requires boardId and taskId.");
|
|
780
|
+
}
|
|
781
|
+
const board = await heartbeatTaskAssignment(projectRoot, input.boardId, input.taskId, {
|
|
782
|
+
...input.heartbeatAt !== void 0 ? { heartbeatAt: input.heartbeatAt } : {},
|
|
783
|
+
...input.leaseExpiresAt !== void 0 ? { leaseExpiresAt: input.leaseExpiresAt } : {}
|
|
784
|
+
});
|
|
785
|
+
return board ? okBoard(board, "Assignment heartbeat updated.") : fail("Task assignment not found.");
|
|
786
|
+
}
|
|
787
|
+
case "recover_stale": {
|
|
788
|
+
if (!input.boardId) return fail("recover_stale requires boardId.");
|
|
789
|
+
const policyFields = [
|
|
790
|
+
input.recoveryPolicyFailOnCostCeiling !== void 0,
|
|
791
|
+
input.recoveryPolicyReleaseOnFailureKinds !== void 0,
|
|
792
|
+
input.recoveryPolicyReleaseOnHeartbeatDue !== void 0,
|
|
793
|
+
input.recoveryPolicyRetryPolicyOverride !== void 0
|
|
794
|
+
].some(Boolean);
|
|
795
|
+
const result2 = await recoverStaleTaskAssignments(projectRoot, input.boardId, {
|
|
796
|
+
...input.recoveryMode !== void 0 ? { mode: input.recoveryMode } : {},
|
|
797
|
+
...input.recoveryNow !== void 0 ? { now: input.recoveryNow } : {},
|
|
798
|
+
...input.releaseReason !== void 0 ? { reason: input.releaseReason } : {},
|
|
799
|
+
...input.clearAssignee !== void 0 ? { clearAssignee: input.clearAssignee } : {},
|
|
800
|
+
...policyFields ? {
|
|
801
|
+
policy: {
|
|
802
|
+
...input.recoveryPolicyFailOnCostCeiling !== void 0 ? { failWhenCostCeilingSet: input.recoveryPolicyFailOnCostCeiling } : {},
|
|
803
|
+
...input.recoveryPolicyReleaseOnFailureKinds !== void 0 ? {
|
|
804
|
+
releaseOnFailureKinds: input.recoveryPolicyReleaseOnFailureKinds
|
|
805
|
+
} : {},
|
|
806
|
+
...input.recoveryPolicyReleaseOnHeartbeatDue !== void 0 ? {
|
|
807
|
+
releaseOnHeartbeatDue: input.recoveryPolicyReleaseOnHeartbeatDue
|
|
808
|
+
} : {},
|
|
809
|
+
...input.recoveryPolicyRetryPolicyOverride !== void 0 ? {
|
|
810
|
+
retryPolicyOverride: input.recoveryPolicyRetryPolicyOverride
|
|
811
|
+
} : {}
|
|
812
|
+
}
|
|
813
|
+
} : {}
|
|
814
|
+
});
|
|
815
|
+
return result2 ? {
|
|
816
|
+
ok: true,
|
|
817
|
+
message: `Recovered ${result2.tasks.length} stale assignment(s).`,
|
|
818
|
+
board: result2.board,
|
|
819
|
+
recoveredTasks: result2.tasks
|
|
820
|
+
} : { ok: true, message: "No stale assignment matched.", recoveredTasks: [] };
|
|
821
|
+
}
|
|
822
|
+
case "events": {
|
|
823
|
+
if (!input.boardId) return fail("events requires boardId.");
|
|
824
|
+
const eventList = await listKanbanEvents(projectRoot, input.boardId);
|
|
825
|
+
return {
|
|
826
|
+
ok: true,
|
|
827
|
+
message: `${eventList.length} event(s).`,
|
|
828
|
+
events: eventList
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
case "queue_health": {
|
|
832
|
+
const health = await getKanbanQueueHealth(projectRoot, {
|
|
833
|
+
...input.boardId !== void 0 ? { boardId: input.boardId } : {}
|
|
834
|
+
});
|
|
835
|
+
return {
|
|
836
|
+
ok: true,
|
|
837
|
+
message: `Counts: ready=${health.counts.ready}, running=${health.counts.running}, stale=${health.staleAssignments.count}.`,
|
|
838
|
+
queueHealth: health
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
case "add_dependency": {
|
|
842
|
+
if (!input.boardId || !input.taskId || !input.dependencyTaskId) {
|
|
843
|
+
return fail("add_dependency requires boardId, taskId, and dependencyTaskId.");
|
|
844
|
+
}
|
|
845
|
+
const board = await addDependency(
|
|
846
|
+
projectRoot,
|
|
847
|
+
input.boardId,
|
|
848
|
+
input.taskId,
|
|
849
|
+
input.dependencyTaskId
|
|
850
|
+
);
|
|
851
|
+
return board ? okBoard(board, "Dependency added.") : fail("Task not found.");
|
|
852
|
+
}
|
|
853
|
+
case "add_goal_metric": {
|
|
854
|
+
if (!input.boardId || !input.taskId || !input.metricName) {
|
|
855
|
+
return fail("add_goal_metric requires boardId, taskId, and metricName.");
|
|
856
|
+
}
|
|
857
|
+
const board = await addGoalMetricToTask(projectRoot, input.boardId, input.taskId, {
|
|
858
|
+
name: input.metricName,
|
|
818
859
|
...input.metricStatus !== void 0 ? { status: input.metricStatus } : {},
|
|
819
860
|
...input.metricTarget !== void 0 ? { target: input.metricTarget } : {},
|
|
820
861
|
...input.metricCurrent !== void 0 ? { current: input.metricCurrent } : {},
|
|
821
862
|
...input.metricUnit !== void 0 ? { unit: input.metricUnit } : {},
|
|
822
863
|
...input.metricNotes !== void 0 ? { notes: input.metricNotes } : {}
|
|
864
|
+
});
|
|
865
|
+
return board ? okBoard(board, "Goal metric added.") : fail("Task not found.");
|
|
866
|
+
}
|
|
867
|
+
case "update_goal_metric": {
|
|
868
|
+
if (!input.boardId || !input.taskId || !input.metricId) {
|
|
869
|
+
return fail("update_goal_metric requires boardId, taskId, and metricId.");
|
|
823
870
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
projectRoot,
|
|
844
|
-
input.boardId,
|
|
845
|
-
input.taskId,
|
|
846
|
-
input.checkId,
|
|
847
|
-
{
|
|
848
|
-
...input.checkDescription !== void 0 ? { description: input.checkDescription } : {},
|
|
849
|
-
...input.checkStatus !== void 0 ? { status: input.checkStatus } : {}
|
|
871
|
+
const board = await updateGoalMetricOnTask(
|
|
872
|
+
projectRoot,
|
|
873
|
+
input.boardId,
|
|
874
|
+
input.taskId,
|
|
875
|
+
input.metricId,
|
|
876
|
+
{
|
|
877
|
+
...input.metricName !== void 0 ? { name: input.metricName } : {},
|
|
878
|
+
...input.metricStatus !== void 0 ? { status: input.metricStatus } : {},
|
|
879
|
+
...input.metricTarget !== void 0 ? { target: input.metricTarget } : {},
|
|
880
|
+
...input.metricCurrent !== void 0 ? { current: input.metricCurrent } : {},
|
|
881
|
+
...input.metricUnit !== void 0 ? { unit: input.metricUnit } : {},
|
|
882
|
+
...input.metricNotes !== void 0 ? { notes: input.metricNotes } : {}
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
return board ? okBoard(board, "Goal metric updated.") : fail("Metric not found.");
|
|
886
|
+
}
|
|
887
|
+
case "add_check": {
|
|
888
|
+
if (!input.boardId || !input.taskId || !input.checkDescription) {
|
|
889
|
+
return fail("add_check requires boardId, taskId, and checkDescription.");
|
|
850
890
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
return
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
891
|
+
const board = await addCheckToTask(projectRoot, input.boardId, input.taskId, {
|
|
892
|
+
description: input.checkDescription,
|
|
893
|
+
type: "manual",
|
|
894
|
+
status: input.checkStatus
|
|
895
|
+
});
|
|
896
|
+
return board ? okBoard(board, "Check added.") : fail("Task not found.");
|
|
897
|
+
}
|
|
898
|
+
case "update_check": {
|
|
899
|
+
if (!input.boardId || !input.taskId || !input.checkId) {
|
|
900
|
+
return fail("update_check requires boardId, taskId, and checkId.");
|
|
901
|
+
}
|
|
902
|
+
const board = await updateCheckOnTask(
|
|
903
|
+
projectRoot,
|
|
904
|
+
input.boardId,
|
|
905
|
+
input.taskId,
|
|
906
|
+
input.checkId,
|
|
907
|
+
{
|
|
908
|
+
...input.checkDescription !== void 0 ? { description: input.checkDescription } : {},
|
|
909
|
+
...input.checkStatus !== void 0 ? { status: input.checkStatus } : {}
|
|
910
|
+
}
|
|
911
|
+
);
|
|
912
|
+
return board ? okBoard(board, "Check updated.") : fail("Check not found.");
|
|
913
|
+
}
|
|
914
|
+
case "add_note": {
|
|
915
|
+
if (!input.boardId || !input.taskId || !input.note)
|
|
916
|
+
return fail("add_note requires boardId, taskId, and note.");
|
|
917
|
+
const board = await addNoteToTask(projectRoot, input.boardId, input.taskId, {
|
|
918
|
+
author: input.author ?? "agent",
|
|
919
|
+
content: input.note
|
|
920
|
+
});
|
|
921
|
+
return board ? okBoard(board, "Note added.") : fail("Task not found.");
|
|
922
|
+
}
|
|
923
|
+
case "add_link": {
|
|
924
|
+
if (!input.boardId || !input.taskId || !input.url)
|
|
925
|
+
return fail("add_link requires boardId, taskId, and url.");
|
|
926
|
+
const board = await addLinkToTask(projectRoot, input.boardId, input.taskId, {
|
|
927
|
+
url: input.url,
|
|
928
|
+
type: input.linkType ?? "url",
|
|
929
|
+
...input.linkTitle !== void 0 ? { title: input.linkTitle } : {}
|
|
930
|
+
});
|
|
931
|
+
return board ? okBoard(board, "Link added.") : fail("Task not found.");
|
|
932
|
+
}
|
|
933
|
+
default:
|
|
934
|
+
return fail(`Unknown kanban action: ${input.action}`);
|
|
872
935
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
936
|
+
})();
|
|
937
|
+
return withPresence(result);
|
|
876
938
|
} catch (err) {
|
|
877
939
|
return fail(err instanceof Error ? err.message : String(err));
|
|
878
940
|
}
|
|
@@ -896,6 +958,7 @@ function taskInput(input) {
|
|
|
896
958
|
title: input.title ?? "",
|
|
897
959
|
columnId: input.columnId,
|
|
898
960
|
description: input.description,
|
|
961
|
+
dueDate: input.dueDate,
|
|
899
962
|
priority: input.priority,
|
|
900
963
|
...input.taskType !== void 0 ? { type: input.taskType } : {},
|
|
901
964
|
status: input.status,
|
|
@@ -904,7 +967,67 @@ function taskInput(input) {
|
|
|
904
967
|
...input.assignee ?? assignment?.name ?? assignment?.agentId ? { assignee: input.assignee ?? assignment?.name ?? assignment?.agentId } : {},
|
|
905
968
|
...mergedDependsOn(input) ? { dependsOn: mergedDependsOn(input) } : {},
|
|
906
969
|
...input.estimatedHours !== void 0 ? { estimatedHours: input.estimatedHours } : {},
|
|
907
|
-
...
|
|
970
|
+
...input.actualHours !== void 0 ? { actualHours: input.actualHours } : {},
|
|
971
|
+
...assignment ? { assignment } : {},
|
|
972
|
+
...input.order !== void 0 ? { order: input.order } : {},
|
|
973
|
+
// Sprint 3 durable task-level fields
|
|
974
|
+
...input.retryPolicy !== void 0 ? { retryPolicy: input.retryPolicy } : {},
|
|
975
|
+
...input.costCeilingUsd !== void 0 ? { costCeilingUsd: input.costCeilingUsd } : {},
|
|
976
|
+
// Relationships — chainId alone cannot construct a KanbanTaskChainRef,
|
|
977
|
+
// so chain/previousTaskId/nextTaskId must be set via update_task.
|
|
978
|
+
...input.childTitles !== void 0 ? { childTaskIds: input.childTitles } : {},
|
|
979
|
+
// Detail objects
|
|
980
|
+
...input.checkDescription !== void 0 ? {
|
|
981
|
+
successCriteria: [
|
|
982
|
+
{
|
|
983
|
+
id: randomUUID(),
|
|
984
|
+
description: input.checkDescription,
|
|
985
|
+
type: "manual",
|
|
986
|
+
status: input.checkStatus ?? "pending"
|
|
987
|
+
}
|
|
988
|
+
]
|
|
989
|
+
} : {},
|
|
990
|
+
...input.metricName !== void 0 ? {
|
|
991
|
+
goalMetrics: [
|
|
992
|
+
{
|
|
993
|
+
id: randomUUID(),
|
|
994
|
+
name: input.metricName,
|
|
995
|
+
status: input.metricStatus ?? "pending",
|
|
996
|
+
...input.metricTarget !== void 0 ? { target: input.metricTarget } : {},
|
|
997
|
+
...input.metricCurrent !== void 0 ? { current: input.metricCurrent } : {},
|
|
998
|
+
...input.metricUnit !== void 0 ? { unit: input.metricUnit } : {},
|
|
999
|
+
...input.metricNotes !== void 0 ? { notes: input.metricNotes } : {}
|
|
1000
|
+
}
|
|
1001
|
+
]
|
|
1002
|
+
} : {},
|
|
1003
|
+
...input.url !== void 0 ? {
|
|
1004
|
+
links: [
|
|
1005
|
+
{
|
|
1006
|
+
url: input.url,
|
|
1007
|
+
type: input.linkType ?? "url",
|
|
1008
|
+
...input.linkTitle !== void 0 ? { title: input.linkTitle } : {}
|
|
1009
|
+
}
|
|
1010
|
+
]
|
|
1011
|
+
} : {},
|
|
1012
|
+
...input.note !== void 0 ? {
|
|
1013
|
+
notes: [
|
|
1014
|
+
{
|
|
1015
|
+
id: randomUUID(),
|
|
1016
|
+
author: input.author ?? "agent",
|
|
1017
|
+
content: input.note,
|
|
1018
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1019
|
+
}
|
|
1020
|
+
]
|
|
1021
|
+
} : {},
|
|
1022
|
+
// Origin tracking
|
|
1023
|
+
...input.graphId !== void 0 ? {
|
|
1024
|
+
origin: {
|
|
1025
|
+
system: input.sourceSystem ?? "kanban-tool",
|
|
1026
|
+
...input.graphId !== void 0 ? { graphId: input.graphId } : {},
|
|
1027
|
+
...input.specId !== void 0 ? { specId: input.specId } : {},
|
|
1028
|
+
...input.phaseId !== void 0 ? { phaseId: input.phaseId } : {}
|
|
1029
|
+
}
|
|
1030
|
+
} : {}
|
|
908
1031
|
};
|
|
909
1032
|
}
|
|
910
1033
|
function mergedDependsOn(input) {
|
|
@@ -918,6 +1041,7 @@ function taskPatch(input) {
|
|
|
918
1041
|
return {
|
|
919
1042
|
title: input.title,
|
|
920
1043
|
description: input.description,
|
|
1044
|
+
dueDate: input.dueDate,
|
|
921
1045
|
columnId: input.columnId,
|
|
922
1046
|
order: input.order,
|
|
923
1047
|
priority: input.priority,
|