@imenam/mcp-organizer 1.0.39 → 1.0.41

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.
Files changed (39) hide show
  1. package/README.md +3 -2
  2. package/dist/shared/logic/checkboxes.d.ts +32 -0
  3. package/dist/shared/logic/checkboxes.js +58 -0
  4. package/dist/shared/schemas/agent-tools.schema.d.ts +21 -0
  5. package/dist/shared/schemas/agent-tools.schema.js +12 -2
  6. package/dist/shared/schemas/api.schema.d.ts +6 -0
  7. package/dist/shared/schemas/api.schema.js +4 -0
  8. package/dist/shared/schemas/entities.schema.d.ts +2 -2
  9. package/dist/shared/schemas/entities.schema.js +2 -2
  10. package/dist/shared/schemas/tasks-api.schema.d.ts +12 -2
  11. package/dist/shared/schemas/tasks-api.schema.js +13 -5
  12. package/dist/src/agent-api/checklist.d.ts +5 -1
  13. package/dist/src/agent-api/checklist.js +17 -13
  14. package/dist/src/agent-api/questions.js +4 -2
  15. package/dist/src/agent-api/tasks.js +6 -11
  16. package/dist/src/core/agent.d.ts +2 -0
  17. package/dist/src/core/agent.js +7 -1
  18. package/dist/src/core/history.d.ts +14 -1
  19. package/dist/src/core/history.js +123 -1
  20. package/dist/src/core/notes.d.ts +3 -0
  21. package/dist/src/core/notes.js +13 -1
  22. package/dist/src/core/requests.d.ts +14 -4
  23. package/dist/src/core/requests.js +43 -18
  24. package/dist/src/core/spaces.js +17 -7
  25. package/dist/src/core/store.d.ts +21 -9
  26. package/dist/src/core/store.js +83 -28
  27. package/dist/src/core/tasks.d.ts +5 -0
  28. package/dist/src/core/tasks.js +25 -2
  29. package/dist/src/core/test-tasks.js +7 -14
  30. package/dist/src/gui-api.js +17 -6
  31. package/dist/src/mcp/start.d.ts +1 -1
  32. package/dist/src/mcp/start.js +3 -2
  33. package/dist/src/mcp/tools.js +11 -6
  34. package/gui/dist/assets/index-BqD-wglW.js +144 -0
  35. package/gui/dist/assets/index-e6E6S5zV.css +1 -0
  36. package/gui/dist/index.html +2 -2
  37. package/package.json +1 -1
  38. package/gui/dist/assets/index-CB0X_FZW.css +0 -1
  39. package/gui/dist/assets/index-xC5hAFk-.js +0 -122
@@ -850,7 +850,7 @@ export class Store {
850
850
  throw new NotFoundError(`Checkpoint ${id} not found.`);
851
851
  return checkpoint;
852
852
  }
