@imenam/mcp-organizer 1.0.7 → 1.0.8

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 (52) hide show
  1. package/README.md +97 -20
  2. package/dist/shared/schemas/admin-api.schema.d.ts +92 -0
  3. package/dist/shared/schemas/admin-api.schema.js +46 -1
  4. package/dist/shared/schemas/agent-api.schema.d.ts +25 -0
  5. package/dist/shared/schemas/agent-api.schema.js +10 -0
  6. package/dist/shared/schemas/agent-tools.schema.d.ts +14 -0
  7. package/dist/shared/schemas/agent-tools.schema.js +12 -1
  8. package/dist/shared/schemas/entities.schema.d.ts +61 -0
  9. package/dist/shared/schemas/entities.schema.js +44 -1
  10. package/dist/shared/schemas/enums.schema.d.ts +19 -1
  11. package/dist/shared/schemas/enums.schema.js +8 -0
  12. package/dist/shared/schemas/instructions-api.schema.d.ts +42 -0
  13. package/dist/shared/schemas/instructions-api.schema.js +25 -0
  14. package/dist/shared/schemas/tasks-api.schema.d.ts +2 -0
  15. package/dist/shared/schemas/views-api.schema.d.ts +139 -0
  16. package/dist/shared/schemas/views-api.schema.js +33 -0
  17. package/dist/src/agent-api/requests.js +4 -2
  18. package/dist/src/cli/setup.d.ts +9 -6
  19. package/dist/src/cli/setup.js +108 -35
  20. package/dist/src/core/admin.d.ts +15 -1
  21. package/dist/src/core/admin.js +45 -0
  22. package/dist/src/core/agent-instructions.d.ts +6 -0
  23. package/dist/src/core/agent-instructions.js +43 -0
  24. package/dist/src/core/agent.d.ts +2 -0
  25. package/dist/src/core/agent.js +16 -2
  26. package/dist/src/core/board-views.d.ts +12 -0
  27. package/dist/src/core/board-views.js +84 -0
  28. package/dist/src/core/migrations.js +66 -0
  29. package/dist/src/core/requests.d.ts +8 -2
  30. package/dist/src/core/requests.js +4 -3
  31. package/dist/src/core/store.d.ts +40 -4
  32. package/dist/src/core/store.js +180 -9
  33. package/dist/src/deploy/env-render.d.ts +1 -1
  34. package/dist/src/deploy/env-render.js +2 -0
  35. package/dist/src/gui-api.d.ts +12 -1
  36. package/dist/src/gui-api.js +51 -3
  37. package/dist/src/mcp/start.d.ts +1 -1
  38. package/dist/src/mcp/start.js +4 -4
  39. package/dist/src/mcp/tools.js +13 -3
  40. package/dist/src/server/claude-processes.d.ts +26 -0
  41. package/dist/src/server/claude-processes.js +72 -0
  42. package/dist/src/server/claude-stream.d.ts +39 -0
  43. package/dist/src/server/claude-stream.js +111 -0
  44. package/dist/src/server/runner.d.ts +40 -0
  45. package/dist/src/server/runner.js +157 -24
  46. package/dist/src/server/start.js +19 -1
  47. package/gui/dist/assets/index-BX6iBj41.js +70 -0
  48. package/gui/dist/assets/index-CXzkYy4P.css +1 -0
  49. package/gui/dist/index.html +2 -2
  50. package/package.json +1 -1
  51. package/gui/dist/assets/index-DuoSNpBr.js +0 -70
  52. package/gui/dist/assets/index-duxL0fvO.css +0 -1
@@ -9,6 +9,8 @@ export declare const MAX_REQUEST_LIST_LIMIT = 100;
9
9
  export declare const MAX_SEARCH_LIMIT = 100;
10
10
  export declare const MAX_REPLY_LENGTH = 5000;
11
11
  export declare const MAX_REASON_LENGTH = 2000;
12
+ export declare const MAX_FOLLOW_UPS = 10;
13
+ export declare const MAX_FOLLOW_UP_LENGTH = 500;
12
14
  export declare const MAX_COMMENT_LENGTH = 10000;
13
15
  export declare const MAX_IDEA_LENGTH = 5000;
14
16
  export declare const MAX_CHECKLIST_ITEM_LENGTH = 500;
@@ -41,8 +43,10 @@ export declare const WaitRequestsQuerySchema: z.ZodObject<{
41
43
  }, z.core.$strict>;
42
44
  /** `POST requests/:id/claim` : sans corps. */
43
45
  export declare const ClaimRequestBodySchema: z.ZodObject<{}, z.core.$strict>;
46
+ /** `POST requests/:id/complete` : réponse à l'auteur, et points qu'il doit encore régler (aucun quand tout est traité). */
44
47
  export declare const CompleteRequestBodySchema: z.ZodObject<{
45
48
  reply: z.ZodString;
49
+ follow_ups: z.ZodDefault<z.ZodArray<z.ZodString>>;
46
50
  }, z.core.$strict>;
