@imenam/mcp-organizer 1.0.11 → 1.0.12

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 (50) hide show
  1. package/README.md +728 -714
  2. package/dist/shared/schemas/agent-api.schema.d.ts +40 -2
  3. package/dist/shared/schemas/agent-api.schema.js +12 -3
  4. package/dist/shared/schemas/agent-tools.schema.d.ts +373 -6
  5. package/dist/shared/schemas/agent-tools.schema.js +54 -3
  6. package/dist/shared/schemas/api.schema.d.ts +26 -0
  7. package/dist/shared/schemas/api.schema.js +9 -0
  8. package/dist/shared/schemas/entities.schema.d.ts +32 -2
  9. package/dist/shared/schemas/entities.schema.js +27 -3
  10. package/dist/shared/schemas/enums.schema.d.ts +4 -2
  11. package/dist/shared/schemas/enums.schema.js +2 -1
  12. package/dist/shared/schemas/notifications-api.schema.d.ts +29 -7
  13. package/dist/shared/schemas/notifications-api.schema.js +21 -5
  14. package/dist/shared/schemas/tasks-api.schema.d.ts +82 -0
  15. package/dist/shared/schemas/tasks-api.schema.js +35 -0
  16. package/dist/src/agent-api/requests.d.ts +1 -1
  17. package/dist/src/agent-api/requests.js +56 -4
  18. package/dist/src/agent-api/router.js +2 -1
  19. package/dist/src/agent-api/views.d.ts +2 -0
  20. package/dist/src/agent-api/views.js +203 -0
  21. package/dist/src/core/agent.d.ts +5 -1
  22. package/dist/src/core/agent.js +61 -2
  23. package/dist/src/core/board-views.d.ts +11 -1
  24. package/dist/src/core/board-views.js +28 -11
  25. package/dist/src/core/follow-ups.d.ts +7 -0
  26. package/dist/src/core/follow-ups.js +15 -0
  27. package/dist/src/core/history.d.ts +2 -1
  28. package/dist/src/core/history.js +62 -3
  29. package/dist/src/core/migrations.js +479 -424
  30. package/dist/src/core/notifications.js +36 -9
  31. package/dist/src/core/requests.d.ts +10 -1
  32. package/dist/src/core/requests.js +41 -3
  33. package/dist/src/core/snapshots.d.ts +4 -4
  34. package/dist/src/core/snapshots.js +6 -2
  35. package/dist/src/core/spaces.d.ts +2 -2
  36. package/dist/src/core/spaces.js +12 -6
  37. package/dist/src/core/store.d.ts +43 -6
  38. package/dist/src/core/store.js +202 -71
  39. package/dist/src/core/tasks.d.ts +21 -1
  40. package/dist/src/core/tasks.js +100 -10
  41. package/dist/src/gui-api.js +14 -4
  42. package/dist/src/mcp/start.d.ts +1 -1
  43. package/dist/src/mcp/start.js +4 -3
  44. package/dist/src/mcp/tools.js +86 -2
  45. package/dist/src/server/runner.js +4 -18
  46. package/gui/dist/assets/{index-BLhlceSY.css → index-CVwckTU6.css} +1 -1
  47. package/gui/dist/assets/index-G5uiHeLf.js +99 -0
  48. package/gui/dist/index.html +2 -2
  49. package/package.json +1 -1
  50. package/gui/dist/assets/index-Em4IQgbR.js +0 -98
@@ -3,7 +3,7 @@ import type { AttachmentStorage } from "./attachments.js";
3
3
  import type { Store } from "./store.js";
4
4
  import type { Space, Task } from "../../shared/schemas/entities.schema.js";
5
5
  import type { TaskStatus } from "../../shared/schemas/enums.schema.js";
