( store: TaskLedgerStore, name: string, )
| 84 | } |
| 85 | |
| 86 | function buildTaskUpdateTool( |
| 87 | store: TaskLedgerStore, |
| 88 | name: string, |
| 89 | ): MakaTool< |
| 90 | { |
| 91 | id: string; |
| 92 | status?: (typeof TASK_STATUSES)[number]; |
| 93 | subject?: string; |
| 94 | blockedReason?: string; |
| 95 | failureReason?: string; |
| 96 | completionEvidence?: string; |
| 97 | explicitReopen?: boolean; |
| 98 | }, |
| 99 | string |
| 100 | > { |
| 101 | return { |
| 102 | name, |
| 103 | displayName: 'Task Update', |
| 104 | description: |
| 105 | 'Update a task in the session task ledger by id. Mark tasks in_progress when you start them; ' + |
| 106 | 'blocked, failed, and completed updates require a reason or evidence field. ' + |
| 107 | 'Reopening completed/cancelled tasks requires explicitReopen=true.', |
| 108 | parameters: z |
| 109 | .object({ |
| 110 | id: z |
| 111 | .string() |
| 112 | .min(1) |
| 113 | .max(TASK_ID_MAX_CHARS) |
| 114 | .refine( |
| 115 | isSafeTaskId, |
| 116 | 'Task reference must be a UUID or short key from the current ledger.', |
| 117 | ) |
| 118 | .describe('Task UUID or short key.'), |
| 119 | status: z.enum(TASK_STATUSES).optional().describe('New task status.'), |
| 120 | subject: z |
| 121 | .string() |
| 122 | .trim() |
| 123 | .min(1) |
| 124 | .max(TASK_SUBJECT_MAX_CHARS) |
| 125 | .optional() |
| 126 | .describe(`Revised task description (max ${TASK_SUBJECT_MAX_CHARS} characters).`), |
| 127 | blockedReason: z |
| 128 | .string() |
| 129 | .trim() |
| 130 | .min(1) |
| 131 | .max(TASK_EVIDENCE_MAX_CHARS) |
| 132 | .optional() |
| 133 | .describe( |
| 134 | 'Required when setting status to blocked. Explain the external input, dependency, or permission needed.', |
| 135 | ), |
| 136 | failureReason: z |
| 137 | .string() |
| 138 | .trim() |
| 139 | .min(1) |
| 140 | .max(TASK_EVIDENCE_MAX_CHARS) |
| 141 | .optional() |
| 142 | .describe( |
| 143 | 'Required when setting status to failed. Explain why the task cannot be completed.', |
no test coverage detected