47
51
  export declare const FailRequestBodySchema: z.ZodObject<{
48
52
  reason: z.ZodString;
@@ -270,6 +274,7 @@ export declare const AgentRequestSummarySchema: z.ZodObject<{
270
274
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
271
275
  claimedByThisToken: z.ZodBoolean;
272
276
  reply: z.ZodNullable<z.ZodString>;
277
+ followUps: z.ZodArray<z.ZodString>;
273
278
  failureReason: z.ZodNullable<z.ZodString>;
274
279
  }, z.core.$strip>;
275
280
  export type AgentRequestSummary = z.infer<typeof AgentRequestSummarySchema>;
@@ -323,6 +328,7 @@ export declare const ListRequestsDataSchema: z.ZodObject<{
323
328
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
324
329
  claimedByThisToken: z.ZodBoolean;
325
330
  reply: z.ZodNullable<z.ZodString>;
331
+ followUps: z.ZodArray<z.ZodString>;
326
332
  failureReason: z.ZodNullable<z.ZodString>;
327
333
  }, z.core.$strip>>;
328
334
  }, z.core.$strip>;
@@ -359,6 +365,7 @@ export declare const ClaimRequestDataSchema: z.ZodObject<{
359
365
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
360
366
  claimedByThisToken: z.ZodBoolean;
361
367
  reply: z.ZodNullable<z.ZodString>;
368
+ followUps: z.ZodArray<z.ZodString>;
362
369
  failureReason: z.ZodNullable<z.ZodString>;
363
370
  }, z.core.$strip>;