6
- import { type AttachmentView, type BoardResponse, type ChangesResponse, type ChecklistItemView, type CommentView, type CreateTaskRequest, type TaskDetailResponse, type TaskFilters, type TaskView, type UpdateTaskRequest, type UploadAttachmentRequest } from "../../shared/schemas/tasks-api.schema.js";
6
+ import { type AttachmentView, type BoardResponse, type ChangesResponse, type ChecklistItemView, type CommentView, type CreateTaskRequest, type TaskDetailResponse, type TaskFilters, type TaskRef, 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
8
  /**
9
9
  * Tâches, checklist, commentaires et pièces jointes, avec les droits de la
@@ -19,6 +19,12 @@ export declare function requireTask(store: Store, taskId: string, userId: string
19
19
  space: Space;
20
20
  };
21
21
  export declare function notFound(): NotFoundError;
22
+ /**
23
+ * Tâche désignée par sa clé (`ORG-41`) parmi les espaces de l'utilisateur :
24
+ * celle de l'espace `contextSpaceId` s'il porte le préfixe, sinon celle du
25
+ * seul espace qui le porte. Plusieurs espaces candidats sans contexte sont un refus.
26
+ */
27
+ export declare function resolveTaskKey(store: Store, userId: string, key: string, contextSpaceId: string | null): TaskRef;
22
28
  /** Arbre des tâches d'un espace, filtré, avec ses membres, ses tags et l'avancement de tout l'espace. */
23
29
  export declare function getBoard(store: Store, userId: string, spaceId: string, filters?: TaskFilters): BoardResponse;
24
30
  /** Détail d'une tâche : champs, parents, sous-tâches, checklist, commentaires, pièces jointes. */
@@ -43,8 +49,22 @@ export declare function updateChecklistItem(store: Store, userId: string, itemId
43
49
  }): ChecklistItemView;
44
50
  export declare function deleteChecklistItem(store: Store, userId: string, itemId: string): void;
45
51
  export declare function moveChecklistItem(store: Store, userId: string, itemId: string, afterId: string | null): ChecklistItemView;
52
+ /**
53
+ * Ajoute un commentaire. Un commentaire qui mentionne @agent confie aussi une
54
+ * demande `message` à l'agent, dans l'espace de la tâche, avec la tâche pour
55
+ * contexte ; sa réponse sera publiée à la suite du commentaire.
56
+ */
46
57
  export declare function addComment(store: Store, userId: string, taskId: string, body: string): CommentView;
58
+ /**
59
+ * Modifie un commentaire. Celui qui a confié une demande à l'agent se modifie
60
+ * tant que la demande attend, et la demande avec lui ; ensuite, il ne se
61
+ * modifie plus.
62
+ */
47
63
  export declare function updateComment(store: Store, userId: string, commentId: string, body: string): CommentView;
64
+ /**
65
+ * Supprime un commentaire. Celui qui a confié une demande encore en attente
66
+ * l'annule ; pendant que l'agent la traite, il ne se supprime pas.
67
+ */
48
68
  export declare function deleteComment(store: Store, userId: string, commentId: string): void;