853
- /** Points de vérification d'une tâche de test, dans l'ordre. */
853
+ /** Points de vérification d'une tâche, dans l'ordre. */
854
854
  listCheckpoints(taskId) {
855
855
  const rows = this.db.prepare("SELECT * FROM test_checkpoints WHERE task_id = ? ORDER BY position").all(taskId);
856
856
  return rows.map(checkpointFromRow);
@@ -2026,7 +2026,7 @@ export class Mutation {
2026
2026
  this.touch("task_question", question.id, task.spaceId, null, taskId);
2027
2027
  return this.store.questionSnapshot(question.id);
2028
2028
  }
2029
- /** Change le texte d'une question ou son type de choix ; un choix unique n'accepte qu'une réponse. */
2029
+ /** Change le texte d'une question ou son type de choix ; un choix unique n'accepte qu'une proposition. */
2030
2030
  updateQuestion(id, patch) {
2031
2031
  const current = this.store.getQuestion(id);
2032
2032
  const question = validate(TaskQuestionSchema, { ...current, ...definedFields(patch) }, "question");
@@ -2147,25 +2147,22 @@ export class Mutation {
2147
2147
  .prepare("INSERT INTO question_options (id, question_id, label, detail, recommended, selected, position) VALUES (?, ?, ?, ?, ?, ?, ?)")
2148
2148
  .run(option.id, option.questionId, option.label, option.detail, option.recommended ? 1 : 0, option.selected ? 1 : 0, option.position);
2149
2149
  }
2150
- /** Un choix unique a pour réponse une seule proposition ou la réponse libre. */
2150
+ /** Un choix unique retient au plus une proposition ; la réponse libre peut l'accompagner. */
2151
2151
  requireSingleAnswer(question, options) {
2152
- const answers = options.filter((option) => option.selected).length + (question.otherAnswer === null ? 0 : 1);
2153
- if (answers > 1)
2154
- throw new InvariantError(`"${question.text}" is a single-choice question: it takes one option or a free answer, not ${answers}.`);
2152
+ const selected = options.filter((option) => option.selected).length;
2153
+ if (selected > 1)
2154
+ throw new InvariantError(`"${question.text}" is a single-choice question: it takes one option, not ${selected}.`);
2155
2155
  }
2156
2156
  touchQuestion(question) {
2157
2157
  this.touch("task_question", question.id, this.store.getTask(question.taskId).spaceId, null, question.taskId);
2158
2158
  }
2159
2159
  // --- Checklist ---
2160
2160
  /**
2161
- * Ajoute un élément à la checklist d'une tâche standard : juste après
2162
- * `afterId` (null : en tête), en fin de liste sans `afterId`.
2161
+ * Ajoute un élément à la checklist d'une tâche : juste après `afterId`
2162
+ * (null : en tête), en fin de liste sans `afterId`.
2163
2163
  */
2164
2164
  addChecklistItem(taskId, text, afterId) {
2165
2165
  const task = this.store.getTask(taskId);
2166
- if (task.type !== "standard") {
2167
- throw new InvariantError(`Task ${taskLabel(this.db, task)} is a test: it has checkpoints, not a checklist.`);
2168
- }
2169
2166
  const items = this.store.listChecklist(taskId);
2170
2167
  const position = this.slotAfter(items, afterId === undefined ? (items.at(-1)?.id ?? null) : afterId, `Checklist item ${afterId} is not in this checklist`, (ids) => {
2171
2168
  const update = this.db.prepare("UPDATE checklist_items SET position = ? WHERE id = ?");
@@ -2197,8 +2194,6 @@ export class Mutation {
2197
2194
  restoreChecklistItem(snapshot) {
2198
2195
  const item = validate(ChecklistItemSchema, snapshot, "checklist item");
2199
2196
  const task = this.store.getTask(item.taskId);
2200
- if (task.type !== "standard")
2201
- throw new InvariantError(`Task ${taskLabel(this.db, task)} is a test: it has checkpoints, not a checklist.`);
2202
2197
  this.db
2203
2198
  .prepare("INSERT INTO checklist_items (id, task_id, text, done, position) VALUES (?, ?, ?, ?, ?)")
2204
2199
  .run(item.id, item.taskId, item.text, item.done ? 1 : 0, item.position);
@@ -2251,31 +2246,23 @@ export class Mutation {
2251
2246
  renumber(items.map((item) => item.id));
2252
2247
  return positionBetween(index > 0 ? index : null, index < items.length ? index + 1 : null);
2253
2248
  }
2254
- // --- Tâches de test ---
2255
- /** Tâche de test qui porte des points de vérification. */
2256
- testTask(taskId) {
2257
- const task = this.store.getTask(taskId);
2258
- if (task.type !== "test") {
2259
- throw new InvariantError(`Task ${taskLabel(this.db, task)} is a standard task: it has a checklist, not test checkpoints.`);
2260
- }
2261
- return task;
2262
- }
2263
- /** Tâche de test dont l'utilisateur acteur est testeur (assigné). */
2249
+ // --- Tests ---
2250
+ /** Tâche dont l'utilisateur acteur est testeur (assigné). */
2264
2251
  testedTask(taskId) {
2265
- const task = this.testTask(taskId);
2252
+ const task = this.store.getTask(taskId);
2266
2253
  if (!this.store.listAssigneeIds(taskId).includes(this.actingUserId)) {
2267
2254
  throw new ForbiddenError(`Only the testers (assignees) of task ${taskLabel(this.db, task)} can record results and reviews; assign the user first.`);
2268
2255
  }
2269
2256
  return task;
2270
2257
  }
2271
2258
  /**
2272
- * Ajoute un point de vérification à une tâche de test : juste après
2259
+ * Ajoute un point de vérification à une tâche : juste après
2273
2260
  * `afterId` (null : en tête), en fin de liste sans `afterId`.
2274
2261
  */
2275
2262
  addCheckpoint(taskId, text, afterId) {
2276
- const task = this.testTask(taskId);
2263
+ const task = this.store.getTask(taskId);
2277
2264
  const checkpoints = this.store.listCheckpoints(taskId);
2278
- const position = this.slotAfter(checkpoints, afterId === undefined ? (checkpoints.at(-1)?.id ?? null) : afterId, `Checkpoint ${afterId} is not in this test`, (ids) => {
2265
+ const position = this.slotAfter(checkpoints, afterId === undefined ? (checkpoints.at(-1)?.id ?? null) : afterId, `Checkpoint ${afterId} is not in the checkpoints of this task`, (ids) => {
2279
2266
  const update = this.db.prepare("UPDATE test_checkpoints SET position = ? WHERE id = ?");
2280
2267
  ids.forEach((checkpointId, index) => {
2281
2268
  update.run(index + 1, checkpointId);
@@ -2305,7 +2292,7 @@ export class Mutation {
2305
2292
  /** Recrée un point de vérification supprimé, avec son identifiant, sa position et les résultats saisis dessus. */
2306
2293
  restoreCheckpoint(snapshot, results) {
2307
2294
  const checkpoint = validate(TestCheckpointSchema, snapshot, "checkpoint");
2308
- const task = this.testTask(checkpoint.taskId);
2295
+ const task = this.store.getTask(checkpoint.taskId);
2309
2296
  this.db
2310
2297
  .prepare("INSERT INTO test_checkpoints (id, task_id, text, position) VALUES (?, ?, ?, ?)")
2311
2298
  .run(checkpoint.id, checkpoint.taskId, checkpoint.text, checkpoint.position);
@@ -2445,6 +2432,19 @@ export class Mutation {
2445
2432
  this.db.prepare("DELETE FROM comments WHERE id = ?").run(id);
2446
2433
  this.touch("comment", id, this.store.getTask(comment.taskId).spaceId, null, comment.taskId);
2447
2434
  }
2435
+ /** Recrée un commentaire de l'agent supprimé, avec son identifiant ; sa réponse à un commentaire disparu depuis est oubliée. */
2436
+ restoreComment(snapshot) {
2437
+ const task = this.store.getTask(snapshot.taskId);
2438
+ if (this.store.findComment(snapshot.id))
2439
+ throw new InvariantError(`Comment ${snapshot.id} already exists.`);
2440
+ const replyToCommentId = snapshot.replyToCommentId !== null && this.store.findComment(snapshot.replyToCommentId) ? snapshot.replyToCommentId : null;
2441
+ const comment = validate(CommentSchema, { ...snapshot, replyToCommentId }, "comment");
2442
+ this.db
2443
+ .prepare("INSERT INTO comments (id, task_id, author_id, body, created_at, edited_at, request_id, reply_to_comment_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
2444
+ .run(comment.id, comment.taskId, comment.authorId, comment.body, comment.createdAt, comment.editedAt, comment.requestId, comment.replyToCommentId);
2445
+ this.touch("comment", comment.id, task.spaceId, null, task.id);
2446
+ return comment;
2447
+ }
2448
2448
  authoredComment(id, action) {
2449
2449
  const comment = this.store.getComment(id);
2450
2450
  if (comment.authorId !== this.actingUserId)
@@ -2469,6 +2469,18 @@ export class Mutation {
2469
2469
  this.touch("attachment", id, this.store.getTask(attachment.taskId).spaceId, null, attachment.taskId);
2470
2470
  return attachment;
2471
2471
  }
2472
+ /** Recrée l'enregistrement d'une pièce jointe supprimée, avec son identifiant ; son fichier doit encore exister sous `storagePath`. */
2473
+ restoreAttachment(snapshot) {
2474
+ const task = this.store.getTask(snapshot.taskId);
2475
+ if (this.store.findAttachment(snapshot.id))
2476
+ throw new InvariantError(`Attachment ${snapshot.id} already exists.`);
2477
+ const attachment = validate(AttachmentSchema, snapshot, "attachment");
2478
+ this.db
2479
+ .prepare("INSERT INTO attachments (id, task_id, uploader_id, filename, mime, size, storage_path, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")
2480
+ .run(attachment.id, attachment.taskId, attachment.uploaderId, attachment.filename, attachment.mime, attachment.size, attachment.storagePath, attachment.createdAt);
2481
+ this.touch("attachment", attachment.id, task.spaceId, null, task.id);
2482
+ return attachment;
2483
+ }
2472
2484
  /** Enregistre une image de demande, encore rattachée à aucune demande, dont le fichier est déjà écrit sous `storagePath`. */
2473
2485
  createRequestAttachment(input) {
2474
2486
  this.store.getSpace(input.spaceId);
@@ -2582,6 +2594,20 @@ export class Mutation {
2582
2594
  return idea;
2583
2595
  }
2584
2596
  /** Supprime une idée ; sa version de suppression a un instantané nul. */
2597
+ /** Recrée une idée supprimée, avec son identifiant ; sa tâche issue de l'idée est oubliée si elle n'existe plus. */
2598
+ restoreIdea(snapshot) {
2599
+ this.store.getSpace(snapshot.spaceId);
2600
+ if (this.store.findIdea(snapshot.id))
2601
+ throw new InvariantError(`Idea ${snapshot.id} already exists.`);
2602
+ const promotedTaskId = snapshot.promotedTaskId !== null && this.store.findTask(snapshot.promotedTaskId) ? snapshot.promotedTaskId : null;
2603
+ const idea = validate(IdeaSchema, { ...snapshot, promotedTaskId }, "idea");
2604
+ this.db
2605
+ .prepare(`INSERT INTO ideas (id, space_id, author_id, text, origin, request_id, promoted_task_id, archived_at, created_at)
2606
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
2607
+ .run(idea.id, idea.spaceId, idea.authorId, idea.text, idea.origin, idea.requestId, idea.promotedTaskId, idea.archivedAt, idea.createdAt);
2608
+ this.touch("idea", idea.id, idea.spaceId, null);
2609
+ return idea;
2610
+ }
2585
2611
  deleteIdea(id) {
2586
2612
  const idea = this.store.getIdea(id);
2587
2613
  this.db.prepare("DELETE FROM ideas WHERE id = ?").run(id);
@@ -3065,6 +3091,17 @@ export class Mutation {
3065
3091
  this.touch("agent_action", id, this.store.getAgentRequest(action.requestId).targetSpaceId, null, taskId);
3066
3092
  return { ...action, undoneAt: this.now, undoneBy: this.actor.userId };
3067
3093
  }
3094
+ /** Marque rétablie une action de l'agent annulée, par l'utilisateur acteur : elle redevient active. */
3095
+ markAgentActionRedone(id, taskId) {
3096
+ if (this.actor.type !== "user")
3097
+ throw new InvariantError("Only a user can redo an agent action.");
3098
+ const action = this.store.getAgentAction(id);
3099
+ if (action.undoneAt === null)
3100
+ throw new InvariantError(`Agent action ${id} is not undone.`);
3101
+ this.db.prepare("UPDATE agent_actions SET undone_at = NULL, undone_by = NULL WHERE id = ?").run(id);
3102
+ this.touch("agent_action", id, this.store.getAgentRequest(action.requestId).targetSpaceId, null, taskId);
3103
+ return { ...action, undoneAt: null, undoneBy: null };
3104
+ }
3068
3105
  // --- Chrono ---
3069
3106
  /**
3070
3107
  * Démarre une session de chrono d'un membre sur une tâche, en marche dès
@@ -3139,6 +3176,24 @@ export class Mutation {
3139
3176
  }
3140
3177
  return this.writeTimeSessionState(current, state);
3141
3178
  }
3179
+ /**
3180
+ * Recrée une session de chrono supprimée, avec son identifiant ; refusé
3181
+ * quand une autre session du membre occupe désormais la tâche, ou tourne
3182
+ * alors que la session recréée est en marche.
3183
+ */
3184
+ restoreTimeSession(snapshot) {
3185
+ this.store.getTask(snapshot.taskId);
3186
+ if (this.store.findTimeSession(snapshot.id))
3187
+ throw new InvariantError(`Time session ${snapshot.id} already exists.`);
3188
+ const session = validate(TimeSessionSchema, snapshot, "time session");
3189
+ if (session.endedAt === null && this.store.findActiveTimeSession(session.taskId, session.userId))
3190
+ throw new InvariantError("Un autre chrono a été démarré depuis sur cette tâche : rétablissement impossible.");
3191
+ if (session.runningSince !== null && this.store.findRunningTimeSessionOf(session.userId))
3192
+ throw new InvariantError("Un autre chrono tourne désormais : mettez-le en pause avant de rétablir.");
3193
+ this.insertTimeSession(session);
3194
+ this.touchTimeSession(session);
3195
+ return session;
3196
+ }
3142
3197
  deleteTimeSession(id) {
3143
3198
  const session = this.store.getTimeSession(id);
3144
3199
  this.db.prepare("DELETE FROM time_sessions WHERE id = ?").run(id);
@@ -5,6 +5,7 @@ import type { Space, Task } from "../../shared/schemas/entities.schema.js";
5
5
  import type { TaskStatus } from "../../shared/schemas/enums.schema.js";
6
6
  import { type AttachmentView, type BoardResponse, type ChangesResponse, type ChecklistItemView, type CommentView, type CreateTaskRequest, type TaskDetailResponse, type TaskFilters, type TaskKeyTarget, type TaskView, type UpdateTaskRequest, type UploadAttachmentRequest } from "../../shared/schemas/tasks-api.schema.js";
7
7
  import type { ApiFile } from "../../shared/schemas/gui-api.schema.js";
8
+ import { type CheckboxTarget } from "../../shared/logic/checkboxes.js";
8
9
  /**
9
10
  * Tâches, checklist, commentaires et pièces jointes, avec les droits de la
10
11
  * GUI : tout membre d'un espace lit et modifie ses tâches ; un non-membre
@@ -38,6 +39,8 @@ export declare function getTaskDetail(store: Store, userId: string, taskId: stri
38
39
  export declare function listChanges(store: Store, userId: string, since: number | null): ChangesResponse;
39
40
  export declare function createTask(store: Store, userId: string, spaceId: string, input: CreateTaskRequest): TaskView;
40
41
  export declare function updateTask(store: Store, userId: string, taskId: string, patch: UpdateTaskRequest): TaskView;
42
+ /** Coche ou décoche une case de la description, comme une modification de la description. */
43
+ export declare function toggleDescriptionCheckbox(store: Store, userId: string, taskId: string, target: CheckboxTarget): TaskView;
41
44
  /** Supprime une tâche, ses sous-tâches et les fichiers de leurs pièces jointes. */
42
45
  export declare function deleteTask(store: Store, storage: AttachmentStorage, userId: string, taskId: string): void;
43
46
  export declare function moveTask(store: Store, userId: string, taskId: string, status: TaskStatus, afterId: string | null): TaskView;
@@ -50,6 +53,8 @@ export declare function updateChecklistItem(store: Store, userId: string, itemId
50
53
  }): ChecklistItemView;
51
54
  export declare function deleteChecklistItem(store: Store, userId: string, itemId: string): void;
52
55
  export declare function moveChecklistItem(store: Store, userId: string, itemId: string, afterId: string | null): ChecklistItemView;
56
+ /** Coche ou décoche une case d'un commentaire ; seul son auteur le peut, comme pour le modifier. */
57
+ export declare function toggleCommentCheckbox(store: Store, userId: string, commentId: string, target: CheckboxTarget): CommentView;
53
58
  /**
54
59
  * Ajoute un commentaire. Un commentaire qui mentionne @agent confie aussi une
55
60
  * demande `message` à l'agent, dans l'espace de la tâche, avec la tâche pour
@@ -5,6 +5,7 @@ import { requireMember } from "./spaces.js";
5
5
  import { downloadRequestAttachment } from "./request-attachments.js";
6
6
  import { MAX_ATTACHMENT_BYTES, } from "../../shared/schemas/tasks-api.schema.js";
7
7
  import { summarizeTest } from "../../shared/logic/test-summary.js";
8
+ import { CHECKBOX_CONFLICT, toggleCheckbox } from "../../shared/logic/checkboxes.js";
8
9
  import { questionViews } from "./questions.js";
9
10
  import { testDetail } from "./test-tasks.js";
10
11
  import { taskTime } from "./timers.js";
@@ -122,7 +123,7 @@ function buildForest(store, space) {
122
123
  subtasks: { done: 0, total: 0 },
123
124
  checklist: checklists.get(task.id) ?? { done: 0, total: 0 },
124
125
  questions: questions.get(task.id) ?? { done: 0, total: 0 },
125
- test: task.type === "test" ? summarizeTest(checkpoints.get(task.id) ?? [], results.get(task.id) ?? [], assignees.get(task.id) ?? []) : null,
126
+ test: task.type === "test" || checkpoints.has(task.id) ? summarizeTest(checkpoints.get(task.id) ?? [], results.get(task.id) ?? [], assignees.get(task.id) ?? []) : null,
126
127
  children: [],
127
128
  });
128
129
  }
@@ -238,7 +239,7 @@ export function getTaskDetail(store, userId, taskId, now = new Date()) {
238
239
  children: byId.get(task.id).children,
239
240
  questions: questionViews(store, task.id),
240
241
  checklist,
241
- test: task.type === "test" ? testDetail(store, task) : null,
242
+ test: testDetail(store, task),
242
243
  comments,
243
244
  attachments: store.listAttachments(task.id).map(attachmentView),
244
245
  members: membersOf(store, space.id),
@@ -294,6 +295,19 @@ export function updateTask(store, userId, taskId, patch) {
294
295
  });
295
296
  return taskView(store, space, store.getTask(taskId));
296
297
  }
298
+ /** Coche ou décoche une case de la description, comme une modification de la description. */
299
+ export function toggleDescriptionCheckbox(store, userId, taskId, target) {
300
+ const space = store.mutate(asUser(userId), (tx) => {
301
+ const { space, task } = requireTask(tx.store, taskId, userId);
302
+ const description = toggleCheckbox(task.description, target);
303
+ if (description === null)
304
+ throw new InvariantError(CHECKBOX_CONFLICT);
305
+ if (description !== task.description)
306
+ tx.updateTask(taskId, { description });
307
+ return space;
308
+ });
309
+ return taskView(store, space, store.getTask(taskId));
310
+ }
297
311
  /** Supprime une tâche, ses sous-tâches et les fichiers de leurs pièces jointes. */
298
312
  export function deleteTask(store, storage, userId, taskId) {
299
313
  const removed = store.mutate(asUser(userId), (tx) => {
@@ -416,6 +430,7 @@ function commentView(store, userId, comment) {
416
430
  requestId: answered.id,
417
431
  followUps: store.listFollowUps(answered.id).map((point) => followUpView(store, point)),
418
432
  liveActions: store.listAgentActions(answered.id).filter((action) => action.undoneAt === null).length,
433
+ undoneActions: store.listAgentActions(answered.id).filter((action) => action.undoneAt !== null).length,
419
434
  canUndo: answered.status === "done" || answered.status === "failed",
420
435
  }
421
436
  : null,
@@ -428,6 +443,14 @@ function requireComment(store, commentId, userId) {
428
443
  requireTask(store, comment.taskId, userId);
429
444
  return comment;
430
445
  }
446
+ /** Coche ou décoche une case d'un commentaire ; seul son auteur le peut, comme pour le modifier. */
447
+ export function toggleCommentCheckbox(store, userId, commentId, target) {
448
+ const current = requireComment(store, commentId, userId);
449
+ const body = toggleCheckbox(current.body, target);
450
+ if (body === null)
451
+ throw new InvariantError(CHECKBOX_CONFLICT);
452
+ return body === current.body ? commentView(store, userId, current) : updateComment(store, userId, commentId, body);
453
+ }
431
454
  /**
432
455
  * Ajoute un commentaire. Un commentaire qui mentionne @agent confie aussi une
433
456
  * demande `message` à l'agent, dans l'espace de la tâche, avec la tâche pour
@@ -1,8 +1,8 @@
1
- import { ForbiddenError, InvariantError } from "./errors.js";
1
+ import { ForbiddenError } from "./errors.js";
2
2
  import { notFound, requireTask } from "./tasks.js";
3
3
  import { summarizeTest } from "../../shared/logic/test-summary.js";
4
4
  /**
5
- * Tâches de test, avec les droits de la GUI : tout membre de l'espace gère
5
+ * Tests d'une tâche, avec les droits de la GUI : tout membre de l'espace gère
6
6
  * les points de vérification ; seul un testeur (assigné de la tâche) saisit
7
7
  * ses propres résultats, son brouillon de review et la soumet. Les résultats
8
8
  * et reviews d'un ancien testeur restent affichés, en lecture seule. Les
@@ -56,33 +56,26 @@ export function testDetail(store, task) {
56
56
  };
57
57
  }
58
58
  // --- Droits ---------------------------------------------------------------------
59
- /** Tâche de test d'un espace dont `userId` est membre. */
60
- function requireTestTask(store, taskId, userId) {
61
- const { task } = requireTask(store, taskId, userId);
62
- if (task.type !== "test")
63
- throw new InvariantError("Cette tâche n'est pas une tâche de test : elle a une checklist, pas de points de vérification.");
64
- return task;
65
- }
66
- /** Tâche de test dont `userId` est testeur. */
59
+ /** Tâche dont `userId` est testeur. */
67
60
  function requireTester(store, taskId, userId) {
68
- const task = requireTestTask(store, taskId, userId);
61
+ const { task } = requireTask(store, taskId, userId);
69
62
  if (!store.listAssigneeIds(taskId).includes(userId)) {
70
63
  throw new ForbiddenError("Seuls les testeurs de la tâche saisissent des résultats et une review : assignez-vous d'abord la tâche.");
71
64
  }
72
65
  return task;
73
66
  }
74
- /** Point de vérification d'une tâche de test dont `userId` est membre de l'espace. */
67
+ /** Point de vérification d'une tâche dont `userId` est membre de l'espace. */
75
68
  function requireCheckpoint(store, checkpointId, userId) {
76
69
  const checkpoint = store.findCheckpoint(checkpointId);
77
70
  if (!checkpoint)
78
71
  throw notFound();
79
- requireTestTask(store, checkpoint.taskId, userId);
72
+ requireTask(store, checkpoint.taskId, userId);
80
73
  return checkpoint;
81
74
  }
82
75
  // --- Points de vérification -----------------------------------------------------
83
76
  export function addCheckpoint(store, userId, taskId, text) {
84
77
  const { id, text: saved, position } = store.mutate(asUser(userId), (tx) => {
85
- requireTestTask(tx.store, taskId, userId);
78
+ requireTask(tx.store, taskId, userId);
86
79
  return tx.addCheckpoint(taskId, text);
87
80
  });
88
81
  return { id, text: saved, position };
@@ -2,15 +2,15 @@ import { ActivateRequestSchema, ChangePasswordRequestSchema, CreateSpaceRequestS
2
2
  import { ForbiddenError, InvariantError, NotFoundError, OrganizerError, UnauthorizedError } from "./core/errors.js";
3
3
  import { authenticate, changePassword, login, logout, redeemAccessLink, resolveAccessLink, updateDisplayName } from "./core/accounts.js";
4
4
  import { acceptReceivedInvitation, createSharedSpace, declineReceivedInvitation, deleteSpace, inviteToSpace, leaveSpace, listMembers, listMemberSuggestions, listReceivedInvitations, listSpaces, removeMember, updateSpace, resendInvitation, revokeInvitation, } from "./core/spaces.js";
5
- import { addChecklistItem, addComment, createTask, deleteAttachment, deleteChecklistItem, deleteComment, deleteTask, downloadAttachment, getBoard, getTaskDetail, listChanges, moveChecklistItem, moveTask, resolveTaskKey, setAssignees, setTags, updateChecklistItem, updateComment, updateTask, uploadAttachment, } from "./core/tasks.js";
5
+ import { addChecklistItem, addComment, createTask, deleteAttachment, deleteChecklistItem, deleteComment, deleteTask, downloadAttachment, getBoard, getTaskDetail, listChanges, moveChecklistItem, moveTask, resolveTaskKey, setAssignees, setTags, updateChecklistItem, updateComment, updateTask, toggleCommentCheckbox, toggleDescriptionCheckbox, uploadAttachment, } from "./core/tasks.js";
6
6
  import { answerQuestion } from "./core/questions.js";
7
7
  import { listTimers, pauseTimer, resumeTimer, startTimer, stopTimer } from "./core/timers.js";
8
8
  import { StartTimerRequestSchema } from "../shared/schemas/timers-api.schema.js";
9
9
  import { addCheckpoint, deleteCheckpoint, moveCheckpoint, saveReviewDraft, setTestResult, submitReview, updateCheckpoint } from "./core/test-tasks.js";
10
- import { AddChecklistItemRequestSchema, AnswerQuestionRequestSchema, CheckpointTextRequestSchema, CommentRequestSchema, CreateTaskRequestSchema, MoveAfterRequestSchema, MoveTaskRequestSchema, ReviewDraftRequestSchema, SetAssigneesRequestSchema, SetTagsRequestSchema, SetTestResultRequestSchema, SubmitReviewRequestSchema, TaskFiltersSchema, TaskKeyQuerySchema, UpdateChecklistItemRequestSchema, UpdateTaskRequestSchema, UploadAttachmentRequestSchema, } from "../shared/schemas/tasks-api.schema.js";
10
+ import { AddChecklistItemRequestSchema, AnswerQuestionRequestSchema, CheckpointTextRequestSchema, CommentRequestSchema, ToggleCheckboxRequestSchema, CreateTaskRequestSchema, MoveAfterRequestSchema, MoveTaskRequestSchema, ReviewDraftRequestSchema, SetAssigneesRequestSchema, SetTagsRequestSchema, SetTestResultRequestSchema, SubmitReviewRequestSchema, TaskFiltersSchema, TaskKeyQuerySchema, UpdateChecklistItemRequestSchema, UpdateTaskRequestSchema, UploadAttachmentRequestSchema, } from "../shared/schemas/tasks-api.schema.js";
11
11
  import { getSettings, getSpaceNotificationSettings, listNotifications, markAllNotificationsRead, markNotificationRead, unreadCount, updateSettings, updateSpaceNotificationSettings } from "./core/notifications.js";
12
12
  import { NotificationListQuerySchema, UpdateSettingsRequestSchema, UpdateSpaceNotificationSettingsRequestSchema } from "../shared/schemas/notifications-api.schema.js";
13
- import { cancelRequest, createRequest, createSuite, getRequest, listRequests, relaunchRequest, resendRequest, setFollowUpDone, setRequestDismissed, stopRequest, undoAction, undoRequest, updateRequest, } from "./core/requests.js";
13
+ import { cancelRequest, createRequest, createSuite, getRequest, listRequests, relaunchRequest, resendRequest, setFollowUpDone, setRequestDismissed, stopRequest, redoAction, redoRequest, undoAction, undoRequest, updateRequest, } from "./core/requests.js";
14
14
  import { listTaskHistory, restoreTaskVersion } from "./core/task-history.js";
15
15
  import { deleteRequestAttachment, uploadRequestAttachment } from "./core/request-attachments.js";
16
16
  import { listSpaceHistory, restoreDeletedTask } from "./core/space-history.js";
@@ -20,7 +20,7 @@ import { createBoardView, deleteBoardView, listBoardViews, moveBoardView, update
20
20
  import { CreateBoardViewRequestSchema, MoveBoardViewRequestSchema, UpdateBoardViewRequestSchema } from "../shared/schemas/views-api.schema.js";
21
21
  import { createIdea, delegatePromotion, listIdeas, promoteIdea, setIdeaArchived } from "./core/ideas.js";
22
22
  import { CreateIdeaRequestSchema, PromoteIdeaRequestSchema, UpdateIdeaRequestSchema } from "../shared/schemas/ideas-api.schema.js";
23
- import { createNote, deleteNote, getNote, listNotes, sendNoteToAgent, updateNote } from "./core/notes.js";
23
+ import { createNote, deleteNote, getNote, listNotes, sendNoteToAgent, toggleNoteCheckbox, updateNote } from "./core/notes.js";
24
24
  import { CreateNoteRequestSchema, SendNoteRequestSchema, UpdateNoteRequestSchema } from "../shared/schemas/notes-api.schema.js";
25
25
  import { deleteDocument, downloadDocument, listDocuments, replaceDocument, updateDocument, uploadDocument } from "./core/documents.js";
26
26
  import { UpdateDocumentRequestSchema } from "../shared/schemas/documents-api.schema.js";
@@ -258,6 +258,9 @@ route("GET", "/task-keys/:key", (ctx, { user, request, params }) => {
258
258
  route("PATCH", "/tasks/:taskId", (ctx, { user, request, params }) => ({
259
259
  body: updateTask(ctx.store, user.id, params.taskId, parseBody(UpdateTaskRequestSchema, request.body)),
260
260
  }));
261
+ route("POST", "/tasks/:taskId/description/checkbox", (ctx, { user, request, params }) => ({
262
+ body: toggleDescriptionCheckbox(ctx.store, user.id, params.taskId, parseBody(ToggleCheckboxRequestSchema, request.body)),
263
+ }));
261
264
  route("DELETE", "/tasks/:taskId", (ctx, { user, params }) => {
262
265
  deleteTask(ctx.store, ctx.attachments, user.id, params.taskId);
263
266
  return { body: ok };
@@ -327,6 +330,9 @@ route("POST", "/tasks/:taskId/comments", (ctx, { user, request, params }) => ({
327
330
  route("PATCH", "/comments/:commentId", (ctx, { user, request, params }) => ({
328
331
  body: updateComment(ctx.store, user.id, params.commentId, parseBody(CommentRequestSchema, request.body).body),
329
332
  }));
333
+ route("POST", "/comments/:commentId/checkbox", (ctx, { user, request, params }) => ({
334
+ body: toggleCommentCheckbox(ctx.store, user.id, params.commentId, parseBody(ToggleCheckboxRequestSchema, request.body)),
335
+ }));
330
336
  route("DELETE", "/comments/:commentId", (ctx, { user, params }) => {
331
337
  deleteComment(ctx.store, user.id, params.commentId);
332
338
  return { body: ok };
@@ -370,6 +376,9 @@ route("GET", "/notes/:noteId", (ctx, { user, params }) => ({ body: getNote(ctx.s
370
376
  route("PATCH", "/notes/:noteId", (ctx, { user, request, params }) => ({
371
377
  body: updateNote(ctx.store, user.id, params.noteId, parseBody(UpdateNoteRequestSchema, request.body)),
372
378
  }));
379
+ route("POST", "/notes/:noteId/checkbox", (ctx, { user, request, params }) => ({
380
+ body: toggleNoteCheckbox(ctx.store, user.id, params.noteId, parseBody(ToggleCheckboxRequestSchema, request.body)),
381
+ }));
373
382
  route("DELETE", "/notes/:noteId", (ctx, { user, params }) => {
374
383
  deleteNote(ctx.store, user.id, params.noteId);
375
384
  return { body: ok };
@@ -414,14 +423,16 @@ route("PUT", "/requests/:requestId/dismissed", (ctx, { user, request, params })
414
423
  route("POST", "/requests/:requestId/resend", (ctx, { user, request, params }) => ({
415
424
  body: resendRequest(ctx.store, user.id, params.requestId, parseBody(ResendRequestSchema, request.body).text),
416
425
  }));
417
- route("POST", "/requests/:requestId/undo", (ctx, { user, params }) => ({ body: undoRequest(ctx.store, ctx.attachments, user.id, params.requestId) }));
426
+ route("POST", "/requests/:requestId/undo", (ctx, { user, params }) => ({ body: undoRequest(ctx.store, user.id, params.requestId) }));
427
+ route("POST", "/requests/:requestId/redo", (ctx, { user, params }) => ({ body: redoRequest(ctx.store, ctx.attachments, user.id, params.requestId) }));
418
428
  route("POST", "/requests/:requestId/suites", (ctx, { user, request, params }) => ({
419
429
  body: createSuite(ctx.store, user.id, params.requestId, parseBody(CreateSuiteSchema, request.body).text),
420
430
  }));
421
431
  route("PUT", "/follow-ups/:followUpId", (ctx, { user, request, params }) => ({
422
432
  body: setFollowUpDone(ctx.store, user.id, params.followUpId, parseBody(SetFollowUpDoneSchema, request.body).done),
423
433
  }));
424
- route("POST", "/agent-actions/:actionId/undo", (ctx, { user, params }) => ({ body: undoAction(ctx.store, ctx.attachments, user.id, params.actionId) }));
434
+ route("POST", "/agent-actions/:actionId/undo", (ctx, { user, params }) => ({ body: undoAction(ctx.store, user.id, params.actionId) }));
435
+ route("POST", "/agent-actions/:actionId/redo", (ctx, { user, params }) => ({ body: redoAction(ctx.store, ctx.attachments, user.id, params.actionId) }));
425
436
  route("GET", "/tasks/:taskId/history", (ctx, { user, params }) => ({ body: listTaskHistory(ctx.store, user.id, params.taskId) }));
426
437
  route("POST", "/tasks/:taskId/restore", (ctx, { user, params }) => ({ body: restoreDeletedTask(ctx.store, user.id, params.taskId) }));
427
438
  route("GET", "/spaces/:spaceId/history", (ctx, { user, request, params }) => {
@@ -1,6 +1,6 @@
1
1
  import { type SiteConnection } from "./client.js";
2
2
  /** Présentation du serveur transmise au client MCP : concepts et déroulé. */
3
- export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as `![file name](attachment:<id>)`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request \u2014 a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment \u2014 a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.\n- A request can carry **images** its author pasted in its text (`![file name](attachment:<id>)`): claim_request lists them with their id. Open them with get_attachment, and attach the ones that explain a task you create or change with copy_attachment, which copies the file on the site: the task then reads without the request.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- **Mentions**: a text mentions a task by its key (`ORG-30`), which the site shows as a button with the task's status and its key or current title, and a page of the space by a markdown link to its address, which the site shows as a pill named after the current name of its target (the link text is only a fallback): `[Tableau de bord](#/tableau-de-bord)`. An address without a space designates the space of the text; members' mentions carry it (`#/espaces/<space id>/\u2026`). Addresses: dashboard `#/tableau-de-bord`, one of the reader's views `#/tableau-de-bord/vue/<view id>`, ideas `#/idees`, notes `#/notes`, a note `#/notes/<note id>`, documents `#/documents`, a document `#/documents/<document id>`, the agent page `#/agent` and its tabs `#/agent/file`, `#/agent/en-traitement`, `#/agent/en-attente`, `#/agent/traitees`, `#/agent/annulees`, history `#/historique`, space settings `#/espace`. Write mentions the same way in your descriptions, comments and replies.\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_attachment for an image of the request or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, copy_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, only what blocks the request and prevents you from completing it, never a point already carried by a task, a checklist item or a question (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When something blocks the work and prevents you from completing it, leave it to your user with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something that blocks the request: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
3
+ export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task can carry a checklist and test checkpoints that each tester (assignee) marks ok, ko, blocked or untested. Its type, standard or test, is only an indicator of what it is about: it restricts neither. Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments, checkpoint comments and free answers to questions: such an image is an attachment of the task, referenced in the text as `![file name](attachment:<id>)`, and get_task flags the comments, checkpoint comments and free answers that contain one. Open with get_attachment the images and PDF files that matter for the request \u2014 a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment \u2014 a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.\n- A request can carry **images** its author pasted in its text (`![file name](attachment:<id>)`): claim_request lists them with their id. Open them with get_attachment, and attach the ones that explain a task you create or change with copy_attachment, which copies the file on the site: the task then reads without the request.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- **Mentions**: a text mentions a task by its key (`ORG-30`), which the site shows as a button with the task's status and its key or current title, and a page of the space by a markdown link to its address, which the site shows as a pill named after the current name of its target (the link text is only a fallback): `[Tableau de bord](#/tableau-de-bord)`. An address without a space designates the space of the text; members' mentions carry it (`#/espaces/<space id>/\u2026`). Addresses: dashboard `#/tableau-de-bord`, one of the reader's views `#/tableau-de-bord/vue/<view id>`, ideas `#/idees`, notes `#/notes`, a note `#/notes/<note id>`, documents `#/documents`, a document `#/documents/<document id>`, the agent page `#/agent` and its tabs `#/agent/file`, `#/agent/en-traitement`, `#/agent/en-attente`, `#/agent/traitees`, `#/agent/annulees`, history `#/historique`, space settings `#/espace`. Write mentions the same way in your descriptions, comments and replies.\n- **Folded blocks**: in a description, a comment or a note, `<details>` on its own line, then `<summary>Title</summary>` on its own line, the markdown content, and `</details>` on its own line show the content folded behind its title until a member clicks it; blocks can nest. Other HTML is shown as text. You can fold secondary content this way (technical details, logs, long excerpts).\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_attachment for an image of the request or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, copy_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, only what blocks the request and prevents you from completing it, never a point already carried by a task, a checklist item or a question (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When something blocks the work and prevents you from completing it, leave it to your user with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something that blocks the request: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
4
4
  /**
5
5
  * Connexion au site d'après `ORGANIZER_URL` et `ORGANIZER_TOKEN` ; une valeur
6
6
  * absente ou invalide, ou une URL http vers une autre machine, est une `ConfigError`.
@@ -15,11 +15,12 @@ Your token covers exactly one space, with the rights of the user who created the
15
15
 
16
16
  Concepts:
17
17
  - A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.
18
- - A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.
19
- - A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as \`![file name](attachment:<id>)\`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request — a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment — a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.
18
+ - A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task can carry a checklist and test checkpoints that each tester (assignee) marks ok, ko, blocked or untested. Its type, standard or test, is only an indicator of what it is about: it restricts neither. Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.
19
+ - A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments, checkpoint comments and free answers to questions: such an image is an attachment of the task, referenced in the text as \`![file name](attachment:<id>)\`, and get_task flags the comments, checkpoint comments and free answers that contain one. Open with get_attachment the images and PDF files that matter for the request — a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment — a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.
20
20
  - A request can carry **images** its author pasted in its text (\`![file name](attachment:<id>)\`): claim_request lists them with their id. Open them with get_attachment, and attach the ones that explain a task you create or change with copy_attachment, which copies the file on the site: the task then reads without the request.
21
21
  - A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in \`#/notes/<id>\`; when a request links notes, claim_request shows them in full. "Envoyer à l'agent" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas…).
22
22
  - **Mentions**: a text mentions a task by its key (\`ORG-30\`), which the site shows as a button with the task's status and its key or current title, and a page of the space by a markdown link to its address, which the site shows as a pill named after the current name of its target (the link text is only a fallback): \`[Tableau de bord](#/tableau-de-bord)\`. An address without a space designates the space of the text; members' mentions carry it (\`#/espaces/<space id>/…\`). Addresses: dashboard \`#/tableau-de-bord\`, one of the reader's views \`#/tableau-de-bord/vue/<view id>\`, ideas \`#/idees\`, notes \`#/notes\`, a note \`#/notes/<note id>\`, documents \`#/documents\`, a document \`#/documents/<document id>\`, the agent page \`#/agent\` and its tabs \`#/agent/file\`, \`#/agent/en-traitement\`, \`#/agent/en-attente\`, \`#/agent/traitees\`, \`#/agent/annulees\`, history \`#/historique\`, space settings \`#/espace\`. Write mentions the same way in your descriptions, comments and replies.
23
+ - **Folded blocks**: in a description, a comment or a note, \`<details>\` on its own line, then \`<summary>Title</summary>\` on its own line, the markdown content, and \`</details>\` on its own line show the content folded behind its title until a member clicks it; blocks can nest. Other HTML is shown as text. You can fold secondary content this way (technical details, logs, long excerpts).
23
24
  - A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export…) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml…) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.
24
25
  - A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.
25
26
  - A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.
@@ -3,7 +3,7 @@ import { POMODORO_LIMITS } from "../../shared/logic/timer.js";
3
3
  import { HISTORY_CATEGORIES, MAX_HISTORY_PAGE } from "../../shared/schemas/history-api.schema.js";
4
4
  import { MAX_BOARD_VIEW_NAME_LENGTH, MAX_QUESTION_LENGTH, MAX_QUESTION_OPTION_DETAIL_LENGTH, MAX_QUESTION_OPTION_LABEL_LENGTH, MAX_QUESTION_OPTIONS, } from "../../shared/schemas/entities.schema.js";
5
5
  import { MAX_TAG_LENGTH, MAX_TASK_TITLE_LENGTH } from "../../shared/schemas/tasks-api.schema.js";
6
- import { MAX_CHECKLIST_ITEM_LENGTH, MAX_CHECKLIST_OPERATIONS, MAX_COMMENT_LENGTH, MAX_FOLLOW_UP_LENGTH, MAX_FOLLOW_UPS, MAX_IDEA_LENGTH, MAX_QUESTION_OPERATIONS, MAX_REASON_LENGTH, MAX_REPLY_LENGTH, MAX_REQUEST_LIST_LIMIT, MAX_SEARCH_LIMIT, } from "../../shared/schemas/agent-tools.schema.js";
6
+ import { CHECKLIST_LISTS, MAX_CHECKLIST_ITEM_LENGTH, MAX_CHECKLIST_OPERATIONS, MAX_COMMENT_LENGTH, MAX_FOLLOW_UP_LENGTH, MAX_FOLLOW_UPS, MAX_IDEA_LENGTH, MAX_QUESTION_OPERATIONS, MAX_REASON_LENGTH, MAX_REPLY_LENGTH, MAX_REQUEST_LIST_LIMIT, MAX_SEARCH_LIMIT, } from "../../shared/schemas/agent-tools.schema.js";
7
7
  /** Argument d'appel d'outil inutilisable pour former la requête. */
8
8
  export class ToolArgumentError extends Error {
9
9
  constructor(message) {
@@ -108,7 +108,7 @@ export const AGENT_TOOLS = [
108
108
  path: "tasks/{task}",
109
109
  definition: {
110
110
  name: "get_task",
111
- description: "Read one task of your space in detail: fields, parents, assignees, tags, description, questions with their options and the members' answers (ids needed by edit_questions), checklist items or test checkpoints (with their ids, needed by edit_checklist), sub-tasks, recent comments and attachments with their id (open them with get_attachment). Use it before modifying a task.",
111
+ description: "Read one task of your space in detail: fields, parents, assignees, tags, description, questions with their options and the members' answers (ids needed by edit_questions), checklist items and test checkpoints (with their ids, needed by edit_checklist), sub-tasks, recent comments and attachments with their id (open them with get_attachment). Use it before modifying a task.",
112
112
  inputSchema: { type: "object", properties: { task: TASK_REF }, required: ["task"], additionalProperties: false },
113
113
  },
114
114
  },
@@ -229,7 +229,7 @@ export const AGENT_TOOLS = [
229
229
  path: "tasks",
230
230
  definition: {
231
231
  name: "create_task",
232
- description: "Create a task in your space: a top-level task, or a sub-task / sub-sub-task with parent (two levels at most). Use type test for a task whose checkpoints testers verify. Search first with search_tasks to avoid duplicates. It goes at the bottom of its column.",
232
+ description: "Create a task in your space: a top-level task, or a sub-task / sub-sub-task with parent (two levels at most). Use type test for a task whose main purpose is to be verified by testers; the type is only an indicator: any task can carry a checklist and test checkpoints (edit_checklist). Search first with search_tasks to avoid duplicates. It goes at the bottom of its column.",
233
233
  inputSchema: {
234
234
  type: "object",
235
235
  properties: {
@@ -318,12 +318,17 @@ export const AGENT_TOOLS = [
318
318
  path: "tasks/{task}/checklist",
319
319
  definition: {
320
320
  name: "edit_checklist",
321
- description: "Edit the checklist of a standard task (add, rename, check or uncheck, move, delete items) or the checkpoints of a test task (add, rename, move, delete; testers record the results themselves). An item is added at the end, or right after after_item_id (null: first); move places an item right after after_item_id (null: first). Operations apply in order, all or nothing. Item ids come from get_task.",
321
+ description: "Edit the checklist of a task (add, rename, check or uncheck, move, delete items) or its test checkpoints (add, rename, move, delete; testers record the results themselves). Any task can carry both, whatever its type: list chooses which one you edit. An item is added at the end, or right after after_item_id (null: first); move places an item right after after_item_id (null: first). Operations apply in order, all or nothing. Item ids come from get_task.",
322
322
  inputSchema: {
323
323
  type: "object",
324
324
  properties: {
325
325
  request_id: REQUEST_ID,
326
326
  task: TASK_REF,
327
+ list: {
328
+ type: "string",
329
+ enum: [...CHECKLIST_LISTS],
330
+ description: "checklist: items members check off; checkpoints: test checkpoints testers mark ok, ko, blocked or untested. Omitted: the checklist of a standard task, the checkpoints of a test task.",
331
+ },
327
332
  operations: {
328
333
  type: "array",
329
334
  minItems: 1,
@@ -338,7 +343,7 @@ export const AGENT_TOOLS = [
338
343
  type: ["string", "null"],
339
344
  description: "add (optional) / move (required): id of the item to place it right after; null places it first. Omitted on add: at the end.",
340
345
  },
341
- done: { type: "boolean", description: "update, standard task only: check (true) or uncheck (false) the item." },
346
+ done: { type: "boolean", description: "update, checklist only: check (true) or uncheck (false) the item." },
342
347
  },
343
348
  required: ["action"],
344
349
  additionalProperties: false,
@@ -370,7 +375,7 @@ export const AGENT_TOOLS = [
370
375
  properties: {
371
376
  action: { type: "string", enum: ["add_question", "update_question", "delete_question", "add_option", "update_option", "delete_option"] },
372
377
  text: { type: "string", maxLength: MAX_QUESTION_LENGTH, description: "add_question: the question; update_question: its new wording." },
373
- multiple: { type: "boolean", description: "add_question / update_question: true lets the members pick several options. Default: false (a single option, or a free answer)." },
378
+ multiple: { type: "boolean", description: "add_question / update_question: true lets the members pick several options. Default: false (a single option, which a free answer may complete)." },
374
379
  options: {
375
380
  type: "array",
376
381
  maxItems: MAX_QUESTION_OPTIONS,