364
371
  history: z.ZodArray<z.ZodObject<{
@@ -393,8 +400,13 @@ export declare const ClaimRequestDataSchema: z.ZodObject<{
393
400
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
394
401
  claimedByThisToken: z.ZodBoolean;
395
402
  reply: z.ZodNullable<z.ZodString>;
403
+ followUps: z.ZodArray<z.ZodString>;
396
404
  failureReason: z.ZodNullable<z.ZodString>;
397
405
  }, z.core.$strip>>;
406
+ instructions: z.ZodObject<{
407
+ site: z.ZodNullable<z.ZodString>;
408
+ space: z.ZodNullable<z.ZodString>;
409
+ }, z.core.$strip>;
398
410
  space: z.ZodObject<{
399
411
  id: z.ZodString;
400
412
  name: z.ZodString;
@@ -479,6 +491,7 @@ export declare const FinishRequestDataSchema: z.ZodObject<{
479
491
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
480
492
  claimedByThisToken: z.ZodBoolean;
481
493
  reply: z.ZodNullable<z.ZodString>;
494
+ followUps: z.ZodArray<z.ZodString>;
482
495
  failureReason: z.ZodNullable<z.ZodString>;
483
496
  }, z.core.$strip>;
484
497
  actionCount: z.ZodNumber;
@@ -849,6 +862,7 @@ export declare const WaitRequestsDataSchema: z.ZodObject<{
849
862
  claimedAt: z.ZodNullable<z.ZodISODateTime>;
850
863
  claimedByThisToken: z.ZodBoolean;
851
864
  reply: z.ZodNullable<z.ZodString>;
865
+ followUps: z.ZodArray<z.ZodString>;
852
866
  failureReason: z.ZodNullable<z.ZodString>;
853
867
  }, z.core.$strip>>;
854
868
  cursor: z.ZodISODateTime;
@@ -12,6 +12,8 @@ export const MAX_REQUEST_LIST_LIMIT = 100;
12
12
  export const MAX_SEARCH_LIMIT = 100;
13
13
  export const MAX_REPLY_LENGTH = 5_000;
14
14
  export const MAX_REASON_LENGTH = 2_000;
15
+ export const MAX_FOLLOW_UPS = 10;
16
+ export const MAX_FOLLOW_UP_LENGTH = 500;
15
17
  export const MAX_COMMENT_LENGTH = 10_000;
16
18
  export const MAX_IDEA_LENGTH = 5_000;
17
19
  export const MAX_CHECKLIST_ITEM_LENGTH = 500;
@@ -42,7 +44,13 @@ export const WaitRequestsQuerySchema = z
42
44
  .strict();
43
45
  /** `POST requests/:id/claim` : sans corps. */
44
46
  export const ClaimRequestBodySchema = z.object({}).strict();
45
- export const CompleteRequestBodySchema = z.object({ reply: z.string().max(MAX_REPLY_LENGTH) }).strict();
47
+ /** `POST requests/:id/complete` : réponse à l'auteur, et points qu'il doit encore régler (aucun quand tout est traité). */
48
+ export const CompleteRequestBodySchema = z
49
+ .object({
50
+ reply: z.string().max(MAX_REPLY_LENGTH),
51
+ follow_ups: z.array(z.string().trim().min(1).max(MAX_FOLLOW_UP_LENGTH)).max(MAX_FOLLOW_UPS).default([]),
52
+ })
53
+ .strict();
46
54
  export const FailRequestBodySchema = z.object({ reason: z.string().max(MAX_REASON_LENGTH) }).strict();
47
55
  /** `GET tasks` : recherche par mots et filtres. */
48
56
  export const SearchTasksQuerySchema = z
@@ -139,6 +147,7 @@ export const AgentRequestSummarySchema = z.object({
139
147
  /** Vrai si la demande est prise par le jeton qui appelle. */
140
148
  claimedByThisToken: z.boolean(),
141
149
  reply: z.string().nullable(),
150
+ followUps: z.array(z.string()),
142
151
  failureReason: z.string().nullable(),
143
152
  });
144
153
  export const AgentIdeaSchema = z.object({ id: IdSchema, text: z.string(), archived: z.boolean(), promotedTaskKey: z.string().nullable(), createdAt: TimestampSchema });
@@ -147,6 +156,8 @@ export const ClaimRequestDataSchema = z.object({
147
156
  request: AgentRequestSummarySchema,
148
157
  /** Échanges précédents de l'auteur dans l'espace, du plus ancien au plus récent, pour une demande de type message. */
149
158
  history: z.array(AgentRequestSummarySchema),
159
+ /** Instructions personnalisées à suivre : celles du site, puis celles de l'espace ; null quand il n'y en a pas. */
160
+ instructions: z.object({ site: z.string().nullable(), space: z.string().nullable() }),
150
161
  space: AgentSpaceSchema,
151
162
  members: z.array(AgentMemberSchema),
152
163
  tasks: z.array(AgentTaskSummarySchema),
@@ -107,6 +107,16 @@ export declare const SpaceSchema: z.ZodObject<{
107
107
  createdAt: z.ZodISODateTime;
108
108
  }, z.core.$strip>;
109
109
  export type Space = z.infer<typeof SpaceSchema>;
110
+ /** Longueur maximale d'un texte d'instructions de l'agent. */
111
+ export declare const AGENT_INSTRUCTIONS_MAX = 4000;
112
+ /** Instructions personnalisées données à l'agent : celles du site (`spaceId` null) ou celles d'un espace. */
113
+ export declare const AgentInstructionsSchema: z.ZodObject<{
114
+ spaceId: z.ZodNullable<z.ZodString>;
115
+ text: z.ZodString;
116
+ updatedAt: z.ZodISODateTime;
117
+ updatedBy: z.ZodNullable<z.ZodString>;
118
+ }, z.core.$strip>;
119
+ export type AgentInstructions = z.infer<typeof AgentInstructionsSchema>;
110
120
  export declare const MembershipSchema: z.ZodObject<{
111
121
  spaceId: z.ZodString;
112
122
  userId: z.ZodString;
@@ -250,6 +260,52 @@ export declare const IdeaSchema: z.ZodObject<{
250
260
  createdAt: z.ZodISODateTime;
251
261
  }, z.core.$strip>;
252
262
  export type Idea = z.infer<typeof IdeaSchema>;
263
+ export declare const MAX_BOARD_VIEW_NAME_LENGTH = 40;
264
+ /**
265
+ * Vue du tableau de bord d'un membre dans un espace : disposition, regroupements
266
+ * et filtres sur le statut et la priorité des tâches de premier niveau. Un
267
+ * filtre vide garde toutes les valeurs. `groupBy` forme les colonnes d'un Kanban
268
+ * ou d'une matrice et les sections d'une liste ; `thenBy` forme les lignes d'une
269
+ * matrice et les sous-sections d'une liste.
270
+ */
271
+ export declare const BoardViewSchema: z.ZodObject<{
272
+ id: z.ZodString;
273
+ spaceId: z.ZodString;
274
+ userId: z.ZodString;
275
+ name: z.ZodString;
276
+ layout: z.ZodEnum<{
277
+ kanban: "kanban";
278
+ list: "list";
279
+ matrix: "matrix";
280
+ }>;
281
+ groupBy: z.ZodEnum<{
282
+ none: "none";
283
+ priority: "priority";
284
+ status: "status";
285
+ }>;
286
+ thenBy: z.ZodEnum<{
287
+ none: "none";
288
+ priority: "priority";
289
+ status: "status";
290
+ }>;
291
+ showEmptyGroups: z.ZodBoolean;
292
+ statuses: z.ZodArray<z.ZodEnum<{
293
+ doing: "doing";
294
+ done: "done";
295
+ review: "review";
296
+ todo: "todo";
297
+ }>>;
298
+ priorities: z.ZodArray<z.ZodEnum<{
299
+ critical: "critical";
300
+ high: "high";
301
+ low: "low";
302
+ medium: "medium";
303
+ }>>;
304
+ position: z.ZodNumber;
305
+ createdAt: z.ZodISODateTime;
306
+ updatedAt: z.ZodISODateTime;
307
+ }, z.core.$strip>;
308
+ export type BoardView = z.infer<typeof BoardViewSchema>;
253
309
  export declare const AgentRequestSchema: z.ZodObject<{
254
310
  id: z.ZodString;
255
311
  authorId: z.ZodString;
@@ -272,6 +328,7 @@ export declare const AgentRequestSchema: z.ZodObject<{
272
328
  processing: "processing";
273
329
  }>;
274
330
  reply: z.ZodNullable<z.ZodString>;
331
+ followUps: z.ZodArray<z.ZodString>;
275
332
  failureReason: z.ZodNullable<z.ZodString>;
276
333
  createdAt: z.ZodISODateTime;
277
334
  updatedAt: z.ZodISODateTime;
@@ -287,9 +344,11 @@ export declare const AgentActionSchema: z.ZodObject<{
287
344
  seq: z.ZodNumber;
288
345
  entityType: z.ZodEnum<{
289
346
  agent_action: "agent_action";
347
+ agent_instructions: "agent_instructions";
290
348
  agent_request: "agent_request";
291
349
  agent_token: "agent_token";
292
350
  attachment: "attachment";
351
+ board_view: "board_view";
293
352
  checklist_item: "checklist_item";
294
353
  comment: "comment";
295
354
  idea: "idea";
@@ -473,9 +532,11 @@ export declare const ChangeSchema: z.ZodObject<{
473
532
  userId: z.ZodNullable<z.ZodString>;
474
533
  entityType: z.ZodEnum<{
475
534
  agent_action: "agent_action";
535
+ agent_instructions: "agent_instructions";
476
536
  agent_request: "agent_request";
477
537
  agent_token: "agent_token";
478
538
  attachment: "attachment";
539
+ board_view: "board_view";
479
540
  checklist_item: "checklist_item";
480
541
  comment: "comment";
481
542
  idea: "idea";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, EntityTypeSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
2
+ import { AccessLinkPurposeSchema, ActorTypeSchema, AgentOperationSchema, BoardGroupingSchema, BoardLayoutSchema, EntityTypeSchema, IdeaOriginSchema, MAX_TASK_DEPTH, MemberRoleSchema, NotificationTypeSchema, RequestKindSchema, RequestStatusSchema, SpaceKindSchema, TaskPrioritySchema, TaskStatusSchema, TaskTypeSchema, TestResultValueSchema, UserStatusSchema, VersionedEntityTypeSchema, } from "./enums.schema.js";
3
3
  /** Entités du modèle de données, telles que lues et écrites par le store. */
4
4
  export const IdSchema = z.string().min(1);
5
5
  export const TimestampSchema = z.iso.datetime();
@@ -91,6 +91,16 @@ export const SpaceSchema = z.object({
91
91
  runnerAllowed: z.boolean(),
92
92
  createdAt: TimestampSchema,
93
93
  });
94
+ /** Longueur maximale d'un texte d'instructions de l'agent. */
95
+ export const AGENT_INSTRUCTIONS_MAX = 4000;
96
+ /** Instructions personnalisées données à l'agent : celles du site (`spaceId` null) ou celles d'un espace. */
97
+ export const AgentInstructionsSchema = z.object({
98
+ spaceId: IdSchema.nullable(),
99
+ text: z.string().trim().min(1).max(AGENT_INSTRUCTIONS_MAX),
100
+ updatedAt: TimestampSchema,
101
+ /** Dernier auteur de la modification ; null quand son compte a été supprimé. */
102
+ updatedBy: IdSchema.nullable(),
103
+ });
94
104
  export const MembershipSchema = z.object({
95
105
  spaceId: IdSchema,
96
106
  userId: IdSchema,
@@ -191,6 +201,37 @@ export const IdeaSchema = z.object({
191
201
  archivedAt: TimestampSchema.nullable(),
192
202
  createdAt: TimestampSchema,
193
203
  });
204
+ export const MAX_BOARD_VIEW_NAME_LENGTH = 40;
205
+ /**
206
+ * Vue du tableau de bord d'un membre dans un espace : disposition, regroupements
207
+ * et filtres sur le statut et la priorité des tâches de premier niveau. Un
208
+ * filtre vide garde toutes les valeurs. `groupBy` forme les colonnes d'un Kanban
209
+ * ou d'une matrice et les sections d'une liste ; `thenBy` forme les lignes d'une
210
+ * matrice et les sous-sections d'une liste.
211
+ */
212
+ export const BoardViewSchema = z
213
+ .object({
214
+ id: IdSchema,
215
+ spaceId: IdSchema,
216
+ userId: IdSchema,
217
+ name: z.string().trim().min(1).max(MAX_BOARD_VIEW_NAME_LENGTH),
218
+ layout: BoardLayoutSchema,
219
+ groupBy: BoardGroupingSchema,
220
+ thenBy: BoardGroupingSchema,
221
+ showEmptyGroups: z.boolean(),
222
+ statuses: z.array(TaskStatusSchema),
223
+ priorities: z.array(TaskPrioritySchema),
224
+ position: PositionSchema,
225
+ createdAt: TimestampSchema,
226
+ updatedAt: TimestampSchema,
227
+ })
228
+ .refine((view) => view.layout === "list" || view.groupBy !== "none", { message: "a kanban or matrix view must be grouped by status or priority", path: ["groupBy"] })
229
+ .refine((view) => view.layout !== "kanban" || view.thenBy === "none", { message: "a kanban view has a single grouping", path: ["thenBy"] })
230
+ .refine((view) => view.layout !== "matrix" || view.thenBy !== "none", { message: "a matrix view needs a second grouping", path: ["thenBy"] })
231
+ .refine((view) => view.thenBy === "none" || (view.groupBy !== "none" && view.thenBy !== view.groupBy), {
232
+ message: "the second grouping must follow a first one and differ from it",
233
+ path: ["thenBy"],
234
+ });
194
235
  export const AgentRequestSchema = z.object({
195
236
  id: IdSchema,
196
237
  authorId: IdSchema,
@@ -202,6 +243,8 @@ export const AgentRequestSchema = z.object({
202
243
  text: z.string().trim().min(1),
203
244
  status: RequestStatusSchema,
204
245
  reply: z.string().nullable(),
246
+ /** Points que l'auteur doit encore régler, laissés par l'agent en terminant la demande ; vide quand tout est traité. */
247
+ followUps: z.array(z.string().trim().min(1)),
205
248
  failureReason: z.string().nullable(),
206
249
  createdAt: TimestampSchema,
207
250
  updatedAt: TimestampSchema,
@@ -48,6 +48,22 @@ export declare const TaskPrioritySchema: z.ZodEnum<{
48
48
  medium: "medium";
49
49
  }>;
50
50
  export type TaskPriority = z.infer<typeof TaskPrioritySchema>;
51
+ /** Dispositions d'une vue du tableau de bord ; une matrice croise deux regroupements. */
52
+ export declare const BOARD_LAYOUTS: readonly ["kanban", "list", "matrix"];
53
+ export declare const BoardLayoutSchema: z.ZodEnum<{
54
+ kanban: "kanban";
55
+ list: "list";
56
+ matrix: "matrix";
57
+ }>;
58
+ export type BoardLayout = z.infer<typeof BoardLayoutSchema>;
59
+ /** Regroupements d'une vue du tableau de bord ; `none` n'existe qu'en liste. */
60
+ export declare const BOARD_GROUPINGS: readonly ["status", "priority", "none"];
61
+ export declare const BoardGroupingSchema: z.ZodEnum<{
62
+ none: "none";
63
+ priority: "priority";
64
+ status: "status";
65
+ }>;
66
+ export type BoardGrouping = z.infer<typeof BoardGroupingSchema>;
51
67
  /** Profondeur maximale d'une tâche : tâche (0) > sous-tâche (1) > sous-sous-tâche (2). */
52
68
  export declare const MAX_TASK_DEPTH = 2;
53
69
  export declare const TEST_RESULTS: readonly ["ok", "ko", "blocked", "untested"];
@@ -104,12 +120,14 @@ export declare const NotificationTypeSchema: z.ZodEnum<{
104
120
  }>;
105
121
  export type NotificationType = z.infer<typeof NotificationTypeSchema>;
106
122
  /** Types d'entités nommés dans le journal `Change`, les versions et les actions de l'agent. */
107
- export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "agent_request", "agent_action", "agent_token", "notification"];
123
+ export declare const ENTITY_TYPES: readonly ["user", "user_settings", "space", "membership", "invitation", "task", "tag", "checklist_item", "test_checkpoint", "test_result", "test_review", "comment", "attachment", "idea", "agent_request", "agent_action", "agent_token", "notification", "board_view", "agent_instructions"];
108
124
  export declare const EntityTypeSchema: z.ZodEnum<{
109
125
  agent_action: "agent_action";
126
+ agent_instructions: "agent_instructions";
110
127
  agent_request: "agent_request";
111
128
  agent_token: "agent_token";
112
129
  attachment: "attachment";
130
+ board_view: "board_view";
113
131
  checklist_item: "checklist_item";
114
132
  comment: "comment";
115
133
  idea: "idea";
@@ -15,6 +15,12 @@ export const TASK_STATUSES = ["todo", "doing", "review", "done"];
15
15
  export const TaskStatusSchema = z.enum(TASK_STATUSES);
16
16
  export const TASK_PRIORITIES = ["low", "medium", "high", "critical"];
17
17
  export const TaskPrioritySchema = z.enum(TASK_PRIORITIES);
18
+ /** Dispositions d'une vue du tableau de bord ; une matrice croise deux regroupements. */
19
+ export const BOARD_LAYOUTS = ["kanban", "list", "matrix"];
20
+ export const BoardLayoutSchema = z.enum(BOARD_LAYOUTS);
21
+ /** Regroupements d'une vue du tableau de bord ; `none` n'existe qu'en liste. */
22
+ export const BOARD_GROUPINGS = ["status", "priority", "none"];
23
+ export const BoardGroupingSchema = z.enum(BOARD_GROUPINGS);
18
24
  /** Profondeur maximale d'une tâche : tâche (0) > sous-tâche (1) > sous-sous-tâche (2). */
19
25
  export const MAX_TASK_DEPTH = 2;
20
26
  export const TEST_RESULTS = ["ok", "ko", "blocked", "untested"];
@@ -51,6 +57,8 @@ export const ENTITY_TYPES = [
51
57
  "agent_action",
52
58
  "agent_token",
53
59
  "notification",
60
+ "board_view",
61
+ "agent_instructions",
54
62
  ];
55
63
  export const EntityTypeSchema = z.enum(ENTITY_TYPES);
56
64
  /** Entités dont chaque modification produit une `EntityVersion`. */
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Instructions personnalisées de l'agent : celles du site
4
+ * (`/api/admin/agent-instructions`, administrateurs) et celles d'un espace
5
+ * (`/api/spaces/:spaceId/agent-instructions`). L'agent reçoit les premières,
6
+ * puis les secondes, avec chaque demande qu'il prend.
7
+ */
8
+ export declare const AgentInstructionsViewSchema: z.ZodObject<{
9
+ text: z.ZodString;
10
+ updatedAt: z.ZodISODateTime;
11
+ updatedByName: z.ZodNullable<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type AgentInstructionsView = z.infer<typeof AgentInstructionsViewSchema>;
14
+ /** `GET|PUT /admin/agent-instructions` : instructions du site, null s'il n'y en a pas. */
15
+ export declare const SiteInstructionsResponseSchema: z.ZodObject<{
16
+ instructions: z.ZodNullable<z.ZodObject<{
17
+ text: z.ZodString;
18
+ updatedAt: z.ZodISODateTime;
19
+ updatedByName: z.ZodNullable<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ }, z.core.$strip>;
22
+ export type SiteInstructionsResponse = z.infer<typeof SiteInstructionsResponseSchema>;
23
+ /** `GET|PUT /spaces/:spaceId/agent-instructions` : instructions de l'espace, celles du site en lecture, et le droit de modifier. */
24
+ export declare const SpaceInstructionsResponseSchema: z.ZodObject<{
25
+ instructions: z.ZodNullable<z.ZodObject<{
26
+ text: z.ZodString;
27
+ updatedAt: z.ZodISODateTime;
28
+ updatedByName: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>>;
30
+ site: z.ZodNullable<z.ZodObject<{
31
+ text: z.ZodString;
32
+ updatedAt: z.ZodISODateTime;
33
+ updatedByName: z.ZodNullable<z.ZodString>;
34
+ }, z.core.$strip>>;
35
+ canEdit: z.ZodBoolean;
36
+ }, z.core.$strip>;
37
+ export type SpaceInstructionsResponse = z.infer<typeof SpaceInstructionsResponseSchema>;
38
+ /** Corps des `PUT` : un texte vide retire les instructions. */
39
+ export declare const SetAgentInstructionsRequestSchema: z.ZodObject<{
40
+ text: z.ZodString;
41
+ }, z.core.$strict>;
42
+ export type SetAgentInstructionsRequest = z.infer<typeof SetAgentInstructionsRequestSchema>;
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import { AGENT_INSTRUCTIONS_MAX, TimestampSchema } from "./entities.schema.js";
3
+ /**
4
+ * Instructions personnalisées de l'agent : celles du site
5
+ * (`/api/admin/agent-instructions`, administrateurs) et celles d'un espace
6
+ * (`/api/spaces/:spaceId/agent-instructions`). L'agent reçoit les premières,
7
+ * puis les secondes, avec chaque demande qu'il prend.
8
+ */
9
+ export const AgentInstructionsViewSchema = z.object({
10
+ text: z.string(),
11
+ updatedAt: TimestampSchema,
12
+ /** Nom du dernier auteur ; null quand son compte a été supprimé. */
13
+ updatedByName: z.string().nullable(),
14
+ });
15
+ /** `GET|PUT /admin/agent-instructions` : instructions du site, null s'il n'y en a pas. */
16
+ export const SiteInstructionsResponseSchema = z.object({ instructions: AgentInstructionsViewSchema.nullable() });
17
+ /** `GET|PUT /spaces/:spaceId/agent-instructions` : instructions de l'espace, celles du site en lecture, et le droit de modifier. */
18
+ export const SpaceInstructionsResponseSchema = z.object({
19
+ instructions: AgentInstructionsViewSchema.nullable(),
20
+ site: AgentInstructionsViewSchema.nullable(),
21
+ /** Le propriétaire de l'espace modifie ses instructions ; les autres membres les lisent. */
22
+ canEdit: z.boolean(),
23
+ });
24
+ /** Corps des `PUT` : un texte vide retire les instructions. */
25
+ export const SetAgentInstructionsRequestSchema = z.object({ text: z.string().max(AGENT_INSTRUCTIONS_MAX) }).strict();
@@ -649,9 +649,11 @@ export declare const ChangesResponseSchema: z.ZodObject<{
649
649
  userId: z.ZodNullable<z.ZodString>;
650
650
  entityType: z.ZodEnum<{
651
651
  agent_action: "agent_action";
652
+ agent_instructions: "agent_instructions";
652
653
  agent_request: "agent_request";
653
654
  agent_token: "agent_token";
654
655
  attachment: "attachment";
656
+ board_view: "board_view";
655
657
  checklist_item: "checklist_item";
656
658
  comment: "comment";
657
659
  idea: "idea";
@@ -0,0 +1,139 @@
1
+ import { z } from "zod";
2
+ /** Corps des requêtes et des réponses des vues du tableau de bord de la GUI. */
3
+ export declare const BoardViewNameSchema: z.ZodString;
4
+ /** Vue du tableau de bord telle que l'affiche la GUI. */
5
+ export declare const BoardViewViewSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ layout: z.ZodEnum<{
8
+ kanban: "kanban";
9
+ list: "list";
10
+ matrix: "matrix";
11
+ }>;
12
+ groupBy: z.ZodEnum<{
13
+ none: "none";
14
+ priority: "priority";
15
+ status: "status";
16
+ }>;
17
+ thenBy: z.ZodEnum<{
18
+ none: "none";
19
+ priority: "priority";
20
+ status: "status";
21
+ }>;
22
+ showEmptyGroups: z.ZodBoolean;
23
+ statuses: z.ZodArray<z.ZodEnum<{
24
+ doing: "doing";
25
+ done: "done";
26
+ review: "review";
27
+ todo: "todo";
28
+ }>>;
29
+ priorities: z.ZodArray<z.ZodEnum<{
30
+ critical: "critical";
31
+ high: "high";
32
+ low: "low";
33
+ medium: "medium";
34
+ }>>;
35
+ id: z.ZodString;
36
+ }, z.core.$strip>;
37
+ export type BoardViewView = z.infer<typeof BoardViewViewSchema>;
38
+ /** Vues de l'utilisateur dans un espace, dans l'ordre des onglets. */
39
+ export declare const BoardViewListResponseSchema: z.ZodObject<{
40
+ views: z.ZodArray<z.ZodObject<{
41
+ name: z.ZodString;
42
+ layout: z.ZodEnum<{
43
+ kanban: "kanban";
44
+ list: "list";
45
+ matrix: "matrix";
46
+ }>;
47
+ groupBy: z.ZodEnum<{
48
+ none: "none";
49
+ priority: "priority";
50
+ status: "status";
51
+ }>;
52
+ thenBy: z.ZodEnum<{
53
+ none: "none";
54
+ priority: "priority";
55
+ status: "status";
56
+ }>;
57
+ showEmptyGroups: z.ZodBoolean;
58
+ statuses: z.ZodArray<z.ZodEnum<{
59
+ doing: "doing";
60
+ done: "done";
61
+ review: "review";
62
+ todo: "todo";
63
+ }>>;
64
+ priorities: z.ZodArray<z.ZodEnum<{
65
+ critical: "critical";
66
+ high: "high";
67
+ low: "low";
68
+ medium: "medium";
69
+ }>>;
70
+ id: z.ZodString;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
73
+ export type BoardViewListResponse = z.infer<typeof BoardViewListResponseSchema>;
74
+ /** Les réglages d'une vue sont validés par le serveur, qui dit quel regroupement manque ou ne convient pas. */
75
+ export declare const CreateBoardViewRequestSchema: z.ZodObject<{
76
+ name: z.ZodString;
77
+ layout: z.ZodEnum<{
78
+ kanban: "kanban";
79
+ list: "list";
80
+ matrix: "matrix";
81
+ }>;
82
+ groupBy: z.ZodEnum<{
83
+ none: "none";
84
+ priority: "priority";
85
+ status: "status";
86
+ }>;
87
+ thenBy: z.ZodEnum<{
88
+ none: "none";
89
+ priority: "priority";
90
+ status: "status";
91
+ }>;
92
+ showEmptyGroups: z.ZodBoolean;
93
+ statuses: z.ZodArray<z.ZodEnum<{
94
+ doing: "doing";
95
+ done: "done";
96
+ review: "review";
97
+ todo: "todo";
98
+ }>>;
99
+ priorities: z.ZodArray<z.ZodEnum<{
100
+ critical: "critical";
101
+ high: "high";
102
+ low: "low";
103
+ medium: "medium";
104
+ }>>;
105
+ }, z.core.$strict>;
106
+ export type CreateBoardViewRequest = z.infer<typeof CreateBoardViewRequestSchema>;
107
+ /** Réglages à changer ; la vue obtenue doit rester valide. */
108
+ export declare const UpdateBoardViewRequestSchema: z.ZodObject<{
109
+ name: z.ZodOptional<z.ZodString>;
110
+ layout: z.ZodOptional<z.ZodEnum<{
111
+ kanban: "kanban";
112
+ list: "list";
113
+ matrix: "matrix";
114
+ }>>;
115
+ groupBy: z.ZodOptional<z.ZodEnum<{
116
+ none: "none";
117
+ priority: "priority";
118
+ status: "status";
119
+ }>>;
120
+ thenBy: z.ZodOptional<z.ZodEnum<{
121
+ none: "none";
122
+ priority: "priority";
123
+ status: "status";
124
+ }>>;
125
+ showEmptyGroups: z.ZodOptional<z.ZodBoolean>;
126
+ statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
127
+ doing: "doing";
128
+ done: "done";
129
+ review: "review";
130
+ todo: "todo";
131
+ }>>>;
132
+ priorities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
133
+ critical: "critical";
134
+ high: "high";
135
+ low: "low";
136
+ medium: "medium";
137
+ }>>>;
138
+ }, z.core.$strict>;
139
+ export type UpdateBoardViewRequest = z.infer<typeof UpdateBoardViewRequestSchema>;
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { BoardGroupingSchema, BoardLayoutSchema, TaskPrioritySchema, TaskStatusSchema } from "./enums.schema.js";
3
+ import { IdSchema, MAX_BOARD_VIEW_NAME_LENGTH } from "./entities.schema.js";
4
+ /** Corps des requêtes et des réponses des vues du tableau de bord de la GUI. */
5
+ export const BoardViewNameSchema = z
6
+ .string()
7
+ .trim()
8
+ .min(1, "Donnez un nom à la vue.")
9
+ .max(MAX_BOARD_VIEW_NAME_LENGTH, `Le nom d'une vue dépasse ${MAX_BOARD_VIEW_NAME_LENGTH} caractères.`);
10
+ /**
11
+ * Réglages d'une vue : nom, disposition, regroupements (`groupBy` : colonnes ou
12
+ * sections ; `thenBy` : lignes d'une matrice ou sous-sections d'une liste),
13
+ * groupes vides, filtres (vides : toutes les valeurs).
14
+ */
15
+ const BoardViewSettingsSchema = z.object({
16
+ name: BoardViewNameSchema,
17
+ layout: BoardLayoutSchema,
18
+ groupBy: BoardGroupingSchema,
19
+ thenBy: BoardGroupingSchema,
20
+ showEmptyGroups: z.boolean(),
21
+ statuses: z.array(TaskStatusSchema),
22
+ priorities: z.array(TaskPrioritySchema),
23
+ });
24
+ /** Vue du tableau de bord telle que l'affiche la GUI. */
25
+ export const BoardViewViewSchema = BoardViewSettingsSchema.extend({ id: IdSchema });
26
+ /** Vues de l'utilisateur dans un espace, dans l'ordre des onglets. */
27
+ export const BoardViewListResponseSchema = z.object({ views: z.array(BoardViewViewSchema) });
28
+ /** Les réglages d'une vue sont validés par le serveur, qui dit quel regroupement manque ou ne convient pas. */
29
+ export const CreateBoardViewRequestSchema = BoardViewSettingsSchema.strict();
30
+ /** Réglages à changer ; la vue obtenue doit rester valide. */
31
+ export const UpdateBoardViewRequestSchema = BoardViewSettingsSchema.partial()
32
+ .strict()
33
+ .refine((patch) => Object.values(patch).some((value) => value !== undefined), "Aucune modification demandée.");
@@ -29,6 +29,7 @@ export const requestRoutes = [
29
29
  return respond(ClaimRequestDataSchema, requestContext(store, agent, request), {
30
30
  request: requestData(store, agent, request),
31
31
  history: requestHistory(store, request).map((previous) => requestData(store, agent, previous)),
32
+ instructions: { site: store.findAgentInstructions(null)?.text ?? null, space: store.findAgentInstructions(agent.space.id)?.text ?? null },
32
33
  space: spaceData(agent.space),
33
34
  members: memberData(store, agent.space),
34
35
  tasks: treeData(store, agent.space),
@@ -42,9 +43,10 @@ export const requestRoutes = [
42
43
  handle: ({ store }, { agent, params, body }) => {
43
44
  const input = parseInput(CompleteRequestBodySchema, body);
44
45
  requestOfSpace(store, agent, params.requestId);
45
- const done = store.mutate(agentActor(agent, params.requestId), (tx) => tx.completeAgentRequest(input.reply));
46
+ const done = store.mutate(agentActor(agent, params.requestId), (tx) => tx.completeAgentRequest(input.reply, input.follow_ups));
46
47
  const actionCount = store.listAgentActions(done.id).length;
47
- return respond(FinishRequestDataSchema, `Request ${done.id} is done (${actionCount} action(s) in its batch). Call list_requests for the next one.`, { request: requestData(store, agent, done), actionCount });
48
+ const left = done.followUps.length === 0 ? "nothing left to its author" : `${done.followUps.length} point(s) left to its author`;
49
+ return respond(FinishRequestDataSchema, `Request ${done.id} is done (${actionCount} action(s) in its batch, ${left}). Call list_requests for the next one.`, { request: requestData(store, agent, done), actionCount });
48
50
  },
49
51
  },
50
52
  {