49
69
  /**
50
70
  * Enregistre une pièce jointe : le fichier est écrit sous
@@ -1,4 +1,5 @@
1
- import { NotFoundError, OrganizerError } from "./errors.js";
1
+ import { InvariantError, NotFoundError, OrganizerError } from "./errors.js";
2
+ import { followUpView, openFollowUps } from "./follow-ups.js";
2
3
  import { newId } from "./ids.js";
3
4
  import { requireMember } from "./spaces.js";
4
5
  import { MAX_ATTACHMENT_BYTES, } from "../../shared/schemas/tasks-api.schema.js";
@@ -28,6 +29,26 @@ export function notFound() {
28
29
  function keyOf(space, task) {
29
30
  return `${space.keyPrefix}-${task.number}`;
30
31
  }
32
+ const TASK_KEY = /^([A-Z][A-Z0-9]{1,9})-(\d+)$/;
33
+ /**
34
+ * Tâche désignée par sa clé (`ORG-41`) parmi les espaces de l'utilisateur :
35
+ * celle de l'espace `contextSpaceId` s'il porte le préfixe, sinon celle du
36
+ * seul espace qui le porte. Plusieurs espaces candidats sans contexte sont un refus.
37
+ */
38
+ export function resolveTaskKey(store, userId, key, contextSpaceId) {
39
+ const match = TASK_KEY.exec(key.trim().toUpperCase());
40
+ if (!match)
41
+ throw new OrganizerError(`« ${key} » n'est pas une clé de tâche.`);
42
+ const candidates = store.listSpacesOf(userId).filter((space) => space.keyPrefix === match[1]);
43
+ const space = candidates.find((candidate) => candidate.id === contextSpaceId) ?? (candidates.length === 1 ? candidates[0] : null);
44
+ if (candidates.length > 1 && !space) {
45
+ throw new InvariantError(`Plusieurs de vos espaces numérotent leurs tâches ${match[1]} : ouvrez la tâche depuis son espace.`);
46
+ }
47
+ const task = space ? store.findTaskByNumber(space.id, Number(match[2])) : null;
48
+ if (!space || !task)
49
+ throw notFound();
50
+ return { id: task.id, key: keyOf(space, task), title: task.title };
51
+ }
31
52
  function membersOf(store, spaceId) {
32
53
  return store.listMemberships(spaceId).map((membership) => {
33
54
  const user = store.getUser(membership.userId);
@@ -180,7 +201,7 @@ export function getTaskDetail(store, userId, taskId) {
180
201
  parentId = parent.parentId;
181
202
  }
182
203
  const checklist = store.listChecklist(task.id).map(({ id, text, done, position }) => ({ id, text, done, position }));
183
- const comments = store.listComments(task.id).map((comment) => commentView(store, comment));
204
+ const comments = store.listComments(task.id).map((comment) => commentView(store, userId, comment));
184
205
  const tested = task.testedTaskId === null ? null : store.findTask(task.testedTaskId);
185
206
  return {
186
207
  task: taskView(store, space, task),
@@ -318,16 +339,56 @@ export function moveChecklistItem(store, userId, itemId, afterId) {
318
339
  return { id, text, done, position };
319
340
  }
320
341
  // --- Commentaires ---------------------------------------------------------------
321
- function commentView(store, comment) {
322
- const author = store.getUser(comment.authorId);
342
+ /** Mention qui confie un commentaire à l'agent : `@agent`, en début de texte ou après une espace. */
343
+ const AGENT_MENTION = /(^|\s)@agent\b/i;
344
+ /** Longueur maximale du début d'un commentaire rappelé par la réponse de l'agent. */
345
+ const REPLY_EXCERPT_LENGTH = 80;
346
+ function excerptOf(text) {
347
+ const line = text.trim().split(/\r?\n/)[0].trim();
348
+ return line.length > REPLY_EXCERPT_LENGTH ? `${line.slice(0, REPLY_EXCERPT_LENGTH - 1)}…` : line;
349
+ }
350
+ function nameOf(store, userId) {
351
+ const user = store.getUser(userId);
352
+ return user.displayName ?? user.email;
353
+ }
354
+ /**
355
+ * Commentaire vu par `userId` : pour un commentaire qui mentionne @agent,
356
+ * l'état de sa demande ; pour la réponse de l'agent, le commentaire auquel
357
+ * elle répond, les points à régler et les modifications de sa demande.
358
+ */
359
+ function commentView(store, userId, comment) {
360
+ const request = store.findRequestOfComment(comment.id);
361
+ const source = comment.replyToCommentId === null ? null : store.findComment(comment.replyToCommentId);
362
+ const answered = comment.replyToCommentId === null || comment.requestId === null ? null : store.findAgentRequest(comment.requestId);
363
+ const steers = request !== null && (request.authorId === userId || store.getUser(userId).isAdmin);
323
364
  return {
324
365
  id: comment.id,
325
366
  authorId: comment.authorId,
326
- authorName: author.displayName ?? author.email,
367
+ authorName: nameOf(store, comment.authorId),
327
368
  body: comment.body,
328
369
  createdAt: comment.createdAt,
329
370
  editedAt: comment.editedAt,
330
371
  byAgent: comment.requestId !== null,
372
+ agentRequest: request
373
+ ? {
374
+ id: request.id,
375
+ status: request.status,
376
+ failureReason: request.failureReason,
377
+ stopped: request.stoppedAt !== null,
378
+ openFollowUps: openFollowUps(store, request.id),
379
+ canCancel: request.status === "pending",
380
+ canRelaunch: request.status === "failed" && request.stoppedAt !== null && steers,
381
+ }
382
+ : null,
383
+ replyTo: source ? { commentId: source.id, authorName: nameOf(store, source.authorId), excerpt: excerptOf(source.body) } : null,
384
+ reply: answered
385
+ ? {
386
+ requestId: answered.id,
387
+ followUps: store.listFollowUps(answered.id).map((point) => followUpView(store, point)),
388
+ liveActions: store.listAgentActions(answered.id).filter((action) => action.undoneAt === null).length,
389
+ canUndo: answered.status === "done" || answered.status === "failed",
390
+ }
391
+ : null,
331
392
  };
332
393
  }
333
394
  function requireComment(store, commentId, userId) {
@@ -337,23 +398,52 @@ function requireComment(store, commentId, userId) {
337
398
  requireTask(store, comment.taskId, userId);
338
399
  return comment;
339
400
  }
401
+ /**
402
+ * Ajoute un commentaire. Un commentaire qui mentionne @agent confie aussi une
403
+ * demande `message` à l'agent, dans l'espace de la tâche, avec la tâche pour
404
+ * contexte ; sa réponse sera publiée à la suite du commentaire.
405
+ */
340
406
  export function addComment(store, userId, taskId, body) {
341
407
  const comment = store.mutate(asUser(userId), (tx) => {
342
- requireTask(tx.store, taskId, userId);
343
- return tx.addComment(taskId, body);
408
+ const { task } = requireTask(tx.store, taskId, userId);
409
+ const comment = tx.addComment(taskId, body);
410
+ if (AGENT_MENTION.test(comment.body)) {
411
+ tx.createAgentRequest({ targetSpaceId: task.spaceId, kind: "message", text: comment.body, contextTaskId: task.id, commentId: comment.id });
412
+ }
413
+ return comment;
344
414
  });
345
- return commentView(store, comment);
415
+ return commentView(store, userId, comment);
346
416
  }
417
+ /**
418
+ * Modifie un commentaire. Celui qui a confié une demande à l'agent se modifie
419
+ * tant que la demande attend, et la demande avec lui ; ensuite, il ne se
420
+ * modifie plus.
421
+ */
347
422
  export function updateComment(store, userId, commentId, body) {
348
423
  const comment = store.mutate(asUser(userId), (tx) => {
349
424
  requireComment(tx.store, commentId, userId);
350
- return tx.updateComment(commentId, body);
425
+ const request = tx.store.findRequestOfComment(commentId);
426
+ if (request && request.status !== "pending")
427
+ throw new InvariantError("L'agent a déjà pris la demande de ce commentaire : il ne se modifie plus.");
428
+ const comment = tx.updateComment(commentId, body);
429
+ if (request)
430
+ tx.updateAgentRequestText(request.id, comment.body);
431
+ return comment;
351
432
  });
352
- return commentView(store, comment);
433
+ return commentView(store, userId, comment);
353
434
  }
435
+ /**
436
+ * Supprime un commentaire. Celui qui a confié une demande encore en attente
437
+ * l'annule ; pendant que l'agent la traite, il ne se supprime pas.
438
+ */
354
439
  export function deleteComment(store, userId, commentId) {
355
440
  store.mutate(asUser(userId), (tx) => {
356
441
  requireComment(tx.store, commentId, userId);
442
+ const request = tx.store.findRequestOfComment(commentId);
443
+ if (request?.status === "processing")
444
+ throw new InvariantError("L'agent traite la demande de ce commentaire : attendez sa réponse pour le supprimer.");
445
+ if (request?.status === "pending")
446
+ tx.cancelAgentRequest(request.id);
357
447
  tx.deleteComment(commentId);
358
448
  });
359
449
  }
@@ -3,14 +3,14 @@ import { schemaVersion } from "./core/migrations.js";
3
3
  import { ForbiddenError, InvariantError, NotFoundError, OrganizerError, UnauthorizedError } from "./core/errors.js";
4
4
  import { authenticate, changePassword, login, logout, redeemAccessLink, resolveAccessLink, updateDisplayName } from "./core/accounts.js";
5
5
  import { acceptReceivedInvitation, createSharedSpace, declineReceivedInvitation, deleteSpace, inviteToSpace, leaveSpace, listMembers, listMemberSuggestions, listReceivedInvitations, listSpaces, removeMember, renameSpace, resendInvitation, revokeInvitation, } from "./core/spaces.js";
6
- import { addChecklistItem, addComment, createTask, deleteAttachment, deleteChecklistItem, deleteComment, deleteTask, downloadAttachment, getBoard, getTaskDetail, listChanges, moveChecklistItem, moveTask, setAssignees, setTags, updateChecklistItem, updateComment, updateTask, uploadAttachment, } from "./core/tasks.js";
6
+ 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";
7
7
  import { addCheckpoint, deleteCheckpoint, moveCheckpoint, saveReviewDraft, setTestResult, submitReview, updateCheckpoint } from "./core/test-tasks.js";
8
- import { AddChecklistItemRequestSchema, CheckpointTextRequestSchema, CommentRequestSchema, CreateTaskRequestSchema, MoveAfterRequestSchema, MoveTaskRequestSchema, ReviewDraftRequestSchema, SetAssigneesRequestSchema, SetTagsRequestSchema, SetTestResultRequestSchema, SubmitReviewRequestSchema, TaskFiltersSchema, UpdateChecklistItemRequestSchema, UpdateTaskRequestSchema, UploadAttachmentRequestSchema, } from "../shared/schemas/tasks-api.schema.js";
8
+ import { AddChecklistItemRequestSchema, CheckpointTextRequestSchema, CommentRequestSchema, CreateTaskRequestSchema, MoveAfterRequestSchema, MoveTaskRequestSchema, ReviewDraftRequestSchema, SetAssigneesRequestSchema, SetTagsRequestSchema, SetTestResultRequestSchema, SubmitReviewRequestSchema, TaskFiltersSchema, TaskKeyQuerySchema, UpdateChecklistItemRequestSchema, UpdateTaskRequestSchema, UploadAttachmentRequestSchema, } from "../shared/schemas/tasks-api.schema.js";
9
9
  import { getSettings, getSpaceNotificationSettings, listNotifications, markAllNotificationsRead, markNotificationRead, unreadCount, updateSettings, updateSpaceNotificationSettings } from "./core/notifications.js";
10
10
  import { NotificationListQuerySchema, UpdateSettingsRequestSchema, UpdateSpaceNotificationSettingsRequestSchema } from "../shared/schemas/notifications-api.schema.js";
11
- import { cancelRequest, createRequest, getRequest, listRequests, relaunchRequest, stopRequest, undoAction, undoRequest, updateRequest } from "./core/requests.js";
11
+ import { cancelRequest, createRequest, createSuite, getRequest, listRequests, relaunchRequest, setFollowUpDone, stopRequest, undoAction, undoRequest, updateRequest, } from "./core/requests.js";
12
12
  import { listTaskVersions, restoreTaskVersion } from "./core/task-history.js";
13
- import { CreateRequestSchema, UpdateRequestSchema } from "../shared/schemas/agent-api.schema.js";
13
+ import { CreateRequestSchema, CreateSuiteSchema, SetFollowUpDoneSchema, UpdateRequestSchema } from "../shared/schemas/agent-api.schema.js";
14
14
  import { createBoardView, deleteBoardView, listBoardViews, updateBoardView } from "./core/board-views.js";
15
15
  import { CreateBoardViewRequestSchema, UpdateBoardViewRequestSchema } from "../shared/schemas/views-api.schema.js";
16
16
  import { createIdea, delegatePromotion, listIdeas, promoteIdea, setIdeaArchived } from "./core/ideas.js";
@@ -218,6 +218,10 @@ route("POST", "/spaces/:spaceId/tasks", (ctx, { user, request, params }) => ({
218
218
  body: createTask(ctx.store, user.id, params.spaceId, parseBody(CreateTaskRequestSchema, request.body)),
219
219
  }));
220
220
  route("GET", "/tasks/:taskId", (ctx, { user, params }) => ({ body: getTaskDetail(ctx.store, user.id, params.taskId) }));
221
+ route("GET", "/task-keys/:key", (ctx, { user, request, params }) => {
222
+ const { spaceId } = parseBody(TaskKeyQuerySchema, request.query);
223
+ return { body: resolveTaskKey(ctx.store, user.id, params.key, spaceId ?? null) };
224
+ });
221
225
  route("PATCH", "/tasks/:taskId", (ctx, { user, request, params }) => ({
222
226
  body: updateTask(ctx.store, user.id, params.taskId, parseBody(UpdateTaskRequestSchema, request.body)),
223
227
  }));
@@ -318,6 +322,12 @@ route("POST", "/requests/:requestId/cancel", (ctx, { user, params }) => ({ body:
318
322
  route("POST", "/requests/:requestId/stop", (ctx, { user, params }) => ({ body: stopRequest(ctx.store, user.id, params.requestId, ctx.runner.stopSession) }));
319
323
  route("POST", "/requests/:requestId/relaunch", (ctx, { user, params }) => ({ body: relaunchRequest(ctx.store, user.id, params.requestId) }));
320
324
  route("POST", "/requests/:requestId/undo", (ctx, { user, params }) => ({ body: undoRequest(ctx.store, user.id, params.requestId) }));
325
+ route("POST", "/requests/:requestId/suites", (ctx, { user, request, params }) => ({
326
+ body: createSuite(ctx.store, user.id, params.requestId, parseBody(CreateSuiteSchema, request.body).text),
327
+ }));
328
+ route("PUT", "/follow-ups/:followUpId", (ctx, { user, request, params }) => ({
329
+ body: setFollowUpDone(ctx.store, user.id, params.followUpId, parseBody(SetFollowUpDoneSchema, request.body).done),
330
+ }));
321
331
  route("POST", "/agent-actions/:actionId/undo", (ctx, { user, params }) => ({ body: undoAction(ctx.store, user.id, params.actionId) }));
322
332
  route("GET", "/tasks/:taskId/versions", (ctx, { user, params }) => ({ body: listTaskVersions(ctx.store, user.id, params.taskId) }));
323
333
  route("POST", "/tasks/:taskId/versions/:version/restore", (ctx, { user, 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 and an idea box. 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).\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).\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 **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.\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), 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.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, add_comment, create_idea, update_idea, promote_idea \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, every point the author still has to handle (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\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); never bury in the reply something the author must act on: 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 and an idea box. 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).\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- 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 and assignees. Each member has their own views in each space.\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 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.\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), 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.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, add_comment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, 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, every point the author still has to handle (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\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); never bury in the reply something the author must act on: 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`.
@@ -16,15 +16,16 @@ Your token covers exactly one space, with the rights of the user who created the
16
16
  Concepts:
17
17
  - A **space** holds tasks and an idea box. A user's **personal space** is private; a **shared space** has one owner and members.
18
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).
19
- - 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).
19
+ - 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.
20
20
  - 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.
21
- - 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.
21
+ - 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 and assignees. Each member has their own views in each space.
22
+ - 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 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.
22
23
 
23
24
  Work loop, when the user asks you to process the queue:
24
25
  1. list_requests to see the pending requests of your space.
25
26
  2. 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), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.
26
27
  3. Read what you need with get_task and search_tasks.
27
- 4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, add_comment, create_idea, update_idea, promote_idea — always passing the request_id. Each write is one undoable action of the batch.
28
+ 4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, add_comment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, and with check_follow_ups for a follow-up — always passing the request_id. Each write is one undoable action of the batch.
28
29
  5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.
29
30
  When the queue is empty, tell the user.
30
31
 
@@ -1,4 +1,5 @@
1
- import { REQUEST_STATUSES, TASK_PRIORITIES, TASK_STATUSES, TASK_TYPES } from "../../shared/schemas/enums.schema.js";
1
+ import { BOARD_GROUPINGS, BOARD_LAYOUTS, REQUEST_STATUSES, TASK_PRIORITIES, TASK_STATUSES, TASK_TYPES } from "../../shared/schemas/enums.schema.js";
2
+ import { MAX_BOARD_VIEW_NAME_LENGTH } from "../../shared/schemas/entities.schema.js";
2
3
  import { MAX_TAG_LENGTH, MAX_TASK_TITLE_LENGTH } from "../../shared/schemas/tasks-api.schema.js";
3
4
  import { MAX_CHECKLIST_ITEM_LENGTH, MAX_CHECKLIST_OPERATIONS, MAX_COMMENT_LENGTH, MAX_FOLLOW_UP_LENGTH, MAX_FOLLOW_UPS, MAX_IDEA_LENGTH, MAX_REASON_LENGTH, MAX_REPLY_LENGTH, MAX_REQUEST_LIST_LIMIT, MAX_SEARCH_LIMIT, } from "../../shared/schemas/agent-tools.schema.js";
4
5
  /** Argument d'appel d'outil inutilisable pour former la requête. */
@@ -13,6 +14,35 @@ const REQUEST_ID = {
13
14
  description: "Id of the request you claimed with claim_request (status processing). Every write is recorded in its batch and can be undone by the users.",
14
15
  };
15
16
  const TASK_REF = { type: "string", description: "Task of your space: its key (e.g. ORG-41) or its id." };
17
+ const VIEW_REQUEST_ID = {
18
+ type: "string",
19
+ description: "Id of the request you claimed (status processing): you act on the board views of its author, and every write is recorded in its batch and can be undone by that author.",
20
+ };
21
+ const VIEW_ID = { type: "string", description: "Id of a view of the request's author, from list_views." };
22
+ /** Réglages d'une vue, communs à create_view et update_view. */
23
+ const VIEW_SETTINGS = {
24
+ name: { type: "string", maxLength: MAX_BOARD_VIEW_NAME_LENGTH, description: "Name of the view, shown as its tab, in the language of the users." },
25
+ layout: { type: "string", enum: [...BOARD_LAYOUTS], description: "kanban: one column per group; list: sections and sub-sections; matrix: columns × rows." },
26
+ group_by: {
27
+ type: "string",
28
+ enum: [...BOARD_GROUPINGS],
29
+ description: "First grouping: columns of a kanban or matrix, sections of a list. none is allowed only for a list.",
30
+ },
31
+ then_by: {
32
+ type: "string",
33
+ enum: [...BOARD_GROUPINGS],
34
+ description: "Second grouping, different from group_by: rows of a matrix (required), sub-sections of a list (optional); none for a kanban.",
35
+ },
36
+ show_empty_groups: { type: "boolean", description: "Show the groups that hold no task." },
37
+ statuses: { type: "array", items: { type: "string", enum: [...TASK_STATUSES] }, description: "Statuses kept by the view; empty: all statuses." },
38
+ priorities: { type: "array", items: { type: "string", enum: [...TASK_PRIORITIES] }, description: "Priorities kept by the view; empty: all priorities." },
39
+ assignees: {
40
+ type: "array",
41
+ items: { type: "string" },
42
+ description: "Member ids or e-mails: the view keeps the tasks assigned to at least one of them; empty (and unassigned false): every task.",
43
+ },
44
+ unassigned: { type: "boolean", description: "Also keep the tasks with no assignee." },
45
+ };
16
46
  export const AGENT_TOOLS = [
17
47
  {
18
48
  method: "GET",
@@ -280,12 +310,66 @@ export const AGENT_TOOLS = [
280
310
  },
281
311
  },
282
312
  },
313
+ {
314
+ method: "GET",
315
+ path: "views",
316
+ definition: {
317
+ name: "list_views",
318
+ description: "List the board views of the author of a request, in your space: each view is a tab of their dashboard with a layout (kanban, list, matrix), groupings by status or priority, and filters on the status, priority and assignees of the top-level tasks. Read them before changing how someone's board looks.",
319
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID }, required: ["request_id"], additionalProperties: false },
320
+ },
321
+ },
322
+ {
323
+ method: "POST",
324
+ path: "views",
325
+ definition: {
326
+ name: "create_view",
327
+ description: "Create a board view for the author of a request (e.g. \"show me only my critical tasks, by status\"), after their other tabs; their open dashboard switches to it. Defaults: kanban grouped by status, then_by none (a matrix crosses status and priority), empty groups shown except in a list, no filter. Prefer update_view when the author asks to change a view they have.",
328
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, ...VIEW_SETTINGS }, required: ["request_id", "name"], additionalProperties: false },
329
+ },
330
+ },
331
+ {
332
+ method: "PATCH",
333
+ path: "views/{view_id}",
334
+ definition: {
335
+ name: "update_view",
336
+ description: "Change a board view of the author of a request: name, layout, groupings, empty groups, filters. Only the given settings change; a list (statuses, priorities, assignees) replaces the previous one. Their open dashboard switches to the view.",
337
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID, ...VIEW_SETTINGS }, required: ["request_id", "view_id"], additionalProperties: false },
338
+ },
339
+ },
340
+ {
341
+ method: "POST",
342
+ path: "views/{view_id}/delete",
343
+ definition: {
344
+ name: "delete_view",
345
+ description: "Delete a board view of the author of a request, when they ask for it. Their last view cannot be deleted.",
346
+ inputSchema: { type: "object", properties: { request_id: VIEW_REQUEST_ID, view_id: VIEW_ID }, required: ["request_id", "view_id"], additionalProperties: false },
347
+ },
348
+ },
349
+ {
350
+ method: "POST",
351
+ path: "requests/{request_id}/follow-ups",
352
+ definition: {
353
+ name: "check_follow_ups",
354
+ description: "While processing a follow-up request (one whose claim_request context shows the request it continues), check the points left to the author of that original request that this follow-up settles; done false reopens a point. Point ids are listed by claim_request. Each change is one undoable action of the batch; once every point is checked, the original request leaves the author's waiting list.",
355
+ inputSchema: {
356
+ type: "object",
357
+ properties: {
358
+ request_id: { type: "string", description: "Id of the follow-up request you claimed (status processing)." },
359
+ follow_ups: { type: "array", minItems: 1, maxItems: MAX_FOLLOW_UPS, items: { type: "string" }, description: "Ids of points of the original request." },
360
+ done: { type: "boolean", description: "true (default) checks the points, false reopens them." },
361
+ },
362
+ required: ["request_id", "follow_ups"],
363
+ additionalProperties: false,
364
+ },
365
+ },
366
+ },
283
367
  {
284
368
  method: "POST",
285
369
  path: "requests/{request_id}/complete",
286
370
  definition: {
287
371
  name: "complete_request",
288
- description: "Finish a processing request with your reply to its author: a short markdown report in the author's language saying what you did (tasks created or changed, where the idea went) or answering their message. Put in follow_ups every point the author still has to handle themselves (a decision to make, a person to assign, something you could not do or understand); leave it empty when everything is done. The Agent page shows the request in green when follow_ups is empty and in orange with these points otherwise. Call it last.",
372
+ description: "Finish a processing request with your reply to its author: a short markdown report in the author's language saying what you did (tasks created or changed, where the idea went) or answering their message. Put in follow_ups every point the author still has to handle themselves (a decision to make, a person to assign, something you could not do or understand); leave it empty when everything is done. Each point becomes a checkbox that the members of the space tick off; the author is notified, and the request stays in their waiting list, in orange, until every point is checked. Call it last.",
289
373
  inputSchema: {
290
374
  type: "object",
291
375
  properties: {
@@ -34,22 +34,6 @@ import { SessionStream } from "./claude-stream.js";
34
34
  */
35
35
  /** Nom du serveur MCP organizer dans la configuration d'une session. */
36
36
  const MCP_SERVER_NAME = "organizer";
37
- /** Outils intégrés de Claude Code refusés à la session : elle n'agit que par les outils organizer. */
38
- const DISALLOWED_TOOLS = [
39
- "Bash",
40
- "BashOutput",
41
- "KillShell",
42
- "Read",
43
- "Write",
44
- "Edit",
45
- "NotebookEdit",
46
- "Glob",
47
- "Grep",
48
- "WebFetch",
49
- "WebSearch",
50
- "Task",
51
- "TodoWrite",
52
- ];
53
37
  /** Consigne de la session. Les `instructions` du serveur MCP organizer décrivent les concepts et la boucle de travail. */
54
38
  export const SESSION_PROMPT = [
55
39
  "You are the organizer runner: process the pending requests of your organizer space with the organizer tools.",
@@ -289,10 +273,12 @@ export class SiteRunner {
289
273
  "--mcp-config",
290
274
  configFile,
291
275
  "--strict-mcp-config",
276
+ "--tools",
277
+ "",
292
278
  "--allowedTools",
293
279
  `mcp__${MCP_SERVER_NAME}`,
294
- "--disallowedTools",
295
- DISALLOWED_TOOLS.join(","),
280
+ "--permission-mode",
281
+ "dontAsk",
296
282
  ];
297
283
  const label = `Runner [${spaceName}]`;
298
284
  this.logger.info(`${label}: session started (max ${settings.maxTurns} turns, ${settings.maxMinutes} min${settings.maxBudgetUsd === null ? "" : `, $${settings.maxBudgetUsd}`})`);